/* ==========================================================================
   Chambers — Ink & Brass
   A legal instrument: deep ink surfaces, restrained brass for authority,
   warm paper in light. Reference numbers and money render in tabular mono.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --brand-ink: #16324F;   /* overridable per firm */
  --brand-brass: #B0842B; /* overridable per firm */

  --r-xs: 7px; --r-sm: 10px; --r: 13px; --r-lg: 18px; --r-xl: 24px;
  --sidebar-w: 266px;
  --content-max: 1180px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* Light (default) */
[data-theme="light"] {
  --paper: #F4F2EC;
  --surface: #FFFFFF;
  --surface-2: #FAF8F2;
  --ink: #1B1E24;
  --ink-soft: #515A67;
  --ink-faint: #8B94A1;
  --line: #E6E2D8;
  --line-soft: #EFEBE1;

  --nav-bg: #142433;
  --nav-fg: #C7D0DC;
  --nav-fg-soft: #8593A3;
  --nav-line: rgba(255,255,255,.08);
  --nav-active-bg: rgba(176,132,43,.16);
  --nav-active-fg: #E7C271;

  --brass-soft: rgba(176,132,43,.13);
  --brass-line: rgba(176,132,43,.35);
  --ink-tint: rgba(22,50,79,.06);

  --good: #2E7D57; --warn: #9A7420; --bad: #B4432F; --info: #2A5C8A;
  --good-soft: rgba(46,125,87,.12); --bad-soft: rgba(180,67,47,.12);
  --info-soft: rgba(42,92,138,.12); --warn-soft: rgba(154,116,32,.14);

  --shadow-sm: 0 1px 2px rgba(20,30,45,.06), 0 1px 1px rgba(20,30,45,.04);
  --shadow: 0 4px 16px rgba(20,30,45,.08), 0 1px 3px rgba(20,30,45,.05);
  --shadow-lg: 0 24px 60px rgba(15,25,40,.18), 0 6px 18px rgba(15,25,40,.10);
}

/* Dark */
[data-theme="dark"] {
  --paper: #0D1014;
  --surface: #161B22;
  --surface-2: #1C222B;
  --ink: #E7E9EC;
  --ink-soft: #9BA4B0;
  --ink-faint: #69727E;
  --line: #262D38;
  --line-soft: #1E242D;

  --nav-bg: #0F141A;
  --nav-fg: #C3CCD8;
  --nav-fg-soft: #7A8593;
  --nav-line: rgba(255,255,255,.06);
  --nav-active-bg: rgba(200,155,70,.15);
  --nav-active-fg: #E7C271;

  --brass-soft: rgba(200,155,70,.14);
  --brass-line: rgba(200,155,70,.4);
  --ink-tint: rgba(255,255,255,.05);

  --good: #4FB286; --warn: #D2A64A; --bad: #E0765F; --info: #6CA6DA;
  --good-soft: rgba(79,178,134,.15); --bad-soft: rgba(224,118,95,.15);
  --info-soft: rgba(108,166,218,.15); --warn-soft: rgba(210,166,74,.15);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 20px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 28px 64px rgba(0,0,0,.55), 0 8px 20px rgba(0,0,0,.4);
}

