/* ================================================================
   AdminPro — Unified Design System v3.0
   Single source of truth for all pages
   ================================================================ */

/* ── Google Font ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
  /* Brand */
  --ap-primary:        #6366f1;
  --ap-primary-dark:   #4f46e5;
  --ap-primary-hover:  #4338ca;
  --ap-primary-soft:   rgba(99,102,241,.1);
  --ap-primary-border: rgba(99,102,241,.25);

  /* Semantic */
  --ap-success:        #10b981;
  --ap-success-soft:   rgba(16,185,129,.1);
  --ap-warning:        #f59e0b;
  --ap-warning-soft:   rgba(245,158,11,.1);
  --ap-danger:         #ef4444;
  --ap-danger-soft:    rgba(239,68,68,.1);
  --ap-info:           #0ea5e9;
  --ap-info-soft:      rgba(14,165,233,.1);
  --ap-purple:         #8b5cf6;
  --ap-purple-soft:    rgba(139,92,246,.1);
  --ap-pink:           #ec4899;
  --ap-pink-soft:      rgba(236,72,153,.1);
  --ap-orange:         #f97316;
  --ap-orange-soft:    rgba(249,115,22,.1);

  /* Layout */
  --sidebar-width:      256px;
  --sidebar-min-width:  68px;
  --topbar-height:      62px;
  --content-padding:    1.75rem;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;
  --radius-2xl: 24px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.18);

  /* Transition */
  --transition: all .2s cubic-bezier(.4,0,.2,1);
  --transition-slow: all .35s cubic-bezier(.4,0,.2,1);
}

/* Light Theme */
[data-bs-theme="light"] {
  --ap-bg:            #f0f2f5;
  --ap-surface:       #ffffff;
  --ap-surface-2:     #f8fafc;
  --ap-border:        #e4e7ec;
  --ap-border-2:      #f1f3f6;
  --ap-text-1:        #111827;
  --ap-text-2:        #374151;
  --ap-text-3:        #6b7280;
  --ap-text-4:        #9ca3af;
  --ap-sidebar-bg:    #111827;
  --ap-sidebar-text:  #9ca3af;
  --ap-sidebar-hover: #1f2937;
  --ap-sidebar-active-bg: rgba(99,102,241,.15);
  --ap-sidebar-border:#1f2937;
  --ap-topbar-bg:     #ffffff;
  --ap-input-bg:      #ffffff;
  --ap-code-bg:       #1e293b;
  --ap-table-head:    #f8fafc;
  --ap-table-stripe:  #fafbfc;
  --ap-skeleton:      #e5e7eb;
}

/* Dark Theme */
[data-bs-theme="dark"] {
  --ap-bg:            #0d1117;
  --ap-surface:       #161b22;
  --ap-surface-2:     #1c2333;
  --ap-border:        #21262d;
  --ap-border-2:      #30363d;
  --ap-text-1:        #f0f6fc;
  --ap-text-2:        #c9d1d9;
  --ap-text-3:        #8b949e;
  --ap-text-4:        #484f58;
  --ap-sidebar-bg:    #0d1117;
  --ap-sidebar-text:  #8b949e;
  --ap-sidebar-hover: #1c2333;
  --ap-sidebar-active-bg: rgba(99,102,241,.18);
  --ap-sidebar-border:#21262d;
  --ap-topbar-bg:     #161b22;
  --ap-input-bg:      #1c2333;
  --ap-code-bg:       #0d1117;
  --ap-table-head:    #1c2333;
  --ap-table-stripe:  #191e26;
  --ap-skeleton:      #21262d;
  --bs-body-bg:       #0d1117;
  --bs-card-bg:       #161b22;
  --bs-border-color:  #21262d;
  --bs-body-color:    #c9d1d9;
}

/* ── Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--ap-bg);
  color: var(--ap-text-1);
  overflow-x: hidden;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 0.9375rem; /* 15px — comfortable reading size */
}
::selection { background: var(--ap-primary-soft); color: var(--ap-primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ap-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ap-text-4); }

/* ================================================================
   SIDEBAR
   ================================================================ */
#ap-sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--ap-sidebar-bg);
  border-right: 1px solid var(--ap-sidebar-border);
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: var(--transition-slow);
  overflow: hidden;
  will-change: width;
}
#ap-sidebar.is-collapsed { width: var(--sidebar-min-width); }

/* Collapse hide helpers */
#ap-sidebar.is-collapsed .sidebar-label,
#ap-sidebar.is-collapsed .sidebar-group-title,
#ap-sidebar.is-collapsed .brand-wordmark,
#ap-sidebar.is-collapsed .nav-item-badge,
#ap-sidebar.is-collapsed .user-info-text,
#ap-sidebar.is-collapsed .user-logout-btn { display: none !important; }
#ap-sidebar.is-collapsed .sidebar-nav-link { justify-content: center; padding: .65rem !important; gap: 0; }
#ap-sidebar.is-collapsed .nav-icon { margin: 0 !important; }
#ap-sidebar.is-collapsed .user-card { justify-content: center; gap: 0; padding: .9rem .5rem; }
#ap-sidebar.is-collapsed .sidebar-brand { justify-content: center; padding: .9rem .5rem; gap: 0; }
/* Sub-nav hidden when collapsed */
#ap-sidebar.is-collapsed .sub-nav { display: none !important; }
#ap-sidebar.is-collapsed .sidebar-nav-link .nav-chevron { display: none !important; }

