/* ═══════════════════════════════════════════════════════════════
   DocSplitr — APP PREMIUM DESIGN SYSTEM v1.0
   Gradient Luxury — Authenticated application shell
   ═══════════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ───────────────────────────────────────────── */
:root {
  /* Brand gradient */
  --ap-purple:        #7C3AED;
  --ap-purple-light:  #a78bfa;
  --ap-blue:          #2563EB;
  --ap-cyan:          #06B6D4;
  --ap-green:         #10B981;
  --ap-amber:         #F59E0B;
  --ap-red:           #EF4444;
  --ap-gradient:      linear-gradient(135deg, #7C3AED 0%, #2563EB 55%, #06B6D4 100%);

  /* Dark surfaces */
  --ap-bg:            linear-gradient(150deg, #08031a 0%, #0d1650 45%, #0a2e96 100%);
  --ap-bg-solid:      #08031a;
  --ap-glass-1:       rgba(255,255,255,0.04);
  --ap-glass-2:       rgba(255,255,255,0.07);
  --ap-glass-3:       rgba(255,255,255,0.11);
  --ap-glass-4:       rgba(255,255,255,0.16);

  /* Borders */
  --ap-border:        rgba(255,255,255,0.08);
  --ap-border-md:     rgba(255,255,255,0.14);
  --ap-border-strong: rgba(255,255,255,0.22);

  /* Text */
  --ap-text:          rgba(255,255,255,0.92);
  --ap-text-2:        rgba(255,255,255,0.75);
  --ap-muted:         rgba(255,255,255,0.50);
  --ap-muted-soft:    rgba(255,255,255,0.32);

  /* Shadows */
  --ap-shadow-sm:     0 4px 16px rgba(0,0,0,0.25);
  --ap-shadow-md:     0 10px 36px rgba(0,0,0,0.35);
  --ap-shadow-lg:     0 24px 72px rgba(0,0,0,0.50);
  --ap-shadow-purple: 0 12px 40px rgba(124,58,237,0.35);

  /* Layout */
  --ap-sidebar-w:     220px;
  --ap-topbar-h:      60px;
  --ap-r-sm:          10px;
  --ap-r-md:          16px;
  --ap-r-lg:          20px;
  --ap-r-xl:          28px;
}

/* ─── GLOBAL BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body.app-dark {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #08031a;
  background-image: var(--ap-bg);
  background-attachment: fixed;
  color: var(--ap-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.app-rtl { direction: rtl; }

a { text-decoration: none; }

/* ─── APP SHELL (grid layout) ─────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  grid-template-rows: var(--ap-topbar-h) 1fr;
  grid-template-columns: var(--ap-sidebar-w) 1fr;
  min-height: 100vh;
}

/* ─── ══════════════════════════════════════════════════════════ */
/*    TOPBAR                                                       */
/* ══════════════════════════════════════════════════════════════ */
.app-topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--ap-topbar-h);
  background: rgba(8, 3, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  padding: 0 20px 0 0;
  gap: 12px;
}

/* Brand */
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--ap-topbar-h);
  padding: 0 16px;
  text-decoration: none;
  flex-shrink: 0;
  border-right: 1px solid var(--ap-border);
  width: var(--ap-sidebar-w);
}

.app-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ap-gradient);
  box-shadow: 0 6px 18px rgba(124,58,237,0.38), inset 0 1px 0 rgba(255,255,255,0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.app-brand-icon::before {
  content: '';
  position: absolute;
  right: 8px; top: 7px;
  width: 7px; height: 11px;
  border-radius: 2.5px;
  background: rgba(255,255,255,0.50);
}
.app-brand-icon::after {
  content: '';
  position: absolute;
  left: 8px; top: 6px;
  width: 7px; height: 11px;
  border-radius: 2.5px;
  background: #fff;
}

.app-brand-name {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #fff;
  line-height: 1;
}

/* Topbar spacer */
.app-topbar-spacer { flex: 1 1 auto; }

/* Org context in topbar */
.app-topbar-org {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--ap-r-sm);
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ap-text-2);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-org-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.app-topbar-org-dot.ok     { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }
.app-topbar-org-dot.warn   { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,0.18); }
.app-topbar-org-dot.off    { background: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,0.18); }

/* User avatar */
.app-topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--ap-r-sm);
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-topbar-user:hover { background: var(--ap-glass-3); }