/* --- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand-ink); text-decoration: none; }
[data-theme="dark"] a { color: var(--nav-active-fg); }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
code { font-family: var(--font-mono); font-size: .86em; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

:focus-visible { outline: 2.5px solid var(--brass-line); outline-offset: 2px; border-radius: 4px; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app__main { display: flex; flex-direction: column; min-width: 0; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--nav-bg); color: var(--nav-fg);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--nav-line);
  overflow-y: auto; z-index: 40;
}
.sidebar__brand {
  display: flex; align-items: center; gap: .5rem;
  padding: 1.15rem 1.15rem 1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; flex: 1; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand__mark svg { width: 34px; height: 34px; display: block; }
.brand__plate { fill: var(--brand-ink); }
.sidebar .brand__plate { fill: rgba(255,255,255,.09); }
.brand__shield { fill: none; stroke: var(--brand-brass); stroke-width: 1.7; }
.brand__seal { fill: var(--brand-brass); }
.brand__word { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.brand__word strong { font-family: var(--font-display); font-size: 1.18rem; color: #fff; font-weight: 600; }
.brand__word em { font-style: normal; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--nav-fg-soft); }
.sidebar__collapse { display: none; background: none; border: 0; color: var(--nav-fg-soft); padding: .3rem; border-radius: var(--r-xs); }
.sidebar__collapse svg { width: 20px; height: 20px; }

.nav { padding: .35rem .7rem 1.5rem; display: flex; flex-direction: column; gap: 1px; }
.nav__group {
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--nav-fg-soft); margin: 1.1rem .55rem .4rem; font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .6rem; border-radius: var(--r-sm);
  color: var(--nav-fg); font-size: .9rem; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav__item:hover { text-decoration: none; background: rgba(255,255,255,.05); color: #fff; }
.nav__icon { display: grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; opacity: .85; }
.nav__icon svg { width: 18px; height: 18px; }
.nav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__item.is-active {
  background: var(--nav-active-bg); color: var(--nav-active-fg);
  box-shadow: inset 2px 0 0 var(--brand-brass);
}
.nav__item.is-active .nav__icon { opacity: 1; }
.nav__item.is-locked { color: var(--nav-fg-soft); cursor: default; }
.nav__item.is-locked:hover { background: transparent; color: var(--nav-fg-soft); }
.nav__item.is-locked .nav__icon { opacity: .45; }
.nav__phase {
  font-family: var(--font-mono); font-size: .62rem; letter-spacing: .02em;
  color: var(--nav-fg-soft); border: 1px solid var(--nav-line);
  padding: .05rem .32rem; border-radius: 5px;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .9rem;
  padding: .7rem 1.5rem; min-height: 62px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; }
.crumbs { display: flex; align-items: center; gap: .5rem; font-size: .9rem; min-width: 0; }
.crumbs__firm { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.crumbs__sep { color: var(--ink-faint); }
.crumbs__here { color: var(--ink-soft); white-space: nowrap; }
.cmd-trigger {
  display: flex; align-items: center; gap: .55rem;
  margin-left: auto; max-width: 340px; width: 100%;
  padding: .5rem .7rem; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-faint); font-size: .86rem; box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.cmd-trigger:hover { border-color: var(--brass-line); }
.cmd-trigger svg { width: 16px; height: 16px; flex-shrink: 0; }
.cmd-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  font-family: var(--font-mono); font-size: .68rem; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: .1rem .32rem;
}
.topbar__right { display: flex; align-items: center; gap: .5rem; }
.cmd-trigger + .topbar__right { margin-left: .25rem; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); box-shadow: var(--shadow-sm);
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--brass-line); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle__moon { display: none; }
[data-theme="dark"] .theme-toggle__sun { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: block; }

/* User menu */
.usermenu { position: relative; }
.usermenu__btn {
  display: flex; align-items: center; gap: .55rem;
  padding: .3rem .5rem .3rem .35rem; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--ink);
}
.usermenu__btn:hover { background: var(--ink-tint); }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%; background: var(--brand-ink); color: #fff;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
}
.usermenu__meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.usermenu__name { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.usermenu__role { font-size: .7rem; color: var(--ink-faint); white-space: nowrap; }
.usermenu__chev { width: 16px; height: 16px; color: var(--ink-faint); }
.menu {
  position: absolute; right: 0; top: calc(100% + .5rem); width: 232px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: .4rem; z-index: 50; animation: pop .16s var(--ease);
}
.menu[hidden] { display: none; }
.menu__head { padding: .55rem .6rem .6rem; border-bottom: 1px solid var(--line-soft); margin-bottom: .3rem; }
.menu__name { display: block; font-weight: 600; font-size: .9rem; }
.menu__email { display: block; font-size: .76rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu__item {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; text-align: left; padding: .5rem .6rem; border-radius: var(--r-xs);
  font-size: .86rem; color: var(--ink); background: none; border: 0;
}
.menu__item:hover { background: var(--ink-tint); text-decoration: none; }
.menu__item.is-muted { color: var(--ink-faint); cursor: default; }
.menu__item.is-muted:hover { background: none; }
.menu__item em { font-style: normal; font-family: var(--font-mono); font-size: .64rem; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 5px; padding: .04rem .3rem; }
.menu__item--danger { color: var(--bad); }
.menu__item--danger:hover { background: var(--bad-soft); }
.menu__form { margin: 0; }

/* Content */
.content { padding: 1.6rem 1.5rem 3rem; width: 100%; max-width: var(--content-max); margin: 0 auto; }

/* Scrim (mobile) */
.scrim { position: fixed; inset: 0; background: rgba(8,12,18,.5); z-index: 39; }
.scrim[hidden] { display: none; }

/* ==========================================================================
   Page primitives
   ========================================================================== */
.page { animation: rise .4s var(--ease) both; }
.page--narrow { max-width: 760px; }
.page__head { margin-bottom: 1.5rem; }
.page__eyebrow { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: .35rem; }
.page__title { font-size: 1.85rem; line-height: 1.1; }
.page__sub { color: var(--ink-soft); margin-top: .5rem; max-width: 62ch; font-size: .95rem; }
.page__sub strong { color: var(--ink); font-weight: 600; }
.page__cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 1.2rem; margin-top: 1.4rem; align-items: start; }
.page__col { display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-grid--2 { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 1.05rem 1.1rem; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden; animation: rise .45s var(--ease) both;
}
.stat:nth-child(2) { animation-delay: .04s; }
.stat:nth-child(3) { animation-delay: .08s; }
.stat:nth-child(4) { animation-delay: .12s; }
.stat__label { font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.stat__value { font-size: 1.9rem; font-weight: 600; margin-top: .35rem; line-height: 1; }
.stat__value--text { font-family: var(--font-display); font-size: 1.4rem; }
.stat__of { color: var(--ink-faint); font-size: 1.1rem; }
.stat__meta { font-size: .78rem; color: var(--ink-soft); margin-top: .5rem; }
.stat--seal::after {
  content: ""; position: absolute; right: -22px; top: -22px; width: 84px; height: 84px;
  border-radius: 50%; border: 8px solid var(--brass-soft);
}

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; animation: rise .5s var(--ease) both; }
.panel--quiet { background: var(--surface-2); }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem .6rem; }
.panel__title { font-size: 1.05rem; }
.panel__hint { font-size: .76rem; color: var(--ink-faint); }
.panel__body { padding: .3rem 1.15rem 1.15rem; }
.panel__actions { margin-top: 1rem; display: flex; justify-content: flex-end; }

/* Ledger (build roadmap) */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger__row { display: flex; align-items: flex-start; gap: .9rem; padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
.ledger__row:last-child { border-bottom: 0; }
.ledger__tag {
  flex-shrink: 0; font-family: var(--font-mono); font-size: .68rem; font-weight: 500;
  color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: .18rem .45rem; margin-top: .05rem; min-width: 62px; text-align: center;
}
.ledger__tag.is-live { color: var(--good); background: var(--good-soft); border-color: transparent; }
.ledger__body { display: flex; flex-direction: column; min-width: 0; }
.ledger__name { font-weight: 600; font-size: .92rem; }
.ledger__desc { font-size: .82rem; color: var(--ink-soft); margin-top: .1rem; }

/* Activity */
.activity { list-style: none; margin: 0; padding: 0; }
.activity__row { display: flex; align-items: flex-start; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
.activity__row:last-child { border-bottom: 0; }
.activity__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-brass); margin-top: .45rem; flex-shrink: 0; }
.activity__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.activity__desc { font-size: .86rem; font-weight: 500; }
.activity__who { font-size: .76rem; color: var(--ink-faint); }
.activity__when { font-size: .74rem; color: var(--ink-faint); white-space: nowrap; }

/* Empty state */
.empty { text-align: center; padding: 1.8rem 1rem; }
.empty__title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.empty__body { font-size: .84rem; color: var(--ink-soft); margin-top: .35rem; max-width: 40ch; margin-inline: auto; }

/* Promo / quiet card */
.promo__title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.promo__body { font-size: .84rem; color: var(--ink-soft); margin: .4rem 0 .9rem; }

/* Filelist */
.filelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.filelist--muted code { color: var(--ink-soft); }
.filelist__row { display: flex; align-items: center; gap: .6rem; padding: .45rem .1rem; font-size: .82rem; border-bottom: 1px solid var(--line-soft); }
.filelist__row:last-child { border-bottom: 0; }
.filelist__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex-shrink: 0; }
.filelist__dot--done { background: var(--good); }

/* Foldout */
.foldout { margin-top: 1.2rem; }
.foldout summary { cursor: pointer; font-size: .84rem; color: var(--ink-soft); padding: .4rem 0; }
.foldout summary:hover { color: var(--ink); }
.foldout[open] summary { margin-bottom: .4rem; }

