/*!
 * CaseDesk — Legal Case Management HTML Dashboard
 * Version 1.0.0 · Plain CSS, no build step required.
 *
 * Contents
 *  1. Fonts
 *  2. Design tokens (light + dark)
 *  3. Base
 *  4. App layout (sidebar, topbar, content)
 *  5. Components (card, button, badge, form, table, tabs, dropdown, modal, toast …)
 *  6. Page parts (KPIs, charts, case header, timeline, calendar, kanban, cause list, invoice, auth)
 *  7. Utilities
 *  8. Responsive + print
 */

/* 1. Fonts ------------------------------------------------------------- */
@font-face {
  font-family: "Public Sans";
  src: url("public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: block;
}
@font-face {
  font-family: "Newsreader";
  src: url("newsreader-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: block;
}

/* Parts drawn by a script from the page's JSON (case, client, invoice, calendar, cause list) stay invisible
   until they are drawn, so the page does not jump. If the script cannot run they appear after 2 seconds anyway. */
[data-pending], body:has([data-pending]) .footer { visibility: hidden; animation: cd-reveal 0s 2s forwards; }
@keyframes cd-reveal { to { visibility: visible; } }

/* 2. Tokens ------------------------------------------------------------ */
:root {
  /* Brand — change these to rebrand the whole template */
  --primary: #1f3d64;
  --primary-strong: #152c4a;
  --primary-soft: #e3eaf3;
  --accent: #a8803a;
  --accent-soft: #f5edde;

  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #f9f8f4;
  --ink: #161a21;
  --ink-2: #454b57;
  --ink-3: #5e6471;
  --line: #e4e1d8;
  --line-strong: #cfcbc0;

  /* Sidebar is dark in both themes */
  --side-bg: #111823;
  --side-line: rgba(255, 255, 255, .08);
  --side-ink: #f0eee8;
  --side-ink-2: #b4bac6;
  --side-ink-3: #8a91a0;
  --side-hover: rgba(255, 255, 255, .06);

  --success: #1d7a46;
  --success-soft: #e2f3e8;
  --warning: #b7791f;
  --warning-text: #87591a;
  --warning-soft: #fbefd8;
  --danger: #b3382b;
  --danger-soft: #fbe5e1;
  --info: #2b6386;
  --info-soft: #e1edf5;

  /* Chart series */
  --c1: var(--primary);
  --c2: var(--accent);
  --c3: #2f7a6b;
  --c4: #a5503f;
  --c5: #6b5ca5;

  --font-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-lg: 12px;
  --r-md: 9px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 24, 32, .05), 0 6px 20px -12px rgba(20, 24, 32, .14);
  --shadow-pop: 0 14px 40px -12px rgba(20, 24, 32, .3);
  /* Type scale */
  --fs-xs: 12px;     /* uppercase labels, table headings */
  --fs-sm: 13px;     /* secondary text, timestamps, case IDs */
  --fs-base: 15px;   /* body text */
  --fs-table: 14px;  /* table cells */
  /* Spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --focus-ring: var(--primary);
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
  color-scheme: light;
}

[data-theme="dark"] {
  --primary: #93b6e8;
  --primary-strong: #b2cbf0;
  --primary-soft: #18253a;
  --accent: #d8b46b;
  --accent-soft: #302716;

  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1b2029;
  --ink: #ebe9e3;
  --ink-2: #bcc0c9;
  --ink-3: #8f95a1;
  --line: #262c36;
  --line-strong: #353c48;

  --side-bg: #0a0d12;

  --success: #5cc78a;
  --success-soft: #15291d;
  --warning: #e7b45a;
  --warning-text: #e7b45a;
  --warning-soft: #33280f;
  --danger: #f2806f;
  --danger-soft: #3a1915;
  --info: #80b6d8;
  --info-soft: #14242e;

  --c1: var(--primary);
  --c2: var(--accent);
  --c3: #6cc0ae;
  --c4: #e0907f;
  --c5: #ab9de0;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -12px rgba(0, 0, 0, .55);
  --shadow-pop: 0 16px 48px -12px rgba(0, 0, 0, .75);
  --focus-ring: var(--accent);
  color-scheme: dark;
}

/* 3. Base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-ui); color: var(--ink); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1, h2, .serif { font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: 31px; font-weight: 600; overflow-wrap: break-word; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 15.5px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }
.sidebar :focus-visible, .auth-art :focus-visible { outline-color: #d8b46b; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
table { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* The "Skip to content" link appears when it gets keyboard focus */
a.sr-only:focus { position: fixed; top: 10px; left: 10px; z-index: 200; width: auto; height: auto; clip: auto; overflow: visible; padding: 10px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: var(--focus); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* 4. Layout ------------------------------------------------------------ */
.app { --sb: var(--sidebar-w); display: grid; grid-template-columns: var(--sb) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--side-bg) 0 var(--sb), transparent var(--sb)); }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--side-bg); color: var(--side-ink-2);
  display: flex; flex-direction: column;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 20px; border-bottom: 1px solid var(--side-line); color: var(--side-ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 23px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 6px; }
