:root {

  --text: #0C0C0D;
  --muted: #5F5F6E;
  --faint: #8E8EA0;


  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-soft: #F8F8FA;


  --border: #E6E6EB;
  --border-strong: #D0D0D8;


  --accent-2: #5046E5;
  --accent-2-hover: #4338CA;
  --accent-2-soft: rgba(80, 70, 229, 0.06);
  --accent-2-ring: rgba(80, 70, 229, 0.15);


  --accent: #111116;


  --green: #12A150;
  --green-soft: rgba(18, 161, 80, 0.08);
  --red: #D93036;
  --red-soft: rgba(217, 48, 54, 0.08);
  --orange: #CF8B17;
  --orange-soft: rgba(207, 139, 23, 0.08);
  --purple: #7847E0;
  --purple-soft: rgba(120, 71, 224, 0.08);


  --sidebar-w: 220px;
  --topbar-h: 56px;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.07);

  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;


  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
}


*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.ap-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  flex-direction: column;
  gap: 16px;
}

.ap-loader {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: ap-spin 0.7s linear infinite;
}

@keyframes ap-spin {
  to { transform: rotate(360deg); }
}


.ap-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.ap-auth-shell {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ap-auth-brand {
  text-align: center;
}

.ap-auth-brand h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.ap-auth-brand p {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.5;
}

.ap-auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.ap-auth-title {
  font-size: var(--text-lg);
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.ap-auth-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.ap-auth-brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  background: var(--accent-2-soft);
  color: var(--accent-2);
}

.ap-btn-login {
  width: 100%;
  min-height: 44px;
  font-size: var(--text-base);
  margin-top: 8px;
}

.ap-auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: var(--text-xs);
}


.ap-root {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.ap-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.ap-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.ap-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.ap-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--accent);
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 250ms ease-out;
}

.ap-sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ap-sidebar-brand h1 {
  font-size: var(--text-md);
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.ap-sidebar-brand p {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.02em;
}


.ap-nav {
  flex: 1;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ap-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 450;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.ap-nav-item:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.ap-nav-item.active {
  color: #FFFFFF;
  background: var(--accent-2-soft);
  background: rgba(80, 70, 229, 0.15);
  font-weight: 550;
  border-left: 3px solid var(--accent-2);
  padding-left: 9px;
}

.ap-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.ap-nav-item.active svg {
  opacity: 1;
}


.ap-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-panel-version {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  padding-top: 8px;
}


.ap-admin-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Avatars */
.ap-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  color: #FFFFFF;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ap-avatar.small {
  width: 28px;
  height: 28px;
  font-size: var(--text-xs);
}

/* Avatar Colors */
.ap-color-0 { background: #5046E5; }
.ap-color-1 { background: #D93036; }
.ap-color-2 { background: #12A150; }
.ap-color-3 { background: #CF8B17; }
.ap-color-4 { background: #7847E0; }
.ap-color-5 { background: #2D8EBB; }
.ap-color-6 { background: #C2185B; }

.ap-admin-name,
.ap-cell-title {
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--text);
  line-height: 1.3;
}

.ap-admin-email,
.ap-cell-sub {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.3;
}

.ap-sidebar .ap-admin-name {
  color: rgba(255, 255, 255, 0.9);
}

.ap-sidebar .ap-admin-email {
  color: rgba(255, 255, 255, 0.4);
}

/* Logout */
.ap-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-logout:hover {
  color: var(--red);
  border-color: rgba(217, 48, 54, 0.3);
  background: rgba(217, 48, 54, 0.08);
}

.ap-logout svg {
  width: 16px;
  height: 16px;
}


.ap-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.ap-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.ap-icon-btn:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.ap-icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Search */
.ap-search {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.ap-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}

.ap-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text);
  transition: all var(--transition-fast);
}

.ap-search input::placeholder {
  color: var(--faint);
}

.ap-search input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-2-ring);
  background: var(--surface);
}

/* Topbar right area */
.ap-topbar-meta,
.ap-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ap-topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.ap-secure-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(18, 161, 80, 0.15);
}

.ap-secure-pill svg {
  width: 12px;
  height: 12px;
}

.ap-content {
  flex: 1;
  padding: 32px 32px 48px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}


.ap-page-header {
  margin-bottom: 32px;
}

.ap-page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.ap-page-sub {
  font-size: var(--text-md);
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
}


.ap-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.ap-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  gap: 16px;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-xs);
}