/* Brand */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: .9rem 1.1rem;
  min-height: var(--topbar-height);
  text-decoration: none;
  border-bottom: 1px solid var(--ap-sidebar-border);
  flex-shrink: 0; overflow: hidden;
}
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ap-primary) 0%, var(--ap-purple) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.brand-wordmark { overflow: hidden; }
.brand-name { color: #fff; font-weight: 800; font-size: 1.05rem; line-height: 1.2; white-space: nowrap; letter-spacing: -.02em; }
.brand-tag  { color: #4b5563; font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }

/* Scrollable nav */
.sidebar-scroll { flex: 1; overflow-y: auto; padding: .5rem 0 .5rem; }
.sidebar-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #1f2937; }

/* Section titles */
.sidebar-group-title {
  font-size: .7rem; font-weight: 700; letter-spacing: .13em;
  color: #4b5563; text-transform: uppercase;
  padding: 1.25rem 1.25rem .45rem;
  white-space: nowrap;
}

/* Nav link */
.sidebar-nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: .7rem 1.25rem !important;
  color: var(--ap-sidebar-text) !important;
  text-decoration: none; font-size: .9375rem; font-weight: 500;
  border-radius: 0; transition: var(--transition);
  position: relative; white-space: nowrap; overflow: hidden;
  border-left: 3px solid transparent;
}
.sidebar-nav-link:hover {
  background: var(--ap-sidebar-hover);
  color: #e5e7eb !important;
}
.sidebar-nav-link.is-active {
  background: var(--ap-sidebar-active-bg);
  color: #fff !important;
  border-left-color: var(--ap-primary);
  font-weight: 600;
}
.sidebar-nav-link.is-active .nav-icon { color: var(--ap-primary); }
.nav-icon {
  font-size: 1.125rem; flex-shrink: 0;
  width: 22px; text-align: center;
  transition: var(--transition);
}
.sidebar-label { flex: 1; }
.nav-chevron {
  font-size: .75rem; transition: transform .2s;
  color: #4b5563; margin-left: auto; flex-shrink: 0;
}
.sidebar-nav-link.is-open .nav-chevron { transform: rotate(90deg); }
.nav-item-badge {
  font-size: .65rem; font-weight: 700; border-radius: 10px;
  padding: .15rem .45rem; flex-shrink: 0; line-height: 1.4;
}

/* Sub-nav (child pages) */
.sub-nav {
  overflow: hidden; max-height: 0;
  transition: max-height .28s ease;
  background: rgba(0,0,0,.15);
}
.sub-nav.is-open { max-height: 400px; }
.sub-nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: .52rem 1.25rem .52rem 3.1rem !important;
  color: #6b7280 !important;
  text-decoration: none; font-size: .875rem; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
  border-left: 3px solid transparent;
}
.sub-nav-link:hover { background: rgba(255,255,255,.04); color: #d1d5db !important; }
.sub-nav-link.is-active {
  color: var(--ap-primary) !important;
  background: rgba(99,102,241,.08);
  border-left-color: var(--ap-primary);
  font-weight: 600;
}
.sub-nav-link .sub-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex-shrink: 0; opacity: .6;
}
.sub-nav-link.is-active .sub-dot { opacity: 1; background: var(--ap-primary); }

/* User card bottom */
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--ap-sidebar-border);
  flex-shrink: 0; overflow: hidden;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ap-primary), var(--ap-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .8rem; font-weight: 700;
}
.user-info-text { flex: 1; overflow: hidden; }
.user-name { color: #e5e7eb; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #4b5563; font-size: .75rem; white-space: nowrap; }
.user-logout-btn {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #4b5563; border-radius: 6px; text-decoration: none;
  transition: var(--transition); font-size: .95rem;
}
.user-logout-btn:hover { color: var(--ap-danger); background: rgba(239,68,68,.1); }

/* Mobile overlay */
#ap-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 1039;
}
#ap-overlay.is-visible { display: block; }

/* ================================================================
   TOPBAR
   ================================================================ */
#ap-topbar {
  position: fixed; top: 0; right: 0;
  left: var(--sidebar-width);
  height: var(--topbar-height);
  background: var(--ap-topbar-bg);
  border-bottom: 1px solid var(--ap-border);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: .75rem;
  z-index: 1030; transition: left var(--transition-slow);
}
#ap-topbar.sidebar-is-collapsed { left: var(--sidebar-min-width); }

.topbar-icon-btn {
  width: 36px; height: 36px; border: none;
  background: transparent; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--ap-text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: var(--transition); flex-shrink: 0;
}
.topbar-icon-btn:hover { background: var(--ap-surface-2); color: var(--ap-text-1); }

