/* ============================================================================
   CPMS · Construction Command Center — Design System
   A premium, decision-driven enterprise UI. Dark-first, fully themed.
   ========================================================================= */

/* ---- Design tokens ------------------------------------------------------- */
:root {
  /* Brand — "Cobalt" */
  --brand-50:  #eef3ff;
  --brand-100: #dbe5ff;
  --brand-200: #bccfff;
  --brand-300: #8faeff;
  --brand-400: #5c82fb;
  --brand-500: #375bf4;
  --brand-600: #2540e3;
  --brand-700: #1e31c9;
  --brand-800: #1f2ca3;
  --brand-900: #1f2b81;

  /* Accent — "Signal" gold */
  --accent-300: #fccb4d;
  --accent-400: #fbb824;
  --accent-500: #f5990b;
  --accent-600: #d97406;

  /* Semantic status */
  --success: #12b312;
  --warning: #f59e0b;
  --serious: #ef7f4e;
  --danger:  #e2413f;
  --info:    #2a86e0;

  /* Data-viz series (validated, colourblind-safe) */
  --series-1: #2a78d6;
  --series-2: #1baf7a;
  --series-3: #eda100;
  --series-4: #008300;
  --series-5: #7c5cff;
  --series-6: #e34948;
  --series-7: #e87ba4;
  --series-8: #eb6834;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  --font-sans: "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --shadow-xs: 0 1px 2px rgba(15, 20, 40, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 20, 40, 0.08), 0 2px 8px -2px rgba(15, 20, 40, 0.06);
  --shadow: 0 4px 14px -4px rgba(15, 20, 40, 0.12), 0 2px 6px -2px rgba(15, 20, 40, 0.08);
  --shadow-lg: 0 18px 48px -14px rgba(15, 20, 40, 0.28), 0 6px 16px -8px rgba(15, 20, 40, 0.16);
  --shadow-brand: 0 10px 30px -8px rgba(37, 64, 227, 0.45);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.22s;
}

/* Light theme (default) — refined, airy, professional */
:root,
html[data-theme="light"] {
  --canvas: #f4f6fb;
  --canvas-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --elevated: #ffffff;
  --sunken: #eef1f7;
  --line: #e7eaf1;
  --line-strong: #d5dae6;
  --ink: #111725;
  --ink-muted: #59637a;
  --ink-subtle: #98a1b4;
  --brand: var(--brand-600);
  --brand-soft: #eef2ff;
  --brand-ink: #ffffff;
  --ring: rgba(37, 64, 227, 0.26);
  --overlay: rgba(17, 23, 37, 0.32);
  --grid-line: rgba(17, 23, 37, 0.05);

  /* Elegant light sidebar */
  --sidebar-bg: #ffffff;
  --sidebar-fg: #111725;
  --sidebar-ink: #4a5468;
  --sidebar-ink-dim: #98a1b4;
  --sidebar-active: #eef2ff;
  --sidebar-active-fg: var(--brand-700);
  --sidebar-hover: #f4f6fb;
  --sidebar-border: #e9ecf3;
  --sidebar-glow: rgba(37, 64, 227, 0.06);

  /* Softer, cooler elevation for light surfaces */
  --shadow-xs: 0 1px 2px rgba(17, 24, 45, 0.05);
  --shadow-sm: 0 1px 2px rgba(17, 24, 45, 0.04), 0 4px 12px -4px rgba(17, 24, 45, 0.07);
  --shadow: 0 2px 6px -2px rgba(17, 24, 45, 0.07), 0 14px 30px -10px rgba(17, 24, 45, 0.12);
  --shadow-lg: 0 24px 56px -18px rgba(17, 24, 45, 0.22), 0 10px 22px -12px rgba(17, 24, 45, 0.14);
  --scrim: rgba(255, 255, 255, 0.7);
  color-scheme: light;
}