.ap-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.ap-stat-label {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 450;
  margin-bottom: 8px;
}

.ap-stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.ap-stat-sub {
  font-size: var(--text-xs);
  color: var(--faint);
  margin-top: 4px;
}

.ap-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-soft);
  color: var(--muted);
}

.ap-stat-icon svg {
  width: 20px;
  height: 20px;
}

.ap-stat-icon.blue {
  background: var(--accent-2-soft);
  color: var(--accent-2);
}

.ap-stat-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.ap-stat-icon.orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.ap-stat-icon.purple {
  background: var(--purple-soft);
  color: var(--purple);
}


.ap-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}


.ap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.ap-card + .ap-card {
  margin-top: 24px;
}

.ap-card-header,
.ap-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.ap-mini-header {
  padding: 16px 20px;
}

.ap-card-title,
.ap-mini-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.ap-mini-title {
  font-size: var(--text-base);
}

.ap-card-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: 2px;
}

.ap-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ap-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-xs);
}

.ap-card-compact {
  padding: 16px 20px;
}


/* ————————————————————————————————————————————
   11. BUTTONS
   ———————————————————————————————————————————— */
.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  line-height: 1;
}

.ap-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ap-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Primary */
.ap-btn-primary {
  background: var(--accent-2);
  color: #FFFFFF;
  border-color: var(--accent-2);
  box-shadow: 0 1px 2px rgba(80, 70, 229, 0.2);
}

.ap-btn-primary:hover {
  background: var(--accent-2-hover);
  border-color: var(--accent-2-hover);
  box-shadow: 0 2px 8px rgba(80, 70, 229, 0.25);
}

/* Secondary */
.ap-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.ap-btn-secondary:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* Danger */
.ap-btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(217, 48, 54, 0.2);
}

.ap-btn-danger:hover {
  background: rgba(217, 48, 54, 0.12);
  border-color: rgba(217, 48, 54, 0.3);
}

/* Success */
.ap-btn-success {
  background: var(--green);
  color: #FFFFFF;
  border-color: var(--green);
}

.ap-btn-success:hover {
  background: #0E8C44;
  border-color: #0E8C44;
}

/* Small */
.ap-btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

/* Ghost */
.ap-btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.ap-btn-ghost:hover {
  background: var(--surface-soft);
  color: var(--text);
}

/* Outline */
.ap-btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.ap-btn-outline:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

/* Icon-only */
.ap-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}


/* ————————————————————————————————————————————
   12. TABLES
   ———————————————————————————————————————————— */
.ap-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--surface-soft);
}

tbody tr:last-child td {
  border-bottom: none;
}

.ap-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-row-title {
  font-weight: 550;
  color: var(--text);
}


/* ————————————————————————————————————————————
   13. BADGES — Outline + Pastel
   ———————————————————————————————————————————— */
.ap-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 550;
  line-height: 1.4;
  white-space: nowrap;
}

.ap-badge-blue {
  border: 1px solid rgba(80, 70, 229, 0.2);
  background: var(--accent-2-soft);
  color: var(--accent-2);
}

.ap-badge-green {
  border: 1px solid rgba(18, 161, 80, 0.2);
  background: var(--green-soft);
  color: var(--green);
}

.ap-badge-red {
  border: 1px solid rgba(217, 48, 54, 0.2);
  background: var(--red-soft);
  color: var(--red);
}

.ap-badge-orange {
  border: 1px solid rgba(207, 139, 23, 0.2);
  background: var(--orange-soft);
  color: var(--orange);
}