.app-topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ap-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.app-topbar-email {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ap-text-2);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Language switch in topbar */
.app-topbar .site-language-switch { flex-shrink: 0; }
.app-topbar .site-language-current {
  height: 38px !important;
  border-radius: var(--ap-r-sm) !important;
  background: var(--ap-glass-2) !important;
  border-color: var(--ap-border) !important;
  color: var(--ap-text-2) !important;
  font-size: 0.85rem !important;
}
.app-topbar .site-language-current:hover { background: var(--ap-glass-3) !important; }
.app-topbar .site-language-menu {
  background: rgba(13, 22, 80, 0.95) !important;
  border-color: var(--ap-border-md) !important;
  backdrop-filter: blur(20px) !important;
}
.app-topbar .site-lang-option { color: var(--ap-text-2) !important; }
.app-topbar .site-lang-option:hover { background: var(--ap-glass-3) !important; color: #fff !important; }
.app-topbar .site-lang-option.active { background: rgba(124,58,237,0.15) !important; color: #c4b5fd !important; }

/* Dev switcher in topbar */
.app-topbar .dev-profile-switcher { flex-shrink: 0; }

/* ─── ══════════════════════════════════════════════════════════ */
/*    SIDEBAR                                                      */
/* ══════════════════════════════════════════════════════════════ */
.app-sidebar {
  grid-area: sidebar;
  background: rgba(6, 2, 18, 0.60);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--ap-border);
  position: sticky;
  top: var(--ap-topbar-h);
  height: calc(100vh - var(--ap-topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Nav sections */
.app-sidenav { flex: 1; display: flex; flex-direction: column; padding: 8px 0; }

.app-sidenav-section { padding: 4px 10px; }

.app-sidenav-label {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ap-muted-soft);
  padding: 8px 6px 4px;
  display: block;
}

/* Nav link */
.app-sidenav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--ap-r-sm);
  color: var(--ap-muted);
  font-size: 0.90rem;
  font-weight: 600;
  transition: all 0.15s ease;
  text-decoration: none;
  border: 1px solid transparent;
  width: 100%;
  cursor: pointer;
  background: transparent;
  font-family: inherit;
  text-align: left;
}
.app-sidenav-link:hover {
  background: var(--ap-glass-2);
  color: var(--ap-text);
  border-color: transparent;
}
.app-sidenav-link.active {
  background: rgba(124,58,237,0.16);
  border-color: rgba(124,58,237,0.22);
  color: #c4b5fd;
}
.app-sidenav-link.active .app-nav-icon { color: #c4b5fd; }

/* Sub-link (indented) */
.app-sidenav-link.sub {
  min-height: 34px;
  font-size: 0.865rem;
  padding-left: 34px;
  color: var(--ap-muted-soft);
}
.app-sidenav-link.sub:hover { color: var(--ap-text-2); }
.app-sidenav-link.sub.active {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.16);
  color: #c4b5fd;
}

/* Nav icon */
.app-nav-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--ap-muted);
  transition: color 0.15s;
}
.app-sidenav-link:hover .app-nav-icon { color: var(--ap-text-2); }

/* Divider */
.app-sidenav-divider {
  height: 1px;
  background: var(--ap-border);
  margin: 6px 10px;
}

/* Spacer pushes bottom items down */
.app-sidenav-spacer { flex: 1 1 auto; min-height: 16px; }

/* ── Trial widget ────────────────────────────────────────────── */
.app-trial-widget {
  margin: 4px 10px 6px;
  padding: 12px 14px;
  background: rgba(124,58,237,0.10);
  border: 1px solid rgba(124,58,237,0.20);
  border-radius: var(--ap-r-md);
}

.app-trial-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.70rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a78bfa;
  margin-bottom: 6px;
}
.app-trial-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167,139,250,0.20);
  flex-shrink: 0;
}