/* Dark theme */
html[data-theme="dark"] {
  --canvas: #070a14;
  --canvas-2: #0a0e1a;
  --surface: #10141f;
  --surface-2: #141926;
  --elevated: #171d2b;
  --sunken: #0c1019;
  --line: #232a3b;
  --line-strong: #313a51;
  --ink: #eef1fa;
  --ink-muted: #9aa2ba;
  --ink-subtle: #6a7a99;
  --brand: var(--brand-400);
  --brand-soft: rgba(92, 130, 251, 0.14);
  --brand-ink: #0a0e1a;
  --ring: rgba(92, 130, 251, 0.5);
  --overlay: rgba(3, 5, 12, 0.66);
  --grid-line: rgba(255, 255, 255, 0.05);
  --sidebar-bg: #080b16;
  --sidebar-fg: #ffffff;
  --sidebar-ink: #c3c9dc;
  --sidebar-ink-dim: #767e99;
  --sidebar-active: rgba(92, 130, 251, 0.16);
  --sidebar-active-fg: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-glow: rgba(92, 130, 251, 0.14);
  --scrim: rgba(8, 11, 22, 0.7);
  --shadow-lg: 0 18px 48px -14px rgba(0, 0, 0, 0.6), 0 6px 16px -8px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul { list-style: none; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; }
::selection { background: var(--brand-400); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-subtle); background-clip: content-box; }

/* ---- Typography helpers -------------------------------------------------- */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-md { font-size: 0.9375rem; }
.text-lg { font-size: 1.0625rem; }
.text-xl { font-size: 1.375rem; }
.text-2xl { font-size: 1.75rem; }
.text-3xl { font-size: 2.25rem; }
.muted { color: var(--ink-muted); }
.subtle { color: var(--ink-subtle); }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }
.eyebrow { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-subtle); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strong { font-weight: 650; }
.center { text-align: center; }

/* ---- Layout primitives --------------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; gap: 18px; grid-template-columns: repeat(4, 1fr); }
.grid-2-1 { display: grid; gap: 20px; grid-template-columns: 2fr 1fr; }
.grid-1-2 { display: grid; gap: 20px; grid-template-columns: 1fr 2fr; }
.grid-3-2 { display: grid; gap: 20px; grid-template-columns: 3fr 2fr; }
@media (max-width: 1100px) { .grid-2-1, .grid-1-2, .grid-3-2, .grid-3 { grid-template-columns: 1fr !important; } }
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-6{margin-top:24px}
.mb-2{margin-bottom:8px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}
.full { width: 100%; }

/* ============================================================================
   App shell
   ========================================================================= */