/* Search */
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--ap-surface-2);
  border: 1.5px solid var(--ap-border);
  border-radius: var(--radius-md); padding: .4rem .85rem;
  flex: 1; max-width: 380px; transition: var(--transition);
}
.topbar-search:focus-within {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px var(--ap-primary-soft);
  background: var(--ap-surface);
}
.topbar-search i { color: var(--ap-text-4); font-size: .95rem; flex-shrink: 0; }
.topbar-search input {
  border: none; background: transparent; outline: none;
  flex: 1; font-size: .9rem; color: var(--ap-text-1); font-family: inherit;
}
.topbar-search input::placeholder { color: var(--ap-text-4); }
.search-shortcut {
  font-size: .7rem; color: var(--ap-text-4);
  background: var(--ap-border); border-radius: 4px;
  padding: 1px 6px; font-family: monospace; flex-shrink: 0;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.topbar-divider { width: 1px; height: 22px; background: var(--ap-border); margin: 0 .25rem; }

/* ── Quick Links Bar (Topbar) ─────────────────────────────────── */
.ap-quick-links {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-left: 1rem;
  padding: .2rem .35rem;
  background: var(--ap-surface-2);
  border: 1.5px solid var(--ap-border);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}
.ap-ql-link {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .3rem .65rem;
  border-radius: var(--radius-md);
  font-size: .78rem;
  font-weight: 500;
  color: var(--ap-text-3);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
  border: 1.5px solid transparent;
}
.ap-ql-link i { font-size: .82rem; flex-shrink: 0; }
.ap-ql-link:hover {
  color: var(--ap-primary);
  background: var(--ap-primary-soft);
  border-color: var(--ap-primary-border);
}
.ap-ql-link.is-active {
  color: var(--ap-primary);
  background: var(--ap-primary-soft);
  border-color: var(--ap-primary-border);
  font-weight: 600;
}

/* Hide quick-links label text on smaller screens, show only icons */
@media (max-width: 1199px) {
  .ap-ql-link span { display: none; }
  .ap-ql-link { padding: .3rem .4rem; }
  .ap-ql-link i { font-size: .9rem; }
}
/* Hide entire quick-links bar on mobile (sidebar handles nav) */
@media (max-width: 767px) {
  .ap-quick-links { display: none; }
}

/* Notification badge */
.notif-wrap { position: relative; }
.notif-counter {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px;
  background: var(--ap-danger); color: #fff;
  font-size: .6rem; font-weight: 700;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ap-topbar-bg);
}

/* Topbar user */
.topbar-user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: .35rem .5rem; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition); border: none; background: transparent;
}
.topbar-user-btn:hover { background: var(--ap-surface-2); }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ap-primary), var(--ap-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .8rem; font-weight: 700;
}
.topbar-user-name { font-size: .9rem; font-weight: 600; color: var(--ap-text-1); white-space: nowrap; }
.topbar-user-role { font-size: .78rem; color: var(--ap-text-3); }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
#ap-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: var(--content-padding);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left var(--transition-slow);
}
#ap-main.sidebar-is-collapsed { margin-left: var(--sidebar-min-width); }

/* ================================================================
   PAGE HEADER (CONSISTENT ACROSS ALL PAGES)
   ================================================================ */
.ap-page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap;
  gap: 1rem; margin-bottom: 1.75rem;
}
.ap-page-header-left {}
.ap-breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8125rem; color: var(--ap-text-3);
  margin-bottom: .4rem;
}
.ap-breadcrumb a { color: var(--ap-text-3); text-decoration: none; transition: var(--transition); }
.ap-breadcrumb a:hover { color: var(--ap-primary); }
.ap-breadcrumb .sep { color: var(--ap-text-4); }
.ap-breadcrumb .current { color: var(--ap-text-2); font-weight: 500; }
.ap-page-title { font-size: 1.625rem; font-weight: 800; color: var(--ap-text-1); letter-spacing: -.03em; margin: 0; }
.ap-page-subtitle { font-size: .9375rem; color: var(--ap-text-3); margin: .35rem 0 0; }
.ap-page-header-right { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ================================================================
   CARDS (UNIFIED)
   ================================================================ */
.ap-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ap-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ap-border);
  gap: .75rem;
}
.ap-card-title {
  font-size: 1rem; font-weight: 700;
  color: var(--ap-text-1); letter-spacing: -.015em;
  display: flex; align-items: center; gap: .5rem;
}
.ap-card-title i { color: var(--ap-primary); font-size: 1rem; }
.ap-card-body { padding: 1.35rem; }
.ap-card-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--ap-border);
  background: var(--ap-surface-2);
}

/* ── Stat Cards ────────────────────────────────────────────── */
.ap-stat {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative; overflow: hidden;
  transition: var(--transition);
}
.ap-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ap-stat-accent {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ap-stat-icon {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: .9rem;
}
.ap-stat-value { font-size: 1.875rem; font-weight: 800; letter-spacing: -.04em; color: var(--ap-text-1); line-height: 1.1; }
.ap-stat-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ap-text-3); margin-top: .3rem; }
.ap-stat-meta { font-size: .84rem; color: var(--ap-text-3); margin-top: .55rem; display: flex; align-items: center; gap: .4rem; }
.ap-stat-trend { font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: .2rem; padding: .2rem .5rem; border-radius: 20px; }
.ap-stat-trend.up   { background: var(--ap-success-soft); color: var(--ap-success); }
.ap-stat-trend.down { background: var(--ap-danger-soft);  color: var(--ap-danger); }

/* ================================================================
   BUTTONS (UNIFIED)
   ================================================================ */
