/* =============================================================
   GOALS by Splurjj — App System Design CSS
   Shared across all authenticated interfaces:
   /auth/* · /app/* · /admin/* · /developers/*
   ============================================================= */

/* ── Design Tokens (mirrors style.css) ──────────────────────── */
:root {
  /* Core palette */
  --black:       #000000;
  --dark:        #0a0a0a;
  --dark-2:      #111111;
  --dark-3:      #161616;
  --dark-4:      #1a1a1a;
  --gray-1:      #222222;
  --gray-2:      #2a2a2a;
  --gray-3:      #333333;
  --gray-4:      #555555;
  --gray-5:      #888888;
  --gray-6:      #aaaaaa;
  --white:       #ffffff;

  /* Brand accent */
  --green:       #22c55e;
  --green-lt:    #86efac;
  --green-dim:   rgba(34, 197, 94, 0.12);
  --green-glow:  rgba(34, 197, 94, 0.28);

  /* Semantic status */
  --status-success: #22c55e;
  --status-warning: #f59e0b;
  --status-danger:  #ef4444;
  --status-info:    #3b82f6;
  --status-neutral: #555555;

  /* Surfaces */
  --surface-0:  #000000;
  --surface-1:  #0a0a0a;
  --surface-2:  #111111;
  --surface-3:  #161616;
  --surface-4:  #1e1e1e;
  --surface-5:  #252525;

  /* Borders */
  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-medium:  rgba(255,255,255,0.16);
  --border-strong:  rgba(255,255,255,0.28);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-disp: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Radius */
  --r-xs:  4px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-pill: 100px;

  /* Spacing scale */
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Sidebar */
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;

  /* Topbar */
  --topbar-h: 60px;

  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.2s;
}

/* ── Reset (scoped to app pages) ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--surface-1);
  color: var(--white);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a   { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-disp);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--white);
}

.text-xs   { font-size: 0.72rem; }
.text-sm   { font-size: 0.85rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.1rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 2rem; }

.text-muted    { color: var(--gray-5); }
.text-subtle   { color: rgba(255,255,255,0.45); }
.text-green    { color: var(--green); }
.text-warning  { color: var(--status-warning); }
.text-danger   { color: var(--status-danger); }
.text-info     { color: var(--status-info); }
.text-mono     { font-family: var(--font-mono); }

.label-caps {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

/* ── Layout Shell ────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* Full-width topbar */
.app-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-h);
  gap: var(--sp-4);
}

.topbar-brand {
  font-family: var(--font-disp);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.topbar-brand .brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

.topbar-center {
  flex: 1;
  max-width: 480px;
}

.topbar-search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-pill);
  padding: 0 var(--sp-4);
  height: 36px;
  transition: border-color var(--duration) var(--ease);
}

.topbar-search:focus-within { border-color: var(--border-medium); }
.topbar-search svg { color: var(--gray-5); flex-shrink: 0; }
.topbar-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--white);
  font-size: 0.88rem;
}
.topbar-search input::placeholder { color: var(--gray-5); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-6);
  transition: background var(--duration), color var(--duration), border-color var(--duration);
  position: relative;
}

.topbar-icon-btn:hover {
  background: var(--surface-4);
  color: var(--white);
  border-color: var(--border-default);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  border: 1.5px solid var(--surface-2);
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gray-3);
  border: 1.5px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-disp);
  color: var(--white);
  cursor: pointer;
  overflow: hidden;
}

/* ── Sidebar Navigation ──────────────────────────────────────── */
.app-sidebar {
  grid-row: 2;
  grid-column: 1;
  background: var(--surface-2);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: var(--sp-4) 0 var(--sp-6);
}

.sidebar-section {
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-6);
}

.sidebar-section-label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,0.55);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--duration), color var(--duration);
  position: relative;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
}

.sidebar-link.active {
  background: var(--green-dim);
  color: var(--green);
  font-weight: 600;
}

.sidebar-link svg {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  opacity: 0.7;
}

.sidebar-link.active svg { opacity: 1; }