.app { display: grid; grid-template-columns: var(--sidebar-w, 268px) 1fr; min-height: 100vh; transition: grid-template-columns var(--dur) var(--ease); }
.app.collapsed { --sidebar-w: 76px; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; z-index: 40;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 45% at 0% 0%, var(--sidebar-glow), transparent 60%);
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px 16px; position: relative; }
.brand-logo { height: 58px; width: auto; max-width: 190px; object-fit: contain; }
.brand-mark.brand-mark--mini { display: none; }
.app.collapsed .brand-logo { display: none; }
.app.collapsed .brand-mark.brand-mark--mini { display: grid; }
html[data-theme="dark"] .brand-logo { background: #fff; border-radius: 9px; padding: 6px 9px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #5c82fb, #2540e3 55%, #1e31c9);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 18px -6px rgba(37,64,227,0.7), inset 0 1px 0 rgba(255,255,255,0.3);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { color: var(--sidebar-fg); font-size: 1.02rem; letter-spacing: -0.02em; font-weight: 750; }
.brand-text span { color: var(--sidebar-ink-dim); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.app.collapsed .brand-text, .app.collapsed .nav__label, .app.collapsed .nav-link span, .app.collapsed .sidebar__foot .u-meta { display: none; }
.app.collapsed .sidebar__brand { justify-content: center; padding-inline: 0; }

.sidebar__nav { flex: 1 1 auto; overflow-y: auto; padding: 6px 14px 20px; position: relative; }
.nav__group { margin-top: 18px; }
.nav__label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: var(--sidebar-ink-dim); padding: 0 12px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--sidebar-ink); font-size: 0.875rem; font-weight: 500; position: relative;
  transition: background var(--dur) var(--ease), color var(--dur); margin-bottom: 2px;
}
.nav-link svg { width: 19px; height: 19px; flex: none; opacity: 0.85; }
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-fg); }
.nav-link.active { background: var(--sidebar-active); color: var(--sidebar-active-fg); font-weight: 600; }
.nav-link.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: linear-gradient(var(--brand-400), var(--brand-600));
}
.nav-link.active svg { opacity: 1; color: var(--brand); }
.nav-badge { margin-left: auto; background: var(--accent-500); color: #241500; font-size: 0.68rem; font-weight: 800; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; }
.app.collapsed .nav-link { justify-content: center; }
.app.collapsed .nav-badge { position: absolute; top: 4px; right: 6px; margin: 0; }

.sidebar__foot { padding: 14px; border-top: 1px solid var(--sidebar-border); position: relative; }
.u-card { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; transition: background var(--dur); }
.u-card:hover { background: var(--sidebar-hover); }
.u-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.u-meta b { color: var(--sidebar-fg); font-size: 0.83rem; font-weight: 600; }
.u-meta span { color: var(--sidebar-ink-dim); font-size: 0.72rem; }

/* Main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; background: var(--canvas); }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 66px; display: flex; align-items: center; gap: 16px;
  padding: 0 26px; background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: var(--ink-muted); border: 1px solid transparent; position: relative; transition: all var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 999px; background: var(--danger); border: 2px solid var(--canvas); }

.searchbar {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px 0 14px; min-width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink-subtle);
  transition: all var(--dur) var(--ease); cursor: text;
}
.searchbar:hover { border-color: var(--line-strong); }
.searchbar svg { width: 17px; height: 17px; }
.searchbar .kbd { margin-left: auto; }
.kbd { font-family: var(--font-mono); font-size: 0.68rem; padding: 2px 6px; border-radius: 6px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink-subtle); }

.page-title-wrap { display: flex; flex-direction: column; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 0.75rem; color: var(--ink-subtle); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb svg { width: 13px; height: 13px; }

/* Content */
.content { padding: 26px; max-width: 1600px; width: 100%; margin: 0 auto; animation: fadeUp 0.4s var(--ease); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.7rem; font-weight: 720; letter-spacing: -0.025em; }
.page-head p { color: var(--ink-muted); font-size: 0.9rem; margin-top: 4px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 var(--ring); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   Cards & surfaces
   ========================================================================= */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); position: relative; transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur) var(--ease);
}
.pad, .card.pad { padding: 22px; }
.card.hover:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.project-hero__head { padding: 22px 24px 20px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card__head h3 { font-size: 1rem; font-weight: 640; }
.card__head p { font-size: 0.8rem; color: var(--ink-muted); margin-top: 2px; }
.card__body { padding: 22px; }
.card__foot { padding: 14px 22px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; font-weight: 640; margin-bottom: 2px; }

.glass {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(16px) saturate(160%); border: 1px solid var(--line);
}

/* ============================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px; font-size: 0.86rem; font-weight: 600;
  border: 1px solid transparent; transition: all var(--dur) var(--ease); white-space: nowrap; user-select: none;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 12px 34px -8px rgba(37,64,227,0.6); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-subtle { background: var(--sunken); color: var(--ink-muted); }
.btn-subtle:hover { color: var(--ink); background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger-soft { background: color-mix(in srgb, var(--danger) 11%, transparent); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; border-color: var(--danger);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--danger) 65%, transparent); }
.btn-danger-soft svg { color: currentColor; }

/* Danger zone — destructive action card (e.g. delete a client approval) */
.danger-card { border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 5%, var(--surface)), var(--surface));
  overflow: hidden; }
.danger-card__body { display: flex; align-items: center; gap: 18px; padding: 20px 22px; flex-wrap: wrap; }
.danger-card__icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(180deg, #f26b68, var(--danger));
  box-shadow: 0 8px 18px -7px color-mix(in srgb, var(--danger) 60%, transparent); }