.ap-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: inherit; font-size: .9rem; font-weight: 600;
  padding: .55rem 1.1rem; border-radius: var(--radius-md);
  border: 1.5px solid transparent; cursor: pointer;
  transition: var(--transition); text-decoration: none;
  white-space: nowrap; line-height: 1.4;
}
.ap-btn:disabled { opacity: .5; cursor: not-allowed; }
.ap-btn-primary   { background: var(--ap-primary);   border-color: var(--ap-primary);   color: #fff; }
.ap-btn-primary:hover { background: var(--ap-primary-dark); border-color: var(--ap-primary-dark); box-shadow: 0 4px 14px rgba(99,102,241,.35); color: #fff; }
.ap-btn-success   { background: var(--ap-success);   border-color: var(--ap-success);   color: #fff; }
.ap-btn-success:hover { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(16,185,129,.3); color: #fff; }
.ap-btn-danger    { background: var(--ap-danger);    border-color: var(--ap-danger);    color: #fff; }
.ap-btn-danger:hover  { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(239,68,68,.3); color: #fff; }
.ap-btn-ghost  { background: transparent; border-color: var(--ap-border); color: var(--ap-text-2); }
.ap-btn-ghost:hover  { background: var(--ap-surface-2); color: var(--ap-text-1); }
/* Secondary = alias for ghost (neutral, bordered) */
.ap-btn-secondary { background: var(--ap-surface-2); border-color: var(--ap-border); color: var(--ap-text-2); }
.ap-btn-secondary:hover { background: var(--ap-surface-3,var(--ap-surface-2)); border-color: var(--ap-primary); color: var(--ap-primary); }
.ap-btn-warning { background: var(--ap-warning); border-color: var(--ap-warning); color: #fff; }
.ap-btn-warning:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(245,158,11,.3); color: #fff; }
.ap-btn-info    { background: var(--ap-info);    border-color: var(--ap-info);    color: #fff; }
.ap-btn-info:hover    { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(14,165,233,.3); color: #fff; }
.ap-btn-outline-primary { background: transparent; border-color: var(--ap-primary); color: var(--ap-primary); }
.ap-btn-outline-primary:hover { background: var(--ap-primary-soft); }
.ap-btn-sm { padding: .38rem .85rem; font-size: .84rem; }
.ap-btn-lg { padding: .75rem 1.5rem; font-size: .9375rem; }
.ap-btn-icon    { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; }
.ap-btn-icon-sm { width: 30px; height: 30px; padding: 0; border-radius: var(--radius-sm); font-size: .84rem;  display: inline-flex; align-items: center; justify-content: center; }
.ap-btn i { font-size: .9rem; }

/* ================================================================
   FORMS (UNIFIED)
   ================================================================ */
.ap-form-label {
  display: block; font-size: .76rem; font-weight: 700;
  color: var(--ap-text-3); text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: .4rem;
}
.ap-form-label .req { color: var(--ap-danger); margin-left: 2px; }
.ap-form-control, .ap-form-select, .ap-form-textarea {
  width: 100%; font-family: inherit; font-size: .875rem;
  color: var(--ap-text-1); background: var(--ap-input-bg);
  border: 1.5px solid var(--ap-border);
  border-radius: var(--radius-md); padding: .55rem .85rem;
  transition: var(--transition); outline: none;
  line-height: 1.5;
}
.ap-form-control:focus, .ap-form-select:focus, .ap-form-textarea:focus {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px var(--ap-primary-soft);
  background: var(--ap-surface);
}
.ap-form-control.is-error { border-color: var(--ap-danger); }
.ap-form-control.is-error:focus { box-shadow: 0 0 0 3px var(--ap-danger-soft); }
.ap-form-control.is-valid { border-color: var(--ap-success); }
.ap-form-error { font-size: .76rem; color: var(--ap-danger); margin-top: .3rem; display: flex; align-items: center; gap: .3rem; }
.ap-form-hint  { font-size: .76rem; color: var(--ap-text-4); margin-top: .3rem; }
.ap-form-textarea { resize: vertical; min-height: 100px; }
.ap-form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 12px; padding-right: 2rem; }

/* Input group */
.ap-input-group { display: flex; align-items: stretch; }
.ap-input-group .ap-form-control { border-radius: 0; }
.ap-input-group .ap-form-control:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.ap-input-group .ap-form-control:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.ap-input-addon {
  display: flex; align-items: center; padding: 0 .85rem;
  background: var(--ap-surface-2); border: 1.5px solid var(--ap-border);
  color: var(--ap-text-3); font-size: .875rem;
  border-right: none; border-radius: var(--radius-md) 0 0 var(--radius-md);
  white-space: nowrap;
}
.ap-input-addon:last-child { border-right: 1.5px solid var(--ap-border); border-left: none; border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* Checkbox / Radio */
.ap-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.ap-check input[type=checkbox], .ap-check input[type=radio] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--ap-primary); flex-shrink: 0;
}
.ap-check-label { font-size: .875rem; color: var(--ap-text-2); }

/* Switch */
.ap-switch { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.ap-switch input { display: none; }
.ap-switch-track {
  width: 40px; height: 22px; background: var(--ap-border);
  border-radius: 11px; position: relative; transition: var(--transition);
  flex-shrink: 0;
}
.ap-switch input:checked + .ap-switch-track { background: var(--ap-primary); }
.ap-switch-track::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.ap-switch input:checked + .ap-switch-track::after { transform: translateX(18px); }
.ap-switch-label { font-size: .875rem; color: var(--ap-text-2); }

/* Range */
.ap-range { width: 100%; accent-color: var(--ap-primary); cursor: pointer; height: 5px; }

/* File upload */
.ap-upload-zone {
  border: 2px dashed var(--ap-border); border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--ap-surface-2);
}
.ap-upload-zone:hover, .ap-upload-zone.is-drag { border-color: var(--ap-primary); background: var(--ap-primary-soft); }
.ap-upload-zone-icon { font-size: 2rem; color: var(--ap-text-4); margin-bottom: .75rem; display: block; }

/* ================================================================
   TABLES (UNIFIED)
   ================================================================ */
.ap-table-wrap { overflow-x: auto; }
.ap-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ap-table thead tr { background: var(--ap-table-head); border-bottom: 2px solid var(--ap-border); }
.ap-table th {
  padding: .8rem 1rem; text-align: left;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ap-text-3);
  white-space: nowrap; cursor: pointer; user-select: none;
}
.ap-table th:hover { color: var(--ap-text-1); }
.ap-table th.is-sorted { color: var(--ap-primary); }
.ap-table td { padding: .8rem 1rem; border-bottom: 1px solid var(--ap-border-2); color: var(--ap-text-2); vertical-align: middle; }
.ap-table tbody tr:hover { background: var(--ap-primary-soft); }
.ap-table tbody tr:last-child td { border-bottom: none; }
.ap-table .ap-check { justify-content: center; }

/* Sort arrows */
.sort-icon { font-size: .65rem; margin-left: .25rem; opacity: .4; }
.is-sorted .sort-icon { opacity: 1; }

/* ================================================================
   BADGES (UNIFIED)
   ================================================================ */
.ap-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 700; border-radius: 20px;
  padding: .25rem .7rem; white-space: nowrap; letter-spacing: .01em;
}
.ap-badge-primary { background: var(--ap-primary-soft);  color: var(--ap-primary); }
.ap-badge-success { background: var(--ap-success-soft);  color: var(--ap-success); }
.ap-badge-warning { background: var(--ap-warning-soft);  color: var(--ap-warning); }
.ap-badge-danger  { background: var(--ap-danger-soft);   color: var(--ap-danger);  }
.ap-badge-info    { background: var(--ap-info-soft);     color: var(--ap-info);    }
.ap-badge-purple  { background: var(--ap-purple-soft);   color: var(--ap-purple);  }
.ap-badge-pink    { background: var(--ap-pink-soft);     color: var(--ap-pink);    }
.ap-badge-orange  { background: var(--ap-orange-soft);   color: var(--ap-orange);  }
.ap-badge-neutral { background: var(--ap-surface-2);     color: var(--ap-text-3);  border: 1px solid var(--ap-border); }
.ap-badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ================================================================
   TABS (UNIFIED)
   ================================================================ */
.ap-tabs { display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--ap-surface-2); border-radius: var(--radius-md); border: 1px solid var(--ap-border); width: fit-content; }
.ap-tab { padding: .42rem 1rem; font-size: .875rem; font-weight: 600; border-radius: calc(var(--radius-md) - 2px); cursor: pointer; transition: var(--transition); color: var(--ap-text-3); white-space: nowrap; border: none; background: transparent; }
.ap-tab:hover { color: var(--ap-text-1); background: var(--ap-surface); }
.ap-tab.is-active { background: var(--ap-surface); color: var(--ap-primary); box-shadow: var(--shadow-sm); }

/* Underline tabs */
.ap-tabs-underline { display: flex; align-items: center; gap: .25rem; border-bottom: 2px solid var(--ap-border); }
.ap-tab-ul { padding: .6rem 1rem; font-size: .9rem; font-weight: 600; cursor: pointer; color: var(--ap-text-3); border: none; background: transparent; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); white-space: nowrap; }
.ap-tab-ul:hover { color: var(--ap-text-1); }
.ap-tab-ul.is-active { color: var(--ap-primary); border-bottom-color: var(--ap-primary); }
.ap-tab-count { font-size: .73rem; padding: .1rem .45rem; border-radius: 10px; margin-left: .35rem; background: var(--ap-surface-2); }
.ap-tab-ul.is-active .ap-tab-count { background: var(--ap-primary-soft); color: var(--ap-primary); }

/* Period selector (7D / 30D / 90D style) */
.ap-period-tabs { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--ap-surface-2); border-radius: var(--radius-md); border: 1px solid var(--ap-border); }
.ap-period-btn {
  padding: .35rem .8rem; font-size: .85rem; font-weight: 600;
  border-radius: calc(var(--radius-md) - 2px); cursor: pointer;
  transition: var(--transition); color: var(--ap-text-3);
  border: none; background: transparent; white-space: nowrap;
}
.ap-period-btn:hover { color: var(--ap-text-1); background: rgba(0,0,0,.04); }
.ap-period-btn.is-active {
  background: var(--ap-surface); color: var(--ap-primary);
  box-shadow: var(--shadow-sm); font-weight: 700;
}

/* ================================================================
   MODALS (UNIFIED)
   ================================================================ */
.ap-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.ap-modal-backdrop.is-open { opacity: 1; pointer-events: all; }
/* .ap-modal base — no transform/display that would break overlay-based modals */
.ap-modal {
  background: var(--ap-surface-1, var(--ap-surface, #fff));
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-xl, 16px); max-height: 90vh;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}
/* Only apply scale animation when inside an ap-modal-backdrop */
.ap-modal-backdrop .ap-modal {
  display: flex; flex-direction: column;
  transform: scale(.96) translateY(8px); transition: opacity .2s, transform .2s;
}
.ap-modal-backdrop.is-open .ap-modal { transform: scale(1) translateY(0); }
.ap-modal-sm { max-width: 420px; }
.ap-modal-md { max-width: 580px; }
.ap-modal-lg { max-width: 780px; }
.ap-modal-xl { max-width: 1000px; }
.ap-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--ap-border); flex-shrink: 0;
}
.ap-modal-title { font-size: 1rem; font-weight: 800; color: var(--ap-text-1); letter-spacing: -.02em; }
.ap-modal-close { width: 32px; height: 32px; border: none; background: transparent; border-radius: 6px; color: var(--ap-text-3); cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.ap-modal-close:hover { background: var(--ap-surface-2); color: var(--ap-text-1); }
.ap-modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.ap-modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--ap-border);
  display: flex; justify-content: flex-end; gap: .6rem; flex-shrink: 0;
  background: var(--ap-surface-2);
}