.app-trial-days {
  font-size: 1.05rem;
  font-weight: 900;
  color: #c4b5fd;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.app-trial-bar {
  height: 3px;
  background: rgba(124,58,237,0.20);
  border-radius: 2px;
  overflow: hidden;
}
.app-trial-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7C3AED, #a78bfa);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.app-trial-upgrade {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #a78bfa;
  text-decoration: none;
  transition: color 0.15s;
}
.app-trial-upgrade:hover { color: #c4b5fd; }

/* ── Sidebar user chip ───────────────────────────────────────── */
.app-sidebar-user {
  margin: 4px 10px 8px;
  padding: 9px 12px;
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
  display: flex;
  align-items: center;
  gap: 9px;
}

.app-sidebar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ap-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.app-sidebar-email {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--ap-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ─── ══════════════════════════════════════════════════════════ */
/*    MAIN CONTENT                                                 */
/* ══════════════════════════════════════════════════════════════ */
.app-main {
  grid-area: main;
  min-height: calc(100vh - var(--ap-topbar-h));
  overflow-y: auto;
}

/* Page wrapper */
.app-page {
  padding: 28px 32px 56px;
  max-width: 1280px;
}

.app-page-fluid {
  padding: 28px 32px 56px;
}

/* Page header */
.app-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}

.app-page-head-left { min-width: 0; }

.app-page-title {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.04em;
  margin: 0 0 4px;
  line-height: 1.1;
}

.app-page-subtitle {
  color: var(--ap-muted);
  font-size: 0.90rem;
  margin: 0;
  line-height: 1.5;
}

.app-page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── ══════════════════════════════════════════════════════════ */
/*    GLASS CARDS / PANELS                                         */
/* ══════════════════════════════════════════════════════════════ */
.app-card {
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.app-card-pad { padding: 22px 24px; }

.app-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--ap-border);
  gap: 12px;
}

.app-card-head-title {
  font-size: 0.93rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
}

.app-card-head-action {
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--ap-purple-light);
  text-decoration: none;
  transition: color 0.15s;
}
.app-card-head-action:hover { color: #c4b5fd; }

/* Gradient hero card */
.app-hero-card {
  position: relative;
  background: linear-gradient(135deg, rgba(124,58,237,0.18) 0%, rgba(37,99,235,0.15) 60%, rgba(6,182,212,0.10) 100%);
  border: 1px solid rgba(124,58,237,0.22);
  border-radius: var(--ap-r-xl);
  overflow: hidden;
  padding: 28px 32px;
  margin-bottom: 22px;
}
.app-hero-card::before {
  content: '';
  position: absolute;
  top: -40%; right: -10%;
  width: 50%; height: 180%;
  background: radial-gradient(ellipse, rgba(124,58,237,0.22) 0%, transparent 65%);
  pointer-events: none;
}
.app-hero-card::after {
  content: '';
  position: absolute;
  bottom: -40%; left: -10%;
  width: 50%; height: 150%;
  background: radial-gradient(ellipse, rgba(6,182,212,0.14) 0%, transparent 65%);
  pointer-events: none;
}

.app-hero-card-inner { position: relative; z-index: 1; }

.app-hero-greeting {
  font-size: 0.80rem;
  font-weight: 700;
  color: rgba(167,139,250,0.80);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.app-hero-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.045em;
  margin: 0 0 10px;
  line-height: 1.1;
}

.app-hero-desc {
  color: rgba(255,255,255,0.60);
  font-size: 0.92rem;
  line-height: 1.65;
  max-width: 52ch;
  margin: 0;
}

/* ─── ══════════════════════════════════════════════════════════ */
/*    KPI CARDS                                                    */
/* ══════════════════════════════════════════════════════════════ */
.app-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.app-kpi {
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-md);
  padding: 18px 20px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.app-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--ap-gradient);
}
.app-kpi:hover {
  background: var(--ap-glass-3);
  transform: translateY(-2px);
  box-shadow: var(--ap-shadow-sm);
}

.app-kpi-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ap-muted);
  margin-bottom: 8px;
  display: block;
}

.app-kpi-value {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: #fff;
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.app-kpi-value.gradient {
  background: var(--ap-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-kpi-delta {
  font-size: 0.77rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}
.app-kpi-delta.up   { color: #34d399; }
.app-kpi-delta.down { color: #f87171; }
.app-kpi-delta.flat { color: var(--ap-muted); }

/* ─── ══════════════════════════════════════════════════════════ */
/*    TABLES                                                       */
/* ══════════════════════════════════════════════════════════════ */
.app-table-wrap {
  overflow: hidden;
  border-radius: var(--ap-r-lg);
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
}

.app-table {
  width: 100%;
  border-collapse: collapse;
}

.app-table th {
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ap-muted-soft);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--ap-border);
  background: rgba(0,0,0,0.10);
  white-space: nowrap;
}

.app-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.875rem;
  color: var(--ap-text-2);
  vertical-align: middle;
}

.app-table tr:last-child td { border-bottom: none; }
.app-table tbody tr { transition: background 0.12s; }
.app-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.app-table td:first-child { color: var(--ap-text); font-weight: 600; }

.app-table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ap-muted);
  font-size: 0.88rem;
}