.brand-name small { font: 600 11.5px var(--font-mono); letter-spacing: .08em; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); padding: 1px 5px; border-radius: 4px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; scrollbar-width: thin; scrollbar-color: #33353d transparent; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-title { font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--side-ink-3); padding: 0 10px 6px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-md);
  color: var(--side-ink-2); font-weight: 500; font-size: 14.5px;
}
.nav a:hover { background: var(--side-hover); color: var(--side-ink); text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #d4ad62; }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav a.active svg { color: #d8b46b; }
.nav .count { margin-left: auto; font: 600 var(--fs-xs) var(--font-mono); background: rgba(216, 180, 107, .16); color: #e2c283; padding: 1px 7px; border-radius: 99px; }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--side-line); }
.register-note { display: flex; gap: 11px; align-items: flex-start; padding: 12px 13px; border-radius: var(--r-md); background: rgba(255, 255, 255, .05); border: 1px solid var(--side-line); color: var(--side-ink-2); font-size: 12.5px; line-height: 1.4; }
.register-note:hover { text-decoration: none; background: rgba(255, 255, 255, .08); }
.register-note b { display: block; color: var(--side-ink); font-size: 13.5px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #d8b46b; margin-top: 5px; flex: none; box-shadow: 0 0 0 3px rgba(216, 180, 107, .2); }

.sidebar-backdrop { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; height: 40px; padding: 0 64px 0 38px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); }
.search kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; font: 600 var(--fs-xs) var(--font-mono); color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-actions .btn { margin-right: 6px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; border-radius: var(--r-md); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg); }
.menu-toggle { display: none; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who b { display: block; font-size: 13.5px; }
.user-btn .who small { color: var(--ink-3); font-size: 12px; }

.content { padding: 28px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.crumbs span::before { content: "/"; margin-right: 6px; }
/* Links inside running text are underlined so they don't rely on colour alone */
p a:not(.btn), .check a { text-decoration: underline; text-underline-offset: 2px; }
.footer { margin-top: auto; padding: 18px 28px; font-size: 13px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
.stack > * + * { margin-top: 20px; }

/* Collapsed sidebar (desktop) */
.sidebar-collapsed .app { --sb: 76px; }
.sidebar-collapsed .brand-name, .sidebar-collapsed .nav-title, .sidebar-collapsed .nav span:not(.sr-only),
.sidebar-collapsed .nav .count, .sidebar-collapsed .sidebar-foot { display: none; }
.sidebar-collapsed .nav a { justify-content: center; }
.sidebar-collapsed .brand { justify-content: center; padding: 0; }

/* 5. Components -------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.card-body { padding: 18px 20px 20px; }
.card-flush { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .btn-primary { color: #0b1626; }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1f1504; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
[data-theme="dark"] .btn-danger { background: #b3382b; border-color: #b3382b; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; background: var(--c3); }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person b { display: block; font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Forms */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%237a7d87' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: 12.5px; display: none; }
.is-invalid ~ .error-text, .field.has-error .error-text, .field:has(.is-invalid) .error-text { display: block; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); min-width: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 13px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface-2); color: var(--ink-3); font-size: 14px; }
.input-group .addon-l { order: -1; border-left: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); font-family: var(--font-mono); }
.input-group .addon-l + .input { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .icon-btn { position: absolute; right: 2px; top: 1px; width: 40px; height: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field + .field { margin-top: 0; }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 24px; background: var(--line-strong); border-radius: 99px; position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

.dropzone { display: block; width: 100%; font: inherit; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 26px; text-align: center; color: var(--ink-2); background: var(--surface-2); cursor: pointer; }
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone svg { width: 30px; height: 30px; margin: 0 auto 8px; color: var(--primary); }

/* Table */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
.table th { text-align: left; font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .right, .table th.right { text-align: right; }
.table td.num, .table td .num { font-size: 13.5px; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: "↕"; margin-left: 6px; opacity: .35; }
.table th[data-dir="asc"]::after { content: "↑"; opacity: 1; }
.table th[data-dir="desc"]::after { content: "↓"; opacity: 1; }
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.table-tools .input, .table-tools .select { height: 38px; width: auto; }
.table-tools .input { min-width: 240px; flex: 1; max-width: 340px; }
.pager { display: flex; flex-wrap: wrap; gap: 4px; }
.pager-gap { min-width: 18px; height: 34px; display: inline-grid; place-items: center; color: var(--ink-3); }
.pager button { min-width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; }
.pager button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: default; }
@media (prefers-reduced-motion: no-preference) { tr.flash td { animation: flash 1.2s ease-out; } @keyframes flash { from { background: var(--accent-soft); } } }
.empty-row td { text-align: center; padding: 40px 16px; color: var(--ink-3); }

/* Tabs */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; overflow-y: hidden; }
.tab { background: none; border: 0; padding: 11px 14px; font-weight: 600; font-size: 14px; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--primary); }
.tab-panel[hidden] { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; }
.tab svg { width: 17px; height: 17px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

/* Dropdown */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; display: none;
}
.dropdown.open > .menu { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); background: none; border: 0; font-size: 14px; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu svg { width: 17px; height: 17px; }
.menu hr { margin: 6px 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.menu-head .link-btn { width: auto; padding: 0; font-size: 13px; font-weight: 600; color: var(--primary); }
.notif { display: flex; gap: 11px; padding: 10px; border-radius: var(--r-sm); }
.notif:hover { background: var(--surface-2); }
.notif p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.notif p b { color: var(--ink); }
.notif small { color: var(--ink-3); font-size: 12px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 13, 18, .55); }
.modal-dialog { position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: no-preference) {
  .modal.open .modal-dialog { animation: pop .18s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
}

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px; padding: 12px 14px; border-radius: var(--r-md); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); font-size: 14px; }
.toast svg { width: 19px; height: 19px; color: #d8b46b; flex: none; }
[data-theme="dark"] .toast svg { color: #8a6a2c; }

/* Alerts, progress, misc */
.alert { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--r-md); font-size: 14px; border: 1px solid transparent; }
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert p { margin: 2px 0 0; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert b { color: inherit; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.progress.tone-warning > span { background: var(--accent); }
.progress.tone-success > span { background: var(--success); }
.progress.tone-danger > span { background: var(--danger); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li > .person, .person > div { min-width: 0; }
.list > li > b, .list > li > .badge { flex-shrink: 0; }
.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list > li:first-child { padding-top: 0; }
.muted { color: var(--ink-3); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 13px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.trend svg { width: 14px; height: 14px; }
.kbd { font: 600 var(--fs-xs) var(--font-mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface-2); color: var(--ink-2); }

/* 6. Page parts -------------------------------------------------------- */
/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px 16px; min-width: 0; }
.kpi-label { font-size: 13.5px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi-label i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.kpi-value { font-family: var(--font-display); font-size: 34px; font-weight: 600; margin: 8px 0 4px; line-height: 1.1; white-space: nowrap; }
.kpi-value small { font: 600 14px var(--font-ui); color: var(--ink-3); margin-left: 6px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.kpi-spark { height: 34px; margin-top: 10px; }

.stat { display: flex; align-items: center; gap: 14px; }
.stat .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .ic svg { width: 21px; height: 21px; }
.stat b { font: 600 24px var(--font-display); display: block; line-height: 1.15; }
.stat span { color: var(--ink-3); font-size: 13px; }
.stat b span { font: inherit; color: inherit; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart .axis text { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font-mono); }
.chart .gridline { stroke: var(--line); stroke-dasharray: 3 4; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); border-radius: var(--r-md); padding: 9px 11px; font-size: 12.5px; min-width: 140px; opacity: 0; transition: opacity .1s; z-index: 5; }
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; font-size: 12.5px; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.chart-tip div span { margin-left: auto; color: var(--ink); font-weight: 600; padding-left: 12px; font-family: var(--font-mono); }
.chart-tip i, .legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.donut-wrap { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 20px; align-items: center; }
.card-body:has(> .donut-wrap) { container-type: inline-size; }
@container (max-width: 340px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .donut-wrap > .list { width: 100%; } }
.donut-center { font-family: var(--font-mono); }

.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; font-size: 14px; }
.bar-row + .bar-row { margin-top: 14px; }
.bar-row .progress { grid-column: 1 / -1; height: 6px; }

/* Product tile (icon square) */
.thumb { width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; }
.thumb svg { width: 22px; height: 22px; }
.thumb-sm { width: 32px; height: 32px; border-radius: 8px; }
.thumb-sm svg { width: 17px; height: 17px; }
/* Category tints: set with style="--tb: background; --ti: icon colour" */
[style*="--tb"] { background: var(--tb); color: var(--ti); }
[data-theme="dark"] [style*="--tb"] { background: color-mix(in srgb, var(--ti) 26%, var(--surface-2)); color: color-mix(in srgb, var(--ti) 35%, #fff); }


/* Long names typed into forms wrap instead of widening the page */
.person b, .person small, .notif p, .case-title, .doc-row b { overflow-wrap: anywhere; }
td { overflow-wrap: break-word; }
.table .mono, .table td[data-value^="20"] { white-space: nowrap; }
.table td .person b, .table td .person small { overflow-wrap: normal; }
.user-btn .who b { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Invoice (A4) */
.invoice { padding: 40px; }
.invoice-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.invoice-title { font: 600 36px var(--font-display); letter-spacing: -.01em; }
.invoice-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 28px 0; }
.invoice-meta h2, .invoice-meta h3 { font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.invoice-meta p { margin: 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.invoice-meta p b { color: var(--ink); }
.totals { margin-left: auto; max-width: 320px; width: 100%; margin-top: 20px; }
.totals div { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; color: var(--ink-2); }
.totals div span:last-child { font-family: var(--font-mono); color: var(--ink); }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 12px; font-size: 20px; font-weight: 700; color: var(--ink); }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.side-tabs { display: grid; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 20px); }
.side-tabs .tab { text-align: left; border: 0; border-radius: var(--r-md); margin: 0; padding: 9px 12px; display: flex; align-items: center; gap: 10px; }
.side-tabs .tab svg { width: 18px; height: 18px; }
.side-tabs .tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-3); }
.saved-note { font-size: 13px; color: var(--success); display: inline-flex; align-items: center; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-form { display: flex; flex-direction: column; padding: 32px clamp(24px, 6vw, 88px); }
.auth-form .inner { margin: auto 0; width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 30px; margin: 0 0 8px; }
.auth-form .lead { color: var(--ink-2); margin-bottom: 26px; }
.auth-form .brand { border: 0; padding: 0; height: auto; color: var(--ink); }
.auth-art { position: relative; overflow: hidden; background: var(--side-bg); color: #f1efe9; padding: 48px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 26px; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 50% at 70% 20%, rgba(80, 120, 180, .35), transparent 70%), radial-gradient(50% 40% at 20% 90%, rgba(216, 180, 107, .2), transparent 70%); }
.auth-art p { position: relative; max-width: 400px; text-align: center; font: 500 23px/1.35 var(--font-display); margin: 0; }
/* Error page */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page p { color: var(--ink-2); max-width: 420px; margin: 12px auto 26px; }

/* ===== CaseDesk parts ===== */
.grow { flex: 1; min-width: 0; }
.d-block { display: block; }
.donut-center { font-family: var(--font-display); }
.eyebrow { font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
[data-theme="light"] .eyebrow { color: #87591a; }
.btn-outline { border-color: var(--line-strong); background: var(--surface); }
.list small { display: block; }
.list .text-right .badge { margin-top: 4px; }
.list .text-right { display: flex; flex-direction: column; align-items: flex-end; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Case cells in tables and lists */
.case-cell { min-width: 220px; }
.case-title { display: block; font-weight: 600; color: var(--ink); line-height: 1.35; }
.case-title:hover { color: var(--primary); }
.case-cell small { color: var(--ink-3); font-size: var(--fs-sm); }
.case-no { font-size: var(--fs-sm); font-weight: 600; }

/* Today in court */
.court-list { list-style: none; margin: 0; padding: 0; }
.court-item { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.court-item:first-child { padding-top: 0; }
.court-item:last-child { border-bottom: 0; padding-bottom: 0; }
.court-time { border-right: 2px solid var(--accent); padding-right: 12px; }
.court-time b { display: block; font-size: 17px; }
.court-time small { color: var(--ink-3); font-size: 12px; }
.court-main small { display: block; color: var(--ink-3); font-size: var(--fs-sm); }

/* Lists with a date block (deadlines) */
.dl-list > li { justify-content: flex-start; }
.dl-date { width: 44px; flex: none; text-align: center; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 0; background: var(--surface-2); line-height: 1.1; }
.dl-date b { display: block; font: 600 19px var(--font-display); }
.dl-date small { font: 600 11.5px var(--font-mono); text-transform: uppercase; color: var(--ink-3); }
.dl-date.is-late { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); color: var(--danger); }
.dl-date.is-late small { color: var(--danger); }
.area-bars .bar-row svg { width: 16px; height: 16px; color: var(--ink-3); }

/* Documents */
.doc-ic { width: 38px; height: 44px; border-radius: 6px; display: grid; place-items: end center; padding-bottom: 6px; flex: none; font: 700 9.5px var(--font-mono); letter-spacing: .04em; position: relative;
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%); }
.doc-row { justify-content: flex-start !important; }
.doc-row b { display: block; font-weight: 600; font-size: 14px; color: var(--ink); }
.doc-row small { font-size: var(--fs-sm); }
.doc-row .icon-btn { width: 34px; height: 34px; flex: none; }
.doc-row .icon-btn svg { width: 17px; height: 17px; }
.doc-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.doc-tools .input { width: 240px; height: 36px; margin-left: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip small { font: 600 var(--fs-xs) var(--font-mono); opacity: .75; }

/* Workload */
.load-list > li { gap: 16px; }
.load { display: flex; align-items: center; gap: 10px; width: 46%; flex: none; }
.load .progress { flex: 1; height: 6px; }
.load b { font-size: 12.5px; min-width: 48px; text-align: right; }

/* Case and client header */
.case-head { padding: 22px 24px 0; margin-bottom: 18px; }
.case-head-top { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.case-ic { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--primary); color: #fff; }
[data-theme="dark"] .case-ic { background: var(--primary-soft); color: var(--primary); }
.case-ic svg { width: 28px; height: 28px; }
.case-head-main { flex: 1; min-width: 260px; }
.case-head-main h1 { font-size: 30px; margin: 4px 0 4px; }
.case-meta-line { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.case-meta-line > * + *::before { content: "·"; margin-right: 14px; }
.case-kind { margin: 0 0 12px; color: var(--ink-2); }
.case-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.case-facts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 20px -24px 0; border-top: 1px solid var(--line); }
.case-facts > div { padding: 14px 18px; min-width: 0; }
.case-facts > div + div { border-left: 1px solid var(--line); }
.case-facts dt { font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.case-facts dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.case-facts dd small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.case-facts .person b a { color: var(--ink); }
.case-facts .person b, .case-facts .person small { white-space: normal; text-overflow: clip; overflow-wrap: normal; }
/* Six narrow columns (laptop widths): drop the avatars so names fit */
@media (min-width: 961px) and (max-width: 1360px) { .case-facts .person .avatar { display: none; } }
.client-head .avatar-lg { border-radius: 16px; }
.case-tabs { margin-bottom: 20px; }
.tab-n:not(:empty) { margin-left: 7px; font: 600 var(--fs-xs) var(--font-mono); padding: 1px 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3); }

/* Next hearing */
.next-hearing { display: flex; gap: 22px; padding: 22px; flex-wrap: wrap; }
.nh-date { width: 104px; flex: none; text-align: center; border-radius: var(--r-lg); background: var(--primary); color: #fff; padding: 14px 8px; align-self: flex-start; }
[data-theme="dark"] .nh-date { background: var(--primary-soft); color: var(--ink); }
.nh-date b { display: block; font: 600 46px/1 var(--font-display); margin: 4px 0; }
.nh-date small { display: block; font-size: 12.5px; opacity: .85; }
.nh-main { flex: 1; min-width: 240px; }
.nh-main h2 { font-size: 24px; margin: 4px 0 12px; }
.nh-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 18px; margin: 0 0 14px; }
.nh-facts dt { font-size: 12px; color: var(--ink-3); }
.nh-facts dd { margin: 0; font-weight: 600; font-size: 14px; }
.nh-prep { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); font-size: 14px; margin: 0 0 14px; }
.nh-prep svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--warning-text); }
.empty-note { text-align: center; color: var(--ink-3); }
.empty-note svg { width: 28px; height: 28px; margin: 0 auto 8px; }
.empty-note p { margin: 0 0 12px; }

/* Tasks */
.task-list .task { justify-content: flex-start; }
.task .check { align-self: flex-start; padding-top: 2px; }
.task.is-done b { text-decoration: line-through; color: var(--ink-3); }
.task small { font-size: var(--fs-sm); }

/* Notes */
.notes { display: grid; gap: 18px; }
.note { display: flex; gap: 12px; }
.note-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.note-head small { color: var(--ink-3); font-size: 12.5px; }
.note p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }

/* Key–value list */
.kv { margin: 0; display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv > div:first-child { padding-top: 0; }
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.kv .is-due dd { color: var(--warning-text); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; display: flex; gap: 16px; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-3); position: relative; z-index: 1; }
.tl-dot svg { width: 17px; height: 17px; }
.tl-item.is-done .tl-dot { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.tl-item.is-next .tl-dot { background: var(--accent); border-color: var(--accent); color: #1f1504; box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-item.is-future .tl-dot { border-style: dashed; }
.tl-body { padding-top: 2px; min-width: 0; }
.tl-body small { color: var(--ink-3); font-size: var(--fs-sm); }
.tl-body b { display: block; font-size: 15px; margin: 2px 0; }
.tl-body p { margin: 0; color: var(--ink-2); font-size: 14px; }
.tl-item.is-future .tl-body b, .tl-item.is-future .tl-body p { color: var(--ink-3); }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.feed-ic svg { width: 16px; height: 16px; }
.feed p { margin: 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.feed p b { color: var(--ink); font-weight: 600; }
.feed small { font-size: var(--fs-sm); white-space: nowrap; }

.missing { max-width: 520px; margin: 40px auto; text-align: center; padding: 40px 24px; }
.missing svg { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--ink-3); }
.missing p { color: var(--ink-2); }

/* New case stepper */
.stepper-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.stepper { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stepper li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink-3); min-width: 0; }
.stepper li span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 600 12.5px var(--font-mono); border: 1px solid var(--line-strong); }
.stepper li.is-on { border-color: var(--primary); color: var(--ink); box-shadow: var(--focus); }
.stepper li.is-on .n { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .stepper li.is-on .n { color: #0b1626; }
.stepper li.is-done { color: var(--ink-2); }
.stepper li.is-done .n { background: var(--success-soft); color: var(--success); border-color: transparent; }
.step-form { padding: 26px; }
.step-form h2 { font-size: 24px; }
.step-form h2:focus { outline: none; box-shadow: none; }
.step-form h2 + .muted { margin: 4px 0 0; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.segmented-radio { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); margin-top: 16px; }
.segmented-radio label { position: relative; cursor: pointer; }
.segmented-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented-radio span { display: block; padding: 7px 16px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--ink-3); }
.segmented-radio input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.segmented-radio input:focus-visible + span { box-shadow: var(--focus); }
.review { margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); }
.review > div { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; padding: 12px 14px; align-items: baseline; }
.review > div + div { border-top: 1px solid var(--line); }
.review dt { color: var(--ink-3); font-size: 13px; }
.review dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.check:has(.is-invalid) + .error-text { display: block; margin-top: 6px; }
.step-help h2 { font-size: 19px; margin-bottom: 14px; }
.help-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 14px; font-size: 14px; color: var(--ink-2); }
.help-list li { display: flex; gap: 10px; }
.help-list svg { width: 19px; height: 19px; flex: none; color: var(--accent); margin-top: 2px; }
.help-list b { color: var(--ink); }

.doc-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.doc-cell b { display: block; font-weight: 600; }
.doc-cell small { font-size: 12px; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.kcol { background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; min-height: 200px; transition: border-color .15s, background .15s; }
.kcol.is-over { border-color: var(--primary); background: var(--primary-soft); }
.kcol header { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; }
.kcol h2 { font: 700 14.5px var(--font-ui); letter-spacing: 0; }
.kcount { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); }
.kcol header .icon-btn { margin-left: auto; width: 32px; height: 32px; }
.klist { display: grid; gap: 10px; min-height: 40px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 12px 10px; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid var(--line-strong); }
.kcard.is-late { border-left-color: var(--danger); }
.kcard.is-done { border-left-color: var(--success); background: var(--surface-2); }
.kcard.is-done h3 { text-decoration: line-through; color: var(--ink-3); }
.kcard.is-dragging { opacity: .45; }
.kcard-top { display: flex; align-items: center; gap: 6px; }
.kcard-top .badge { height: 22px; font-size: 12px; padding: 0 8px; }
.kcard-top .dropdown { margin-left: auto; }
.kcard-top .icon-btn { width: 30px; height: 30px; }
.kcard h3 { font-size: 14.5px; font-weight: 600; margin: 8px 0 4px; line-height: 1.35; overflow-wrap: anywhere; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.kdue { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); color: var(--ink-3); }
.kdue svg { width: 14px; height: 14px; }
.kempty { text-align: center; font-size: 13px; color: var(--ink-3); padding: 18px 8px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); margin: 0; }

/* Calendar */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 18px 10px; }
.cal-title { font-size: 24px; margin-left: 6px; }
.cal-chips { padding: 0 18px 14px; }
.ev-chip i { width: 9px; height: 9px; border-radius: 3px; background: var(--evc); }
.ev-chip[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.ev-chip[aria-pressed="false"] { opacity: .55; text-decoration: line-through; }
.ev-hearing { --evc: var(--primary); --evb: var(--primary-soft); }
.ev-deadline { --evc: var(--danger); --evb: var(--danger-soft); }
.ev-task { --evc: var(--c3); --evb: color-mix(in srgb, var(--c3) 14%, var(--surface)); }
.ev-meeting { --evc: var(--accent); --evb: var(--accent-soft); }
.cal-grid { border-top: 1px solid var(--line); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--line); }
.cal-head div { padding: 8px 10px; font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); }
.cal-cell { min-height: 112px; padding: 6px; border-left: 1px solid var(--line); min-width: 0; position: relative; }
.cal-cell:first-child { border-left: 0; }
.cal-cell.is-out { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cal-cell.is-out .cal-day-btn { color: var(--ink-3); }
.cal-cell.is-wkend { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.cal-cell.is-sel { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.cal-day-btn:hover { background: var(--surface-2); }
.cal-cell.is-today .cal-day-btn { background: var(--primary); color: #fff; }
[data-theme="dark"] .cal-cell.is-today .cal-day-btn { color: #0b1626; }
.cal-evs { display: grid; gap: 3px; margin-top: 4px; }
.ev { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--evc); background: var(--evb); color: var(--ink); border-radius: 5px; padding: 3px 6px; font-size: 12.5px; line-height: 1.3; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .mono { font-size: 11.5px; color: var(--ink-2); }
.ev:hover { filter: brightness(.97); }
.ev-more { border: 0; background: none; padding: 1px 6px; text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.cal-dots { display: none; }
.cal-agenda { border-top: 1px solid var(--line); padding: 8px 18px 18px; }
.ag-day { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.ag-day:last-child { border-bottom: 0; }
.ag-day h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ev-row { white-space: normal; padding: 8px 10px; font-size: 13.5px; }
.cal-day { position: sticky; top: calc(var(--topbar-h) + 20px); }
.cal-day h2 { font-size: 22px; }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day-ev { display: flex; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--evc); border-radius: var(--r-md); background: var(--surface); cursor: pointer; align-items: flex-start; }
.day-ev:hover { background: var(--surface-2); }
.day-time { font-size: 12.5px; color: var(--ink-2); min-width: 52px; padding-top: 1px; }
.day-ev b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.day-ev small { display: block; color: var(--ink-3); font-size: var(--fs-sm); margin-top: 2px; }

/* Cause list */
.cl-date { width: 170px; height: 40px; }
.cause-sheet { padding: 28px 30px; }
.cl-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 2px solid var(--ink); margin-bottom: 8px; }
.cl-title { font-size: 28px; margin: 4px 0; }
.cl-sum { display: flex; gap: 26px; margin: 0; }
.cl-sum dt { font-size: 12px; color: var(--ink-3); }
.cl-sum dd { margin: 0; font: 600 30px/1.1 var(--font-display); }
.cl-court { margin-top: 22px; }
.cl-court h3 { font: 600 19px var(--font-display); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding-bottom: 8px; }
.cl-court h3 small { font: 500 13px var(--font-ui); color: var(--ink-3); }
.cl-table { border: 1px solid var(--line); }
.cl-table td { vertical-align: top; }
.cl-no { width: 52px; }
.cl-prep { color: var(--warning-text); margin-top: 4px; font-size: 12.5px; }
.cl-table tr.is-ready td { background: color-mix(in srgb, var(--success-soft) 60%, transparent); }
.cl-empty { padding: 50px 10px; }
.cl-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }

/* Timer */
.timer-card { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; padding: 20px; margin-bottom: 20px; }
.timer-fields { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-width: 280px; }
.timer-fields .field + .field { margin-top: 0; }
.timer-run { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.timer-display { font-size: 34px; font-weight: 600; min-width: 170px; letter-spacing: 0; color: var(--ink); }
.timer-card.is-running .timer-display { color: var(--primary); }
.timer-card.is-running [data-timer-toggle] { background: var(--accent); border-color: var(--accent); color: #1f1504; }

/* Team */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.member { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.member-top { display: flex; gap: 14px; align-items: flex-start; }
.member-top .avatar-lg { border-radius: 16px; width: 56px; height: 56px; font-size: 19px; }
.member h2 { font-size: 21px; }
.member-top p { margin: 2px 0 0; color: var(--ink-3); font-size: 13.5px; }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); }
.member-stats div { padding: 10px 12px; }
.member-stats div + div { border-left: 1px solid var(--line); }
.member-stats dt { font-size: 12px; color: var(--ink-3); }
.member-stats dd { margin: 0; font: 600 22px var(--font-display); }
.member-util .progress { margin-top: 8px; height: 6px; }
.member-contact { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.member-contact li { display: flex; gap: 10px; align-items: center; min-width: 0; }
.member-contact a, .member-contact span { overflow-wrap: anywhere; min-width: 0; }
.member-contact svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.team-q { width: 260px; height: 36px; margin-left: auto; }

/* Invoice */
.inv-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.inv-brand svg { width: 40px; height: 40px; }
.inv-brand b { font: 600 22px var(--font-display); overflow-wrap: anywhere; min-width: 0; }
.inv-table { margin-top: 4px; }
.inv-table .inv-sub td { background: var(--surface-2); font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding-top: 9px; padding-bottom: 9px; }
.inv-bottom { display: flex; gap: 30px; justify-content: space-between; flex-wrap: wrap; margin-top: 10px; }
.inv-notes { max-width: 380px; padding-top: 20px; }
.inv-notes h2, .inv-notes h3 { font: 600 var(--fs-xs) var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.inv-notes p { font-size: 13.5px; }
.totals .due { margin-top: 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--ink); font-weight: 700; font-size: 16px; }
.totals .due.is-paid { background: var(--success-soft); color: var(--success); }
.totals .due span:last-child { color: inherit; }

/* Settings bits */
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-actions .saved-note { margin-right: auto; }
.profile-row { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.setting-list > li { justify-content: flex-start; }
.setting-list .grow { min-width: 0; overflow-wrap: anywhere; }
.setting-list svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.inline-add { display: flex; gap: 10px; margin-top: 16px; }
.inline-add .input { max-width: 340px; }

/* Sign in art */
.art-card { position: relative; width: 100%; max-width: 380px; padding: 22px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); display: grid; gap: 6px; transform: rotate(-2deg); }
.art-card .eyebrow { color: #e2c283; }
.art-card b { font-size: 22px; line-height: 1.25; color: #fff; font-weight: 600; }
.art-card small { color: #b4bac6; font-size: 13px; }
.art-tl { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr; align-items: center; gap: 6px; margin-top: 14px; font-size: 11.5px; color: #b4bac6; }
.art-tl i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #d8b46b; }
.art-tl i.on { background: #d8b46b; }
.err-mark { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--primary); color: #d8b46b; }
.error-page h1 { margin: 8px 0 0; font-size: 36px; }


/* 7. Utilities --------------------------------------------------------- */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.text-right { text-align: right; } .text-center { text-align: center; } .small { font-size: 13px; } .strong { font-weight: 600; color: var(--ink); }
.w-100 { width: 100%; } .nowrap { white-space: nowrap; }
.bg-primary-soft { background: var(--primary-soft); color: var(--primary); }
.bg-accent-soft, .bg-warning-soft { background: var(--accent-soft); color: var(--warning-text); }
.bg-info-soft { background: var(--info-soft); color: var(--info); }
.bg-danger-soft { background: var(--danger-soft); color: var(--danger); }
.bg-success-soft { background: var(--success-soft); color: var(--success); }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warning { color: var(--warning-text); }
[hidden] { display: none !important; }

/* 8. Responsive -------------------------------------------------------- */
@media (max-width: 1280px) {
  .kpis, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 6; }
}
@media (max-width: 1100px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
}
@media (max-width: 960px) {
  .app, .sidebar-collapsed .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; box-shadow: var(--shadow-pop); }
  .sidebar-open .sidebar { transform: none; visibility: visible; transition: transform .25s ease; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,14,12,.5); z-index: 35; display: none; }
  .sidebar-open .sidebar-backdrop { display: block; }
  .menu-toggle { display: inline-grid; }
  .collapse-toggle { display: none; }
  .sidebar-collapsed .brand-name, .sidebar-collapsed .nav-title, .sidebar-collapsed .nav span:not(.sr-only), .sidebar-collapsed .nav .count, .sidebar-collapsed .sidebar-foot { display: revert; }
  .sidebar-collapsed .brand-name { display: flex; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .side-tabs { position: static; display: flex; overflow-x: auto; }
  .invoice-meta { grid-template-columns: 1fr 1fr; }
  .case-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .case-facts > div:nth-child(4) { border-left: 0; }
  .case-facts > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .stepper-wrap, .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-day { position: static; }
  .board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .search { display: none; }
  .user-btn .who, .hide-sm { display: none !important; }
  .span-3 { grid-column: span 12; }
  .kpis, .stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .invoice { padding: 22px; }
  .invoice-meta { grid-template-columns: 1fr; }
  .footer { padding: 16px; }
  h1 { font-size: 26px; }
  .case-head { padding: 18px 16px 0; }
  .case-head-main h1 { font-size: 24px; }
  .case-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 18px -16px 0; }
  .case-facts > div { padding: 12px 14px; }
  .case-facts > div:nth-child(odd) { border-left: 0; }
  .case-facts > div:nth-child(4) { border-left: 1px solid var(--line); }
  .case-facts > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .case-actions { width: 100%; }
  .court-item { grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; }
  .load { width: 42%; }
  .doc-tools .input { width: 100%; margin-left: 0; }
  .next-hearing { padding: 16px; gap: 16px; }
  .nh-date { width: 84px; }
  .nh-date b { font-size: 38px; }
  .feed li { grid-template-columns: 32px minmax(0, 1fr); }
  .feed li small { grid-column: 2; }
  .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .stepper li { flex-direction: column; gap: 6px; padding: 10px 4px; font-size: 12px; text-align: center; }
  .stepper li span:last-child { white-space: normal; }
  .step-form { padding: 18px 16px; }
  .review > div { grid-template-columns: minmax(0, 1fr) auto; }
  .review dt { grid-column: 1 / -1; }
  .cal-bar { padding: 14px 12px 8px; }
  .cal-chips { padding: 0 12px 12px; }
  .cal-title { font-size: 20px; }
  .cal-cell { min-height: 58px; padding: 4px 2px; text-align: center; }
  .cal-head div { padding: 6px 2px; text-align: center; font-size: 11px; }
  .cal-evs { display: none; }
  .cal-dots { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
  .cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--evc); }
  .cal-day-btn { width: 30px; height: 30px; }
  .cause-sheet { padding: 18px 14px; }
  .cl-sum { gap: 18px; }
  .cl-sum dd { font-size: 24px; }
  .page-head .actions .cl-date { width: 150px; }
  .timer-fields { grid-template-columns: 1fr; min-width: 0; }
  .timer-display { font-size: 28px; min-width: 0; width: 100%; }
  .team-q { width: 100%; margin-left: 0; }
  .member-grid { grid-template-columns: minmax(0, 1fr); }
  .inline-add .input { max-width: none; }
  .table-tools .input { min-width: 0; max-width: none; flex: 1 1 100%; }
  .table-tools .btn { margin-left: 0 !important; }
  .pager button { min-width: 30px; height: 32px; }
  .pager-gap { min-width: 12px; height: 32px; }
}
@page { margin: 12mm; }
@page invoice { size: A4; margin: 12mm; }
@media print {
  /* Always print with the light colours, even when the screen is in dark mode */
  [data-theme="dark"] {
    --primary: #1f3d64; --primary-strong: #152c4a; --primary-soft: #e3eaf3; --accent: #a8803a; --accent-soft: #f5edde;
    --bg: #ffffff; --surface: #ffffff; --surface-2: #f9f8f4; --ink: #161a21; --ink-2: #454b57; --ink-3: #5e6471; --line: #e4e1d8; --line-strong: #cfcbc0;
    --success: #1d7a46; --success-soft: #e2f3e8; --warning: #b7791f; --warning-text: #87591a; --warning-soft: #fbefd8;
    --danger: #b3382b; --danger-soft: #fbe5e1; --info: #2b6386; --info-soft: #e1edf5;
    --c3: #2f7a6b; --c4: #a5503f; --c5: #6b5ca5;
    color-scheme: light;
  }
  .sidebar, .topbar, .footer, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
  .tabs, .case-actions, .modal, .missing { display: none !important; }
  .tab-panel[hidden] { display: block !important; }
  /* Case summary: no buttons or filters on paper, and the overview lists that the full tabs repeat are left out */
  [data-case-view] .btn, [data-case-view] .icon-btn, [data-case-view] .doc-tools, #cd-activity { display: none !important; }
  #cd-overview .card:has([data-c-list="tasksOpen"], [data-c-list="notesLatest"], [data-c-list="docsLatest"]) { display: none !important; }
  .tab-panel { margin-top: 18px; break-inside: auto; }
  .case-head { break-inside: avoid; }
  .cause-sheet { padding: 0; }
  .cl-table { border: 0; }
  .cl-court { break-inside: avoid; margin-top: 14px; }
  /* Same column widths for every court, so the printed list lines up */
  .cl-table { table-layout: fixed; }
  .cl-table th, .cl-table td { padding: 7px 10px; }
  .cl-table th:nth-child(1) { width: 7%; } .cl-table th:nth-child(2) { width: 9%; } .cl-table th:nth-child(3) { width: 40%; }
  .cl-table th:nth-child(4) { width: 17%; } .cl-table th:nth-child(5) { width: 12%; } .cl-table th:nth-child(6) { width: 15%; }
  .cl-head { padding-bottom: 12px; }
  .cl-foot { margin-top: 16px; }
  .cal-day, .cal-chips, .cal-bar .btn, .cal-bar .segmented { display: none !important; }
  .totals .due { background: none; border: 2px solid #161a21; }
  /* A4 invoice: one clean page, no on-screen padding */
  .invoice { page: invoice; padding: 0; break-inside: auto; font-size: 12.5px; }
  .invoice tr, .invoice .totals { break-inside: avoid; }
  /* Keep the desktop layout on paper (A4 is narrower than the tablet breakpoint) and tighten the spacing */
  .invoice-top { padding-bottom: 14px; }
  .invoice-title { font-size: 30px; }
  .invoice-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 14px 0; }
  .invoice-meta p { font-size: 12.5px; }
  .invoice .table-wrap { overflow: visible; }
  .invoice .table th { padding: 6px 8px; }
  .invoice .table td { padding: 6px 8px; font-size: 12.5px; }
  .inv-bottom { flex-wrap: nowrap; gap: 24px; margin-top: 4px; }
  .inv-notes { padding-top: 12px; }
  .inv-notes p { font-size: 12px; }
  .totals { margin-top: 10px; }
  .totals div { padding: 4px 0; font-size: 12.5px; }
  .totals .grand { font-size: 17px; padding-top: 8px; }
  .totals .due { padding: 8px 12px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Theme toggle icon */
.theme-sun { display: none; }
[data-theme="dark"] .theme-sun { display: contents; }
[data-theme="dark"] .theme-moon { display: none; }

/* Scrollable tables get a visible focus ring when reached with the keyboard */
.table-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