/* ==========================================================================
   Buttons & forms
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.1rem; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: .9rem; font-weight: 600; line-height: 1;
  transition: transform .12s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand-ink); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: color-mix(in srgb, var(--brand-ink) 88%, #000); }
[data-theme="dark"] .btn--primary { background: var(--brand-brass); color: #201603; }
[data-theme="dark"] .btn--primary:hover { background: color-mix(in srgb, var(--brand-brass) 88%, #fff); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--brass-line); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.is-loading { opacity: .75; pointer-events: none; }

.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field__label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.field__opt { font-weight: 400; color: var(--ink-faint); font-size: .76rem; }
.field__input {
  font-family: inherit; font-size: .92rem; color: var(--ink);
  padding: .62rem .75rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field__input::placeholder { color: var(--ink-faint); }
.field__input:focus { outline: none; border-color: var(--brass-line); box-shadow: 0 0 0 3px var(--brass-soft); }
.field__help { font-size: .76rem; color: var(--ink-faint); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Notices */
.notice { border-radius: var(--r-sm); padding: .8rem .9rem; font-size: .85rem; border: 1px solid var(--line); }
.notice code { background: var(--ink-tint); padding: .05rem .3rem; border-radius: 4px; }
.notice--info { background: var(--info-soft); border-color: transparent; color: var(--ink); }
.notice--warn { background: var(--warn-soft); border-color: transparent; }
.notice--error { background: var(--bad-soft); border-color: transparent; color: var(--ink); }

/* ==========================================================================
   Flash & toasts
   ========================================================================== */
.flash-stack { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.2rem; }
.flash {
  display: flex; align-items: center; gap: .65rem;
  padding: .7rem .9rem; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  animation: rise .3s var(--ease) both;
}
.flash__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.flash--success .flash__dot { background: var(--good); }
.flash--error .flash__dot { background: var(--bad); }
.flash--info .flash__dot { background: var(--info); }
.flash--warning .flash__dot { background: var(--warn); }
.flash__msg { flex: 1; font-size: .88rem; }
.flash__close { background: none; border: 0; color: var(--ink-faint); font-size: 1.2rem; line-height: 1; padding: 0 .2rem; }
.flash__close:hover { color: var(--ink); }

.toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 80; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-size: .86rem;
  animation: rise .28s var(--ease) both; max-width: 340px;
}
.toast__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex-shrink: 0; }

/* ==========================================================================
   Command palette
   ========================================================================== */
.cmdk { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding-top: 14vh; }
.cmdk[hidden] { display: none; }
.cmdk__scrim { position: absolute; inset: 0; background: rgba(8,12,18,.5); backdrop-filter: blur(3px); animation: fade .18s var(--ease); }
.cmdk__panel {
  position: relative; width: min(560px, 92vw);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .18s var(--ease);
}
.cmdk__search { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.cmdk__search svg { width: 18px; height: 18px; color: var(--ink-faint); flex-shrink: 0; }
.cmdk__search input { flex: 1; border: 0; background: none; font-family: inherit; font-size: 1rem; color: var(--ink); outline: none; }
.cmdk__list { list-style: none; margin: 0; padding: .4rem; max-height: 46vh; overflow-y: auto; }
.cmdk__item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .7rem; border-radius: var(--r-sm); cursor: pointer; }
.cmdk__item:hover, .cmdk__item.is-selected { background: var(--ink-tint); }
.cmdk__item.is-locked { opacity: .55; }
.cmdk__label { font-size: .9rem; font-weight: 500; }
.cmdk__hint { font-size: .74rem; color: var(--ink-faint); font-family: var(--font-mono); }
.cmdk__empty { padding: 1.4rem; text-align: center; color: var(--ink-faint); font-size: .86rem; }
.cmdk__item[hidden] { display: none; }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth-body { min-height: 100vh; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth__aside {
  background: var(--nav-bg); color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: center; gap: .3rem;
  position: relative;
}
.auth__aside::after {
  content: ""; position: absolute; right: -80px; bottom: -80px;
  width: 300px; height: 300px; border-radius: 50%; border: 20px solid var(--brass-soft);
}
.auth__mark svg { width: 52px; height: 52px; margin-bottom: 1rem; }
.auth__aside .brand__plate { fill: rgba(255,255,255,.09); }
.auth__wordmark { font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; line-height: 1; }
.auth__tag { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--nav-fg-soft); margin-top: .3rem; }
.auth__note { margin-top: 1.4rem; color: var(--nav-fg); max-width: 34ch; font-size: .95rem; line-height: 1.55; }
.auth__main { display: grid; place-items: center; padding: 2rem; background: var(--paper); }

.authcard { width: min(380px, 100%); }
.authcard__head { margin-bottom: 1.5rem; }
.authcard__head h1 { font-size: 1.7rem; }
.authcard__head p { color: var(--ink-soft); margin-top: .4rem; font-size: .92rem; }
.authcard__foot { margin-top: 1.2rem; font-size: .86rem; }
.authcard .flash-stack { margin-bottom: 1rem; }

/* ==========================================================================
   Installer
   ========================================================================== */
.install-body { min-height: 100vh; }
.install { min-height: 100vh; display: grid; grid-template-columns: 300px 1fr; }
.install__rail { background: var(--nav-bg); color: var(--nav-fg); padding: 2rem 1.8rem; display: flex; flex-direction: column; }
.install__brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 2.5rem; }
.install__brand .brand__plate { fill: rgba(255,255,255,.09); }
.install__brand strong { display: block; font-family: var(--font-display); font-size: 1.3rem; color: #fff; }
.install__brand em { font-style: normal; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-fg-soft); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.steps__item { display: flex; align-items: center; gap: .75rem; padding: .55rem .3rem; color: var(--nav-fg-soft); font-size: .9rem; }
.steps__dot {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--nav-line); font-size: .78rem; font-family: var(--font-mono);
  flex-shrink: 0;
}
.steps__item.is-current { color: #fff; }
.steps__item.is-current .steps__dot { border-color: var(--brand-brass); color: var(--brand-brass); }
.steps__item.is-done { color: var(--nav-fg); }
.steps__item.is-done .steps__dot { background: var(--brand-brass); border-color: var(--brand-brass); color: #201603; }
.install__foot { font-size: .78rem; color: var(--nav-fg-soft); margin-top: 2rem; line-height: 1.5; }
.install__main { padding: 3rem; display: grid; place-items: start center; background: var(--paper); overflow-y: auto; }

.wizard { width: min(560px, 100%); animation: rise .4s var(--ease) both; }
.wizard--center { text-align: center; }
.wizard__head { margin-bottom: 1.5rem; }
.wizard__head h1 { font-size: 1.75rem; }
.wizard__head p { color: var(--ink-soft); margin-top: .5rem; font-size: .95rem; }
.wizard__actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; }
.wizard__actions--single { justify-content: stretch; }
.wizard--center .wizard__head { margin-top: 1rem; }

.checklist { list-style: none; margin: 0 0 1.2rem; padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.checklist__row { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line-soft); }
.checklist__row:last-child { border-bottom: 0; }
.checklist__mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .78rem; flex-shrink: 0; }
.checklist__row.is-pass .checklist__mark { background: var(--good-soft); color: var(--good); }
.checklist__row.is-fail .checklist__mark { background: var(--bad-soft); color: var(--bad); }
.checklist__label { flex: 1; font-size: .88rem; font-weight: 500; }
.checklist__detail { display: block; font-size: .74rem; color: var(--ink-faint); font-weight: 400; font-family: var(--font-mono); }
.checklist__state { font-size: .76rem; color: var(--ink-faint); }