/* ─── ══════════════════════════════════════════════════════════ */
/*    BADGES / STATUS                                              */
/* ══════════════════════════════════════════════════════════════ */
.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.app-badge.green  { background: rgba(16,185,129,0.14); color: #34d399; }
.app-badge.amber  { background: rgba(245,158,11,0.14); color: #fbbf24; }
.app-badge.red    { background: rgba(239,68,68,0.14); color: #fca5a5; }
.app-badge.purple { background: rgba(124,58,237,0.14); color: #c4b5fd; }
.app-badge.blue   { background: rgba(37,99,235,0.14); color: #93c5fd; }
.app-badge.gray   { background: rgba(255,255,255,0.07); color: var(--ap-muted); }

/* ─── ══════════════════════════════════════════════════════════ */
/*    BUTTONS                                                      */
/* ══════════════════════════════════════════════════════════════ */
.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--ap-r-md);
  font-weight: 700;
  font-size: 0.90rem;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
}
.ap-btn:hover { transform: translateY(-2px); }
.ap-btn:active { transform: translateY(0); }

.ap-btn-gradient {
  background: var(--ap-gradient);
  color: #fff;
  box-shadow: var(--ap-shadow-purple);
}
.ap-btn-gradient:hover { color: #fff; box-shadow: 0 18px 50px rgba(124,58,237,0.45); }

.ap-btn-glass {
  background: var(--ap-glass-3);
  border: 1px solid var(--ap-border-md);
  color: var(--ap-text);
}
.ap-btn-glass:hover { color: #fff; background: var(--ap-glass-4); }

.ap-btn-ghost {
  background: transparent;
  border: 1px solid var(--ap-border-md);
  color: var(--ap-text-2);
}
.ap-btn-ghost:hover { background: var(--ap-glass-2); color: var(--ap-text); }

.ap-btn-danger {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.22);
  color: #fca5a5;
}
.ap-btn-danger:hover { background: rgba(239,68,68,0.20); color: #fff; }

.ap-btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.83rem; border-radius: var(--ap-r-sm); }

/* ─── ══════════════════════════════════════════════════════════ */
/*    FORM ELEMENTS (dark variant)                                 */
/* ══════════════════════════════════════════════════════════════ */
.ap-form-group { margin-bottom: 16px; }

.ap-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ap-text-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.ap-input,
.ap-select,
.ap-textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--ap-r-md);
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--ap-border-md);
  color: var(--ap-text);
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.15s ease;
  outline: none;
}
.ap-input::placeholder { color: var(--ap-muted-soft); }
.ap-input:focus,
.ap-select:focus,
.ap-textarea:focus {
  border-color: var(--ap-purple-light);
  background: rgba(0,0,0,0.35);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}

.ap-textarea { padding: 12px 14px; min-height: 90px; resize: vertical; }
.ap-select { padding-right: 36px; cursor: pointer; }

/* ─── ══════════════════════════════════════════════════════════ */
/*    ONBOARDING CHECKLIST                                         */
/* ══════════════════════════════════════════════════════════════ */
.app-onboarding-card {
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-xl);
  overflow: hidden;
  margin-bottom: 22px;
}

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

.app-onboarding-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-onboarding-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--ap-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(124,58,237,0.28);
}

.app-onboarding-title {
  font-size: 0.97rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 2px;
}

.app-onboarding-progress-text {
  font-size: 0.78rem;
  color: var(--ap-muted);
}

/* Progress bar */
.app-onboarding-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.app-onboarding-bar-fill {
  height: 100%;
  background: var(--ap-gradient);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checklist steps */
.app-onboarding-steps { padding: 4px 0 8px; }

.app-onboarding-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 24px;
  transition: background 0.12s;
  cursor: default;
}
.app-onboarding-step.clickable { cursor: pointer; }
.app-onboarding-step.clickable:hover { background: rgba(255,255,255,0.03); }