/* ================================================================
   PAGINATION (UNIFIED)
   ================================================================ */
.ap-pagination { display: flex; align-items: center; gap: .25rem; }
.ap-page-btn {
  min-width: 32px; height: 32px; padding: 0 .5rem;
  border: 1.5px solid var(--ap-border);
  border-radius: var(--radius-sm); background: var(--ap-surface);
  color: var(--ap-text-2); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.ap-page-btn:hover { border-color: var(--ap-primary); color: var(--ap-primary); background: var(--ap-primary-soft); }
.ap-page-btn.is-active { background: var(--ap-primary); border-color: var(--ap-primary); color: #fff; }
.ap-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ================================================================
   TOASTS (UNIFIED)
   ================================================================ */
#ap-toasts {
  position: fixed; top: calc(var(--topbar-height) + 12px); right: 16px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.ap-toast {
  min-width: 300px; max-width: 380px;
  background: var(--ap-surface); border: 1px solid var(--ap-border);
  border-left: 4px solid; border-radius: var(--radius-lg);
  padding: .85rem 1rem; box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: .75rem;
  pointer-events: all; animation: toastSlideIn .3s ease;
}
@keyframes toastSlideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.ap-toast-success { border-left-color: var(--ap-success); }
.ap-toast-warning { border-left-color: var(--ap-warning); }
.ap-toast-danger  { border-left-color: var(--ap-danger); }
.ap-toast-info    { border-left-color: var(--ap-info); }
.ap-toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.ap-toast-success .ap-toast-icon { color: var(--ap-success); }
.ap-toast-warning .ap-toast-icon { color: var(--ap-warning); }
.ap-toast-danger  .ap-toast-icon { color: var(--ap-danger); }
.ap-toast-info    .ap-toast-icon { color: var(--ap-info); }
.ap-toast-content { flex: 1; }
.ap-toast-title   { font-size: .84rem; font-weight: 700; color: var(--ap-text-1); }
.ap-toast-msg     { font-size: .8rem;  color: var(--ap-text-3); margin-top: .15rem; }
.ap-toast-close   { background: transparent; border: none; cursor: pointer; color: var(--ap-text-4); font-size: .9rem; padding: 0; }
.ap-toast-close:hover { color: var(--ap-text-1); }

/* ================================================================
   AVATAR
   ================================================================ */
.ap-avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ap-primary), var(--ap-purple));
}
.ap-avatar-xs  { width: 24px; height: 24px; font-size: .62rem; }
.ap-avatar-sm  { width: 32px; height: 32px; font-size: .72rem; }
.ap-avatar-md  { width: 40px; height: 40px; font-size: .82rem; }
.ap-avatar-lg  { width: 52px; height: 52px; font-size: .95rem; }
.ap-avatar-xl  { width: 72px; height: 72px; font-size: 1.25rem; border-radius: 20px; }
.ap-avatar-xxl { width: 96px; height: 96px; font-size: 1.5rem;  border-radius: 24px; }