.danger-card__icon svg { width: 22px; height: 22px; }
.danger-card__text { min-width: 220px; flex: 1 1 340px; }
.danger-card__eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--danger); margin-bottom: 5px; }
.danger-card__eyebrow svg { width: 13px; height: 13px; }
.danger-card__text b { display: block; font-size: 1.02rem; color: var(--ink); letter-spacing: -0.01em; }
.danger-card__text p { margin: 4px 0 0; color: var(--ink-muted); font-size: 0.86rem; line-height: 1.55; }
.danger-card__text .mono { color: var(--ink); font-weight: 600; }
.danger-card__action { flex: none; margin-left: auto; }
@media (max-width: 620px) {
  .danger-card__action { margin-left: 0; width: 100%; }
  .danger-card__action .btn { width: 100%; }
}
.btn-accent { background: linear-gradient(180deg, var(--accent-400), var(--accent-600)); color: #2a1900; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.8rem; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 0.94rem; }
.btn-icon { width: 40px; padding: 0; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-block { width: 100%; }

/* ============================================================================
   Badges, chips, pills, tones
   ========================================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge .tdot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.tone-brand { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); border-color: color-mix(in srgb, var(--brand) 24%, transparent); }
.tone-success { color: #0f9b0f; background: color-mix(in srgb, var(--success) 13%, transparent); border-color: color-mix(in srgb, var(--success) 26%, transparent); }
.tone-warning { color: #b9770a; background: color-mix(in srgb, var(--warning) 15%, transparent); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.tone-serious { color: #cf6234; background: color-mix(in srgb, var(--serious) 15%, transparent); border-color: color-mix(in srgb, var(--serious) 30%, transparent); }
.tone-danger { color: #d63a38; background: color-mix(in srgb, var(--danger) 13%, transparent); border-color: color-mix(in srgb, var(--danger) 26%, transparent); }
.tone-info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); border-color: color-mix(in srgb, var(--info) 24%, transparent); }
.tone-neutral { color: var(--ink-muted); background: var(--sunken); border-color: var(--line); }
html[data-theme="dark"] .tone-success { color: #34d334; }
html[data-theme="dark"] .tone-warning { color: #fbbf3f; }
html[data-theme="dark"] .tone-serious { color: #f5a27a; }
html[data-theme="dark"] .tone-danger { color: #ff6b69; }

.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 550; color: var(--ink-muted); background: var(--surface);
  border: 1px solid var(--line); transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--shadow-brand); }
.chip svg { width: 15px; height: 15px; }

/* ============================================================================
   Avatars
   ========================================================================= */
.avatar {
  --sz: 38px; width: var(--sz); height: var(--sz); border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: calc(var(--sz) * 0.4);
  letter-spacing: 0.01em; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16); overflow: hidden;
}
.avatar.sm { --sz: 30px; } .avatar.lg { --sz: 48px; } .avatar.xl { --sz: 64px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px rgba(255,255,255,0.16); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-more { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--sunken); color: var(--ink-muted); font-size: 0.72rem; font-weight: 700; margin-left: -10px; box-shadow: 0 0 0 2px var(--surface); }

/* ============================================================================
   KPI / stat tiles
   ========================================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--kpi-accent, var(--brand)) 16%, transparent), transparent 70%); }
.kpi__icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--kpi-accent, var(--brand)); background: color-mix(in srgb, var(--kpi-accent, var(--brand)) 14%, transparent); margin-bottom: 14px; }
.kpi__icon svg { width: 21px; height: 21px; }
.kpi__label { font-size: 0.78rem; color: var(--ink-muted); font-weight: 550; }
.kpi__value { font-size: 1.9rem; font-weight: 740; letter-spacing: -0.03em; margin-top: 4px; line-height: 1; }
.kpi__value .unit { font-size: 0.95rem; color: var(--ink-subtle); font-weight: 600; margin-left: 3px; }
.kpi__foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.78rem; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; padding: 2px 7px; border-radius: 999px; font-size: 0.72rem; }
.delta svg { width: 13px; height: 13px; }
.delta.up { color: #0f9b0f; background: color-mix(in srgb, var(--success) 13%, transparent); }
.delta.down { color: #d63a38; background: color-mix(in srgb, var(--danger) 13%, transparent); }
html[data-theme="dark"] .delta.up { color: #34d334; }
html[data-theme="dark"] .delta.down { color: #ff6b69; }

/* Stat strip (project detail hero) */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.kpi-stat { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-right: 1px solid var(--line); }
.kpi-stat:last-child { border-right: none; }
.kpi-stat b { font-weight: 640; }
@media (max-width: 900px) { .kpi-strip { grid-template-columns: repeat(2, 1fr); } .kpi-stat:nth-child(2) { border-right: none; } }

/* Project cards */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.project-card { overflow: hidden; }
.project-card__body { display: flex; flex-direction: column; gap: 15px; padding: 20px; height: 100%; }
.proj-ic { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent); }
.proj-ic svg { width: 21px; height: 21px; }
.project-card__foot { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }

/* Client-approval review console (PMTS-style) */
.review-console { overflow: hidden; }
.review-console__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px; background: linear-gradient(120deg, #4a3aa7 0%, #6d5ef0 58%, #7c5cff 100%); flex-wrap: wrap; }
.review-console__head h3 { font-size: 1.18rem; color: #fff; }
.review-console__head p { font-size: 0.86rem; margin-top: 2px; }
.review-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 13px; margin-bottom: 12px; flex-wrap: wrap; transition: box-shadow var(--dur) var(--ease); }
.review-card:hover { box-shadow: var(--shadow-sm); }
.review-card:last-child { margin-bottom: 0; }
.review-card.done { border-left-color: var(--success); background: var(--surface); }
.review-console__done { padding: 20px 24px 24px; border-top: 1px solid var(--line); background: var(--surface-2); }
.review-console__actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }

/* Client-approval checklist slots */
.slot-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); margin: 0; }
.slot-row:last-child { border-bottom: none; }
.slot-flag { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.slot-flag svg { width: 15px; height: 15px; }
.slot-flag.done { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.slot-flag.missing { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.slot-label { font-size: 0.88rem; font-weight: 550; }

/* Chart of Accounts */
table.data.coa td { padding-top: 9px; padding-bottom: 9px; }
table.data.coa tr.coa-d0 td { background: var(--sunken); border-top: 2px solid var(--line-strong); font-size: 0.9rem; }
table.data.coa tr.coa-d1 td { background: var(--surface-2); }

/* Project checklist (client assignment) */
.proj-checklist { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; padding: 6px; background: var(--surface); }
.proj-check { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 0.86rem; }
.proj-check:hover { background: var(--surface-2); }
.proj-check input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }

/* RBAC matrix */
.role-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.role-ic svg { width: 16px; height: 16px; }
input.perm { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }
table.data.matrix thead th { text-align: center; }
table.data.matrix thead th:first-child { text-align: left; }
table.data.matrix td, table.data.matrix th { padding-top: 11px; padding-bottom: 11px; }

/* Profile header */
.profile-card { overflow: hidden; }
.profile-cover { position: relative; height: 120px; background: linear-gradient(115deg, #1e31c9 0%, #2f54eb 52%, #4361ee 100%); }
.profile-cover::before { content: ""; position: absolute; inset: 0; background: radial-gradient(130% 150% at 10% 0%, rgba(255,255,255,0.22), transparent 52%); }
.profile-cover::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px); background-size: 34px 34px; -webkit-mask-image: linear-gradient(105deg, #000, transparent 72%); mask-image: linear-gradient(105deg, #000, transparent 72%); }
.profile-actions { position: absolute; top: 16px; right: 18px; z-index: 2; }
.profile-head { display: flex; align-items: flex-end; gap: 20px; padding: 0 26px 22px; margin-top: -46px; position: relative; }
.profile-head .grow { padding-bottom: 6px; }
.profile-avatar { --sz: 94px; font-size: 1.9rem; box-shadow: 0 0 0 5px var(--surface), 0 10px 24px -10px rgba(17,24,45,0.4); }
@media (max-width: 640px) { .profile-head { flex-direction: column; align-items: flex-start; gap: 12px; } .profile-actions { top: 14px; right: 14px; } }

/* ============================================================================
   Progress bars & rings
   ========================================================================= */
.progress { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; position: relative; }
.progress__bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); transition: width 0.7s var(--ease); }
.progress.thin { height: 6px; }
.progress__bar.success { background: linear-gradient(90deg, #22c55e, var(--success)); }
.progress__bar.warning { background: linear-gradient(90deg, #fbbf24, var(--warning)); }
.progress__bar.danger { background: linear-gradient(90deg, #f87171, var(--danger)); }
.progress__bar.accent { background: linear-gradient(90deg, var(--accent-400), var(--accent-600)); }

.ring { --p: 0; --sz: 68px; --tw: 7px; width: var(--sz); height: var(--sz); border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ring-color, var(--brand)) calc(var(--p) * 1%), var(--sunken) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: var(--tw); border-radius: 50%; background: var(--surface); }
.ring__val { position: relative; font-weight: 720; font-size: calc(var(--sz) * 0.24); letter-spacing: -0.02em; }
.ring__val small { font-size: 0.6em; color: var(--ink-subtle); }

/* ============================================================================
   Tables
   ========================================================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.data thead th {
  text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-subtle); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
table.data tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: background var(--dur); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-primary { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 0.76rem; color: var(--ink-subtle); }

/* ============================================================================
   Forms
   ========================================================================= */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--ink-muted); }
.input, .select, textarea.input {
  height: 44px; padding: 0 14px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: 0.9rem; width: 100%; transition: border-color var(--dur), box-shadow var(--dur);
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 90px; line-height: 1.5; }
.input::placeholder { color: var(--ink-subtle); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a91a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group svg.lead { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--ink-subtle); pointer-events: none; }
.input-group .input { padding-left: 42px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid .col-span-2 { grid-column: 1 / -1; }
.hint { font-size: 0.74rem; color: var(--ink-subtle); }
.switch { --w: 44px; --h: 25px; width: var(--w); height: var(--h); border-radius: 999px; background: var(--line-strong); position: relative; transition: background var(--dur); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: calc(var(--h) - 6px); height: calc(var(--h) - 6px); border-radius: 50%; background: #fff; transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-sm); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(calc(var(--w) - var(--h))); }

/* ============================================================================
   Tabs
   ========================================================================= */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 12px 16px; font-size: 0.86rem; font-weight: 550; color: var(--ink-muted); position: relative; white-space: nowrap; transition: color var(--dur); display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); font-weight: 650; }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.tab .count { font-size: 0.7rem; background: var(--sunken); padding: 1px 7px; border-radius: 999px; color: var(--ink-subtle); }

/* ============================================================================
   Timeline / workflow / activity
   ========================================================================= */
.timeline { position: relative; padding-left: 8px; }
.tl-item { position: relative; padding: 0 0 22px 34px; }
.tl-item::before { content: ""; position: absolute; left: 12px; top: 22px; bottom: -4px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 3px; top: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-subtle); z-index: 1; }
.tl-dot svg { width: 11px; height: 11px; }
.tl-dot.success { border-color: var(--success); color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.tl-dot.danger { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.tl-dot.brand { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.tl-dot.warning { border-color: var(--warning); color: var(--warning); }
.tl-body b { font-size: 0.87rem; font-weight: 600; }
.tl-body p { font-size: 0.82rem; color: var(--ink-muted); margin-top: 2px; }
.tl-time { font-size: 0.72rem; color: var(--ink-subtle); margin-top: 3px; }

/* Approval chain (horizontal stepper) */
.chain { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 0; }
.chain__step { flex: 1 1 0; min-width: 128px; position: relative; padding: 0 6px; text-align: center; }
.chain__node { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-subtle); position: relative; z-index: 2; transition: all var(--dur) var(--ease); }
.chain__node svg { width: 18px; height: 18px; }
.chain__step::before { content: ""; position: absolute; top: 20px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 1; }
.chain__step:first-child::before { display: none; }
.chain__step.done .chain__node { background: var(--success); border-color: var(--success); color: #fff; }
.chain__step.done::before { background: var(--success); }
.chain__step.current .chain__node { background: var(--brand); border-color: var(--brand); color: #fff; animation: pulseRing 2s infinite; }
.chain__step.rejected .chain__node { background: var(--danger); border-color: var(--danger); color: #fff; }
.chain__role { font-size: 0.76rem; font-weight: 600; }
.chain__who { font-size: 0.7rem; color: var(--ink-subtle); margin-top: 2px; }

/* ============================================================================
   Kanban
   ========================================================================= */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban__col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: 640px; }
.kanban__head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.82rem; font-weight: 650; }
.kanban__head .count { margin-left: auto; background: var(--sunken); color: var(--ink-muted); font-size: 0.7rem; padding: 1px 9px; border-radius: 999px; font-weight: 700; }
.kanban__head .kdot { width: 8px; height: 8px; border-radius: 999px; }
.kanban__list { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow-xs); transition: all var(--dur) var(--ease); cursor: pointer; }
.kcard:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }

/* ============================================================================
   Dropdown / menu / popover
   ========================================================================= */
.pop { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--elevated);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 7px; z-index: 60;
  animation: scaleIn 0.16s var(--ease); transform-origin: top right;
}
.menu.left { right: auto; left: 0; transform-origin: top left; }
.menu-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; font-size: 0.85rem; color: var(--ink); width: 100%; text-align: left; transition: background var(--dur); }
.menu-item:hover { background: var(--surface-2); }
.menu-item svg { width: 17px; height: 17px; color: var(--ink-subtle); }
.menu-item.danger { color: var(--danger); } .menu-item.danger svg { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-subtle); padding: 8px 11px 5px; font-weight: 700; }
[hidden] { display: none !important; }

/* ============================================================================
   Modal
   ========================================================================= */
.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); z-index: 90; display: grid; place-items: center; padding: 24px; animation: fadeIn 0.2s; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; animation: scaleIn 0.22s var(--ease); }
.modal.wide { max-width: 820px; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 1.15rem; font-weight: 680; }
.modal__body { padding: 22px 24px; overflow-y: auto; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* Confirmation dialog */
.confirm-card { max-width: 428px; text-align: center; padding: 34px 30px 26px; }
.confirm-card__icon { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; background: var(--brand-soft); color: var(--brand); }
.confirm-card__icon svg { width: 28px; height: 28px; }
.confirm-card__icon.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.confirm-card__icon.success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.confirm-card__icon.warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.confirm-card h3 { font-size: 1.22rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.confirm-card p { font-size: 0.9rem; line-height: 1.55; margin-bottom: 24px; max-width: 340px; margin-left: auto; margin-right: auto; }
.confirm-card__actions { display: flex; gap: 10px; }
.confirm-card__actions .btn { flex: 1; height: 44px; }

/* ============================================================================
   Command palette
   ========================================================================= */
.cmdk-backdrop { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(6px); z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fadeIn 0.15s; }
.cmdk { width: 100%; max-width: 620px; background: var(--elevated); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: scaleIn 0.18s var(--ease); }
.cmdk__input { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.cmdk__input svg { width: 20px; height: 20px; color: var(--ink-subtle); }
.cmdk__input input { border: none; background: none; outline: none; font-size: 1.02rem; width: 100%; }
.cmdk__list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk__group-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-subtle); padding: 10px 12px 6px; font-weight: 700; }
.cmdk__item { display: flex; align-items: center; gap: 13px; padding: 11px 12px; border-radius: 11px; cursor: pointer; font-size: 0.9rem; }
.cmdk__item .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--sunken); display: grid; place-items: center; color: var(--ink-muted); flex: none; }
.cmdk__item .ic svg { width: 17px; height: 17px; }
.cmdk__item small { color: var(--ink-subtle); font-size: 0.75rem; }
.cmdk__item.active { background: var(--brand-soft); }
.cmdk__item.active .ic { background: var(--brand); color: #fff; }
.cmdk__foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 16px; font-size: 0.72rem; color: var(--ink-subtle); }

