/* ==========================================================================
   Athena Case Management System - design system
   Navy and antique gold on ivory. Inter for the interface, Cormorant Garamond
   for display, tabular numerals wherever money appears.
   ========================================================================== */

:root {
  --navy-950: #060f26;
  --navy-900: #0b1f4b;
  --navy-800: #112b63;
  --navy-700: #1a3a7c;
  --navy-600: #24499a;
  --navy-100: #e3e9f5;
  --navy-50: #f1f4fb;
  --gold-700: #8f6d24;
  --gold-600: #a97f2f;
  --gold-500: #b8923f;
  --gold-400: #c9a45c;
  --gold-300: #dcc08a;
  --gold-200: #ecdcb4;
  --gold-100: #f6efdc;
  --ivory: #f6f3ec;
  --paper: #ffffff;
  --paper-2: #fbfaf6;
  --ink: #171c2b;
  --ink-2: #3a4157;
  --muted: #6b7288;
  --muted-2: #9aa0b3;
  --line: #e5e0d4;
  --line-2: #d4cfc1;
  --success: #1f7a4d;
  --success-bg: #e6f4ec;
  --warning: #a8701a;
  --warning-bg: #fbf1dc;
  --danger: #b3261e;
  --danger-bg: #fbe7e5;
  --info: #1e5aa8;
  --info-bg: #e4edf9;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 75, .06), 0 1px 1px rgba(11, 31, 75, .03);
  --shadow: 0 10px 30px -14px rgba(11, 31, 75, .28), 0 2px 6px -2px rgba(11, 31, 75, .08);
  --shadow-lg: 0 24px 60px -24px rgba(6, 15, 38, .45);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sidebar-w: 268px;
  --topbar-h: 64px;
  --content-max: 1480px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ivory: #0e1424;
  --paper: #141b2e;
  --paper-2: #182036;
  --ink: #eceef5;
  --ink-2: #c5cad9;
  --muted: #8f97ad;
  --muted-2: #6c7389;
  --line: #26304a;
  --line-2: #33405e;
  --navy-100: #1b2742;
  --navy-50: #172239;
  --gold-100: #2a2617;
  --gold-200: #3d351d;
  --success-bg: #12301f;
  --warning-bg: #332711;
  --danger-bg: #3a1614;
  --info-bg: #14264a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-ui); color: var(--ink); background: var(--ivory);
  line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:root[data-theme="dark"] a { color: var(--gold-400); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.15; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .82rem; }
code, .mono { font-family: var(--font-mono); font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, th.num, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }
.gold-text { color: var(--gold-600); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.display { font-family: var(--font-display); }
.eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--gold-600); font-weight: 600; }
.divider-gold { height: 2px; width: 44px; background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); border-radius: 2px; }

:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------------------
   App frame
   -------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 0 0 1.5rem;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%); color: #dfe5f3;
  border-right: 1px solid rgba(255, 255, 255, .05); scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.brand { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.15rem .9rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand img { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.brand .brand-name { font-family: var(--font-display); font-size: 1.55rem; letter-spacing: .12em; color: #fff; line-height: 1; font-weight: 600; }
.brand .brand-sub { font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-400); margin-top: .25rem; }
.tenant-chip { margin: .9rem 1rem 0; padding: .6rem .75rem; border-radius: var(--radius-sm); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.tenant-chip .t-name { font-weight: 600; color: #fff; font-size: .9rem; line-height: 1.25; }
.tenant-chip .t-model { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-300); margin-top: .15rem; }
.nav { padding: .75rem .6rem 0; }
.nav-section { margin-top: .9rem; }
.nav-title { padding: 0 .65rem .35rem; font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(223,229,243,.5); font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; margin: 1px 0; border-radius: 8px; color: #cdd6ea; font-size: .9rem;
  transition: background .15s, color .15s; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(184,146,63,.16); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -.6rem; top: 20%; height: 60%; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-400); }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav a .count { margin-left: auto; font-size: .7rem; font-weight: 600; padding: .05rem .45rem; border-radius: 99px; background: var(--gold-500); color: var(--navy-950); }
.sidebar-foot { margin: 1.5rem 1rem 0; font-size: .7rem; color: rgba(223,229,243,.45); line-height: 1.5; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--ivory) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar .search-trigger {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--paper); color: var(--muted); cursor: text; text-align: left; box-shadow: var(--shadow-sm);
}
.topbar .search-trigger:hover { border-color: var(--gold-400); }
.topbar .search-trigger kbd { margin-left: auto; font-family: var(--font-ui); font-size: .7rem; padding: .1rem .4rem; border: 1px solid var(--line-2); border-radius: 5px; background: var(--paper-2); color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--paper); border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem .3rem .3rem; border-radius: 10px; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--paper); }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .4rem; z-index: 40; }
.user-menu .menu a, .user-menu .menu button { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: 8px; border: 0; background: none; color: var(--ink); cursor: pointer; font-size: .9rem; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--navy-50); text-decoration: none; }
.user-menu .menu .menu-head { padding: .5rem .7rem .4rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; letter-spacing: .02em; background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); color: #fff; border: 2px solid var(--gold-300); flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .6rem; border-width: 1.5px; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }

.content { padding: 1.5rem 1.75rem 3rem; width: 100%; max-width: var(--content-max); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin-top: .25rem; max-width: 70ch; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { display: flex; gap: .4rem; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: .5rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span.sep { opacity: .5; }

/* --------------------------------------------------------------------------
   Cards, grids, KPIs
   -------------------------------------------------------------------------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: .95rem; }
.card-head .sub { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.card-body { padding: 1.15rem; }
.card-body.tight { padding: .6rem .75rem; }
.card-foot { padding: .75rem 1.15rem; border-top: 1px solid var(--line); background: var(--paper-2); border-radius: 0 0 var(--radius) var(--radius); font-size: .85rem; color: var(--muted); }
.card.accent { border-top: 3px solid var(--gold-500); }
.card.navy { background: linear-gradient(135deg, var(--navy-900), var(--navy-800)); color: #e8edf8; border-color: var(--navy-800); }
.card.navy h2, .card.navy h3, .card.navy .kpi-value { color: #fff; }
.card.navy .muted { color: rgba(232,237,248,.65); }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.main-aside { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack.tight { gap: .5rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.gap-1 { gap: .35rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.p-0 { padding: 0 !important; }

.kpi { padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .3rem; min-height: 104px; }
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.65rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi-value.display { font-family: var(--font-display); font-size: 2.1rem; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi.warn .kpi-value { color: var(--warning); }
.kpi.danger .kpi-value { color: var(--danger); }
.kpi.good .kpi-value { color: var(--success); }
.kpi a { color: inherit; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .95rem; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--paper); color: var(--ink); font-weight: 500; font-size: .88rem; cursor: pointer; white-space: nowrap; line-height: 1.25;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--gold-400); background: var(--paper-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.btn.primary:hover { background: var(--navy-800); }
.btn.gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-600)); border-color: var(--gold-600); color: var(--navy-950); font-weight: 600; }
.btn.gold:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line-2)); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.success { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, var(--line-2)); }
.btn.success.solid { background: var(--success); color: #fff; border-color: var(--success); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--navy-50); }
.btn.sm { padding: .3rem .65rem; font-size: .8rem; border-radius: 7px; }
.btn.xs { padding: .18rem .5rem; font-size: .74rem; border-radius: 6px; }
.btn.lg { padding: .7rem 1.3rem; font-size: 1rem; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-group { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
form.inline { display: inline; }

/* --------------------------------------------------------------------------
   Pills, badges, tags
   -------------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 600; letter-spacing: .02em; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.no-dot::before { display: none; }
.pill.neutral { background: var(--navy-50); color: var(--ink-2); border-color: var(--line); }
.pill.navy { background: var(--navy-900); color: #fff; }
.pill.gold { background: var(--gold-100); color: var(--gold-700); border-color: var(--gold-200); }
.pill.success { background: var(--success-bg); color: var(--success); }
.pill.warning { background: var(--warning-bg); color: var(--warning); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.outline { background: transparent; border-color: var(--line-2); color: var(--muted); }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; background: var(--navy-50); color: var(--ink-2); font-size: .74rem; border: 1px solid var(--line); }
.badge-count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--navy-100); color: var(--navy-800); font-size: .7rem; font-weight: 700; align-items: center; justify-content: center; }

/* --------------------------------------------------------------------------
   Alerts, banners, callouts
   -------------------------------------------------------------------------- */
.alert { display: flex; gap: .75rem; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .9rem; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: .1rem; }
.alert.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.alert.success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.alert.warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.alert.danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert strong { font-weight: 600; }
.alert .body { flex: 1; }
.alert a { color: inherit; text-decoration: underline; }
.banner { padding: .55rem 1.5rem; font-size: .82rem; display: flex; gap: .6rem; align-items: center; justify-content: center; }
.banner.demo { background: var(--gold-100); color: var(--gold-700); border-bottom: 1px solid var(--gold-200); }
.banner.wall { background: var(--danger); color: #fff; font-weight: 600; }
.callout { padding: .9rem 1.1rem; border-left: 3px solid var(--gold-500); background: var(--gold-100); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .9rem; }
.callout.navy { border-color: var(--navy-700); background: var(--navy-50); }
.callout.danger { border-color: var(--danger); background: var(--danger-bg); }
.spec { font-size: .7rem; color: var(--muted-2); font-family: var(--font-mono); margin-left: .35rem; }

/* toasts */
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; max-width: 420px; }
.toast { padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--navy-900); color: #fff; box-shadow: var(--shadow-lg); font-size: .9rem; display: flex; gap: .7rem; align-items: flex-start; animation: toast-in .25s ease-out; border-left: 4px solid var(--gold-500); }
.toast.success { border-left-color: #4fc38a; }
.toast.danger { border-left-color: #ff7b72; }
.toast.warning { border-left-color: var(--gold-400); }
.toast button { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; font-size: 1.1rem; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: .32rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--danger); margin-left: .15rem; }
.field .help { font-size: .76rem; color: var(--muted); }
.field .error { font-size: .76rem; color: var(--danger); }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; padding: .55rem .75rem; border-radius: 9px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(184,146,63,.18); }
.field input[readonly], .field input[disabled] { background: var(--paper-2); color: var(--muted); }
.field textarea { min-height: 96px; resize: vertical; }
.field select { appearance: none; 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='%236b7288' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
.field .input-money { position: relative; }
.field .input-money input { padding-left: 2.9rem; text-align: right; font-variant-numeric: tabular-nums; }
.field .input-money::before { content: "TT$"; position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); font-size: .8rem; color: var(--muted); font-weight: 600; }
.check { display: flex; align-items: center; gap: .55rem; font-size: .9rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--navy-800); }
.check-list { display: flex; flex-direction: column; gap: .4rem; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-actions .left { margin-right: auto; color: var(--muted); font-size: .82rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem 1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-size: .8rem; font-weight: 600; color: var(--gold-700); letter-spacing: .05em; text-transform: uppercase; }
details.advanced { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: .6rem .9rem; margin-top: .5rem; }
details.advanced summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
details.advanced[open] summary { margin-bottom: .75rem; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 160px; }
.autosave-note { font-size: .74rem; color: var(--muted); }
.draft-restore { display: none; }
.draft-restore.show { display: flex; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: .6rem .85rem; border-bottom: 1px solid var(--line); background: var(--paper-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table td { padding: .65rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--navy-50) 55%, transparent); }
.table tr.clickable { cursor: pointer; }
.table .primary { font-weight: 600; color: var(--ink); }
.table .sub { display: block; font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.table tfoot td { font-weight: 600; background: var(--paper-2); border-top: 2px solid var(--line-2); }
.table.compact td, .table.compact th { padding: .4rem .6rem; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn { margin-left: .25rem; }
.table th.num, .table td.num { text-align: right; }
.table .row-muted td { color: var(--muted); }
.table tr.locked td { background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(0,0,0,.015) 8px, rgba(0,0,0,.015) 16px); }
.filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; padding: .85rem 1.15rem; border-bottom: 1px solid var(--line); background: var(--paper-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 150px; gap: .2rem; }
.filters .field label { font-size: .7rem; }
.filters input, .filters select { min-height: 36px; padding: .35rem .6rem; }
.pagination { display: flex; gap: .3rem; justify-content: flex-end; padding: .75rem 1rem; font-size: .85rem; align-items: center; }
.pagination a, .pagination span { padding: .3rem .6rem; border-radius: 6px; border: 1px solid var(--line); }
.pagination .current { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

.empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto .75rem; border-radius: 50%; background: var(--gold-100); color: var(--gold-600); display: flex; align-items: center; justify-content: center; }
.empty .icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: .95rem; margin-bottom: .25rem; color: var(--ink-2); }
.empty p { font-size: .85rem; max-width: 46ch; margin: 0 auto .75rem; }

/* definition lists */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; font-size: .88rem; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.dl.stack { grid-template-columns: 1fr; gap: .2rem; }
.dl.stack dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.dl.stack dd { margin-bottom: .55rem; }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 1.25rem; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: .65rem .9rem; font-size: .86rem; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--navy-800); border-bottom-color: var(--gold-500); font-weight: 600; }
:root[data-theme="dark"] .tabs a.active { color: #fff; }
.tabs a .badge-count { min-width: 18px; height: 18px; font-size: .66rem; }
.segmented { display: inline-flex; background: var(--navy-50); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.segmented a, .segmented button { padding: .3rem .75rem; border-radius: 7px; font-size: .8rem; color: var(--muted); border: 0; background: transparent; cursor: pointer; }
.segmented .active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

/* --------------------------------------------------------------------------
   Matter header band (FR-MAT-08)
   -------------------------------------------------------------------------- */
.matter-band { background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy-800) 60%, #1c3f86 100%); color: #e9edf7; border-radius: var(--radius); padding: 1.15rem 1.35rem 1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; margin-bottom: 1.1rem; }
.matter-band::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(201,164,92,.28), transparent 65%); pointer-events: none; }
.matter-band .ref { font-family: var(--font-mono); font-size: .82rem; letter-spacing: .06em; color: var(--gold-300); }
.matter-band h1 { color: #fff; font-size: 1.75rem; margin: .1rem 0 .15rem; }
.matter-band .meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .84rem; color: rgba(233,237,247,.8); align-items: center; }
.matter-band .meta b { color: #fff; font-weight: 600; }
.matter-band .figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-top: 1rem; }
.matter-band .fig { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: .55rem .75rem; }
.matter-band .fig .l { font-size: .64rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(233,237,247,.6); }
.matter-band .fig .v { font-size: 1.05rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matter-band .fig .v.small { font-size: .9rem; }
.matter-band .fig.hidden-value .v { color: rgba(255,255,255,.45); font-style: italic; font-weight: 400; }
.matter-band .fig.alert { border-color: rgba(255,123,114,.6); background: rgba(179,38,30,.25); }
.matter-band .fig.alert .v { color: #ffd6d2; }
.matter-band .fig.warn { border-color: rgba(220,192,138,.6); background: rgba(184,146,63,.22); }
.matter-band .pill { border-color: rgba(255,255,255,.15); }
.matter-band .pill.neutral { background: rgba(255,255,255,.1); color: #fff; }
.matter-band .actions { position: absolute; right: 1.1rem; top: 1rem; display: flex; gap: .4rem; z-index: 1; }
.matter-band .actions .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.matter-band .actions .btn:hover { background: rgba(255,255,255,.18); }
.matter-band .actions .btn.gold { color: var(--navy-950); }
.gauge { height: 8px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: .35rem; }
.gauge > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-400), var(--gold-300)); }
.gauge.over > span { background: linear-gradient(90deg, #ff9d96, #ff7b72); }
.card .gauge { background: var(--navy-50); }

/* --------------------------------------------------------------------------
   Timeline / activity / notes
   -------------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 1.1rem 2.4rem; }
.timeline li .dot { position: absolute; left: 7px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 3px solid var(--navy-600); }
.timeline li.gold .dot { border-color: var(--gold-500); }
.timeline li.danger .dot { border-color: var(--danger); }
.timeline li.success .dot { border-color: var(--success); }
.timeline .when { font-size: .74rem; color: var(--muted); }
.timeline .what { font-size: .9rem; }
.note { padding: .9rem 1.05rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.note + .note { margin-top: .65rem; }
.note .note-head { display: flex; gap: .6rem; align-items: center; font-size: .78rem; color: var(--muted); margin-bottom: .4rem; }
.note .note-body { white-space: pre-wrap; font-size: .92rem; }
.note.correction { margin-left: 2rem; border-left: 3px solid var(--gold-400); }
.note.locked .note-head::after { content: "locked"; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-600); margin-left: auto; }

/* --------------------------------------------------------------------------
   Calendar
   -------------------------------------------------------------------------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal-grid .dow { padding: .45rem .5rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; background: var(--paper-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 112px; padding: .4rem .45rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .78rem; background: var(--paper); }
.cal-cell.other { background: var(--paper-2); color: var(--muted-2); }
.cal-cell.today { background: var(--gold-100); }
.cal-cell.holiday { background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 6px, var(--paper-2) 6px, var(--paper-2) 12px); }
.cal-cell .day { font-weight: 600; font-size: .8rem; display: flex; justify-content: space-between; }
.cal-cell .day .hol { font-weight: 400; color: var(--muted); font-size: .66rem; }
.cal-ev { display: block; margin-top: .25rem; padding: .15rem .4rem; border-radius: 5px; background: var(--navy-50); color: var(--navy-800); border-left: 3px solid var(--navy-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; }
.cal-ev.critical { background: var(--danger-bg); color: var(--danger); border-left-color: var(--danger); font-weight: 600; }
.cal-ev.court { background: var(--gold-100); color: var(--gold-700); border-left-color: var(--gold-500); }
.cal-ev.placeholder { opacity: .6; border-style: dashed; }
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.agenda-day { display: grid; grid-template-columns: 96px 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.agenda-day .d { font-weight: 600; }
.agenda-day .d small { display: block; color: var(--muted); font-weight: 400; }

/* --------------------------------------------------------------------------
   Command palette & modals
   -------------------------------------------------------------------------- */
.cmdk-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(6,15,38,.55); backdrop-filter: blur(3px); z-index: 80; display: none; align-items: flex-start; justify-content: center; padding: 8vh 1rem; }
.cmdk-backdrop.open, .modal-backdrop.open { display: flex; }
.cmdk { width: 100%; max-width: 640px; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; }
.cmdk input { width: 100%; padding: 1rem 1.15rem; border: 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; background: transparent; outline: none; }
.cmdk .results { max-height: 60vh; overflow-y: auto; padding: .4rem; }
.cmdk .res { display: flex; gap: .8rem; align-items: center; padding: .55rem .7rem; border-radius: 8px; color: var(--ink); }
.cmdk .res:hover, .cmdk .res.sel { background: var(--navy-50); text-decoration: none; }
.cmdk .res .kind { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-600); width: 70px; flex: none; font-weight: 600; }
.cmdk .res .sub { font-size: .76rem; color: var(--muted); }
.cmdk .hint { padding: .5rem .9rem; font-size: .72rem; color: var(--muted); border-top: 1px solid var(--line); display: flex; gap: 1rem; }
.modal { width: 100%; max-width: 560px; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); margin-top: 4vh; }
.modal.wide { max-width: 820px; }
.modal .modal-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .modal-body { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
.modal .modal-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }

/* timers dock */
.timer-dock { position: fixed; left: calc(var(--sidebar-w) + 1rem); bottom: 1rem; z-index: 60; display: flex; flex-direction: column; gap: .4rem; }
.timer-chip { display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; border-radius: 10px; background: var(--navy-900); color: #fff; box-shadow: var(--shadow-lg); font-size: .82rem; border-left: 4px solid var(--gold-500); }
.timer-chip .t { font-family: var(--font-mono); font-size: .95rem; font-variant-numeric: tabular-nums; min-width: 70px; }
.timer-chip.paused { border-left-color: var(--muted-2); opacity: .85; }
.timer-chip .btn { padding: .15rem .45rem; font-size: .72rem; background: rgba(255,255,255,.12); border-color: transparent; color: #fff; box-shadow: none; }

/* --------------------------------------------------------------------------
   Auth / public pages
   -------------------------------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-hero { background: radial-gradient(1200px 600px at 20% 0%, #1d3f86 0%, var(--navy-900) 45%, var(--navy-950) 100%); color: #e9edf7; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero .logo { width: 220px; filter: drop-shadow(0 12px 30px rgba(0,0,0,.45)); }
.auth-hero h1 { color: #fff; font-size: 3rem; line-height: 1.05; margin: 1.25rem 0 .75rem; }
.auth-hero p { color: rgba(233,237,247,.78); max-width: 46ch; font-size: 1.02rem; }
.auth-hero .pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 2rem; }
.auth-hero .pillar { border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); border-radius: 12px; padding: .8rem .9rem; font-size: .8rem; }
.auth-hero .pillar b { display: block; color: var(--gold-300); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .25rem; }
.auth-hero .foot { font-size: .75rem; color: rgba(233,237,247,.5); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--ivory); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h2 { font-family: var(--font-display); font-size: 2rem; font-weight: 600; margin-bottom: .25rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.5rem; }
.demo-accounts { margin-top: 1.5rem; font-size: .8rem; }
.demo-accounts table { width: 100%; border-collapse: collapse; }
.demo-accounts td { padding: .25rem .4rem; border-bottom: 1px solid var(--line); }
.demo-accounts button { background: none; border: 0; color: var(--navy-700); cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; }
.public-page { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.public-page .brand-row { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.5rem; }
.public-page .brand-row img { width: 56px; }
.notice-box { padding: 1rem 1.15rem; border: 2px solid var(--gold-500); background: var(--gold-100); border-radius: var(--radius-sm); font-weight: 500; }

/* --------------------------------------------------------------------------
   Report & print
   -------------------------------------------------------------------------- */
.report-face { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); padding: .7rem 1.15rem; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.report-face b { color: var(--ink); }
.trace { font-family: var(--font-mono); font-size: .78rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; white-space: pre-wrap; line-height: 1.6; }
.trace ol { margin: 0; padding-left: 1.4rem; }
.invoice-doc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem 2.25rem; max-width: 900px; }
.invoice-doc .doc-head { display: flex; justify-content: space-between; gap: 2rem; border-bottom: 2px solid var(--navy-900); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.invoice-doc .doc-head h1 { font-size: 2.2rem; }
.invoice-doc .totals { margin-left: auto; width: 320px; }
.invoice-doc .totals td { padding: .3rem 0; }
.invoice-doc .totals tr.grand td { border-top: 2px solid var(--navy-900); font-weight: 700; font-size: 1.05rem; }
.stat-list { display: flex; flex-direction: column; }
.stat-list .stat { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.stat-list .stat:last-child { border-bottom: 0; }
.stat-list .stat b { font-variant-numeric: tabular-nums; }
.progress { height: 6px; background: var(--navy-50); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--navy-700); border-radius: 99px; }
.progress.gold > span { background: var(--gold-500); }
.bar-list .bar-row { display: grid; grid-template-columns: 140px 1fr 90px; gap: .75rem; align-items: center; font-size: .84rem; padding: .3rem 0; }
.bar-list .bar-row .bar { height: 10px; background: var(--navy-50); border-radius: 99px; overflow: hidden; }
.bar-list .bar-row .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-700), var(--navy-600)); }
.bar-list .bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: middle; }