/* ================================================================
   STATUS DOT
   ================================================================ */
.ap-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ap-status-dot.online  { background: var(--ap-success); box-shadow: 0 0 0 2px var(--ap-success-soft); }
.ap-status-dot.busy    { background: var(--ap-warning); }
.ap-status-dot.away    { background: var(--ap-orange); }
.ap-status-dot.offline { background: var(--ap-text-4); }

/* ================================================================
   PROGRESS BARS
   ================================================================ */
.ap-progress { height: 6px; background: var(--ap-border); border-radius: 10px; overflow: hidden; }
.ap-progress-bar { height: 100%; border-radius: 10px; transition: width .6s ease; }
.ap-progress-primary { background: var(--ap-primary); }
.ap-progress-success { background: var(--ap-success); }
.ap-progress-warning { background: var(--ap-warning); }
.ap-progress-danger  { background: var(--ap-danger); }

/* ================================================================
   TIMELINE
   ================================================================ */
.ap-timeline { padding-left: 1.5rem; position: relative; }
.ap-timeline::before { content:''; position:absolute; left:.55rem; top:0; bottom:0; width:2px; background:var(--ap-border); }
.ap-tl-item { position:relative; padding-bottom:1.25rem; }
.ap-tl-item:last-child { padding-bottom:0; }
.ap-tl-dot { position:absolute; left:-1.05rem; top:.2rem; width:12px; height:12px; border-radius:50%; border:2px solid var(--ap-surface); box-shadow:0 0 0 2px var(--ap-border); }