/* ============================================================================
   Toast
   ========================================================================= */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--elevated); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 300px; animation: slideInRight 0.3s var(--ease); }
.toast.success { border-left-color: var(--success); } .toast.danger { border-left-color: var(--danger); } .toast.warning { border-left-color: var(--warning); }
.toast svg { width: 19px; height: 19px; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* Django messages */
.messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.alert { display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-radius: 12px; font-size: 0.86rem; border: 1px solid; }
.alert svg { width: 18px; height: 18px; flex: none; }
.alert.success { background: color-mix(in srgb, var(--success) 10%, var(--surface)); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: #0f9b0f; }
.alert.error, .alert.danger { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: #d63a38; }
.alert.warning { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: #b9770a; }
.alert.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 24%, transparent); color: var(--brand); }

/* ============================================================================
   Misc: dividers, empty states, tooltips, skeleton
   ========================================================================= */
.divider { height: 1px; background: var(--line); border: none; }
.vr { width: 1px; align-self: stretch; background: var(--line); }
.empty { text-align: center; padding: 56px 24px; }
.empty__icon { width: 60px; height: 60px; border-radius: 18px; background: var(--sunken); display: grid; place-items: center; margin: 0 auto 16px; color: var(--ink-subtle); }
.empty h3 { font-size: 1.05rem; margin-bottom: 6px; }
.empty p { color: var(--ink-muted); font-size: 0.88rem; max-width: 380px; margin: 0 auto 18px; }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 16px; font-size: 0.87rem; }
.dl dt { color: var(--ink-subtle); padding: 8px 0; }
.dl dd { color: var(--ink); font-weight: 550; padding: 8px 0; border-bottom: 1px solid var(--line); }

.meter-legend { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--ink-muted); }
.meter-legend .sw { width: 11px; height: 11px; border-radius: 3px; }