.review { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); margin-bottom: 1.2rem; }
.review__row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line-soft); }
.review__row:last-child { border-bottom: 0; }
.review__key { color: var(--ink-soft); font-size: .86rem; }
.review__val { font-weight: 600; font-size: .9rem; }

.done__seal { display: grid; place-items: center; margin: 0 auto 1rem; }
.done__seal svg { width: 72px; height: 72px; }
.done__ring { fill: none; stroke: var(--brass-line); stroke-width: 3; }
.done__tick { fill: none; stroke: var(--good); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.done__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin: 1.2rem 0; }
.done__label { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.done__value { display: block; font-weight: 600; margin-top: .2rem; }

/* ==========================================================================
   Error pages
   ========================================================================== */
.errorpage { width: min(440px, 100%); text-align: center; }
.errorpage__code { font-size: 3.4rem; font-weight: 600; color: var(--brand-brass); line-height: 1; }
.errorpage__title { font-size: 1.5rem; margin-top: .5rem; }
.errorpage__body { color: var(--ink-soft); margin: .7rem 0 1.5rem; }

/* ==========================================================================
   Motion
   ========================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px) {
  .page__cols { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 280px;
    transform: translateX(-100%); transition: transform .25s var(--ease);
  }
  .app.is-sidebar-open .sidebar { transform: none; }
  .sidebar__collapse { display: grid; place-items: center; }
  .topbar__menu { display: grid; }
  .cmd-trigger { max-width: none; }
  .cmd-trigger span { display: none; }
  .crumbs__firm { max-width: 30vw; }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .install { grid-template-columns: 1fr; }
  .install__rail { flex-direction: row; align-items: center; gap: 1.2rem; padding: 1.2rem 1.5rem; }
  .install__brand { margin-bottom: 0; }
  .steps { flex-direction: row; overflow-x: auto; gap: .8rem; }
  .steps__label { display: none; }
  .install__foot { display: none; }
  .install__main { padding: 1.8rem 1.3rem; }
}
@media (max-width: 560px) {
  .stat-grid, .stat-grid--2 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .content { padding: 1.2rem 1rem 3rem; }
  .usermenu__meta { display: none; }
  .page__title { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Phase 2 — Clients & Matters
   ========================================================================== */
.page__head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.page__actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page__title .pill, .page__title .badge { vertical-align: middle; margin-left: .5rem; }

/* Filter toolbar */
.toolbar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar__search {
  display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .5rem .7rem; box-shadow: var(--shadow-sm);
}
.toolbar__search svg { width: 16px; height: 16px; color: var(--ink-faint); flex-shrink: 0; }
.toolbar__search input { flex: 1; border: 0; background: none; font: inherit; color: var(--ink); outline: none; }
.toolbar__select {
  font: inherit; font-size: .88rem; color: var(--ink); padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.toolbar__select:focus { outline: none; border-color: var(--brass-line); }

/* Segmented control */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.segmented--wide { margin-bottom: 1rem; }
.segmented__item { padding: .4rem .8rem; border-radius: 8px; font-size: .84rem; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.segmented__item:hover { text-decoration: none; color: var(--ink); }
.segmented__item.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Data table */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table thead th {
  text-align: left; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: .7rem 1.15rem; border-bottom: 1px solid var(--line);
}
.table--flush thead th:first-child, .table--flush tbody td:first-child { padding-left: 0; }
.table--flush thead th:last-child, .table--flush tbody td:last-child { padding-right: 0; }
.table__num { width: 1%; white-space: nowrap; }
.table__center { text-align: center; }
.table tbody td { padding: .8rem 1.15rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table__row { cursor: pointer; transition: background .12s var(--ease); }
.table__row:hover { background: var(--ink-tint); }
.table__title { font-weight: 600; color: var(--ink); }
.table__soft { color: var(--ink-soft); }
.table__meta { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: .1rem; }

/* Badges & pills */
.badge { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 600; padding: .2rem .5rem; border-radius: 6px; letter-spacing: .01em; }
.badge--open { background: var(--good-soft); color: var(--good); }
.badge--hold { background: var(--warn-soft); color: var(--warn); }
.badge--closed { background: var(--ink-tint); color: var(--ink-soft); }
.badge--muted { background: var(--ink-tint); color: var(--ink-faint); }
.pill { display: inline-flex; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); }
.pill--individual { border-color: var(--brass-line); color: var(--brand-brass); }
.pill--organisation { border-color: color-mix(in srgb, var(--info) 40%, transparent); color: var(--info); }

/* Panels with padding + form actions */
.panel--pad { padding: 1.4rem; }
.form__actions { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
.field__req { color: var(--bad); font-weight: 700; }
textarea.field__input { resize: vertical; min-height: 72px; font: inherit; }
select.field__input { cursor: pointer; }
.inline-form { display: inline; margin: 0; }

/* Radio set */
.segset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.radioset { display: flex; gap: .6rem; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .9rem; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; font-size: .9rem; background: var(--surface); transition: border-color .15s var(--ease); }
.radio:has(input:checked) { border-color: var(--brand-brass); background: var(--brass-soft); }
.radio input { accent-color: var(--brand-ink); }

/* Conflict check */
.conflict { margin-top: .55rem; border: 1px solid var(--brass-line); background: var(--brass-soft); border-radius: var(--r-sm); padding: .6rem .75rem; }
.conflict__head { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-brass); margin-bottom: .4rem; }
.conflict__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.conflict__list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .84rem; }
.conflict__tag { color: var(--ink-faint); font-size: .76rem; }

/* Facts (key/value detail) */
.facts { margin: 0; }
.facts__row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.facts__row:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-faint); font-size: .82rem; }
.facts dd { margin: 0; font-weight: 500; font-size: .86rem; text-align: right; }

/* Party list */
.partylist { list-style: none; margin: 0 0 1rem; padding: 0; }
.partylist__row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
.partylist__row:last-child { border-bottom: 0; }
.partylist__side { flex-shrink: 0; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: .18rem .45rem; border-radius: 6px; min-width: 78px; text-align: center; }
.side--client { background: var(--good-soft); color: var(--good); }
.side--opposing { background: var(--bad-soft); color: var(--bad); }
.side--other { background: var(--ink-tint); color: var(--ink-soft); }
.partylist__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.partylist__name { font-weight: 600; font-size: .9rem; }
.partylist__meta { font-size: .78rem; color: var(--ink-faint); }
.iconlink { background: none; border: 0; color: var(--ink-faint); font-size: .9rem; padding: .3rem; border-radius: 6px; line-height: 1; }
.iconlink:hover { color: var(--bad); background: var(--bad-soft); }