.app-step-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.app-step-check.done {
  background: rgba(16,185,129,0.15);
  border-color: rgba(52,211,153,0.40);
}
.app-step-check.done svg { color: #34d399; }
.app-step-check.current {
  border-color: rgba(124,58,237,0.60);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.12);
}

.app-step-body { flex: 1; min-width: 0; }

.app-step-label {
  font-size: 0.90rem;
  font-weight: 600;
  color: var(--ap-text-2);
  display: block;
  line-height: 1.3;
}
.app-step-label.done { color: var(--ap-muted-soft); text-decoration: line-through; }
.app-step-label.current { color: #fff; }

.app-step-desc {
  font-size: 0.80rem;
  color: var(--ap-muted-soft);
  display: block;
  line-height: 1.4;
  margin-top: 1px;
}

.app-step-cta {
  font-size: 0.80rem;
  font-weight: 700;
  color: #a78bfa;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  transition: color 0.15s;
}
.app-step-cta:hover { color: #c4b5fd; }

/* Full onboarding page styles */
.app-onboarding-page-card {
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-xl);
  overflow: hidden;
  max-width: 760px;
  margin: 0 auto;
}

.app-onboarding-page-step {
  display: flex;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  align-items: flex-start;
  transition: background 0.15s;
}
.app-onboarding-page-step:last-child { border-bottom: none; }
.app-onboarding-page-step.active { background: rgba(124,58,237,0.06); }

.app-ob-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ap-muted);
  margin-top: 2px;
}
.app-ob-num.done {
  background: rgba(16,185,129,0.14);
  border-color: rgba(52,211,153,0.40);
  color: #34d399;
}
.app-ob-num.current {
  background: rgba(124,58,237,0.14);
  border-color: rgba(124,58,237,0.50);
  color: #c4b5fd;
}

.app-ob-content { flex: 1; min-width: 0; }
.app-ob-title {
  font-size: 0.97rem;
  font-weight: 800;
  color: var(--ap-text-2);
  margin: 0 0 3px;
}
.app-ob-title.done { color: var(--ap-muted-soft); text-decoration: line-through; }
.app-ob-title.current { color: #fff; }
.app-ob-desc {
  font-size: 0.84rem;
  color: var(--ap-muted);
  margin: 0 0 10px;
  line-height: 1.6;
}
.app-ob-desc.hidden { display: none; }

/* Inline org creation form */
.app-ob-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  max-width: 400px;
}
.app-ob-form .ap-input { flex: 1; min-height: 40px; }
.app-ob-form .ap-btn { min-height: 40px; padding: 0 18px; white-space: nowrap; }

/* ─── ══════════════════════════════════════════════════════════ */
/*    GRID UTILITIES                                               */
/* ══════════════════════════════════════════════════════════════ */
.app-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.app-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.app-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─── ══════════════════════════════════════════════════════════ */
/*    SECTION TITLE INSIDE DASHBOARD                              */
/* ══════════════════════════════════════════════════════════════ */
.app-section-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ap-muted-soft);
  margin: 0 0 12px;
}

/* Empty state */
.app-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
  gap: 12px;
}
.app-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--ap-glass-2);
  border: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ap-muted);
}
.app-empty-title { font-size: 0.95rem; font-weight: 800; color: var(--ap-text-2); margin: 0; }
.app-empty-desc  { font-size: 0.85rem; color: var(--ap-muted); margin: 0; line-height: 1.6; }

/* ─── ══════════════════════════════════════════════════════════ */
/*    RESPONSIVE                                                   */
/* ══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .app-kpis { grid-template-columns: repeat(2, 1fr); }
  .app-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --ap-sidebar-w: 0px; }

  .app-shell {
    grid-template-areas:
      "topbar"
      "main";
    grid-template-rows: var(--ap-topbar-h) 1fr;
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    display: none; /* Collapse sidebar on mobile */
  }

  .app-brand { width: auto; }

  .app-page, .app-page-fluid { padding: 20px 16px 48px; }

  .app-kpis { grid-template-columns: 1fr 1fr; }

  .app-hero-card { padding: 20px; border-radius: var(--ap-r-lg); }

  .app-grid-2, .app-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .app-kpis { grid-template-columns: 1fr; }
  .app-topbar-email { display: none; }
}