.stat-line { display: flex; align-items: baseline; gap: 8px; }
.stat-line b { font-size: 1.5rem; font-weight: 720; letter-spacing: -0.02em; }

/* ============================================================================
   Auth / login
   ========================================================================= */
.auth { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: 100vh; background: var(--canvas); }
.auth__showcase { position: relative; overflow: hidden; background: linear-gradient(158deg, #1a256b 0%, #16205e 42%, #0f1642 100%); display: flex; padding: 46px; color: #e8ecfb; }
.auth__aurora { position: absolute; inset: -20%; background:
    radial-gradient(42% 42% at 22% 24%, rgba(92,130,251,0.42), transparent 62%),
    radial-gradient(38% 38% at 84% 16%, rgba(245,153,11,0.24), transparent 60%),
    radial-gradient(50% 50% at 76% 84%, rgba(30,49,201,0.5), transparent 62%),
    radial-gradient(40% 40% at 40% 100%, rgba(124,92,255,0.28), transparent 60%);
  filter: blur(6px); animation: auroraPan 16s ease-in-out infinite alternate; }
@keyframes auroraPan { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(-3%, 2%) scale(1.08); } }
.auth__grid-overlay { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 78%); }
.auth__showcase-inner { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 30px; width: 100%; max-width: 540px; margin: auto; }
.auth__showcase-inner .brand-text b { color: #fff; }
.auth__showcase-inner .brand-text span { color: rgba(232,236,251,0.6); }

.auth__eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 0.74rem; font-weight: 600; color: rgba(232,236,251,0.82); text-transform: uppercase; letter-spacing: 0.09em; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); padding: 7px 14px; border-radius: 999px; width: fit-content; }
.pulse-dot { width: 8px; height: 8px; border-radius: 999px; background: #37f0a0; box-shadow: 0 0 0 0 rgba(55,240,160,0.6); animation: pulseDot 2s infinite; }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(55,240,160,0.55); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.auth__hero h1 { font-size: 2.65rem; font-weight: 760; letter-spacing: -0.035em; line-height: 1.08; margin-top: 16px; color: #fff; }
.auth__hero .grad { background: linear-gradient(100deg, #8faeff, #5c82fb 40%, #fbb824); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__hero p { color: rgba(232,236,251,0.72); font-size: 1rem; margin-top: 18px; max-width: 460px; line-height: 1.6; }

.auth__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.auth__mcard { background: rgba(255,255,255,0.055); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 16px; backdrop-filter: blur(8px); animation: fadeUp 0.7s var(--ease) both; }
.mc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.mc-ic svg { width: 17px; height: 17px; }
.mc-val { font-size: 1.7rem; font-weight: 760; letter-spacing: -0.03em; color: #fff; line-height: 1; }
.mc-val span { font-size: 0.95rem; color: rgba(232,236,251,0.6); margin-left: 2px; }
.mc-lab { font-size: 0.72rem; color: rgba(232,236,251,0.62); margin-top: 7px; line-height: 1.3; }

.auth__trust { margin-top: 4px; }
.auth__trust > span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(232,236,251,0.45); }
.auth__trust-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 12px; }
.auth__trust-row span { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: rgba(232,236,251,0.8); }
.auth__trust-row svg { width: 16px; height: 16px; color: #8faeff; }

.auth__panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth__form { width: 100%; max-width: 400px; animation: fadeUp 0.6s var(--ease); }
.auth-logo { height: 92px; width: auto; object-fit: contain; margin-bottom: 26px; }
.auth__demo { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.auth__foot { margin-top: 26px; font-size: 0.72rem; color: var(--ink-subtle); text-align: center; }

@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .auth__showcase { display: none; }
  .auth .hide-desktop { display: flex !important; }
}

/* Responsive */
.hide-desktop { display: none !important; }
@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .grid-3, .grid-2 { grid-template-columns: 1fr !important; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 0 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 268px; transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .content { padding: 18px; }
  .form-grid, .dl { grid-template-columns: 1fr; }
  .searchbar { min-width: 0; }
  .hide-mobile { display: none !important; }
  .hide-desktop { display: inline-flex !important; }
  .page-head { gap: 12px; }
}