/* Add-party inline form */
.partyadd { display: grid; grid-template-columns: 130px 1.4fr 1fr auto; gap: .5rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.partyadd .field__input { padding: .5rem .6rem; font-size: .86rem; }

/* Status dropdown reuses .menu; align to the left edge */
.statusmenu { position: relative; }
.menu--left { right: auto; left: 0; }

/* Prose blocks */
.prose { font-size: .92rem; line-height: 1.65; color: var(--ink-soft); }
.filepreview { color: var(--brand-brass); font-weight: 600; }

@media (max-width: 620px) {
  .partyadd { grid-template-columns: 1fr 1fr; }
  .facts dd { text-align: left; }
  .table thead { display: none; }
  .table tbody td { padding: .5rem .9rem; }
  .table__num { width: auto; }
}

/* ==========================================================================
   Phase 3 — Diary, Tasks, Audit
   ========================================================================== */

/* Event type accents */
.ev--hearing     { --ev: var(--brand-ink); }
.ev--mention     { --ev: var(--info); }
.ev--deadline    { --ev: var(--bad); }
.ev--appointment { --ev: var(--good); }
.ev--reminder    { --ev: var(--brand-brass); }
.ev--other       { --ev: var(--ink-faint); }
[data-theme="dark"] .ev--hearing { --ev: #6f9fd8; }

.ev-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ev, var(--ink-faint)); flex-shrink: 0; }

/* Calendar bar */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: .5rem; }
.cal-nav__label { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; min-width: 9.5rem; }
.cal-today { font-size: .84rem; font-weight: 600; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); }
.cal-today:hover { border-color: var(--brass-line); text-decoration: none; }