.sidebar-link .link-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--green-dim);
  color: var(--green);
  padding: 1px 7px;
  border-radius: var(--r-pill);
}

.sidebar-link .link-badge.danger {
  background: rgba(239,68,68,0.15);
  color: var(--status-danger);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-2) var(--sp-6);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--sp-4) var(--sp-3) 0;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--duration);
}
.sidebar-user-row:hover { background: rgba(255,255,255,0.04); }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.72rem; color: var(--gray-5); }

/* ── Main Content Area ───────────────────────────────────────── */
.app-main {
  grid-row: 2;
  grid-column: 2;
  background: var(--surface-1);
  overflow-y: auto;
  min-height: calc(100vh - var(--topbar-h));
}

.app-content {
  padding: var(--sp-8) var(--sp-8) var(--sp-16);
  max-width: 1440px;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--sp-8);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.page-header-left {}
.page-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: var(--sp-1);
}
.page-title {
  font-family: var(--font-disp);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.page-subtitle {
  font-size: 0.9rem;
  color: var(--gray-5);
  margin-top: var(--sp-1);
  line-height: 1.6;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: border-color var(--duration);
}

.stat-card:hover { border-color: var(--border-default); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-5);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.green  { background: var(--green-dim); color: var(--green); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); color: #60a5fa; }
.stat-icon.amber  { background: rgba(245,158,11,0.12); color: #fbbf24; }
.stat-icon.red    { background: rgba(239,68,68,0.12);  color: #f87171; }
.stat-icon.purple { background: rgba(168,85,247,0.12); color: #c084fc; }

.stat-value {
  font-family: var(--font-disp);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--white);
}

.stat-delta {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--status-danger); }
.stat-delta.flat { color: var(--gray-5); }

/* ── Section + Panels ────────────────────────────────────────── */
.panel {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.panel-title {
  font-family: var(--font-disp);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.01em;
}

.panel-body { padding: var(--sp-6); }
.panel-body.no-pad { padding: 0; }

.panel-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

/* ── Two-Column Grid ─────────────────────────────────────────── */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
.col-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-5); }
.col-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-6); }
.col-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-6); }

/* ── Tables ──────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--surface-3);
  color: rgba(255,255,255,0.4);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  color: rgba(255,255,255,0.78);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.data-table .cell-primary { color: var(--white); font-weight: 500; }
.data-table .cell-mono { font-family: var(--font-mono); font-size: 0.82rem; color: var(--gray-6); }
.data-table .cell-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* ── Badges / Status Pills ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.badge-green   { background: var(--green-dim); color: var(--green); }
.badge-green::before { background: var(--green); }

.badge-amber   { background: rgba(245,158,11,0.12); color: #fbbf24; }
.badge-amber::before { background: #fbbf24; }

.badge-red     { background: rgba(239,68,68,0.12); color: #f87171; }
.badge-red::before { background: #f87171; }

.badge-blue    { background: rgba(59,130,246,0.12); color: #60a5fa; }
.badge-blue::before { background: #60a5fa; }

.badge-gray    { background: rgba(255,255,255,0.06); color: var(--gray-6); }
.badge-gray::before { background: var(--gray-5); }

.badge-purple  { background: rgba(168,85,247,0.12); color: #c084fc; }
.badge-purple::before { background: #c084fc; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background var(--duration), transform var(--duration), box-shadow var(--duration), border-color var(--duration);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-xl { padding: 15px 36px; font-size: 1rem; }

.btn-primary {
  background: var(--green);
  color: var(--black);
  border-color: var(--green);
}
.btn-primary:hover {
  background: var(--green-lt);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--green-glow);
}

.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--white);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--border-medium);
}

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.65);
  border-color: transparent;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.22);
  border-color: rgba(239,68,68,0.4);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  color: var(--gray-6);
}
.btn-icon:hover { background: var(--surface-4); color: var(--white); border-color: var(--border-default); }
.btn-icon.sm { width: 28px; height: 28px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.75); }
.form-label .required { color: var(--status-danger); margin-left: 3px; }

.form-input,
.form-select,
.form-textarea {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  color: var(--white);
  font-size: 0.9rem;
  font-family: var(--font-body);
  padding: 10px 14px;
  width: 100%;
  transition: border-color var(--duration), background var(--duration);
  outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-5); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green);
  background: var(--surface-4);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; appearance: none; }
.form-select option { background: var(--surface-3); }

.form-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.form-input-wrap .form-input { padding-left: 38px; }
.form-input-wrap .input-icon {
  position: absolute;
  left: 12px;
  color: var(--gray-5);
  pointer-events: none;
}
.form-input-wrap .input-action {
  position: absolute;
  right: 12px;
  color: var(--gray-5);
  cursor: pointer;
  transition: color var(--duration);
}
.form-input-wrap .input-action:hover { color: var(--white); }

.form-hint { font-size: 0.78rem; color: var(--gray-5); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--status-danger); margin-top: 4px; }
.form-input.error { border-color: var(--status-danger); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: var(--sp-3); }
.toggle-wrap .toggle-label { font-size: 0.9rem; color: rgba(255,255,255,0.75); }
.toggle-wrap .toggle-desc { font-size: 0.78rem; color: var(--gray-5); margin-top: 2px; }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-3);
  border-radius: var(--r-pill);
  transition: background 0.25s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.25s;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface-4);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--r-pill);
  transition: width 0.6s var(--ease);
}
.progress-fill.amber  { background: var(--status-warning); }
.progress-fill.red    { background: var(--status-danger); }
.progress-fill.blue   { background: var(--status-info); }

/* ── Ring Progress ───────────────────────────────────────────── */
.ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ring-label {
  position: absolute;
  font-family: var(--font-disp);
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
}