.ap-badge-purple {
  border: 1px solid rgba(120, 71, 224, 0.2);
  background: var(--purple-soft);
  color: var(--purple);
}

.ap-badge-gray {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
}

.ap-badge-dark {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
}

.ap-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  border: 1px solid rgba(80, 70, 229, 0.12);
}


/* ————————————————————————————————————————————
   14. LISTS
   ———————————————————————————————————————————— */
.ap-list {
  display: flex;
  flex-direction: column;
}

.ap-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.ap-list-item:hover {
  background: var(--surface-soft);
}

.ap-list-item:last-child {
  border-bottom: none;
}

.ap-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--faint);
  font-size: var(--text-sm);
}


/* ————————————————————————————————————————————
   15. FORMS
   ———————————————————————————————————————————— */
.ap-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.ap-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ap-form-label {
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--text);
}

.ap-form-input,
.ap-form-select,
.ap-form-textarea {
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text);
  transition: all var(--transition-fast);
  width: 100%;
}

.ap-form-textarea {
  height: auto;
  min-height: 100px;
  padding: 12px 16px;
  resize: vertical;
  line-height: 1.5;
}

.ap-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8EA0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.ap-form-input:focus,
.ap-form-select:focus,
.ap-form-textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-2-ring);
  outline: none;
}

.ap-form-input::placeholder,
.ap-form-textarea::placeholder {
  color: var(--faint);
}

.ap-form-hint {
  font-size: var(--text-xs);
  color: var(--faint);
  line-height: 1.4;
}


/* ————————————————————————————————————————————
   16. ALERTS
   ———————————————————————————————————————————— */
.ap-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(217, 48, 54, 0.15);
  margin-bottom: 16px;
}

.ap-warning {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid rgba(207, 139, 23, 0.15);
  margin-bottom: 16px;
}

.ap-info-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  border: 1px solid rgba(80, 70, 229, 0.12);
  margin-bottom: 16px;
}


/* ————————————————————————————————————————————
   17. TABS
   ———————————————————————————————————————————— */
.ap-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.ap-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  white-space: nowrap;
}

.ap-tab:hover {
  color: var(--text);
}

.ap-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Clean Tabs Variant */
.ap-tabs-clean {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  gap: 0;
  margin-bottom: 24px;
}

