/* ==========================================================================
   FINEX BABYLON — Practice Manager
   Admin design system · navy + gold · light & dark themes
   ========================================================================== */

:root {
  --navy-950: #081326;
  --navy-900: #0c1a33;
  --navy-800: #122952;
  --navy: #1b3a6b;
  --navy-600: #2a4f8f;
  --gold: #c4860a;
  --gold-600: #a86f06;
  --gold-soft: rgba(196, 134, 10, .12);

  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef2f8;
  --border: #e2e8f1;
  --border-strong: #cdd6e4;
  --text: #0f1f3d;
  --text-2: #3d546e;
  --muted: #7a8aa3;
  --focus: rgba(27, 58, 107, .18);

  --green: #15803d;  --green-bg: #e6f5ec;
  --red: #b91c1c;    --red-bg: #fdecec;
  --amber: #b45309;  --amber-bg: #fff3df;
  --blue: #1d4ed8;   --blue-bg: #e8effd;
  --purple: #6d28d9; --purple-bg: #f1eafe;
  --cyan: #0e7490;   --cyan-bg: #e2f4f7;
  --gray: #475569;   --gray-bg: #eef1f5;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Poppins', 'Inter', system-ui, sans-serif;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 61, .06);
  --shadow: 0 4px 16px rgba(15, 31, 61, .08);
  --shadow-lg: 0 18px 48px rgba(15, 31, 61, .18);
  --sidebar-w: 256px;
  --topbar-h: 62px;
  --t: .18s ease;
}