/* Month grid */
.calwrap { padding: 0; overflow: hidden; }
.cal { display: flex; flex-direction: column; }
.cal__head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal__dow { padding: .6rem .7rem; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
.cal__week { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line-soft); }
.cal__week:last-child { border-bottom: 0; }
.cal__day { min-height: 108px; padding: .35rem; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: .2rem; }
.cal__day:last-child { border-right: 0; }
.cal__day.is-out { background: var(--surface-2); }
.cal__day.is-out .cal__daynum { color: var(--ink-faint); opacity: .6; }
.cal__daynum { font-size: .82rem; font-weight: 600; color: var(--ink-soft); text-align: right; }
.cal__add { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; color: inherit; }
.cal__add:hover { background: var(--ink-tint); text-decoration: none; color: var(--ink); }
.cal__day.is-today .cal__daynum .cal__add,
.cal__day.is-today .cal__daynum span { background: var(--brand-ink); color: #fff; border-radius: 999px; padding: 0 .1rem; }
[data-theme="dark"] .cal__day.is-today .cal__daynum .cal__add { background: var(--brand-brass); color: #201603; }
.cal__events { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.ev { display: flex; align-items: center; gap: .3rem; padding: .12rem .35rem; border-radius: 5px; font-size: .74rem; line-height: 1.3;
      background: color-mix(in srgb, var(--ev) 14%, transparent); color: var(--ink); border-left: 2.5px solid var(--ev); overflow: hidden; }
.ev:hover { text-decoration: none; background: color-mix(in srgb, var(--ev) 24%, transparent); }
.ev.is-done { opacity: .5; text-decoration: line-through; }
.ev.is-cancelled { opacity: .4; }
.ev__time { color: var(--ink-soft); flex-shrink: 0; }
.ev__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev__lim { color: var(--bad); font-weight: 800; flex-shrink: 0; }
.ev__more { font-size: .72rem; color: var(--ink-faint); padding-left: .35rem; }

/* Agenda */
.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-day { margin-bottom: 1.1rem; }
.agenda-day:last-child { margin-bottom: 0; }
.agenda-day__label { font-size: .78rem; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }
.agenda-day__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.agenda-item { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.agenda-item:last-child { border-bottom: 0; }
.agenda-item__time { font-size: .8rem; color: var(--ink-soft); width: 3.6rem; flex-shrink: 0; }
.agenda-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agenda-item__title { font-weight: 600; font-size: .9rem; color: var(--ink); }
.agenda-item__meta { font-size: .78rem; color: var(--ink-faint); }
.agenda__matter { font-size: .76rem; color: var(--ink-soft); }
.panel--danger { border-color: var(--bad); }
.panel--danger .panel__title { color: var(--bad); }

/* Upcoming (dashboard) */
.upnext { list-style: none; margin: 0; padding: 0; }
.upnext__row { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.upnext__row:last-child { border-bottom: 0; }
.upnext__date { display: flex; flex-direction: column; align-items: center; width: 2.6rem; flex-shrink: 0; }
.upnext__day { font-size: 1.1rem; font-weight: 700; line-height: 1; }
.upnext__mon { font-size: .68rem; text-transform: uppercase; color: var(--ink-faint); }
.upnext__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.upnext__title { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upnext__meta { font-size: .78rem; color: var(--ink-faint); }
.upnext__lim { color: var(--bad); font-weight: 600; }

/* Task list */
.tasklist { list-style: none; margin: 0; padding: 0; }
.tasklist__row { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.tasklist__row:last-child { border-bottom: 0; }
.tasklist__row.is-done .tasklist__title { text-decoration: line-through; color: var(--ink-faint); }
.taskcheck { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1.6px solid var(--line); background: var(--surface); color: #fff; flex-shrink: 0; padding: 0; }
.taskcheck:hover { border-color: var(--brand-brass); }
.taskcheck.is-checked { background: var(--good); border-color: var(--good); }
.taskcheck svg { width: 14px; height: 14px; }
.tasklist__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tasklist__title { font-weight: 500; font-size: .9rem; }
.tasklist__meta { font-size: .78rem; color: var(--ink-faint); }
.tasklist__edit { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; color: var(--ink-faint); }
.tasklist__edit:hover { background: var(--ink-tint); color: var(--ink); }
.tasklist__edit svg { width: 16px; height: 16px; }
.duechip { font-size: .74rem; font-weight: 600; padding: .18rem .45rem; border-radius: 6px; background: var(--ink-tint); color: var(--ink-soft); white-space: nowrap; }
.duechip.is-overdue { background: var(--bad-soft); color: var(--bad); }

/* Checkboxes */
.checkrow { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; cursor: pointer; }
.check input { accent-color: var(--brand-ink); width: 16px; height: 16px; }
.check--pill { padding: .5rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: .84rem; }

/* Split form actions + danger-ghost button */
.form__actions--split { justify-content: space-between; }
.form__actions-right { display: inline-flex; gap: .6rem; align-items: center; }
.btn--danger-ghost { background: transparent; border-color: var(--line); color: var(--bad); }
.btn--danger-ghost:hover { background: var(--bad-soft); border-color: transparent; }

/* Audit */
.auditcode { font-size: .78rem; color: var(--brand-ink); background: var(--ink-tint); padding: .1rem .4rem; border-radius: 5px; }
[data-theme="dark"] .auditcode { color: var(--nav-active-fg); }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.2rem; }
.pager__label { font-size: .84rem; color: var(--ink-soft); }
.btn.is-disabled { opacity: .4; pointer-events: none; }

@media (max-width: 760px) {
  .cal__day { min-height: 72px; }
  .ev__title { display: none; }
  .ev { justify-content: center; }
  .cal-nav__label { min-width: auto; font-size: 1rem; }
}

/* Mini lists (matter show: diary & tasks) */
.minihead { display: flex; align-items: center; justify-content: space-between; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: .9rem 0 .4rem; }
.minihead:first-child { margin-top: 0; }
.minihead a { font-size: .78rem; text-transform: none; letter-spacing: 0; }
.mini-empty { font-size: .82rem; color: var(--ink-faint); }
.minilist { list-style: none; margin: 0; padding: 0; }
.minilist li { display: flex; align-items: center; gap: .55rem; padding: .4rem 0; border-bottom: 1px solid var(--line-soft); font-size: .86rem; }
.minilist li:last-child { border-bottom: 0; }
.minilist__title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.minilist__meta { color: var(--ink-faint); font-size: .78rem; flex-shrink: 0; }

/* ==========================================================================
   Phase 4 — Documents
   ========================================================================== */

/* Category chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-size: .84rem; font-weight: 500; color: var(--ink-soft); background: var(--surface); }
.chip:hover { border-color: var(--brass-line); color: var(--ink); text-decoration: none; }
.chip.is-active { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
[data-theme="dark"] .chip.is-active { background: var(--brand-brass); border-color: var(--brand-brass); color: #201603; }
.chip__n { font-size: .74rem; opacity: .7; }

/* File type icon */
.fileicon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; font-size: .6rem; font-weight: 800; letter-spacing: .02em;
            background: var(--ink-tint); color: var(--ink-soft); flex-shrink: 0; }
.fileicon--lg { width: 52px; height: 52px; font-size: .72rem; border-radius: 10px; }
.fileicon--sm { width: 26px; height: 26px; font-size: .5rem; border-radius: 6px; }
.fileicon--pdf { background: #fce8e6; color: #c5221f; }
.fileicon--doc, .fileicon--docx, .fileicon--rtf, .fileicon--odt { background: #e8f0fe; color: #1a56c4; }
.fileicon--xls, .fileicon--xlsx, .fileicon--csv { background: #e6f4ea; color: #137333; }
.fileicon--ppt, .fileicon--pptx { background: #fef0e3; color: #c4560c; }
.fileicon--jpg, .fileicon--jpeg, .fileicon--png, .fileicon--gif { background: #f3e8fd; color: #7627bb; }
.fileicon--zip { background: #f1f3f4; color: #5f6368; }
[data-theme="dark"] .fileicon--pdf { background: #3a1f1e; color: #f2837b; }
[data-theme="dark"] .fileicon--doc, [data-theme="dark"] .fileicon--docx { background: #1c2a45; color: #7ba7f0; }
[data-theme="dark"] .fileicon--xls, [data-theme="dark"] .fileicon--xlsx, [data-theme="dark"] .fileicon--csv { background: #14301f; color: #6bbf8a; }

/* Document link cell */
.doclink { display: flex; align-items: center; gap: .7rem; color: inherit; }
.doclink:hover { text-decoration: none; }
.doclink:hover .doclink__title { color: var(--brand-ink); }
[data-theme="dark"] .doclink:hover .doclink__title { color: var(--nav-active-fg); }
.doclink__body { display: flex; flex-direction: column; min-width: 0; }
.doclink__title { font-weight: 600; font-size: .9rem; }
.doclink__meta { font-size: .78rem; color: var(--ink-faint); }
.table__actions { text-align: right; white-space: nowrap; }

/* Dropzone */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; text-align: center;
            padding: 2rem 1rem; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand-brass); background: color-mix(in srgb, var(--brand-brass) 6%, var(--surface-2)); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone__icon { color: var(--brand-brass); }
.dropzone__text { font-weight: 600; font-size: .95rem; }
.dropzone__hint { font-size: .8rem; color: var(--ink-faint); }

/* File card (document show) */
.filecard { display: flex; align-items: center; gap: 1rem; padding: 1.15rem; }
.filecard__body { flex: 1; min-width: 0; }
.filecard__name { font-weight: 600; word-break: break-word; }
.filecard__meta { font-size: .82rem; color: var(--ink-faint); margin-top: .15rem; }
.filecard__actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* Version list */
.verlist { list-style: none; margin: 0; padding: 0; }
.verlist__row { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.verlist__row:last-child { border-bottom: 0; }
.verlist__no { font-weight: 700; color: var(--ink-soft); width: 2.4rem; flex-shrink: 0; }
.verlist__row.is-current .verlist__no { color: var(--good); }
.verlist__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.verlist__name { font-weight: 500; font-size: .88rem; word-break: break-word; }
.verlist__meta { font-size: .78rem; color: var(--ink-faint); }

.btn--sm { padding: .35rem .7rem; font-size: .82rem; }
.btn--block { width: 100%; justify-content: center; }
.page__head-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.prose { line-height: 1.65; color: var(--ink-soft); }

/* ==========================================================================
   Phase 5 — Time & Billing
   ========================================================================== */

/* Summary stat bar */
.statbar { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 1.2rem; }
.statbar__item { flex: 1; min-width: 140px; background: var(--surface); padding: .85rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; }
.statbar__item--accent { background: color-mix(in srgb, var(--brand-brass) 8%, var(--surface)); }
.statbar__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.statbar__value { font-size: 1.15rem; font-weight: 600; color: var(--ink); }

.stat-grid--two { grid-template-columns: repeat(2, 1fr); margin-top: 1rem; }
.stat--accent { border-left: 3px solid var(--brand-brass); }

/* Toolbar extras */
.toolbar--wrap { flex-wrap: wrap; }
.check--pill { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; cursor: pointer; white-space: nowrap; }

/* Grids */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 640px) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }

.field__static { padding: .6rem .75rem; border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-weight: 600; color: var(--ink); }

/* Table cell stacking + pick tables */
.cellmain { display: block; font-weight: 500; }
.cellsub { display: block; font-size: .78rem; color: var(--ink-faint); }
.table--pick .table__check { width: 40px; text-align: center; }
.table--pick tbody tr:hover { background: var(--surface-2); }
.table__check input { width: 16px; height: 16px; accent-color: var(--brand-brass); }

/* Segmented wide (invoice status tabs) */
.segmented--wide { width: 100%; overflow-x: auto; margin-bottom: 1.2rem; }

/* Pick list (matter chooser) */
.picklist { list-style: none; margin: 0; padding: 0; }
.picklist__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.picklist__row:last-child { border-bottom: 0; }
.picklist__main { display: flex; flex-direction: column; color: inherit; flex: 1; min-width: 0; }
.picklist__main:hover { text-decoration: none; }
.picklist__main:hover .picklist__title { color: var(--brand-ink); }
[data-theme="dark"] .picklist__main:hover .picklist__title { color: var(--nav-active-fg); }
.picklist__title { font-weight: 600; }
.picklist__sub { font-size: .8rem; color: var(--ink-faint); }
.picklist__amt { text-align: right; display: flex; flex-direction: column; }
.picklist__amt .num { font-weight: 700; }
.picklist__break { font-size: .72rem; color: var(--ink-faint); }

/* Invoice summary block */
.summary { margin: 0; padding: 0; }
.summary__row { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; font-size: .9rem; }
.summary__row dt { color: var(--ink-soft); }
.summary__row dd { margin: 0; font-weight: 600; }
.summary__row--total { border-top: 2px solid var(--line); margin-top: .3rem; padding-top: .6rem; font-size: 1.05rem; }
.summary__row--total dt, .summary__row--total dd { font-weight: 700; color: var(--ink); }
.invtotals { padding: 1rem 1.15rem 1.15rem; border-top: 1px solid var(--line); }
.invtotals .summary { max-width: 320px; margin-left: auto; }

/* Payments list */
.paylist { list-style: none; margin: 0 0 1rem; padding: 0; }
.paylist__row { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); font-size: .88rem; }
.paylist__row:last-child { border-bottom: 0; }
.paylist__date { color: var(--ink-faint); width: 5.5rem; flex-shrink: 0; }
.paylist__body { flex: 1; }
.paylist__amt { font-weight: 600; }
.payform { border-top: 1px dashed var(--line); padding-top: 1rem; }

/* Button stack (invoice actions) */
.btnstack { display: flex; flex-direction: column; gap: .55rem; }

/* Info badge */
.badge--info { background: color-mix(in srgb, #2563eb 14%, transparent); color: #1d4ed8; }
[data-theme="dark"] .badge--info { background: rgba(96,165,250,.18); color: #93c5fd; }

/* Split form actions */
.form__actions--split { display: flex; justify-content: space-between; align-items: center; }
.form__actions-right { display: inline-flex; gap: .5rem; }

/* ==========================================================================
   Phase 6 — Trust accounts
   ========================================================================== */

.stat-grid--flow { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 1rem; }

/* Notices */
.notice { padding: .8rem 1.1rem; border-radius: var(--r-md); font-size: .88rem; margin-bottom: 1.2rem; border: 1px solid transparent; }
.notice--info { background: color-mix(in srgb, #2563eb 8%, var(--surface)); border-color: color-mix(in srgb, #2563eb 25%, transparent); color: var(--ink); }
.notice--warn { background: color-mix(in srgb, #d97706 10%, var(--surface)); border-color: color-mix(in srgb, #d97706 30%, transparent); color: var(--ink); }

/* Account list */
.acctlist { list-style: none; margin: 0; padding: 0; }
.acctlist__row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.acctlist__row:last-child { border-bottom: 0; }
.acctlist__name { font-weight: 600; font-size: .9rem; }
.acctlist__meta { display: block; font-size: .76rem; color: var(--ink-faint); }
.acctlist__bal { font-weight: 700; }

/* Ledger feed */
.ledgerfeed { list-style: none; margin: 0; padding: 0; }
.ledgerfeed__row { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
.ledgerfeed__row:last-child { border-bottom: 0; }
.ledgerfeed__dir { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; font-weight: 800; flex-shrink: 0; }
.ledgerfeed__dir--in { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.ledgerfeed__dir--out { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
[data-theme="dark"] .ledgerfeed__dir--out { color: #f0b866; }
.ledgerfeed__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ledgerfeed__title { font-weight: 500; font-size: .88rem; }
.ledgerfeed__meta { font-size: .76rem; color: var(--ink-faint); }
.ledgerfeed__amt { font-weight: 600; }

/* Invoice alt-settlement link */
.payform-alt { margin: 0 0 .8rem; font-size: .88rem; }

/* ==========================================================================
   Phase 7 — Client portal
   ========================================================================== */

body.portal { background: var(--bg); color: var(--ink); }
.portalbar { position: sticky; top: 0; z-index: 20; background: var(--brand-ink); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.1); }
[data-theme="dark"] .portalbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.portalbar__inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; }
.portalbar__brand { display: flex; align-items: center; gap: .6rem; color: inherit; font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.05rem; }
.portalbar__brand:hover { text-decoration: none; }
.portalbar__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand-brass); color: #201603; font-weight: 800; }
.portalbar__sub { display: block; font-family: 'Inter', sans-serif; font-size: .68rem; font-weight: 500; opacity: .7; letter-spacing: .04em; text-transform: uppercase; }
.portalnav { display: flex; gap: .3rem; margin-left: auto; }
.portalnav__item { color: rgba(255,255,255,.8); padding: .45rem .8rem; border-radius: 8px; font-size: .9rem; font-weight: 500; }
[data-theme="dark"] .portalnav__item { color: var(--ink-soft); }
.portalnav__item:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
[data-theme="dark"] .portalnav__item:hover { background: var(--surface-2); color: var(--ink); }
.portalnav__item.is-active { background: rgba(255,255,255,.16); color: #fff; }
[data-theme="dark"] .portalnav__item.is-active { background: var(--brand-brass); color: #201603; }
.portalnav__dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--brand-brass); color: #201603; font-size: .7rem; font-weight: 700; }
.portalbar__right { display: flex; align-items: center; gap: .8rem; }
.portalbar__user { font-size: .88rem; opacity: .9; }
.portalbar__logout { margin: 0; }
.portalbar .btn--ghost { color: #fff; border-color: rgba(255,255,255,.3); }
[data-theme="dark"] .portalbar .btn--ghost { color: var(--ink); border-color: var(--line); }
.iconbtn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; cursor: pointer; }
[data-theme="dark"] .iconbtn { color: var(--ink); border-color: var(--line); }
.portalmain { max-width: 1080px; margin: 0 auto; padding: 1.8rem 1.5rem 3rem; }
.portalfoot { max-width: 1080px; margin: 0 auto; padding: 1.5rem; text-align: center; font-size: .8rem; color: var(--ink-faint); }

.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg, 16px); padding: 1.3rem 1.5rem; margin-bottom: 1.2rem; }
.pcard--hero { background: linear-gradient(135deg, var(--brand-ink), color-mix(in srgb, var(--brand-ink) 70%, #000)); color: #fff; border: 0; }
[data-theme="dark"] .pcard--hero { background: linear-gradient(135deg, var(--surface-2), var(--surface)); color: var(--ink); border: 1px solid var(--line); }
.pcard__eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin: 0 0 .2rem; }
.phero__title { font-family: 'Fraunces', Georgia, serif; font-size: 1.8rem; margin: 0; }
.phero__sub { margin: .3rem 0 0; opacity: .85; }
.pcard__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.pcard__title { font-family: 'Fraunces', Georgia, serif; font-size: 1.15rem; font-weight: 600; margin: 0; }
.ptitle { font-family: 'Fraunces', Georgia, serif; font-size: 1.5rem; margin: .2rem 0 0; }
.psub { color: var(--ink-faint); margin: .25rem 0 0; font-size: .9rem; }
.phead-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.plink { color: var(--brand-brass); font-weight: 600; font-size: .88rem; }

.pgrid--stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.pstat { display: flex; flex-direction: column; gap: .2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.1rem 1.2rem; color: inherit; }
a.pstat:hover { border-color: var(--brand-brass); text-decoration: none; }
.pstat__value { font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.pstat__label { font-size: .8rem; color: var(--ink-faint); }
.pcols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 820px) { .pcols { grid-template-columns: 1fr; } }

.plist { list-style: none; margin: 0; padding: 0; }
.plist__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
.plist__row:last-child { border-bottom: 0; }
.plist__main { display: flex; align-items: center; gap: .7rem; color: inherit; min-width: 0; flex: 1; }
.plist__main:hover { text-decoration: none; }
.plist__main:hover .plist__title { color: var(--brand-brass); }
.plist__title { display: block; font-weight: 600; font-size: .92rem; }
.plist__sub { display: block; font-size: .78rem; color: var(--ink-faint); }
.plist__amt { text-align: right; display: flex; flex-direction: column; gap: .2rem; }
.pmuted { color: var(--ink-faint); font-size: .9rem; }

.pbadge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pbadge--open { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pbadge--closed { background: var(--ink-tint); color: var(--ink-soft); }
.pbadge--hold { background: color-mix(in srgb, #d97706 16%, transparent); color: #b45309; }
[data-theme="dark"] .pbadge--hold { color: #f0b866; }

.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
.ptable td { padding: .6rem .4rem; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.ptable .r { text-align: right; }
.psummary { margin: 1rem 0 0; max-width: 300px; margin-left: auto; }
.psummary > div { display: flex; justify-content: space-between; padding: .35rem 0; font-size: .9rem; }
.psummary dt { color: var(--ink-soft); } .psummary dd { margin: 0; font-weight: 600; }
.psummary__total { border-top: 2px solid var(--line); margin-top: .3rem; padding-top: .6rem !important; font-size: 1.05rem; }
.psummary__total dt, .psummary__total dd { font-weight: 700; }
.pnote { margin: 1.2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .88rem; }
.pfacts { margin: 0; } .pfacts > div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--line-soft); font-size: .88rem; }
.pfacts > div:last-child { border-bottom: 0; } .pfacts dt { color: var(--ink-faint); } .pfacts dd { margin: 0; font-weight: 500; text-align: right; }
.pcard--side .btn { margin-top: .8rem; }

/* Chat / messages */
.chat { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.2rem; }
.chat--compact { max-height: 320px; overflow-y: auto; }
.chat__row { display: flex; }
.chat__row--me { justify-content: flex-end; }
.chat__bubble { max-width: 78%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: .6rem .9rem; }
.chat__row--me .chat__bubble { background: color-mix(in srgb, var(--brand-brass) 14%, var(--surface)); border-color: color-mix(in srgb, var(--brand-brass) 30%, transparent); }
.chat__meta { font-size: .72rem; color: var(--ink-faint); margin-bottom: .2rem; }
.chat__body { font-size: .9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.chatform textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .7rem .85rem; font: inherit; background: var(--surface); color: var(--ink); resize: vertical; box-sizing: border-box; }
.chatform__actions { margin-top: .6rem; text-align: right; }

/* ==========================================================================
   Phase 8 — Reports & Accounting
   ========================================================================== */

.rangefield { display: inline-flex; flex-direction: column; gap: .2rem; font-size: .72rem; color: var(--ink-faint); }
.rangefield input { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .4rem .55rem; font: inherit; background: var(--surface); color: var(--ink); }

/* Simple CSS bar chart */
.barchart { display: flex; flex-direction: column; gap: .55rem; }
.barchart__row { display: grid; grid-template-columns: 72px 1fr 78px; align-items: center; gap: .7rem; }
.barchart__label { font-size: .78rem; color: var(--ink-faint); }
.barchart__bars { display: flex; flex-direction: column; gap: 3px; }
.barchart__bar { height: 9px; border-radius: 3px; min-width: 2px; }
.barchart__bar--billed { background: var(--brand-brass); }
.barchart__bar--recv { background: var(--brand-ink); }
[data-theme="dark"] .barchart__bar--recv { background: #7ba7f0; }
.barchart__val { text-align: right; font-size: .82rem; font-weight: 600; }
.barchart__legend { margin-top: .9rem; font-size: .78rem; color: var(--ink-faint); display: flex; align-items: center; gap: .5rem; }
.barchart__legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: .6rem; }
.dot--billed { background: var(--brand-brass); } .dot--recv { background: var(--brand-ink); }
[data-theme="dark"] .dot--recv { background: #7ba7f0; }

/* Link list (report index) */
.linklist { list-style: none; margin: 0; padding: 0; }
.linklist__row { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
.linklist li:last-child .linklist__row { border-bottom: 0; }
.linklist__row:hover { text-decoration: none; }
.linklist__row:hover .linklist__title { color: var(--brand-brass); }
.linklist__title { display: block; font-weight: 600; font-size: .9rem; }
.linklist__desc { display: block; font-size: .78rem; color: var(--ink-faint); }

/* Table foot totals */
.table tfoot th { border-top: 2px solid var(--line); padding: .6rem .9rem; font-weight: 700; color: var(--ink); }

/* ==========================================================================
   Phase 9 — HR, Assets & Settings
   ========================================================================== */

.pill-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: .35rem; border-radius: 999px; background: var(--brand-brass); color: #201603; font-size: .72rem; font-weight: 700; vertical-align: middle; }

.form__section { font-family: 'Fraunces', Georgia, serif; font-size: .95rem; font-weight: 600; color: var(--ink); margin: 1.3rem 0 .3rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.colourfield { display: flex; align-items: center; gap: .6rem; }
.colourfield input[type="color"] { inline-size: 44px; block-size: 34px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.colourfield .num { font-size: .82rem; color: var(--ink-soft); text-transform: uppercase; }

.segmented--wide { display: flex; width: 100%; margin-bottom: 1.2rem; }
.segmented--wide .segmented__item { flex: 1; text-align: center; }