.ap-tabs-clean .ap-tab {
  border-radius: 0;
  padding: 10px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.ap-tabs-clean .ap-tab.active {
  background: transparent;
  box-shadow: none;
  border-bottom-color: var(--accent-2);
  color: var(--accent-2);
}

.ap-tabs-clean .ap-tab:hover {
  color: var(--text);
  border-bottom-color: var(--border-strong);
}


/* ————————————————————————————————————————————
   18. CATEGORIES — Details/Summary Accordion
   ———————————————————————————————————————————— */
.ap-category-stats-clean {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.ap-category-filter-note {
  font-size: var(--text-xs);
  color: var(--faint);
  margin-bottom: 16px;
  font-style: italic;
}

.ap-category-groups-clean {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-category-group-clean {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* Summary element */
.ap-category-group-clean-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background var(--transition-fast);
  gap: 16px;
}

.ap-category-group-clean-head::-webkit-details-marker {
  display: none;
}

.ap-category-group-clean-head::marker {
  display: none;
  content: '';
}

.ap-category-group-clean-head:hover {
  background: var(--surface-soft);
}

.ap-category-group-clean-head .ap-card-title {
  font-size: var(--text-base);
  font-weight: 600;
}

.ap-category-group-clean-head .ap-card-sub {
  font-size: var(--text-xs);
  margin-top: 0;
}

.ap-category-group-clean-total {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

/* Accordion chevron */
.ap-accordion-chevron {
  display: inline-flex;
  transition: transform var(--transition-base);
  color: var(--faint);
  flex-shrink: 0;
}

.ap-accordion-chevron svg {
  width: 16px;
  height: 16px;
}

details[open] > summary .ap-accordion-chevron {
  transform: rotate(180deg);
}

/* Category list inside accordion */
.ap-category-list-clean {
  border-top: 1px solid var(--border);
}

.ap-category-row-clean {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.ap-category-row-clean:hover {
  background: var(--surface-soft);
}

.ap-category-row-clean:last-child {
  border-bottom: none;
}

.ap-category-row-clean-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ap-category-row-clean-title {
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--text);
}

.ap-category-row-clean-sub {
  font-size: var(--text-xs);
  color: var(--faint);
}

.ap-category-row-clean-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Category card + name + count (mini cards) */
.ap-category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.ap-category-name {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 450;
  margin-bottom: 4px;
}

.ap-category-count {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* Generic summary styling */
summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::marker {
  display: none;
  content: '';
}


/* ————————————————————————————————————————————
   19. FEED / ACTIVITY
   ———————————————————————————————————————————— */
.ap-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 550;
  color: var(--green);
}

.ap-live-indicator::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: ap-live-pulse 2s ease-in-out infinite;
}

@keyframes ap-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.ap-feed-list,
.ap-feed-list-clean {
  display: flex;
  flex-direction: column;
}

.ap-feed-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.ap-feed-item:hover {
  background: var(--surface-soft);
}

.ap-feed-item:last-child {
  border-bottom: none;
}

.ap-feed-item-main {
  flex: 1;
  min-width: 0;
}

.ap-feed-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.ap-feed-new {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  flex-shrink: 0;
}

.ap-feed-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.ap-feed-meta {
  font-size: var(--text-xs);
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ap-feed-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

.ap-feed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}


/* ————————————————————————————————————————————
   20. KVKK / INFO SECTIONS
   ———————————————————————————————————————————— */
.ap-kvkk-notice,
.ap-kvkk-notice-modal {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--orange-soft);
  border: 1px solid rgba(207, 139, 23, 0.15);
  font-size: var(--text-sm);
  color: var(--orange);
  line-height: 1.5;
  margin-bottom: 16px;
}

.ap-kvkk-notice-modal {
  margin-bottom: 0;
}

.ap-kvkk-footnote {
  font-size: var(--text-xs);
  color: var(--faint);
  line-height: 1.5;
  margin-top: 8px;
}

.ap-info-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.ap-info-section:last-child {
  border-bottom: none;
}

.ap-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 12px;
}

.ap-device-empty {
  text-align: center;
  padding: 24px;
  color: var(--faint);
  font-size: var(--text-sm);
}


/* ————————————————————————————————————————————
   21. MODALS
   ———————————————————————————————————————————— */
.ap-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: ap-fade-in 150ms ease-out;
}

@keyframes ap-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ap-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ap-modal-up 200ms ease-out;
}

@keyframes ap-modal-up {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ap-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.ap-modal-title {
  font-size: var(--text-lg);
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ap-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.ap-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}


/* ————————————————————————————————————————————
   22. TOASTS
   ———————————————————————————————————————————— */
.ap-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.ap-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  pointer-events: auto;
  animation: ap-toast-in 250ms ease-out;
}

@keyframes ap-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px) translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

.ap-toast.success {
  border-left: 3px solid var(--green);
}

.ap-toast.error {
  border-left: 3px solid var(--red);
}


/* ————————————————————————————————————————————
   23. UTILITIES
   ———————————————————————————————————————————— */
.ap-muted {
  color: var(--muted);
}


/* ————————————————————————————————————————————
   24. FOCUS & ACCESSIBILITY
   ———————————————————————————————————————————— */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--accent-2-ring);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ————————————————————————————————————————————
   25. RESPONSIVE — 1080px
   ———————————————————————————————————————————— */
@media (max-width: 1080px) {
  .ap-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .ap-grid-3 {
    grid-template-columns: 1fr;
  }

  .ap-content {
    padding: 24px;
  }

  .ap-form-grid {
    grid-template-columns: 1fr;
  }
}