/* ================================================================
   DROPDOWN MENUS
   ================================================================ */
.ap-dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--ap-surface); border: 1px solid var(--ap-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 180px; z-index: 1500; overflow: hidden;
  animation: dropIn .15s ease;
}
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.ap-dropdown-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1rem; font-size: .84rem; color: var(--ap-text-2);
  cursor: pointer; transition: var(--transition); text-decoration: none;
  white-space: nowrap; border: none; background: transparent; width: 100%;
}
.ap-dropdown-item:hover { background: var(--ap-primary-soft); color: var(--ap-primary); }
.ap-dropdown-item.is-danger { color: var(--ap-danger); }
.ap-dropdown-item.is-danger:hover { background: var(--ap-danger-soft); }
.ap-dropdown-divider { height: 1px; background: var(--ap-border); margin: .35rem 0; }
.ap-dropdown-header { padding: .5rem 1rem .25rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ap-text-4); }

/* ================================================================
   ALERTS
   ================================================================ */
.ap-alert {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem; border-radius: var(--radius-md);
  border-left: 4px solid; font-size: .875rem;
}
.ap-alert-title { font-weight: 700; margin-bottom: .2rem; font-size: .875rem; }
.ap-alert-info    { background: var(--ap-info-soft);    border-color: var(--ap-info);    color: var(--ap-info); }
.ap-alert-success { background: var(--ap-success-soft); border-color: var(--ap-success); color: var(--ap-success); }
.ap-alert-warning { background: var(--ap-warning-soft); border-color: var(--ap-warning); color: var(--ap-warning); }
.ap-alert-danger  { background: var(--ap-danger-soft);  border-color: var(--ap-danger);  color: var(--ap-danger); }
.ap-alert i { font-size: 1.1rem; flex-shrink: 0; }
.ap-alert-content { flex: 1; color: var(--ap-text-2); }
.ap-alert-content .ap-alert-title { color: inherit; }

/* ================================================================
   CHART CONTAINERS
   ================================================================ */
.ap-chart-box { position: relative; }
.ap-chart-box canvas { display: block; width: 100% !important; }
.ap-chart-h200 { height: 200px; }
.ap-chart-h260 { height: 260px; }
.ap-chart-h300 { height: 300px; }
.ap-chart-h340 { height: 340px; }

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.ap-divider  { height: 1px; background: var(--ap-border); margin: 1rem 0; }
.ap-divider-v { width: 1px; background: var(--ap-border); align-self: stretch; }
.ap-text-primary { color: var(--ap-primary) !important; }
.ap-text-muted   { color: var(--ap-text-3) !important; }
.ap-text-1       { color: var(--ap-text-1) !important; }
.ap-text-2       { color: var(--ap-text-2) !important; }
.ap-gap-1 { gap: .35rem; }
.ap-gap-2 { gap: .75rem; }
.ap-gap-3 { gap: 1.25rem; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.position-relative { position: relative; }
.skeleton { background: linear-gradient(90deg,var(--ap-skeleton) 25%,var(--ap-surface-2) 50%,var(--ap-skeleton) 75%); background-size:200% 100%; animation:skeleton 1.2s infinite; border-radius:var(--radius-sm); }
@keyframes skeleton { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.empty-state { text-align: center; padding: 3.5rem 1rem; }
.empty-icon { font-size: 2.8rem; opacity: .2; margin-bottom: 1rem; display: block; color: var(--ap-text-3); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 992px) {
  #ap-sidebar { left: calc(-1 * var(--sidebar-width)); transition: left var(--transition-slow); }
  #ap-sidebar.is-mobile-open { left: 0; width: var(--sidebar-width); }
  #ap-topbar, #ap-main { margin-left: 0 !important; left: 0 !important; }
  #ap-topbar.sidebar-is-collapsed { left: 0 !important; }
  :root { --content-padding: 1.1rem; }
}
@media (max-width: 576px) {
  .ap-page-header { flex-direction: column; }
  .ap-page-title { font-size: 1.15rem; }
  #ap-toasts { right: 8px; left: 8px; }
  .ap-toast { min-width: 0; }
}

/* ================================================================
   SETTINGS PAGE — Vertical Tab Nav
   ================================================================ */
.settings-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; align-items: start; }
.settings-nav-card {
  background: var(--ap-surface); border: 1px solid var(--ap-border);
  border-radius: var(--radius-lg); overflow: hidden; position: sticky; top: calc(var(--topbar-height) + 1.5rem);
}
.settings-nav-header {
  padding: .9rem 1.1rem .6rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ap-text-4); border-bottom: 1px solid var(--ap-border);
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: .72rem 1.1rem;
  background: transparent; border: none; cursor: pointer;
  color: var(--ap-text-2); font-size: .88rem; font-weight: 500; font-family: inherit;
  text-align: left; transition: var(--transition);
  border-left: 3px solid transparent; border-bottom: 1px solid var(--ap-border-2);
}
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item i { font-size: 1rem; color: var(--ap-text-3); flex-shrink: 0; width: 18px; text-align: center; }
.settings-nav-item .nav-badge { margin-left: auto; font-size: .62rem; font-weight: 700; background: var(--ap-danger); color: #fff; padding: 1px 6px; border-radius: 10px; }
.settings-nav-item:hover { background: var(--ap-surface-2); color: var(--ap-text-1); }
.settings-nav-item:hover i { color: var(--ap-primary); }
.settings-nav-item.is-active {
  background: var(--ap-primary-soft); color: var(--ap-primary);
  border-left-color: var(--ap-primary); font-weight: 600;
}
.settings-nav-item.is-active i { color: var(--ap-primary); }
.settings-panel { display: none; }
.settings-panel.is-active { display: block; }
.settings-section-title {
  font-size: 1rem; font-weight: 700; color: var(--ap-text-1);
  letter-spacing: -.02em; margin-bottom: .25rem;
}
.settings-section-desc {
  font-size: .84rem; color: var(--ap-text-3); margin-bottom: 1.5rem;
}
.settings-divider {
  border: none; border-top: 1px solid var(--ap-border);
  margin: 1.5rem 0;
}
.settings-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--ap-border-2);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: .875rem; font-weight: 600; color: var(--ap-text-1); }
.settings-row-desc  { font-size: .8rem; color: var(--ap-text-3); margin-top: .15rem; }
/* Toggle switch */
.ap-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.ap-switch input { opacity: 0; width: 0; height: 0; }
.ap-switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--ap-border); border-radius: 24px; transition: .25s;
}
.ap-switch-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.ap-switch input:checked + .ap-switch-slider { background: var(--ap-primary); }
.ap-switch input:checked + .ap-switch-slider::before { transform: translateX(18px); }