[data-theme="dark"] {
  --bg: #0a1120;
  --surface: #101a2d;
  --surface-2: #0d1627;
  --surface-3: #16223a;
  --border: #1d2a42;
  --border-strong: #2a3a58;
  --text: #e7edf6;
  --text-2: #b0bdd0;
  --muted: #7d8ca5;
  --focus: rgba(196, 134, 10, .25);
  --green-bg: rgba(34, 197, 94, .14);  --green: #4ade80;
  --red-bg: rgba(248, 113, 113, .14);  --red: #f87171;
  --amber-bg: rgba(251, 191, 36, .14); --amber: #fbbf24;
  --blue-bg: rgba(96, 165, 250, .14);  --blue: #93b4fb;
  --purple-bg: rgba(167, 139, 250, .16); --purple: #c4b5fd;
  --cyan-bg: rgba(34, 211, 238, .14);  --cyan: #67e8f9;
  --gray-bg: rgba(148, 163, 184, .14); --gray: #aab6c8;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--navy-600); text-decoration: none; }
[data-theme="dark"] a { color: #9db8ec; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { font-family: var(--font-head); color: var(--text); margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 600; }
h4 { font-size: .92rem; font-weight: 600; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }
kbd { background: var(--surface-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--text-2); }
.icon { flex-shrink: 0; vertical-align: middle; }
[hidden] { display: none !important; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 60;
  background: linear-gradient(180deg, #102650 0%, #0b1a36 100%); color: rgba(255,255,255,.72);
  display: flex; flex-direction: column; transition: width var(--t), transform var(--t);
  border-right: 1px solid rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--topbar-h); text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(196,134,10,.55); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; }
.brand-name { font-family: var(--font-head); font-weight: 800; font-size: 1rem; letter-spacing: .05em; color: #fff; }
.brand-name em { color: var(--gold); font-style: normal; }
.brand-sub { font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.45); margin-top: 3px; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section { font-size: .62rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 16px 12px 6px; white-space: nowrap; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; margin: 1px 0; border-radius: 8px;
  color: rgba(255,255,255,.72); font-weight: 500; font-size: .86rem; text-decoration: none; white-space: nowrap; position: relative;
  transition: background var(--t), color var(--t);
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(196,134,10,.16); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav a.active .icon { color: var(--gold); }
.nav-badge { margin-left: auto; background: rgba(255,255,255,.12); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center; }
.nav-badge.alert { background: #dc2626; }
.nav-badge.gold { background: var(--gold); }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: #fff; text-decoration: none !important; }
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.sidebar-user small { display: block; color: rgba(255,255,255,.5); font-size: .72rem; }
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.sidebar-collapsed .sidebar { width: 72px; }
body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-section, body.sidebar-collapsed .nav a span, body.sidebar-collapsed .nav-badge, body.sidebar-collapsed .sidebar-user div { display: none; }
body.sidebar-collapsed .nav a { justify-content: center; padding: 10px; }
body.sidebar-collapsed .main { margin-left: 72px; }
body.sidebar-collapsed .brand { justify-content: center; padding: 12px; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left var(--t); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; width: min(440px, 45vw); height: 38px; padding: 0 12px;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; color: var(--muted);
  font: inherit; cursor: pointer; transition: border-color var(--t);
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-left: auto; }
.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; position: relative; transition: background var(--t);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 10px; background: #dc2626; color: #fff; font-size: .62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* Timer widget */
.timer-pill { display: none; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; border-radius: 20px; background: var(--green-bg); color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; font-size: .85rem; }
.timer-pill.running { display: inline-flex; }
.timer-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
.timer-pill button { border: 0; background: var(--green); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Page header ───────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .subtitle { color: var(--muted); margin: 4px 0 0; font-size: .88rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 .85rem var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), transform var(--t);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-primary:hover { background: var(--gold-600); border-color: var(--gold-600); box-shadow: 0 4px 14px rgba(196,134,10,.3); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-800); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--red); }
.btn-success { background: #15803d; border-color: #15803d; color: #fff; }
.btn-success:hover { background: #116932; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { background: var(--gold-soft); border-color: transparent; color: var(--gold-600); }
[data-theme="dark"] .btn-soft { color: #f0b545; }
.btn-sm { height: 31px; padding: 0 11px; font-size: .79rem; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: .74rem; border-radius: 7px; gap: 5px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 31px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }
.btn-group .btn.active { background: var(--navy); border-color: var(--navy); color: #fff; z-index: 1; }
.link-btn { background: none; border: 0; padding: 0; color: var(--navy-600); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-danger { color: var(--red) !important; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card { margin-top: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h3, .card-title { margin: 0; font-size: .95rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header .icon { color: var(--muted); }
.card-body { padding: 18px; }
.card-body.p0 { padding: 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-muted { background: var(--surface-2); }
.card-accent { border-top: 3px solid var(--gold); }

/* ── Grids & utilities ─────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-main-wide { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.stack > * + * { margin-top: 20px; }
.stack-sm > * + * { margin-top: 10px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-1 { flex: 1; min-width: 0; }
.gap-sm { gap: 6px; } .gap-lg { gap: 18px; }
.text-muted { color: var(--muted) !important; }
.text-2 { color: var(--text-2); }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-sm { font-size: .82rem; } .text-xs { font-size: .74rem; } .text-lg { font-size: 1.05rem; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.text-green { color: var(--green) !important; } .text-red { color: var(--red) !important; } .text-amber { color: var(--amber) !important; } .text-gold { color: var(--gold) !important; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; letter-spacing: .02em; }
.tabular { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.w-100 { width: 100%; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }

/* ── KPI tiles ─────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); text-decoration: none !important; color: inherit; transition: border-color var(--t), transform var(--t); }
a.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--gold-soft); color: var(--gold); }
.kpi-icon.navy { background: rgba(27,58,107,.1); color: var(--navy); }
[data-theme="dark"] .kpi-icon.navy { background: rgba(147,180,251,.12); color: #93b4fb; }
.kpi-icon.green { background: var(--green-bg); color: var(--green); }
.kpi-icon.red { background: var(--red-bg); color: var(--red); }
.kpi-icon.purple { background: var(--purple-bg); color: var(--purple); }
.kpi-icon.blue { background: var(--blue-bg); color: var(--blue); }
.kpi-label { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-value { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.kpi-meta .up { color: var(--green); font-weight: 600; } .kpi-meta .down { color: var(--red); font-weight: 600; }

/* ── Badges, chips, avatars ────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 20px; font-size: .7rem; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-cyan { background: var(--cyan-bg); color: var(--cyan); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.badge-navy { background: rgba(27,58,107,.1); color: var(--navy); }
[data-theme="dark"] .badge-navy { background: rgba(147,180,251,.14); color: #a9c1f5; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; background: var(--surface-3); font-size: .75rem; color: var(--text-2); border: 1px solid var(--border); }
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.avatar { --av: #1b3a6b; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--av); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .02em; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: .6rem; }
.avatar.lg { width: 48px; height: 48px; font-size: .95rem; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.entity-avatar { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--surface-3); color: var(--navy); flex-shrink: 0; }
[data-theme="dark"] .entity-avatar { color: #a9c1f5; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th { text-align: left; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr[data-href] { cursor: pointer; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.table-compact td, .table-compact th { padding: 7px 12px; }
.table .row-title { font-weight: 600; color: var(--text); }
.table .row-sub { font-size: .76rem; color: var(--muted); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }
.sort-link { color: inherit !important; text-decoration: none !important; }
.sort-link.active { color: var(--text) !important; }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 16px 18px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field label, .label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--red); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date], .field input[type=time], .field input[type=datetime-local], .field input[type=tel], .field input[type=url], .field input[type=search], .field input[type=month], .field select, .field textarea, select.input, textarea.input {
  width: 100%; height: 39px; padding: 0 12px; font: 400 .88rem var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.field textarea, textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field select, select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8aa3' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.field select[multiple] { height: auto; padding: 6px; background-image: none; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--focus); }
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--muted); opacity: .8; }
.field input[readonly] { background: var(--surface-2); }
.is-invalid, .field .is-invalid { border-color: var(--red) !important; }
.field-error { color: var(--red); font-size: .76rem; margin-top: 5px; font-weight: 500; }
.field-hint { color: var(--muted); font-size: .75rem; margin-top: 5px; }
.field-hint.ok { color: var(--green); }
.field-hint.bad { color: var(--red); }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: flex; align-items: center; padding: 0 11px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--muted); font-weight: 600; font-size: .85rem; }
.input-group .addon:first-child { border-right: 0; border-radius: 9px 0 0 9px; }
.input-group .addon:last-child { border-left: 0; border-radius: 0 9px 9px 0; }
.input-group input { border-radius: 0 9px 9px 0 !important; }
.input-group input:not(:last-child) { border-radius: 9px 0 0 9px !important; }
.input-sm { height: 32px !important; font-size: .82rem !important; }
.form-section { font-family: var(--font-head); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); grid-column: span 12; margin-top: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border-strong); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 6px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text); font-size: .86rem; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 20px; background: var(--border-strong); position: relative; transition: background var(--t); flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--t); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--focus); }
.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.radio-card { position: relative; border: 1.5px solid var(--border-strong); border-radius: 10px; padding: 11px 13px; cursor: pointer; transition: border-color var(--t), background var(--t); }
.radio-card input { position: absolute; opacity: 0; }
.radio-card strong { display: block; font-size: .85rem; }
.radio-card small { color: var(--muted); font-size: .74rem; }
.radio-card:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }

/* Combobox (searchable select) */
.combo { position: relative; }
.combo-input { cursor: text; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; display: none; }
.combo.open .combo-list { display: block; }
.combo-opt { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: .86rem; }
.combo-opt small { display: block; color: var(--muted); font-size: .74rem; }
.combo-opt.active, .combo-opt:hover { background: var(--surface-3); }
.combo-empty { padding: 10px; color: var(--muted); font-size: .84rem; }

/* ── Toolbar / filters ─────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input, .toolbar select, .toolbar input { height: 34px; font-size: .83rem; width: auto; }
.toolbar .search-input { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search-input .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search-input input { width: 100%; padding-left: 32px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 5px 11px; border-radius: 7px; font-size: .79rem; font-weight: 600; color: var(--text-2); text-decoration: none !important; white-space: nowrap; }
.seg a:hover { color: var(--text); }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg a .count { color: var(--muted); font-weight: 500; margin-left: 3px; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font: 600 .85rem var(--font); color: var(--muted); text-decoration: none !important; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--gold); }
.tabs .count { background: var(--surface-3); color: var(--text-2); border-radius: 20px; padding: 0 7px; font-size: .7rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Dropdowns ─────────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 80; display: none; }
.dropdown.open > .dropdown-menu { display: block; animation: pop .14s ease; }
.dropdown-menu.left { left: 0; right: auto; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); font: 500 .85rem var(--font); background: none; border: 0; text-align: left; cursor: pointer; text-decoration: none !important; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu .icon { color: var(--muted); }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-menu .menu-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 10px 4px; }
.dropdown-menu .danger { color: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* Notifications panel */
.notif-menu { width: 370px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text) !important; text-decoration: none !important; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: color-mix(in srgb, var(--gold) 6%, var(--surface)); }
.notif-item .ni-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--navy-600); flex-shrink: 0; }
.notif-item strong { display: block; font-size: .84rem; font-weight: 600; }
.notif-item small { color: var(--muted); font-size: .75rem; }
.notif-foot { padding: 10px; text-align: center; font-size: .82rem; }

/* ── Modals ────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(8, 19, 38, .55); backdrop-filter: blur(2px); display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal-backdrop.open { display: flex; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; border: 1px solid var(--border); animation: pop .18s ease; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Command palette */
.palette { max-width: 640px; padding: 0; overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; border: 0; outline: none; background: none; font: 500 1rem var(--font); color: var(--text); }
.palette-results { max-height: 420px; overflow-y: auto; padding: 6px; }
.palette-group { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 10px 12px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--text) !important; text-decoration: none !important; cursor: pointer; }
.palette-item .pi-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; }
.palette-item strong { display: block; font-size: .87rem; font-weight: 600; }
.palette-item small { color: var(--muted); font-size: .75rem; }
.palette-item.active { background: var(--gold-soft); }
.palette-item.active .pi-icon { background: var(--gold); color: #fff; }
.palette-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: .72rem; color: var(--muted); background: var(--surface-2); }

/* ── Toasts ────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slidein .25s ease; font-size: .86rem; border-left: 4px solid var(--navy); }
.toast.success { border-left-color: #16a34a; } .toast.success .icon { color: #16a34a; }
.toast.error { border-left-color: #dc2626; } .toast.error .icon { color: #dc2626; }
.toast.warning { border-left-color: #d97706; } .toast.warning .icon { color: #d97706; }
.toast.info .icon { color: var(--navy-600); }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.toast.hide { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: .86rem; border: 1px solid transparent; margin-bottom: 16px; }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 20%, transparent); }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 22%, transparent); }
.alert-danger { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.alert-success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 20%, transparent); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ── Definition lists ──────────────────────────────────────────────────── */
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 9px 14px; font-size: .86rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; color: var(--text); font-weight: 500; word-break: break-word; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: .86rem; }
.stat-row:last-child { border-bottom: 0; }
.stat-row strong { font-variant-numeric: tabular-nums; }

/* ── Profile header (client / matter) ──────────────────────────────────── */
.hero-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 20px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.hero-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--navy), var(--gold)); }
.hero-card h1 { font-size: 1.3rem; margin: 0 0 4px; }
.hero-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--text-2); font-size: .84rem; align-items: center; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { color: var(--muted); }
.hero-stats { display: flex; gap: 26px; margin-left: auto; flex-wrap: wrap; }
.hero-stats div { text-align: right; }
.hero-stats small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.hero-stats strong { font-family: var(--font-head); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ── Timeline / activity ───────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--navy-600); }
.tl-item.gold::before { border-color: var(--gold); background: var(--gold); }
.tl-item.green::before { border-color: var(--green); }
.tl-item.red::before { border-color: var(--red); }
.tl-item.amber::before { border-color: var(--amber); }
.tl-item .tl-time { font-size: .74rem; color: var(--muted); }
.tl-item .tl-title { font-weight: 600; font-size: .87rem; }
.tl-item .tl-body { font-size: .84rem; color: var(--text-2); margin-top: 3px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
a.list-item { color: inherit; text-decoration: none !important; }
a.list-item:hover { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: .87rem; }
.list-item .li-sub { font-size: .76rem; color: var(--muted); }
.date-tile { width: 46px; flex-shrink: 0; text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.date-tile .m { background: var(--navy); color: #fff; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 2px 0; }
.date-tile .d { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; padding: 2px 0; }
.date-tile.today .m { background: var(--gold); }

/* Notes */
.note { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.note + .note { margin-top: 10px; }
.note.pinned { border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: var(--gold-soft); }
.note-meta { display: flex; gap: 8px; align-items: center; font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.note-body { font-size: .86rem; white-space: pre-wrap; }

/* Progress */
.progress { height: 7px; background: var(--surface-3); border-radius: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--gold)); border-radius: 10px; }
.progress.green > span { background: #16a34a; } .progress.red > span { background: #dc2626; }

/* ── Kanban ────────────────────────────────────────────────────────────── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: var(--surface-3); border-radius: 12px; padding: 10px; min-height: 200px; border: 1px solid var(--border); }
.board-col.drag-over { outline: 2px dashed var(--gold); outline-offset: -4px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.board-col-head .count { background: var(--surface); border-radius: 20px; padding: 0 8px; font-size: .72rem; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t); }
.board-card:hover { box-shadow: var(--shadow); }
.board-card.dragging { opacity: .5; transform: rotate(1.5deg); }
.board-card .bc-title { font-weight: 600; font-size: .86rem; margin-bottom: 4px; color: var(--text); }
.board-card .bc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .74rem; color: var(--muted); margin-top: 6px; }

/* ── Calendar ──────────────────────────────────────────────────────────── */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 9px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; position: relative; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { color: var(--muted); opacity: .6; }
.cal-day.today .cal-num { background: var(--gold); color: #fff; }
.cal-day.weekend { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cal-num { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; font-size: .8rem; font-weight: 600; margin-bottom: 3px; }
.cal-ev { display: block; font-size: .72rem; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; font-weight: 500; border-left: 3px solid; }
.cal-ev.hearing { background: var(--red-bg); color: var(--red); }
.cal-ev.task { background: var(--blue-bg); color: var(--blue); }
.cal-ev.event { background: var(--purple-bg); color: var(--purple); }
.cal-ev.compliance { background: var(--amber-bg); color: var(--amber); }
.cal-ev.invoice { background: var(--green-bg); color: var(--green); }
.cal-more { font-size: .7rem; color: var(--muted); padding-left: 4px; cursor: pointer; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .icon { color: var(--border-strong); margin-bottom: 10px; }
.empty-state h4 { color: var(--text-2); margin-bottom: 4px; }
.empty-state p { font-size: .85rem; max-width: 380px; margin: 0 auto 14px; }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.pagination-links { display: flex; gap: 4px; }
.pagination-links a, .pagination-links span { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; text-decoration: none !important; }
.pagination-links a:hover { background: var(--surface-3); }
.pagination-links .current { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagination-links .disabled { opacity: .4; }
.pagination-links .gap { border: 0; }

/* ── Invoice builder ───────────────────────────────────────────────────── */
.line-items { width: 100%; border-collapse: separate; border-spacing: 0; }
.line-items th { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.line-items td { padding: 6px; vertical-align: top; border-bottom: 1px dashed var(--border); }
.line-items input, .line-items select, .line-items textarea { width: 100%; height: 36px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: .84rem var(--font); outline: none; }
.line-items textarea { height: 36px; min-height: 36px; padding: 8px 9px; resize: vertical; line-height: 1.35; }
.line-items input:focus, .line-items select:focus, .line-items textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--focus); }
.line-items .num input { text-align: right; }
.line-items .li-amount { text-align: right; font-weight: 600; padding-top: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-items .li-type { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; display: inline-block; }
.line-items tr.reimb td { background: color-mix(in srgb, var(--cyan-bg) 60%, transparent); }
.totals { width: 100%; max-width: 380px; margin-left: auto; font-size: .88rem; }
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; }
.totals .row.muted { color: var(--muted); font-size: .82rem; }
.totals .row.total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; }
.supply-indicator { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: .74rem; font-weight: 600; }

/* ── Charts ────────────────────────────────────────────────────────────── */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 210px; }
.bar-list .bl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin-bottom: 12px; font-size: .84rem; }
.bar-list .bl-row .progress { grid-column: span 2; }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-brand { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 10% 10%, #1f4786 0%, #102650 45%, #081326 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 28px 28px; pointer-events: none; }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .brand { padding: 0; border: 0; height: auto; }
.auth-brand .brand img { width: 52px; height: 52px; }
.auth-brand h2 { color: #fff; font-size: 2rem; line-height: 1.2; margin: 0 0 14px; max-width: 460px; }
.auth-brand h2 em { color: var(--gold); font-style: normal; }
.auth-brand p { color: rgba(255,255,255,.7); max-width: 440px; }
.auth-features { display: grid; gap: 12px; margin-top: 26px; max-width: 460px; }
.auth-features div { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.82); font-size: .9rem; }
.auth-features .icon { color: var(--gold); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 26px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .btn { height: 44px; font-size: .92rem; }
.otp-input { letter-spacing: .5em; text-align: center; font-size: 1.4rem !important; font-weight: 700; height: 54px !important; font-family: ui-monospace, monospace !important; }
.auth-foot { margin-top: 26px; font-size: .78rem; color: var(--muted); text-align: center; }

/* ── Error pages ───────────────────────────────────────────────────────── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.error-code { font-family: var(--font-head); font-size: 5rem; font-weight: 800; color: var(--gold); line-height: 1; }
.error-trace { text-align: left; max-width: 980px; margin: 20px auto 0; background: #0b1220; color: #e7edf6; padding: 16px; border-radius: 10px; overflow: auto; font-size: .78rem; }

/* ── Document viewer (templates) ───────────────────────────────────────── */
.paper { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 56px 64px; box-shadow: var(--shadow); border-radius: 6px; font-family: 'Georgia', 'Times New Roman', serif; font-size: 15px; line-height: 1.7; }
.paper h3, .paper h4 { font-family: 'Georgia', serif; color: #111; }
.letterhead { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--gold); padding-bottom: 14px; margin-bottom: 26px; font-family: var(--font); }
.letterhead img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
.letterhead strong { font-family: var(--font-head); font-size: 1.2rem; letter-spacing: .04em; color: #1b3a6b; display: block; }
.letterhead small { color: #555; font-size: .78rem; }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.inline-form { display: inline; margin: 0; }
.ico-sun { display: none; }
[data-theme="dark"] .ico-sun { display: inline-flex; }
[data-theme="dark"] .ico-moon { display: none; }
.ico-moon, .ico-sun { align-items: center; }
.qr-box { display: inline-block; padding: 8px; background: #fff; border-radius: 10px; border: 1px solid var(--border); }
.qr-box img, .qr-box canvas { display: block; }
.secret-key { font-family: ui-monospace, monospace; font-size: 1rem; letter-spacing: .12em; background: var(--surface-3); padding: 10px 14px; border-radius: 8px; word-break: break-all; }
.drop-zone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); transition: border-color var(--t), background var(--t); cursor: pointer; }
.drop-zone.over { border-color: var(--gold); background: var(--gold-soft); }
.file-icon { width: 38px; height: 44px; border-radius: 6px; display: inline-flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; font-size: .58rem; font-weight: 800; color: #fff; background: #64748b; flex-shrink: 0; letter-spacing: .04em; }
.file-icon.pdf { background: #dc2626; } .file-icon.doc, .file-icon.docx { background: #2563eb; } .file-icon.xls, .file-icon.xlsx, .file-icon.csv { background: #16a34a; } .file-icon.jpg, .file-icon.jpeg, .file-icon.png, .file-icon.webp { background: #9333ea; } .file-icon.zip { background: #d97706; }
.msg-thread { display: flex; flex-direction: column; gap: 12px; max-height: 520px; overflow-y: auto; padding: 18px; }
.msg { max-width: 76%; padding: 10px 14px; border-radius: 14px; font-size: .88rem; white-space: pre-wrap; }
.msg.them { background: var(--surface-3); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.me { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.msg small { display: block; font-size: .7rem; opacity: .7; margin-top: 4px; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.welcome { background: linear-gradient(120deg, var(--navy-800), var(--navy) 55%, #28518f); color: #fff; border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; position: relative; overflow: hidden; }
.welcome::after { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(196,134,10,.35), transparent 70%); }
.welcome h1 { color: #fff; margin: 0 0 4px; font-size: 1.35rem; }
.welcome p { margin: 0; color: rgba(255,255,255,.72); }
.welcome .btn { position: relative; z-index: 1; }
.welcome-stats { display: flex; gap: 22px; position: relative; z-index: 1; flex-wrap: wrap; }
.welcome-stats div { font-size: .76rem; color: rgba(255,255,255,.65); }
.welcome-stats strong { display: block; font-family: var(--font-head); font-size: 1.35rem; color: #fff; }

.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.subnav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.subnav .sn-label { font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.subnav a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: .85rem; text-decoration: none !important; }
.subnav a:hover { background: var(--surface-3); color: var(--text); }
.subnav a.active { background: var(--gold-soft); color: var(--text); font-weight: 600; }
.subnav a.active .icon { color: var(--gold); }
.check-list { display: grid; gap: 8px; }
.health { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: .86rem; }
.health:last-child { border-bottom: 0; }
.health .icon { flex-shrink: 0; }
.health.ok .icon { color: var(--green); } .health.warn .icon { color: var(--amber); } .health.bad .icon { color: var(--red); }
@media (max-width: 900px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } .subnav { position: static; } }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .grid-main { grid-template-columns: minmax(0, 1fr) 320px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-main, .grid-main-wide, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,19,38,.5); z-index: 55; }
  .main, body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-section, body.sidebar-collapsed .nav a span, body.sidebar-collapsed .nav-badge, body.sidebar-collapsed .sidebar-user div { display: revert; }
  .menu-toggle { display: inline-flex; }
  .collapse-toggle { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}
@media (max-width: 768px) {
  .content { padding: 16px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .search-trigger { width: auto; flex: 1; }
  .search-trigger kbd, .search-trigger .st-text { display: none; }
  .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .hero-stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .hero-stats div { text-align: left; }
  .notif-menu { width: calc(100vw - 24px); right: -60px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .cal-day { min-height: 70px; }
  .cal-ev { font-size: .62rem; padding: 2px 4px; }
  .hide-mobile { display: none !important; }
  .paper { padding: 28px 22px; }
}

/* ── Print ─────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .toasts, .pagination, .toolbar { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
  .paper { box-shadow: none; padding: 0; max-width: none; }
}

/* ============================================================
   LAUNCH DAY
   ============================================================ */
.launch-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .launch-grid { grid-template-columns: 1fr; } }

.launched-card { border-color: rgba(21, 128, 61, .35); }

.launch-card {
  margin-top: 18px;
  border: 0;
  background:
    radial-gradient(ellipse 60% 70% at 50% 120%, rgba(201,165,92,.30), transparent 70%),
    linear-gradient(160deg, var(--navy-800) 0%, var(--navy-950) 100%);
  color: #e8ecf3;
  overflow: hidden;
}
.launch-card .card-body { padding: 40px 28px 34px; text-align: center; }
.eyebrow-line {
  margin: 0 0 10px; font-size: .68rem; font-weight: 600;
  letter-spacing: .3em; text-transform: uppercase; color: var(--gold);
}
.launch-title { margin: 0; color: #fff; font-size: clamp(1.5rem, 3vw, 2.15rem); }
.launch-sub { margin: 10px auto 0; max-width: 46ch; color: rgba(232,236,243,.72); font-size: .92rem; }

.lock {
  --pad: 6px; --h: 66px; --lp: 0; --lift: 0;
  position: relative;
  width: min(520px, 100%);
  height: var(--h);
  margin: 28px auto 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(4,8,14,.6), rgba(16,22,32,.6));
  box-shadow:
    inset 0 0 0 1px rgba(201,165,92, calc(.3 + var(--lp) * .5)),
    inset 0 2px 12px rgba(0,0,0,.5),
    0 0 calc(var(--lp) * 50px) rgba(201,165,92, calc(var(--lp) * .4));
  touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden;
}
.lock-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, rgba(156,122,53,.18), rgba(201,165,92,.5));
}
.lock-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding-left: calc(var(--h) - 12px);
  font-size: .78rem; font-weight: 500; letter-spacing: .26em; text-transform: uppercase;
  color: rgba(226,232,240,.62);
  opacity: calc(1 - var(--lp) * 1.8);
  pointer-events: none;
}
.lock-goal {
  position: absolute; top: 50%; right: 20px; transform: translateY(-50%);
  color: var(--gold); opacity: calc(.35 + var(--lp) * .65); pointer-events: none;
}
.lock-goal svg { display: block; }
.lock-handle {
  position: absolute; top: var(--pad); left: var(--pad);
  width: calc(var(--h) - var(--pad) * 2); height: calc(var(--h) - var(--pad) * 2);
  border-radius: 50%; display: grid; place-items: center;
  color: #141a23;
  background: linear-gradient(180deg, #ead199 0%, var(--gold) 52%, #b18b43 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.45) inset, 0 8px 20px -6px rgba(0,0,0,.7);
  cursor: grab; touch-action: none; z-index: 1;
}
.lock.is-dragging .lock-handle { cursor: grabbing; }
.lock-handle:focus-visible { outline: 2px solid #ead199; outline-offset: 4px; }
.lock.is-returning .lock-handle { transition: transform .5s cubic-bezier(.3,1.45,.5,1); }
.lock.is-returning .lock-fill { transition: width .5s cubic-bezier(.3,1.45,.5,1); }
.padlock .shackle {
  transform-box: view-box; transform-origin: 16.5px 11px;
  transform: translateY(calc(var(--lift) * -2.6px));
}
.lock.is-unlocked .padlock .shackle {
  transform: translateY(-3.4px) rotate(-40deg);
  transition: transform .35s cubic-bezier(.3,1.6,.5,1);
}
.launch-hint { margin: 16px 0 0; font-size: .8rem; color: rgba(232,236,243,.55); }
.launch-hint.is-error { color: #ffb4b4; }

/* the celebration sits over the panel */
.launch-sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2000; pointer-events: none; display: none; }
body.is-launching .launch-sky { display: block; }
.launch-done {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  z-index: 2001; text-align: center; padding: 34px 40px; border-radius: 20px;
  background: rgba(12, 26, 51, .93); color: #fff;
  box-shadow: 0 0 0 1px rgba(201,165,92,.45), 0 30px 80px -20px rgba(0,0,0,.7);
  animation: launchArrive .9s cubic-bezier(.2,.8,.2,1) both;
}
.launch-done h2 {
  margin: 0; color: #fff;
  font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: .02em;
}
.launch-done-sub { margin: 10px 0 20px; color: rgba(232,236,243,.75); }
@keyframes launchArrive { from { opacity: 0; transform: translate(-50%, -50%) scale(.88); } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .launch-done { animation: none; }
  .lock.is-returning .lock-handle, .lock.is-returning .lock-fill { transition: none; }
}

/* ".field label" sets display:block and outranks .flex-between, which ran the
   "Password" label and the "Forgot password?" link together on the sign-in pages. */
.field label.flex-between { display: flex; }