/* ————————————————————————————————————————————
   26. RESPONSIVE — 820px (Tablet)
   ———————————————————————————————————————————— */
@media (max-width: 820px) {
  .ap-sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .ap-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .ap-main {
    margin-left: 0;
  }

  .ap-content {
    padding: 20px 16px 32px;
  }

  /* Table → Card layout */
  .ap-table-wrap table,
  .ap-table-wrap thead,
  .ap-table-wrap tbody,
  .ap-table-wrap th,
  .ap-table-wrap td,
  .ap-table-wrap tr {
    display: block;
  }

  .ap-table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .ap-table-wrap tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
  }

  .ap-table-wrap td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }

  .ap-table-wrap td:last-child {
    border-bottom: none;
  }

  .ap-table-wrap td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 12px;
  }

  /* Buttons full-width */
  .ap-btn {
    width: 100%;
    justify-content: center;
  }

  .ap-btn-sm,
  .ap-btn-icon,
  .ap-btn-ghost {
    width: auto;
  }

  .ap-card-actions {
    flex-wrap: wrap;
  }

  .ap-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .ap-card-actions {
    width: 100%;
  }

  .ap-card-actions .ap-btn {
    flex: 1;
  }

  /* Category rows stack */
  .ap-category-row-clean {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ap-category-row-clean-metrics {
    width: 100%;
    justify-content: flex-start;
  }

  /* Modal adjustments */
  .ap-modal-backdrop {
    padding: 16px;
  }

  .ap-modal {
    max-height: 90vh;
  }

  .ap-modal-header,
  .ap-modal-body,
  .ap-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .ap-topbar {
    padding: 0 16px;
  }

  .ap-page-title {
    font-size: var(--text-xl);
  }
}


/* ————————————————————————————————————————————
   27. RESPONSIVE — 560px (Mobile)
   ———————————————————————————————————————————— */
@media (max-width: 560px) {
  .ap-stats {
    grid-template-columns: 1fr;
  }

  .ap-search {
    display: none;
  }

  .ap-content {
    padding: 16px 16px 32px;
  }

  .ap-page-header {
    margin-bottom: 24px;
  }

  .ap-page-title {
    font-size: var(--text-lg);
  }

  .ap-page-sub {
    font-size: var(--text-sm);
  }

  /* Modal bottom-sheet */
  .ap-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .ap-modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: ap-modal-slide-up 250ms ease-out;
  }

  @keyframes ap-modal-slide-up {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .ap-stat-card {
    padding: 16px;
  }

  .ap-stat-value {
    font-size: var(--text-xl);
  }

  .ap-card-header {
    padding: 16px;
  }

  .ap-list-item {
    padding: 12px 16px;
  }

  .ap-feed-item {
    padding: 12px 16px;
  }

  .ap-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .ap-tabs::-webkit-scrollbar {
    display: none;
  }

  .ap-toast-stack {
    top: auto;
    bottom: 16px;
    right: 8px;
    left: 8px;
    max-width: 100%;
  }

  .ap-topbar-meta .ap-secure-pill {
    display: none;
  }

  .ap-category-stats-clean {
    grid-template-columns: repeat(2, 1fr);
  }

  .ap-form-grid {
    grid-template-columns: 1fr;
  }

  .ap-auth-card {
    padding: 24px 20px;
  }

  /* Minimum touch targets */
  .ap-nav-item,
  .ap-tab,
  .ap-btn,
  .ap-icon-btn {
    min-height: 44px;
  }
}


/* ————————————————————————————————————————————
   28. SCROLLBAR
   ———————————————————————————————————————————— */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}


/* ————————————————————————————————————————————
   29. PRINT
   ———————————————————————————————————————————— */
@media print {
  .ap-sidebar,
  .ap-topbar,
  .ap-overlay,
  .ap-toast-stack {
    display: none !important;
  }

  .ap-main {
    margin-left: 0 !important;
  }

  .ap-content {
    padding: 0 !important;
  }

  body {
    background: #FFFFFF;
  }
}