/* ================================================================
   PROFILE PAGE
   ================================================================ */
.profile-hero {
  border-radius: var(--radius-xl);
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.profile-hero-banner {
  height: 160px;
  background: linear-gradient(135deg, var(--ap-primary) 0%, #7c3aed 50%, var(--ap-pink) 100%);
  position: relative;
}
.profile-hero-body {
  padding: 0 2rem 1.75rem;
  position: relative;
}
.profile-avatar-wrap {
  position: relative; display: inline-block; margin-top: -52px;
}
.profile-avatar-lg {
  width: 104px; height: 104px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ap-primary), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.4rem; font-weight: 800;
  border: 4px solid var(--ap-surface);
  box-shadow: 0 4px 20px rgba(99,102,241,.4);
}
.profile-avatar-edit {
  position: absolute; bottom: 4px; right: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ap-primary); color: #fff; border: 2px solid var(--ap-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; cursor: pointer; transition: var(--transition);
}
.profile-avatar-edit:hover { background: var(--ap-primary-dark); }
.profile-hero-info { padding-top: 1rem; }
.profile-name { font-size: 1.4rem; font-weight: 800; color: var(--ap-text-1); letter-spacing: -.03em; margin-bottom: .25rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.profile-meta-item { display: flex; align-items: center; gap: .35rem; font-size: .83rem; color: var(--ap-text-3); }
.profile-meta-item i { font-size: .9rem; color: var(--ap-text-4); }
.profile-stat-row {
  display: flex; gap: 2rem; padding-top: 1.25rem;
  border-top: 1px solid var(--ap-border); flex-wrap: wrap;
}
.profile-stat-item { text-align: center; }
.profile-stat-value { font-size: 1.35rem; font-weight: 800; color: var(--ap-primary); letter-spacing: -.03em; }
.profile-stat-label { font-size: .72rem; color: var(--ap-text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: .1rem; }
.profile-tab-nav {
  display: flex; gap: 2px; padding: 3px;
  background: var(--ap-surface-2); border: 1px solid var(--ap-border);
  border-radius: var(--radius-md); width: fit-content; margin-bottom: 1.5rem;
}
.profile-tab-btn {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border: none; background: transparent;
  font-family: inherit; font-size: .85rem; font-weight: 500;
  color: var(--ap-text-3); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.profile-tab-btn:hover { color: var(--ap-text-1); background: rgba(0,0,0,.04); }
.profile-tab-btn.is-active {
  background: var(--ap-surface); color: var(--ap-primary);
  font-weight: 600; box-shadow: var(--shadow-sm);
}
.profile-tab-btn i { font-size: .9rem; }
.profile-panel { display: none; }
.profile-panel.is-active { display: block; }
/* Skill bar */
.skill-bar { margin-bottom: 1rem; }
.skill-bar-header { display: flex; justify-content: space-between; margin-bottom: .4rem; }
.skill-bar-name { font-size: .83rem; font-weight: 600; color: var(--ap-text-2); }
.skill-bar-pct  { font-size: .78rem; color: var(--ap-text-3); font-weight: 600; }
/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; gap: 1rem; padding: .9rem 0;
  border-bottom: 1px solid var(--ap-border-2);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.activity-content { flex: 1; }
.activity-title { font-size: .875rem; font-weight: 600; color: var(--ap-text-1); }
.activity-desc  { font-size: .8rem; color: var(--ap-text-3); margin-top: .1rem; }
.activity-time  { font-size: .75rem; color: var(--ap-text-4); margin-top: .15rem; white-space: nowrap; }