.tab-btn {
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-5);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--duration), border-color var(--duration);
  cursor: pointer;
}
.tab-btn:hover { color: var(--white); }
.tab-btn.active { color: var(--white); border-bottom-color: var(--green); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Dropdown Menu ───────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-2) 0;
  min-width: 180px;
  z-index: 500;
  display: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  font-size: 0.88rem;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background var(--duration), color var(--duration);
  white-space: nowrap;
}
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.dropdown-item.danger:hover { color: var(--status-danger); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--sp-1) 0; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s var(--ease);
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--sp-6) var(--sp-6) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-4);
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--white); }
.modal-close { color: var(--gray-5); transition: color var(--duration); }
.modal-close:hover { color: var(--white); }
.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-6);
  text-align: center;
  gap: var(--sp-4);
}
.empty-icon {
  width: 56px;
  height: 56px;
  background: var(--surface-3);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-5);
}
.empty-title { font-size: 1rem; font-weight: 600; color: var(--white); }
.empty-body  { font-size: 0.88rem; color: var(--gray-5); max-width: 320px; line-height: 1.6; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.88rem;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: all;
  animation: toastIn 0.3s var(--ease) forwards;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.warning { border-left: 3px solid var(--status-warning); }
.toast.error   { border-left: 3px solid var(--status-danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Auth Pages ──────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-0);
}

.auth-left {
  position: relative;
  background: var(--surface-2);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: var(--sp-12) var(--sp-12);
  overflow: hidden;
}

.auth-left-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #000 0%, #0a0a0a 50%, #111 100%);
}

.auth-left-pattern {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 60px, rgba(255,255,255,0.015) 60px, rgba(255,255,255,0.015) 61px),
    repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(255,255,255,0.015) 60px, rgba(255,255,255,0.015) 61px);
}