.mobile-nav-toggle { display: none; }
.wall-notice { border: 2px solid var(--danger); background: var(--danger-bg); color: var(--danger); padding: .75rem 1rem; border-radius: var(--radius-sm); font-weight: 600; }

@media print {
  .sidebar, .topbar, .page-head .actions, .tabs, .toasts, .timer-dock, .banner, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* --------------------------------------------------------------------------
   Responsive (NFR-USE-01)
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .grid.cols-4, .grid.cols-5, .grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-aside { grid-template-columns: 1fr; }
  .auth-hero .pillars { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 320px); z-index: 70; transform: translateX(-100%); transition: transform .2s ease; height: 100vh; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-nav-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5, .grid.cols-6 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 2rem 1.5rem; }
  .auth-hero h1 { font-size: 2.1rem; }
  .matter-band .actions { position: static; margin-top: .8rem; flex-wrap: wrap; }
  .timer-dock { left: 1rem; right: 1rem; }
  .cal-cell { min-height: 70px; }
  .dl { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
  .table td, .table th { padding: .5rem .6rem; }
}

/* ==========================================================================
   Release 2 additions
   ========================================================================== */

/* ---- landing / signed-out pages: large mark, centre-left ---------------- */
.auth-hero { justify-content: center; }
.auth-hero-mark { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding-left: clamp(0rem, 6vw, 5rem); }
.auth-hero .auth-hero-mark .logo { width: min(460px, 70%); height: auto; filter: drop-shadow(0 22px 50px rgba(0,0,0,.5)); }
.auth-hero .wordmark { font-family: var(--font-display); font-size: clamp(2.6rem, 5vw, 4.2rem); letter-spacing: .22em; color: #fff; font-weight: 600; line-height: 1; margin-top: .75rem; }
.auth-hero .eyebrow { color: var(--gold-300); letter-spacing: .2em; font-size: .78rem; text-transform: uppercase; }
.auth-hero .foot { position: absolute; left: 3rem; bottom: 2rem; }
.auth-card.wide { max-width: 640px; }
.demo-accounts > summary { cursor: pointer; list-style: none; }
.demo-accounts > summary::-webkit-details-marker { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.choice { display: flex; gap: .55rem; align-items: flex-start; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .7rem .8rem; cursor: pointer; background: var(--paper); }
.choice:has(input:checked) { border-color: var(--gold-500); box-shadow: 0 0 0 2px var(--gold-200); }
.choice small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.35; margin-top: .15rem; }
.choice input { margin-top: .2rem; min-height: 0; }
.qr { background: #fff; display: inline-block; padding: .6rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qr svg { display: block; width: 210px; height: 210px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: .1em; padding: .5rem .7rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-xs); text-align: center; }
.input-reveal { position: relative; }
.input-reveal input { width: 100%; padding-right: 2.6rem; }
.input-reveal .icon-btn { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: .35rem; }
.pw-meter i { height: 5px; border-radius: 99px; background: var(--line); }
.pw-meter i.on.s1 { background: var(--danger); } .pw-meter i.on.s2 { background: var(--warning); }
.pw-meter i.on.s3 { background: var(--gold-500); } .pw-meter i.on.s4 { background: var(--success); }
.pw-help.ok { color: var(--success); }
.copy-row { display: flex; gap: .4rem; } .copy-row input { flex: 1; font-family: var(--font-mono); font-size: .78rem; }
.wrap { flex-wrap: wrap; }

/* ---- banners, back button ------------------------------------------------ */
.banner.platform { background: #4a1d6b; color: #fff; font-weight: 500; }
.banner.platform .btn { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }
.back-top { margin-right: .25rem; }
.back-top[disabled], .back-btn[disabled] { opacity: .35; cursor: default; }

/* ---- type-ahead picker ----------------------------------------------------- */
.picker { position: relative; }
.picker-box { position: relative; }
.picker-box input { width: 100%; padding-right: 2rem; }
.picker-clear { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; font-size: 1.2rem; color: var(--muted); cursor: pointer; line-height: 1; }
.picker-results { position: absolute; z-index: 40; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; }
.picker-item { padding: .5rem .7rem; cursor: pointer; font-size: .88rem; border-bottom: 1px solid var(--line); }
.picker-item:last-child { border-bottom: 0; }
.picker-item .sub { font-size: .76rem; color: var(--muted); }
.picker-item.sel, .picker-item:hover { background: var(--navy-50); }
.picker-empty { padding: .6rem .7rem; color: var(--muted); font-size: .84rem; }

/* ---- duration stepper ------------------------------------------------------- */
.hm { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hm .hm-box { display: flex; align-items: center; gap: .3rem; }
.hm .hm-box input { width: 4.6rem; text-align: center; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hm .hm-box span { color: var(--muted); font-size: .8rem; }
.hm .chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip-btn { border: 1px solid var(--line-2); background: var(--paper); border-radius: 99px; padding: .22rem .65rem; font-size: .78rem; cursor: pointer; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--gold-500); color: var(--ink); }

/* ---- calendar: clickable days, custom colours, filters --------------------- */
.cal-cell[data-date] { cursor: pointer; position: relative; }
.cal-cell[data-date]:hover { box-shadow: inset 0 0 0 2px var(--gold-300); }
.cal-cell[data-date]:hover .day::after { content: "+ add"; font-weight: 500; font-size: .66rem; color: var(--gold-700); }
.cal-ev.custom { background: color-mix(in srgb, var(--ev) 14%, var(--paper)); color: var(--ink); border-left-color: var(--ev); }
.change-list { margin: .4rem 0 0; padding: 0; list-style: none; display: grid; gap: .3rem; }
.change-list li { display: grid; grid-template-columns: 120px 1fr; gap: .6rem; font-size: .88rem; padding: .35rem .55rem; background: var(--paper-2); border-radius: var(--radius-xs); }
.change-list .was { color: var(--muted); text-decoration: line-through; margin-right: .4rem; }

/* ---- charts (server-rendered SVG) ------------------------------------------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-ui); font-size: 11px; fill: var(--muted); }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .bar { fill: var(--navy-600); } .chart .bar.alt { fill: var(--gold-500); } .chart .bar.good { fill: var(--success); } .chart .bar.bad { fill: var(--danger); }
.chart .line { fill: none; stroke: var(--navy-600); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.alt { stroke: var(--gold-500); }
.chart .area { fill: var(--navy-600); opacity: .1; }
.chart .dotp { fill: var(--paper); stroke: var(--navy-600); stroke-width: 2; }
.chart .val { fill: var(--ink-2); font-weight: 600; }
.legend-row { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--ink-2); }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; gap: .6rem; align-items: center; font-size: .84rem; padding: .28rem 0; }
.hbar .track { height: 10px; background: var(--navy-50); border-radius: 99px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-700), var(--navy-600)); border-radius: 99px; }
.hbar .fill.gold { background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); }
.hbar .fill.good { background: var(--success); } .hbar .fill.bad { background: var(--danger); }
.hbar .v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.hbar .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-wrap { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex: none; }
.donut-center { font-family: var(--font-ui); font-size: 15px; font-weight: 700; fill: var(--ink); }
.donut-sub { font-size: 9px; fill: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.delta { font-size: .76rem; font-weight: 600; } .delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* ---- time dashboard -------------------------------------------------------------- */
.time-ring { display: flex; align-items: center; gap: 1rem; }
.time-ring svg { width: 108px; height: 108px; flex: none; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; align-items: end; height: 170px; padding-top: .5rem; }
.week-bars .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .25rem; text-decoration: none; color: inherit; }
.week-bars .stack-bar { width: 70%; max-width: 46px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 2px 2px; overflow: hidden; background: var(--navy-50); min-height: 3px; }
.week-bars .seg-b { background: var(--navy-600); } .week-bars .seg-n { background: var(--gold-400); }
.week-bars .lbl { font-size: .72rem; color: var(--muted); } .week-bars .tot { font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-bars .col.today .lbl { color: var(--gold-700); font-weight: 700; }
.matter-time { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .6rem; background: var(--paper); }
.matter-time > summary { display: grid; grid-template-columns: 1fr auto auto auto; gap: 1rem; align-items: center; padding: .7rem .9rem; cursor: pointer; list-style: none; }
.matter-time > summary::-webkit-details-marker { display: none; }
.matter-time > summary .ref { font-weight: 600; } .matter-time > summary .sub { color: var(--muted); font-size: .8rem; }
.matter-time[open] > summary { border-bottom: 1px solid var(--line); background: var(--paper-2); }
.tag.billable { background: var(--info-bg); color: var(--info); } .tag.nonbill { background: var(--gold-100); color: var(--gold-700); }

/* ---- grouped lists (matters by category / client / attorney) ------------------------ */
.group-head { display: flex; justify-content: space-between; align-items: center; padding: .55rem 1.15rem; background: var(--navy-50); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 600; font-size: .86rem; }
.group-head .count { color: var(--muted); font-weight: 500; font-size: .78rem; }
details.group > summary { list-style: none; cursor: pointer; } details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .group-head .gname::before { content: "\25B8"; margin-right: .5rem; color: var(--muted); } details.group[open] > summary .group-head .gname::before { content: "\25BE"; }

/* ---- document preview ----------------------------------------------------------------- */
.preview-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #525659; }
.preview-img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; border-radius: var(--radius-xs); box-shadow: var(--shadow); background: #fff; }
.preview-doc { background: #fff; color: #111; padding: clamp(1rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: var(--radius-sm); max-width: 900px; margin: 0 auto; box-shadow: var(--shadow-sm); line-height: 1.55; overflow-wrap: anywhere; }
.preview-doc h1, .preview-doc h2, .preview-doc h3 { font-family: var(--font-ui); color: #111; margin: 1em 0 .4em; }
.preview-doc table { border-collapse: collapse; margin: .6rem 0; font-size: .86rem; } .preview-doc td, .preview-doc th { border: 1px solid #ccc; padding: .25rem .5rem; vertical-align: top; }
.preview-doc p { margin: 0 0 .7em; min-height: 1em; }
.preview-sheet { overflow: auto; max-height: 76vh; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.preview-sheet table { border-collapse: collapse; font-size: .8rem; color: #111; }
.preview-sheet td, .preview-sheet th { border: 1px solid #d9d9d9; padding: .2rem .5rem; white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.preview-sheet th { background: #f1f1f1; position: sticky; top: 0; font-weight: 600; color: #555; } .preview-sheet td.rn { background: #f1f1f1; color: #777; position: sticky; left: 0; text-align: right; }
.preview-text { white-space: pre-wrap; font-family: var(--font-mono); font-size: .82rem; background: #fff; color: #111; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 78vh; overflow: auto; }
.file-ico { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 22px; padding: 0 .35rem; border-radius: 5px; font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--muted); }
.file-ico.pdf { background: #c0392b; } .file-ico.doc, .file-ico.docx, .file-ico.rtf, .file-ico.odt { background: #2b5797; } .file-ico.xls, .file-ico.xlsx, .file-ico.csv { background: #1e7145; }
.file-ico.ppt, .file-ico.pptx { background: #d24726; } .file-ico.png, .file-ico.jpg, .file-ico.jpeg, .file-ico.gif, .file-ico.tif, .file-ico.tiff { background: #7d3c98; } .file-ico.zip { background: #7f6a00; } .file-ico.msg, .file-ico.eml { background: #0e7490; }

/* ---- library ------------------------------------------------------------------------------ */
.lib-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.lib-nav a { display: flex; justify-content: space-between; padding: .4rem .7rem; border-radius: var(--radius-xs); color: var(--ink-2); font-size: .88rem; }
.lib-nav a.active, .lib-nav a:hover { background: var(--navy-50); color: var(--ink); text-decoration: none; }
.lib-nav .t { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: .8rem .7rem .3rem; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.lib-card { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-sm); padding: .85rem .95rem; display: flex; flex-direction: column; gap: .4rem; box-shadow: var(--shadow-sm); }
.lib-card:hover { border-color: var(--gold-400); }
.lib-card .ttl { font-weight: 600; line-height: 1.3; color: var(--ink); }
.lib-card .meta { font-size: .76rem; color: var(--muted); }
.lib-card .acts { margin-top: auto; display: flex; gap: .35rem; flex-wrap: wrap; padding-top: .4rem; }

/* ---- dashboard customisation --------------------------------------------------------------- */
.sort-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--paper); margin-bottom: .35rem; }
.sort-row .grow { flex: 1; } .sort-row .rank { width: 1.6rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.star { border: 0; background: transparent; cursor: pointer; color: var(--muted-2); padding: 0 .2rem; } .star.on { color: var(--gold-500); } .star.on svg { fill: currentColor; }
.prio-tag { font-size: .68rem; color: var(--gold-700); background: var(--gold-100); border-radius: 99px; padding: .05rem .45rem; margin-left: .35rem; }

@media (max-width: 900px) { .lib-layout { grid-template-columns: 1fr; } .auth-hero-mark { align-items: center; padding-left: 0; text-align: center; } .auth-hero .foot { position: static; margin-top: 2rem; } .matter-time > summary { grid-template-columns: 1fr auto; } }
@media print { .sidebar, .topbar, .banner, .back-btn, .actions, .toasts { display: none !important; } .main { margin: 0 !important; } }

/* pickers and labels on the navy cards */
.card.navy .picker label, .on-navy label { color: rgba(255,255,255,.85); }
.card.navy .picker-results { color: var(--ink); }
.card.navy .hm .hm-box input, .card.navy select, .card.navy input { color: var(--ink); background: var(--paper); }
.card.navy .chip-btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.card.navy .segmented button { color: rgba(255,255,255,.75); }
.card.navy .segmented button.active { background: var(--paper); color: var(--ink); }
details.card > summary { list-style: none; } details.card > summary::-webkit-details-marker { display: none; }

/* entries that came from the viewer's own linked Google Calendar */
.cal-ev.gcal { background: #e8f0fe; color: #174ea6; border-left-color: #1a73e8; border-left-style: dashed; }
:root[data-theme="dark"] .cal-ev.gcal { background: #17305c; color: #c6dafc; }

/* task status, changeable in place */
.status-form { display: inline-block; }
.status-select { min-height: 30px; padding: .15rem 1.6rem .15rem .6rem; border-radius: 99px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line-2); background-color: var(--paper); cursor: pointer; }
.status-select.s-todo { color: var(--ink-2); }
.status-select.s-in_progress { color: var(--info); background-color: var(--info-bg); border-color: transparent; }
.status-select.s-waiting { color: var(--warning); background-color: var(--warning-bg); border-color: transparent; }
.status-select.s-done { color: var(--success); background-color: var(--success-bg); border-color: transparent; }

/* ---- professional fee lines on a bill: a wrapping grid, never a sideways-scrolling table -------------------------- */
.pf-lines { display: flex; flex-direction: column; gap: .75rem; }
.pf-line { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: .6rem .8rem; padding: .85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2, rgba(0,0,0,.015)); }
.pf-line[hidden] { display: none; }
.pf-line .field { margin: 0; min-width: 0; }
.pf-line .field input, .pf-line .field select { width: 100%; min-width: 0; }
.pf-line .pf-num { grid-column: span 2; }
.pf-line .pf-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pf-line .pf-total { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 720px) {
  .pf-line { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pf-line .pf-cat { grid-column: span 2; }
  .pf-line .pf-desc { grid-column: span 4; }
  .pf-line .pf-num { grid-column: span 2; }
}
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.segmented.wrap { flex-wrap: wrap; height: auto; }

/* ---- global search bar ------------------------------------------------------------------------------------------- */
.gsearch { position: relative; flex: 1; max-width: 620px; min-width: 0; }
.gsearch-box { position: relative; display: flex; align-items: center; gap: .55rem; height: 42px; padding: 0 .6rem 0 .85rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper); box-shadow: var(--shadow-sm); transition: border-color .18s, box-shadow .18s, border-radius .18s, background .18s; }
.gsearch-box:hover { border-color: var(--gold-400); }
.gsearch-box:focus-within { border-color: var(--gold-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold-400) 22%, transparent), var(--shadow); }
.gsearch.open .gsearch-box { border-radius: 16px 16px 0 0; border-bottom-color: transparent; box-shadow: none; }
.gsearch-ico { display: inline-flex; color: var(--muted); flex: none; transition: color .18s, transform .18s; }
.gsearch-box:focus-within .gsearch-ico { color: var(--gold-600); transform: scale(1.06); }
.gsearch-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0; font-size: .92rem; color: var(--ink); box-shadow: none; }
.gsearch-box input:focus { outline: 0; box-shadow: none; border: 0; }
.gsearch-box input::placeholder { color: var(--muted-2); }
.gsearch-box input::-webkit-search-cancel-button { display: none; }
.gsearch-kbd { flex: none; font-family: var(--font-ui); font-size: .68rem; letter-spacing: .02em; padding: .12rem .45rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--paper-2); color: var(--muted); }
.gsearch-box:focus-within .gsearch-kbd { display: none; }
.gsearch-clear { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--navy-50); color: var(--muted); cursor: pointer; }
.gsearch-clear:hover { background: var(--navy-100); color: var(--ink); }
.gsearch-clear[hidden] { display: none; }
.gsearch-spin { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--gold-200); border-top-color: var(--gold-600); opacity: 0; transition: opacity .15s; }
.gsearch.busy .gsearch-spin { opacity: 1; animation: gs-spin .7s linear infinite; }
@keyframes gs-spin { to { transform: rotate(360deg); } }

.gsearch-panel { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: var(--paper); border: 1px solid var(--gold-500); border-top: 1px solid var(--line);
  border-radius: 0 0 16px 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: gs-drop .16s ease-out; }
.gsearch-panel[hidden] { display: none; }
@keyframes gs-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.gsearch-body { max-height: min(64vh, 560px); overflow-y: auto; padding: .35rem .4rem .5rem; scrollbar-width: thin; }
.gs-group + .gs-group { margin-top: .15rem; padding-top: .25rem; border-top: 1px solid var(--line); }
.gs-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .7rem .3rem; font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-600); }
.gs-count { min-width: 18px; padding: 0 .35rem; border-radius: 999px; background: var(--gold-100); color: var(--gold-700); font-size: .66rem; letter-spacing: 0; text-align: center; }
.gs-link { border: 0; background: none; padding: 0; font: inherit; letter-spacing: .06em; color: var(--muted); cursor: pointer; }
.gs-link:hover { color: var(--danger); }
.gs-item { position: relative; display: flex; align-items: center; gap: .75rem; padding: .5rem .7rem; border-radius: 10px; color: var(--ink); text-decoration: none; transition: background .12s; }
.gs-item:hover { text-decoration: none; }
.gs-item.sel { background: linear-gradient(90deg, var(--navy-50), color-mix(in srgb, var(--gold-100) 55%, transparent)); }
.gs-item.sel::before { content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--gold-500); }
.gs-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--navy-50); color: var(--navy-700); }
.gs-ico.k-contacts, .gs-ico.t-gold { background: var(--gold-100); color: var(--gold-700); }
.gs-ico.k-documents { background: var(--info-bg); color: var(--info); }
.gs-ico.k-invoices { background: var(--success-bg); color: var(--success); }
.gs-ico.k-tasks { background: var(--warning-bg); color: var(--warning); }
.gs-ico.k-events { background: var(--danger-bg); color: var(--danger); }
.gs-ico.t-navy { background: var(--navy-900); color: #fff; }
.gs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.gs-label { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item .gs-label { color: var(--ink); }
.gs-item .gs-title { font-weight: 400; color: var(--ink-2); }
.gs-all .gs-label, .gs-item.gs-all .gs-label { color: var(--navy-700); }
.gs-sub { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item mark { background: color-mix(in srgb, var(--gold-300) 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.gs-badge { flex: none; font-size: .66rem; font-weight: 600; letter-spacing: .03em; padding: .14rem .5rem; border-radius: 999px; background: var(--paper-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.gs-badge.t-navy { background: var(--navy-50); color: var(--navy-700); border-color: var(--navy-100); }
.gs-badge.t-gold { background: var(--gold-100); color: var(--gold-700); border-color: var(--gold-200); }
.gs-badge.t-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.gs-badge.t-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.gs-badge.t-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.gs-badge.t-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.gs-go { flex: none; display: inline-flex; color: var(--gold-600); opacity: 0; transform: translateX(-4px); transition: opacity .12s, transform .12s; }
.gs-item.sel .gs-go { opacity: 1; transform: none; }
.gs-all .gs-label { color: var(--navy-700); }
.gs-empty { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.6rem 1.5rem 1.1rem; text-align: center; color: var(--muted); font-size: .82rem; }
.gs-empty b { color: var(--ink); font-size: .95rem; font-family: var(--font-display); font-size: 1.15rem; }
.gs-empty-ico { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--gold-100); color: var(--gold-700); margin-bottom: .2rem; }
.gs-skel { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; }
.gs-skel i, .gs-skel b { display: block; border-radius: 9px; background: linear-gradient(90deg, var(--navy-50) 25%, var(--paper-2) 45%, var(--navy-50) 65%); background-size: 300% 100%; animation: gs-shimmer 1.1s linear infinite; }
.gs-skel i { width: 32px; height: 32px; flex: none; }
.gs-skel b { height: 12px; flex: 1; max-width: 60%; }
.gs-skel:nth-child(odd) b { max-width: 78%; }
@keyframes gs-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.gsearch-foot { display: flex; align-items: center; gap: 1rem; padding: .5rem .9rem; border-top: 1px solid var(--line); background: var(--paper-2); font-size: .7rem; color: var(--muted); }
.gsearch-foot kbd { font-family: var(--font-ui); font-size: .66rem; padding: 0 .3rem; margin-right: .15rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--paper); }
.gsearch-foot-note { margin-left: auto; display: inline-flex; align-items: center; gap: .3rem; }
.gsearch-mobile { display: none; }
[data-theme="dark"] .gs-item.sel { background: linear-gradient(90deg, rgba(255,255,255,.07), rgba(201,164,92,.10)); }
[data-theme="dark"] .gs-ico, [data-theme="dark"] .gsearch-clear { background: rgba(255,255,255,.07); color: var(--ink-2); }
[data-theme="dark"] .gs-ico.k-matters { background: rgba(96,134,214,.18); color: #a9c1f2; }
[data-theme="dark"] .gs-ico.k-contacts, [data-theme="dark"] .gs-ico.t-gold { background: rgba(201,164,92,.18); color: #e3c988; }
[data-theme="dark"] .gs-ico.k-documents { background: rgba(80,150,230,.18); color: #9cc6f5; }
[data-theme="dark"] .gs-ico.k-invoices { background: rgba(60,170,110,.18); color: #8fd6ae; }
[data-theme="dark"] .gs-ico.k-tasks { background: rgba(220,150,50,.18); color: #ecc07f; }
[data-theme="dark"] .gs-ico.k-events { background: rgba(220,80,70,.18); color: #f0a39d; }
[data-theme="dark"] .gs-ico.t-navy { background: var(--gold-500); color: #14100a; }
[data-theme="dark"] .gs-badge.t-navy { background: rgba(255,255,255,.07); color: var(--ink-2); border-color: transparent; }
[data-theme="dark"] .gs-item.gs-all .gs-label { color: var(--gold-300); }
[data-theme="dark"] .gs-item mark { background: rgba(201,164,92,.30); color: #f3dfae; }
[data-theme="dark"] .gs-count { background: rgba(201,164,92,.16); color: var(--gold-300); }
[data-theme="dark"] .gs-skel i, [data-theme="dark"] .gs-skel b { background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.11) 45%, rgba(255,255,255,.05) 65%); background-size: 300% 100%; }
@media (max-width: 900px) {
  .gsearch { display: none; }
  .gsearch-mobile { display: inline-flex; }
  .gsearch.mobile-open { display: block; position: fixed; left: .6rem; right: .6rem; top: .65rem; max-width: none; z-index: 70; }
  .gsearch-foot span:not(.gsearch-foot-note) { display: none; }
  .gsearch-foot-note { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .gsearch-panel, .gs-skel i, .gs-skel b, .gsearch.busy .gsearch-spin { animation: none; } }

/* ---- practice accounts ------------------------------------------------------------------------------------------- */
.acc-hero { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); gap: .75rem; align-items: stretch; }
.acc-net { background: radial-gradient(120% 140% at 0% 0%, var(--navy-700), var(--navy-950)); border: 0; position: relative; overflow: hidden; }
.acc-net::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 1px solid rgba(220,192,138,.22); box-shadow: 0 0 0 28px rgba(220,192,138,.05), 0 0 0 64px rgba(220,192,138,.03); pointer-events: none; }
.acc-net-value { color: #fff; font-size: 2.6rem !important; margin: .15rem 0 .1rem; }
.acc-net-value.neg { color: #f4b4ae; }
.acc-net .delta.up { color: #9fe0bd; } .acc-net .delta.down { color: #f4b4ae; } .acc-net .muted { color: rgba(255,255,255,.55); }
.acc-flow { display: flex; flex-direction: column; gap: .15rem; border-top: 1px solid rgba(255,255,255,.14); padding-top: .7rem; position: relative; z-index: 1; }
.acc-flow-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .86rem; color: rgba(255,255,255,.82); padding: .18rem 0; font-variant-numeric: tabular-nums; }
.acc-flow-row b { color: #fff; font-weight: 600; white-space: nowrap; }
.acc-flow-row.in span::before, .acc-flow-row.out span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .5rem; background: #7fd3a6; }
.acc-flow-row.out span::before { background: var(--gold-400); }
.acc-flow-row.sub { font-size: .76rem; color: rgba(255,255,255,.55); padding-left: 1rem; } .acc-flow-row.sub b { color: rgba(255,255,255,.7); font-weight: 500; }
.acc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.acc-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.1rem; }
.acc-notes > div { display: flex; flex-direction: column; gap: .15rem; } .acc-notes b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.success-text { color: var(--success); }
.field.combo select + div input { width: 100%; }
@media (max-width: 1180px) { .acc-hero { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .acc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .acc-kpis { grid-template-columns: 1fr; } }

.choice .sub { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); margin-top: .1rem; }

/* ---- platform purge ---- */
.purge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .6rem; }
.purge-choice:has(input:checked) { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-bg); }
.purge-audit { border-style: dashed; }