.auth-left-glow {
  position: absolute;
  bottom: -100px;
  left: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(34,197,94,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-left-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.auth-brand {
  font-family: var(--font-disp);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
  margin-bottom: auto;
}

.auth-left-headline {
  font-family: var(--font-disp);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-4);
}

.auth-left-sub {
  font-size: 0.95rem;
  color: var(--gray-5);
  line-height: 1.7;
  max-width: 360px;
  margin-bottom: var(--sp-8);
}

.auth-quote {
  border-left: 2px solid var(--green);
  padding-left: var(--sp-4);
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
  font-style: italic;
  line-height: 1.7;
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
  background: var(--surface-1);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card-header { margin-bottom: var(--sp-8); }
.auth-card-title { font-size: 1.8rem; font-weight: 700; color: var(--white); margin-bottom: var(--sp-2); }
.auth-card-sub { font-size: 0.9rem; color: var(--gray-5); line-height: 1.6; }

.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin: var(--sp-2) 0;
}
.auth-divider-line { flex: 1; height: 1px; background: var(--border-subtle); }
.auth-divider-text { font-size: 0.75rem; color: var(--gray-5); white-space: nowrap; }

.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: 11px;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--white);
  cursor: pointer;
  transition: background var(--duration), border-color var(--duration);
  width: 100%;
}
.auth-social-btn:hover { background: var(--surface-4); border-color: var(--border-medium); }

.auth-footer-text {
  margin-top: var(--sp-6);
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray-5);
}
.auth-footer-text a { color: var(--green); font-weight: 600; }
.auth-footer-text a:hover { text-decoration: underline; }

.auth-terms {
  font-size: 0.75rem;
  color: var(--gray-5);
  text-align: center;
  line-height: 1.6;
  margin-top: var(--sp-4);
}
.auth-terms a { color: rgba(255,255,255,0.5); text-decoration: underline; }

/* ── Role Selector ───────────────────────────────────────────── */
.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.role-card {
  position: relative;
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-3);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--duration), background var(--duration);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.role-card:hover { border-color: var(--border-medium); background: rgba(255,255,255,0.03); }
.role-card.selected { border-color: var(--green); background: var(--green-dim); }
.role-card input { position: absolute; opacity: 0; }
.role-icon { font-size: 1.4rem; }
.role-name { font-size: 0.8rem; font-weight: 600; color: var(--white); }
.role-desc { font-size: 0.7rem; color: var(--gray-5); line-height: 1.4; }

/* ── Mimic Goal Badge ────────────────────────────────────────── */
.mimic-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(168,85,247,0.12);
  color: #c084fc;
  border: 1px solid rgba(168,85,247,0.22);
  padding: 2px 9px;
  border-radius: var(--r-pill);
}

/* ── Code / Mono blocks ──────────────────────────────────────── */
.code-block {
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.7;
  overflow-x: auto;
  position: relative;
}
.code-block .copy-btn {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xs);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-family: var(--font-body);
  color: var(--gray-6);
  cursor: pointer;
  transition: all var(--duration);
}
.code-block .copy-btn:hover { background: var(--surface-4); color: var(--white); }
.code-key   { color: #60a5fa; }
.code-string{ color: #86efac; }
.code-num   { color: #fbbf24; }
.code-comment { color: rgba(255,255,255,0.3); }

/* ── Chart Placeholders ──────────────────────────────────────── */
.chart-wrap { width: 100%; position: relative; }
.chart-canvas-wrap { position: relative; }

/* ── Misc Utilities ──────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mt-8  { margin-top: var(--sp-8); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-6  { margin-bottom: var(--sp-6); }
.mb-8  { margin-bottom: var(--sp-8); }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive Guard ────────────────────────────────────────── */
@media (max-width: 1200px) {
  .col-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: var(--sidebar-collapsed) 1fr; }
  .sidebar-section-label, .sidebar-link span, .sidebar-user-info { display: none; }
  .sidebar-link { justify-content: center; padding: var(--sp-3); }
  .sidebar-link svg { width: 20px; height: 20px; }
  .sidebar-footer .sidebar-user-row { justify-content: center; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-left  { display: none; }
  .col-2      { grid-template-columns: 1fr; }
  .col-2-1    { grid-template-columns: 1fr; }
  .col-1-2    { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-content { padding: var(--sp-5) var(--sp-4) var(--sp-12); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .role-selector { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .data-table { font-size: 0.82rem; }
  .data-table th, .data-table td { padding: var(--sp-3) var(--sp-3); }
}
