/* DOCKET, ink on paper.
   Black on warm white; colour only for state. Red is owed, overdue, blocked or
   declined. Steel is in progress, out for signature, under negotiation, watched.
   Green is executed, paid, reconciled, clear. A page with nothing wrong is black
   and white. Figtree for the interface, Archivo for titles and every figure, IBM
   Plex Mono for identifiers: matter numbers, clause references, invoice numbers.
   Rows on hairlines, never boxes; figures with no box and no label above; no
   shadow except the drawer, the menus and the palette. Dark is the same tokens
   turned over. Every colour in this file is a token; the token blocks are the
   only place a colour literal may appear. */

@font-face { font-family: "Figtree"; src: url("fonts/Figtree.ttf") format("truetype"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/Archivo-400.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/Archivo-500.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/Archivo-600.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/Archivo-700.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-400.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-500.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --sans: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --title: "Archivo", "Figtree", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-control: 6px;
  --r-tag: 4px;
  --r-field: 8px;
  --rail-w: 224px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --snap: cubic-bezier(0.2, 0, 0, 1);

  --paper: #FBFAF8;
  --rail: #F1F0EC;
  --sheet: #FFFFFF;
  --ink: #191B1F;
  --ink-soft: #5B5F66;
  --line: #E4E2DC;
  --line-2: #C9C6BE;
  --tint: #ECEAE4;
  --red: #C81E3A;
  --red-ink: #A3152C;
  --red-tint: #FBE9EC;
  --steel: #4A5F8F;
  --steel-ink: #3B4E7A;
  --steel-tint: #E9EDF5;
  --green: #1F7A4D;
  --green-ink: #1F7A4D;
  --green-tint: #E6F2EB;
  --on-ink: #FBFAF8;
  --on-red: #FFFFFF;
  --scrim: rgba(25, 27, 31, 0.4);
  --shadow-menu: 0 8px 24px rgba(25, 27, 31, 0.12);
  --ring: rgba(74, 95, 143, 0.28);
  --yv-ink: #191B1F;
  --yv-paper: #F5F4F1;
  --print-paper: #FFFFFF;
  --print-ink: #14161A;
  --print-soft: #5B5F66;
  --print-line: #D9D7D1;
}

/* dark: the same tokens turned over */
:root[data-theme="dark"] {
  --paper: #15171A;
  --rail: #1B1D21;
  --sheet: #1F2226;
  --ink: #F2F1EE;
  --ink-soft: #A4A7AE;
  --line: #2C2F35;
  --line-2: #3C4047;
  --tint: #262A30;
  --red: #E35B74;
  --red-ink: #F08A9C;
  --red-tint: #3A2028;
  --steel: #8AA0CF;
  --steel-ink: #A9BBE0;
  --steel-tint: #242B3A;
  --green: #5CB789;
  --green-ink: #7CCB9F;
  --green-tint: #1E3128;
  --on-ink: #15171A;
  --on-red: #15171A;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.45);
  --ring: rgba(138, 160, 207, 0.32);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --paper: #15171A;
    --rail: #1B1D21;
    --sheet: #1F2226;
    --ink: #F2F1EE;
    --ink-soft: #A4A7AE;
    --line: #2C2F35;
    --line-2: #3C4047;
    --tint: #262A30;
    --red: #E35B74;
    --red-ink: #F08A9C;
    --red-tint: #3A2028;
    --steel: #8AA0CF;
    --steel-ink: #A9BBE0;
    --steel-tint: #242B3A;
    --green: #5CB789;
    --green-ink: #7CCB9F;
    --green-tint: #1E3128;
    --on-ink: #15171A;
    --on-red: #15171A;
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.45);
    --ring: rgba(138, 160, 207, 0.32);
  }
}
/* ---------- end of the token blocks ---------- */

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.93em; }
.num, table.ledger { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
button { font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--steel-tint); }
kbd {
  font-family: var(--mono); font-size: 10px; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--r-tag); padding: 1px 5px;
  background: var(--sheet);
}
.pos-label, .palette-group, .menu-label, .kv > dt { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
p { margin: 0 0 10px; }
.text { font-size: 14px; line-height: 1.55; }
.text p:last-child { margin-bottom: 0; }

/* ---------- YV chrome (software only, never on client documents) ---------- */
.yv-endorse {
  display: flex; align-items: center; gap: 7px;
  color: var(--ink-soft);
  font-size: 9px; letter-spacing: 0.03em; font-variant: small-caps; text-transform: lowercase;
  white-space: nowrap; text-decoration: none;
}
.yv-endorse svg { width: 11px; height: 11px; flex-shrink: 0; }
.yv-link { cursor: pointer; transition: color 140ms var(--ease); }
.yv-link:hover { color: var(--ink); }
.rail-foot .yv-endorse { padding-top: 12px; }
.login-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; margin-top: 30px; }
.login-foot a.yv-endorse[href]:hover { color: var(--ink); text-decoration: underline; }

.yv-sting {
  position: fixed; inset: 0; z-index: 400;
  background: var(--yv-ink); color: var(--yv-paper);
  display: flex; align-items: center; justify-content: center;
}
.yv-sting.out { opacity: 0; transition: opacity 160ms var(--ease); }
.yv-sting-inner { display: flex; align-items: center; gap: 14px; }
.yv-sting-mark { width: 42px; height: 42px; }
.yv-s-whole, .yv-s-top { animation: yv-rise 240ms var(--snap) both; }
.yv-s-base { animation: yv-rise-gap 360ms var(--snap) both; }
.yv-sting-word {
  font-family: var(--title); font-size: 27px; font-weight: 700; letter-spacing: -0.035em;
  clip-path: inset(0 100% 0 0);
  animation: yv-wipe 200ms var(--snap) 360ms forwards;
}
@keyframes yv-rise { from { transform: translateY(64px); } to { transform: translateY(0); } }
@keyframes yv-rise-gap { 0% { transform: translateY(56px); } 66% { transform: translateY(-8px); } 100% { transform: translateY(0); } }
@keyframes yv-wipe { to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) {
  .yv-s-whole, .yv-s-top, .yv-s-base, .yv-sting-word { animation: none; clip-path: none; }
}

/* ---------- sign in: the firm's letterhead ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: var(--paper);
}
.login-sheet {
  width: 100%; max-width: 420px;
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 40px 40px 28px;
}
.login-brand { margin-bottom: 26px; }
.client-mark { width: 40px; height: 40px; color: var(--ink); margin-bottom: 14px; display: block; }
.client-mark.small { width: 28px; height: 28px; margin-bottom: 0; }
.login-company {
  font-family: var(--title);
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.2;
}
.login-desk { font-size: 14px; color: var(--ink); margin-top: 4px; }
.login-desk:empty { display: none; }
.login-product { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-top: 4px; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin: 14px 0 6px; }
.login-error {
  margin-top: 14px; font-size: 13px; color: var(--red-ink);
  background: var(--red-tint); border-radius: var(--r-control); padding: 10px 12px;
}
.login-hint { font-size: 13px; color: var(--ink); text-align: left; margin: 18px 0 0; line-height: 1.6; }
.login-hint:empty { display: none; }
#loginForm .btn-block { margin-top: 20px; }
#loginForm #loginForgot { margin-top: 8px; }
.login-notice { margin: 14px 0 0; font-size: 14px; line-height: 1.6; color: var(--ink); }
.link-field { font-family: var(--mono); font-size: 12px; }
.setup-form .btn-block { margin-top: 20px; }
.setup-form .input[readonly] { color: var(--ink-soft); }
.closed-title { font-family: var(--title); font-size: 17px; font-weight: 600; margin: 0 0 8px; }
.closed-note { font-size: 14px; color: var(--ink); line-height: 1.6; margin: 0 0 20px; }
.login-sheet a.btn-block { display: block; text-align: center; text-decoration: none; }
img.client-logo { object-fit: contain; display: inline-block; }

/* ---------- application frame ---------- */
.app { display: flex; min-height: 100vh; }
.frame { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; padding: 24px 36px 90px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------- rail ---------- */
.rail {
  width: var(--rail-w); flex-shrink: 0;
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; }
.brand-company { font-family: var(--title); font-size: 15px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.2; }
.brand-product { font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-top: 1px; }
.nav { flex: 1; overflow-y: auto; padding: 2px 10px 16px; }
.nav::-webkit-scrollbar { width: 3px; }
.nav::-webkit-scrollbar-thumb { background: var(--line-2); }
.nav-group { padding: 7px 0; }
.nav-group + .nav-group { border-top: 1px solid var(--line); }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--ink);
  min-height: 34px; padding: 0 10px; border-radius: var(--r-control);
  transition: background 130ms var(--ease), color 130ms var(--ease);
}
.nav-item:hover { background: var(--tint); }
.nav-item.is-current { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-leader { flex: 1; }
.nav-count { font-size: 12px; font-weight: 500; color: var(--ink-soft); flex-shrink: 0; }
.nav-item.is-current .nav-count { color: var(--on-ink); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.rail-foot { padding: 12px 18px 14px; border-top: 1px solid var(--line); }
.user-name { font-size: 14px; font-weight: 600; }
.user-title { font-size: 13px; color: var(--ink); margin-top: 1px; }
.user-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.user-actions a.btn { text-decoration: none; }
.appearance {
  display: flex; margin-top: 12px; padding: 2px;
  background: var(--tint); border-radius: var(--r-control);
}
.appearance button {
  flex: 1; border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--ink);
  min-height: 26px; border-radius: var(--r-tag);
  transition: background 130ms var(--ease), color 130ms var(--ease);
}
.appearance button:hover { background: var(--line); }
.appearance button.is-on { background: var(--ink); color: var(--on-ink); font-weight: 600; }

/* ---------- demonstration line ---------- */
.demo-line {
  padding: 5px 24px; font-size: 12px; line-height: 1.5;
  color: var(--steel-ink); background: var(--steel-tint); border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 24px;
  position: sticky; top: 0; z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--r-control);
  background: none; color: var(--ink); cursor: pointer;
  transition: background 130ms var(--ease);
}
.icon-btn:hover { background: var(--tint); }
.icon-btn svg { width: 17px; height: 17px; }
.rail-toggle { display: inline-flex; }
.cmdbar {
  display: flex; align-items: center; gap: 9px;
  width: 100%; max-width: 320px; min-height: 34px;
  border: 1px solid var(--line-2); border-radius: var(--r-control); cursor: pointer;
  background: var(--sheet);
  color: var(--ink-soft); font-size: 13px;
  padding: 0 10px;
  transition: border-color 130ms var(--ease), color 130ms var(--ease);
}
.cmdbar:hover { border-color: var(--ink); color: var(--ink); }
.cmdbar svg { width: 14px; height: 14px; flex-shrink: 0; }
.cmdbar-text { flex: 1; text-align: left; }

/* ---------- segmented controls: the deployment switch (demonstrations only) ---------- */
.desk-switch, .seg { display: inline-flex; align-items: center; padding: 2px; background: var(--tint); border-radius: var(--r-control); }
.desk-switch-label { display: none; }
.desk-opt, .seg-opt {
  font-size: 12px; font-weight: 500;
  min-height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-tag);
  background: none; color: var(--ink); cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.desk-opt:hover, .seg-opt:hover { background: var(--line); }
.desk-opt.on, .seg-opt.is-on { background: var(--ink); color: var(--on-ink); font-weight: 600; }
@media (max-width: 780px) { .desk-switch { display: none; } }

/* ---------- buttons: two sizes, one primary per screen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14px; font-weight: 500;
  min-height: 38px; padding: 0 14px; line-height: 1.2;
  border: 1px solid var(--line-2); border-radius: var(--r-control); cursor: pointer;
  background: var(--sheet); color: var(--ink);
  transition: background 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.btn:hover { border-color: var(--ink); background: var(--tint); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.btn-primary:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: var(--on-ink); }
.btn-ghost { background: none; }
.btn-ghost:hover { background: var(--tint); }
.btn-quiet { background: none; border-color: transparent; }
.btn-quiet:hover { background: var(--tint); border-color: transparent; }
.btn-danger { background: none; border-color: var(--red); color: var(--red-ink); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.is-armed { background: var(--red); border-color: var(--red); color: var(--on-red); font-weight: 600; }
.btn-small { min-height: 32px; font-size: 13px; padding: 0 11px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2);
  transition: text-decoration-color 130ms var(--ease);
}
.btn-link:hover { text-decoration-color: var(--ink); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- fields ---------- */
.input, .select, textarea.input {
  width: 100%;
  font-size: 14px; color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line-2); border-radius: var(--r-field);
  min-height: 38px; padding: 7px 11px;
  transition: border-color 130ms var(--ease), box-shadow 130ms var(--ease);
}
textarea.input { min-height: 76px; line-height: 1.45; }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--steel);
  box-shadow: 0 0 0 3px var(--ring);
}
.input::placeholder { color: var(--ink-soft); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.checkline input { accent-color: var(--ink); width: 15px; height: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row > div { min-width: 0; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input, .filters .select, .filters .dd-wrap { width: auto; }

/* the dropdown: the kit's own control in place of the native select */
.dd-wrap { display: block; position: relative; width: 100%; }
.dd {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 38px; padding: 0 34px 0 11px;
  font-size: 14px; color: var(--ink); text-align: left;
  background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-field);
  cursor: pointer; position: relative;
  transition: border-color 130ms var(--ease), box-shadow 130ms var(--ease);
}
.dd:hover { border-color: var(--ink); }
.dd:focus-visible, .dd.is-open { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px var(--ring); }
.dd-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd.is-empty .dd-text { color: var(--ink-soft); }
.dd-chev {
  position: absolute; right: 13px; top: 50%; width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
  transform: translateY(-70%) rotate(45deg);
}
.dd.compact, .filters .dd { min-height: 32px; font-size: 13px; }
.dd-menu {
  position: fixed; z-index: 230; min-width: 200px; max-width: 420px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-control);
  box-shadow: var(--shadow-menu);
  padding: 4px; display: flex; flex-direction: column;
}
.dd-search {
  margin: 2px 2px 4px; min-height: 32px; font-size: 13px;
  border: 1px solid var(--line-2); border-radius: var(--r-control); padding: 0 10px;
  background: var(--sheet); color: var(--ink);
}
.dd-search:focus { outline: none; border-color: var(--steel); }
.dd-list { max-height: 300px; overflow-y: auto; }
.dd-opt {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  font-size: 14px; color: var(--ink);
  min-height: 34px; padding: 7px 10px; border-radius: var(--r-tag);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 110ms var(--ease);
}
.dd-opt:hover, .dd-opt.is-sel { background: var(--tint); }
.dd-opt.is-on { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.dd-none { padding: 10px; font-size: 13px; color: var(--ink-soft); }

/* ---------- page head ---------- */
.page-head { margin-bottom: 22px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.crumb { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 8px; }
.crumb a { color: var(--ink-soft); text-decoration: none; cursor: pointer; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.page-title {
  font-family: var(--title);
  font-size: 30px; font-weight: 600; letter-spacing: -0.015em; line-height: 36px; margin: 0;
}
.page-title .idtag { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--ink-soft); margin-left: 10px; letter-spacing: 0; }
.head-actions, .page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- figures: a number with its unit beside it, no box ---------- */
.figures { display: flex; flex-wrap: wrap; gap: 10px 40px; margin: 0 0 28px; }
.figure { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.figure-n { font-family: var(--title); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.figure-u { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.figure.red .figure-n { color: var(--red-ink); }
.figure.steel .figure-n { color: var(--steel-ink); }
.figure.green .figure-n { color: var(--green-ink); }
.figure[data-goto] { cursor: pointer; }
.figure[data-goto]:hover .figure-u { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.figure.small .figure-n { font-size: 24px; }
@media (max-width: 620px) { .figures { gap: 10px 24px; } .figure-n { font-size: 28px; } }

/* ---------- the dashboard flow: counts by stage ---------- */
.flow {
  display: flex; align-items: stretch; flex-wrap: wrap;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin: 0 0 28px; padding: 0;
}
.flow-cell {
  flex: 1 1 0; min-width: 96px; padding: 12px 8px 12px 14px;
  cursor: pointer; position: relative;
  border-left: 1px solid var(--line);
  transition: background 140ms var(--ease);
}
.flow-cell:first-child { border-left: 0; padding-left: 2px; }
.flow-cell:hover { background: var(--tint); }
.flow-count { font-family: var(--title); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1; }
.flow-cell.empty .flow-count { color: var(--ink-soft); font-weight: 400; }
.flow-cell.hot::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--ink); }
.flow-cell.hot:first-child::after { left: 2px; }
.flow-label { font-size: 13px; font-weight: 500; color: var(--ink); margin-top: 6px; line-height: 1.3; }
.flow-value { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.flow-arrow, .flow-note { display: none; }
@media (max-width: 900px) { .flow-cell { flex: 1 1 30%; min-width: 0; } }

/* ---------- the instruments on the dashboard ---------- */
.instruments {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0; margin: 0 0 28px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.instrument {
  padding: 14px 18px 16px 0; cursor: pointer;
  border-left: 1px solid var(--line); padding-left: 18px;
  transition: background 140ms var(--ease);
}
.instrument:first-child { border-left: 0; padding-left: 2px; }
.instrument:hover { background: var(--tint); }
.instrument-name { font-family: var(--title); font-size: 16px; font-weight: 600; }
.instrument-figure { font-family: var(--title); font-size: 24px; font-weight: 600; letter-spacing: -0.012em; line-height: 1; margin-top: 8px; }
.instrument-line { font-size: 13px; color: var(--ink); line-height: 1.5; margin-top: 6px; }
@media (max-width: 620px) { .instruments { grid-template-columns: 1fr; } .instrument { border-left: 0; padding-left: 2px; } }

/* ---------- sections: a title on a hairline, no box ---------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; align-items: start; }
.cols.dossier { grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols, .cols.dossier { grid-template-columns: 1fr; } }
.section { margin: 0 0 30px; min-width: 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0 10px; border-top: 1px solid var(--ink);
}
.section-title { font-family: var(--title); font-size: 16px; font-weight: 600; margin: 0; }
.section-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-body { min-width: 0; }
.empty { color: var(--ink); font-size: 14px; padding: 14px 0; }

/* ---------- the record head: the instrument, drawn as a document ---------- */
.record-head {
  background: var(--sheet); border: 1px solid var(--line); border-top: 2px solid var(--ink);
  border-radius: 0 0 var(--r-field) var(--r-field);
  padding: 18px 22px 20px; margin: 0 0 24px;
}
.record-kind { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.record-title { font-family: var(--title); font-size: 24px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; margin: 2px 0 0; }
.record-id { font-family: var(--mono); font-size: 13px; color: var(--ink); margin-top: 6px; }
.record-facts { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 36px; }
.fact { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.fact-k { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.fact-v { font-size: 14px; color: var(--ink); }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 28px; }

/* ---------- tables: the register ---------- */
.tablewrap { overflow-x: auto; }
.tablewrap::-webkit-scrollbar { height: 7px; }
.tablewrap::-webkit-scrollbar-thumb { background: var(--line-2); }
table.ledger { border-collapse: collapse; width: 100%; }
table.ledger th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-soft);
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.ledger th:first-child, table.ledger td:first-child { padding-left: 0; }
table.ledger th:last-child, table.ledger td:last-child { padding-right: 0; }
table.ledger td {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 14px; vertical-align: top; line-height: 1.45;
}
table.ledger tr:last-child td { border-bottom: 0; }
table.ledger tfoot td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 600; }
table.ledger tr.rowlink { cursor: pointer; }
table.ledger tr.rowlink td { transition: background 120ms var(--ease); }
table.ledger tr.rowlink:hover td { background: var(--tint); }
table.ledger tr.rowlink:focus-visible { outline: none; }
table.ledger tr.rowlink:focus-visible td { background: var(--tint); border-top-color: var(--steel); border-bottom: 1px solid var(--steel); }
.row:focus-visible { outline: 1px solid var(--steel); outline-offset: -1px; background: var(--tint); }
table.ledger td.r, table.ledger th.r { text-align: right; }
table.ledger td.mono, table.ledger td.r { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.ledger td.strong { font-weight: 600; }
table.ledger td.soft { color: var(--ink-soft); }
table.ledger.compact td { padding: 7px 12px; font-size: 13px; }
table.ledger.queue { min-width: 780px; }
table.ledger td.late { color: var(--red-ink); font-weight: 600; }
table.ledger td.opens {
  font-size: 13px; color: var(--ink-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 210px;
}
table.ledger tr:hover td.opens { color: var(--ink); }
.opens-mark { margin-left: 6px; }

/* ---------- rows: one line on a hairline, never a box ---------- */
.rows { display: block; }
.row {
  display: grid; grid-template-columns: 8px minmax(0, 42%) minmax(0, 1fr) auto;
  gap: 0 14px; align-items: center;
  min-height: 44px; padding: 8px 0; border-top: 1px solid var(--line);
}
.rows .row:first-child { border-top: 0; }
.row[data-goto] { cursor: pointer; transition: background 120ms var(--ease); }
.row[data-goto]:hover { background: var(--tint); }
.row-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.row-mark.red { background: var(--red); }
.row-mark.steel { background: var(--steel); }
.row-mark.green { background: var(--green); }
.row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-line { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; gap: 8px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.row-meta .mono { color: var(--ink); }
@media (max-width: 720px) {
  .row { grid-template-columns: 8px 1fr auto; }
  .row-line { grid-column: 2 / span 2; }
}

/* ---------- tags: sentence case, tinted by state ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; line-height: 1;
  color: var(--ink); background: var(--tint);
  border-radius: var(--r-tag); padding: 4px 7px;
  white-space: nowrap; vertical-align: middle;
}
.tag.red { color: var(--red-ink); background: var(--red-tint); }
.tag.steel { color: var(--steel-ink); background: var(--steel-tint); }
.tag.green { color: var(--green-ink); background: var(--green-tint); }
.tag.mute { color: var(--ink-soft); }
.tag-row, .chip-row { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tag.click { cursor: pointer; transition: background 130ms var(--ease); }
.tag.click:hover { background: var(--line); }
.tag.toggle { cursor: pointer; background: none; border: 1px solid var(--line-2); padding: 3px 7px; }
.tag.toggle:hover { background: var(--tint); }
.tag.toggle.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- deal spine ---------- */
.spine { display: flex; width: 100%; overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spine-seg { flex: 1; padding: 9px 12px 10px; border-left: 1px solid var(--line); min-width: 0; position: relative; }
.spine-seg:first-child { border-left: 0; }
.spine-seg .seg-n { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); display: block; margin-bottom: 3px; }
.spine-seg .seg-l { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.spine-seg.done .seg-l { color: var(--ink); }
.spine-seg.now .seg-l, .spine-seg.now .seg-n { color: var(--ink); font-weight: 600; }
.spine-seg.now::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.spine-seg.dead .seg-l { color: var(--red-ink); font-weight: 600; }

/* ---------- tabs: one row of words that scrolls, never wraps ---------- */
.tabs {
  display: flex; gap: 0; overflow-x: auto; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px; max-width: 100%;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font-size: 14px; font-weight: 500;
  color: var(--ink-soft); background: none; border: 0;
  min-height: 38px; padding: 0 14px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  position: relative; margin-bottom: -1px; flex-shrink: 0;
  transition: color 140ms var(--ease);
}
.tab:first-child { padding-left: 2px; }
.tab:hover { color: var(--ink); }
.tab.is-current { color: var(--ink); font-weight: 600; }
.tab.is-current::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); }
.tab-n { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.tab.is-current .tab-n { color: var(--ink); }
.tabs-inline { display: inline-flex; gap: 0; margin-right: 12px; border-bottom: 1px solid var(--line); }
.tab-inline {
  font-size: 13px; font-weight: 500;
  min-height: 32px; padding: 0 10px; border: 0; background: none; color: var(--ink-soft);
  cursor: pointer; position: relative;
  transition: color 120ms var(--ease);
}
.tab-inline:hover { color: var(--ink); }
.tab-inline.on { color: var(--ink); font-weight: 600; }
.tab-inline.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }

/* ---------- key-value: a term and its value on one line ---------- */
.kv { display: grid; grid-template-columns: minmax(130px, 36%) 1fr; margin: 0; }
.kv > dt { padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line); }
.kv > dd {
  margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 14px; line-height: 1.45; min-width: 0; overflow-wrap: break-word;
}
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }
.kv .none { color: var(--ink-soft); }

/* ---------- meters ---------- */
.meter { height: 4px; background: var(--tint); overflow: hidden; border-radius: 2px; }
.meter > span { display: block; height: 100%; background: var(--ink); transition: width 260ms var(--ease); }
.meter > span.good, .meter > span.green { background: var(--green); }
.meter > span.bad, .meter > span.red { background: var(--red); }
.meter > span.warn, .meter > span.steel { background: var(--steel); }

/* ---------- points ---------- */
.pts-bar { display: flex; height: 22px; overflow: hidden; border: 1px solid var(--line-2); background: var(--sheet); border-radius: var(--r-tag); }
.pts-seg { height: 100%; min-width: 2px; }
.pts-seg.house { background: repeating-linear-gradient(45deg, var(--tint), var(--tint) 5px, var(--sheet) 5px, var(--sheet) 10px); }
.pts-seg.over { background: var(--red); }
.pts-legend { display: flex; flex-wrap: wrap; gap: 7px 20px; margin-top: 12px; }
.pts-key { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.pts-swatch { width: 9px; height: 9px; flex-shrink: 0; border-radius: 2px; }
.pts-num { font-size: 13px; font-weight: 600; }
.pts-of { font-size: 12px; color: var(--ink-soft); margin-left: 5px; white-space: nowrap; }

/* ---------- exceptions: one row per flag on a hairline ---------- */
.flag-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.flag-row:first-child { border-top: 0; }
.flag-row[data-goto] { cursor: pointer; }
.flag-row[data-goto]:hover .flag-text { text-decoration: underline; text-underline-offset: 3px; }
.flag-kind { min-width: 84px; }
.flag-text { font-size: 14px; line-height: 1.45; }
.blockquote { border-left: 2px solid var(--line-2); padding: 2px 0 2px 14px; color: var(--ink); font-size: 14px; line-height: 1.6; }

/* ---------- grades and risk rows ---------- */
.grade-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 0 6px; }
.grade-name { font-size: 13px; font-weight: 600; }
.grade-critical .grade-name { color: var(--red-ink); }
.grade-attention .grade-name { color: var(--steel-ink); }
.grade-monitor .grade-name { color: var(--ink-soft); }
.grade-count { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.grade-note { display: none; }
.risk { display: grid; grid-template-columns: 104px 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.risk[data-goto] { cursor: pointer; transition: background 120ms var(--ease); }
.risk[data-goto]:hover { background: var(--tint); }
.risk-cat { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); padding-top: 3px; line-height: 1.5; }
.risk-critical .risk-cat { color: var(--red-ink); }
.risk-attention .risk-cat { color: var(--steel-ink); }
.risk-main { min-width: 0; }
.risk-statement { font-size: 14px; line-height: 1.45; }
.risk-ref { font-family: var(--mono); font-size: 12px; color: var(--ink); margin-top: 3px; }
@media (max-width: 720px) { .risk { grid-template-columns: 1fr; gap: 5px; } .risk-cat { padding-top: 0; } }

/* ---------- rows of the older shape, issues, diary ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.rowline {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px; padding: 8px 0; border-top: 1px solid var(--line);
  transition: background 120ms var(--ease);
}
.rowline:first-child { border-top: 0; }
.rowline[data-goto] { cursor: pointer; }
.rowline[data-goto]:hover { background: var(--tint); }
.rowline-main { min-width: 0; flex: 1; display: flex; gap: 14px; align-items: baseline; }
.rowline-title { font-size: 14px; font-weight: 500; line-height: 1.4; }
.rowline-line { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowline-side { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.issue { border-top: 1px solid var(--line); padding: 12px 0; }
.issue-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.issue-title { font-weight: 600; font-size: 14px; }
.issue-pos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
@media (max-width: 720px) { .issue-pos { grid-template-columns: 1fr; } }
.pos { border-top: 1px solid var(--line); padding-top: 8px; }
.pos-label { display: block; }
.pos-text { font-size: 14px; color: var(--ink); line-height: 1.5; margin-top: 4px; }

.diary-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 0 16px; align-items: center;
  min-height: 44px; padding: 8px 0; border-top: 1px solid var(--line);
}
.diary-row:first-child { border-top: 0; }
.diary-row[data-goto] { cursor: pointer; }
.diary-row[data-goto]:hover { background: var(--tint); }
.diary-date { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.diary-date.bad, .diary-date.red { color: var(--red-ink); font-weight: 600; }
.diary-date.warn, .diary-date.steel { color: var(--steel-ink); }
.diary-main { min-width: 0; display: flex; gap: 12px; align-items: baseline; }
.diary-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diary-ctx { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diary-side { display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) { .diary-row { grid-template-columns: 80px 1fr; } .diary-side { grid-column: 2; } .diary-main { flex-wrap: wrap; } }

.doc-preview {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75; white-space: pre-wrap;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-control); padding: 18px; max-height: 480px; overflow-y: auto;
}

/* ---------- arriving at a row ---------- */
.focused, tr.focused td { animation: land 2600ms var(--ease) forwards; }
@keyframes land { 0%, 55% { background: var(--steel-tint); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .focused, tr.focused td { animation: none; background: var(--steel-tint); } }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 200; min-width: 200px;
  background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--r-control);
  box-shadow: var(--shadow-menu);
  padding: 4px;
}
.menu-label { padding: 8px 10px 4px; }
.menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  font-size: 14px; color: var(--ink);
  min-height: 34px; padding: 7px 10px; border-radius: var(--r-tag);
  transition: background 110ms var(--ease);
}
.menu-item:hover { background: var(--tint); }
.menu-item.current { font-weight: 600; }
.menu-item.danger { color: var(--red-ink); }
.menu-item.danger:hover { background: var(--red-tint); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 210;
  background: var(--scrim);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 20px 40px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  animation: modal-in 180ms var(--snap);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }
.modal.wide { max-width: 620px; }
.modal.xwide { max-width: 780px; }
.modal-head { padding: 22px 24px 0; }
.modal-title { font-family: var(--title); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.modal-body { padding: 14px 24px 6px; }
.modal-text { font-size: 14px; line-height: 1.55; margin: 0; }
.modal-err { margin-top: 14px; font-size: 13px; color: var(--red-ink); background: var(--red-tint); border-radius: var(--r-control); padding: 10px 12px; line-height: 1.5; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 14px 24px 22px; }
.modal-foot > :first-child:not(.btn) { margin-right: auto; }

/* ---------- drawer: the right edge ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 150; width: 400px; max-width: 100vw;
  background: var(--sheet); border-left: 1px solid var(--line); box-shadow: var(--shadow-menu);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 220ms var(--ease);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-title { font-family: var(--title); font-size: 16px; font-weight: 600; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* ---------- command palette ---------- */
.palette-wrap {
  position: fixed; inset: 0; z-index: 220;
  background: var(--scrim);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 20px 20px;
}
.palette {
  width: 100%; max-width: 560px;
  background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--r-field);
  box-shadow: var(--shadow-menu);
  overflow: hidden;
  animation: modal-in 160ms var(--snap);
}
.palette-input {
  width: 100%; border: 0; outline: none; background: none;
  font-family: var(--sans); font-size: 16px; color: var(--ink);
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.palette-input::placeholder { color: var(--ink-soft); }
.palette-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.palette-group { padding: 9px 12px 3px; }
.palette-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
  font-size: 14px; color: var(--ink);
  min-height: 34px; padding: 7px 12px; border-radius: var(--r-tag);
}
.palette-item .pi-meta { color: var(--ink-soft); font-size: 13px; margin-left: auto; }
.palette-item.sel, .palette-item:hover { background: var(--tint); }
.palette-empty { padding: 26px 20px; color: var(--ink); font-size: 14px; }
.palette-foot { border-top: 1px solid var(--line); padding: 9px 16px; font-size: 12px; color: var(--ink-soft); display: flex; gap: 8px; align-items: center; }

/* ---------- toasts: an ink pill at the foot ---------- */
.toast-stack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--on-ink);
  border-radius: var(--r-control);
  font-size: 13px; font-weight: 500;
  padding: 9px 16px;
  animation: toast-in 220ms var(--snap);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.bad { background: var(--red); color: var(--on-red); }

/* ---------- drafters: client paper, never YV ---------- */
.print-page {
  background: var(--print-paper); color: var(--print-ink);
  max-width: 880px; margin: 0 auto; padding: 66px 74px 84px;
  border: 1px solid var(--line);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.68;
}
.print-page h1 { font-family: var(--title); font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 600; }
.print-sub { font-size: 14px; margin-top: 2px; }
.print-page h2 {
  font-family: var(--title); font-size: 13px; font-weight: 600;
  margin: 34px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--print-line);
}
.print-page h3 { font-size: 14px; margin: 20px 0 6px; font-weight: 600; }
.print-head { border-bottom: 2px solid var(--print-ink); padding-bottom: 18px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.print-org { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.print-meta { font-family: var(--mono); font-size: 11px; color: var(--print-soft); text-align: right; line-height: 1.7; }
.print-page table { border-collapse: collapse; width: 100%; margin: 12px 0 6px; font-variant-numeric: tabular-nums; }
.print-page th { text-align: left; font-size: 12px; font-weight: 500; color: var(--print-soft); padding: 8px 10px; border-bottom: 1px solid var(--print-ink); }
.print-page td { padding: 9px 10px; border-bottom: 1px solid var(--print-line); font-size: 12.5px; vertical-align: top; }
.print-page td.r, .print-page th.r { text-align: right; }
.print-page ul { padding-left: 20px; margin: 10px 0; }
.print-page li { margin-bottom: 8px; }
.print-foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--print-line); font-size: 12px; color: var(--print-ink); line-height: 1.7; }
.print-bar { max-width: 880px; margin: 0 auto 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

@media print {
  .rail, .topbar, .demo-line, .print-bar, .toast-stack, .rail-scrim, .drawer { display: none !important; }
  body, .app, .frame, .main { background: var(--print-paper) !important; padding: 0 !important; margin: 0 !important; display: block !important; }
  .print-page { border: 0; max-width: none; padding: 0; }
}

/* ---------- rail put-away and drawer ---------- */
.topbar .rail-toggle { display: inline-flex; }
.app.rail-away .rail { display: none; }
.rail-scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 220ms var(--ease);
  }
  .rail.open { transform: translateX(0); }
  .rail-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease); }
  .rail-scrim.open { opacity: 1; pointer-events: auto; }
  .app.rail-away .rail { display: flex; }
  .main { padding: 20px 18px 80px; }
  .topbar { padding: 8px 16px; }
  .page-title { font-size: 26px; line-height: 32px; }
  .cmdbar-key { display: none; }
}
@media (max-width: 620px) {
  .modal-wrap { padding: 20px 12px; }
  .palette-wrap { padding: 60px 12px 12px; }
  .print-page { padding: 30px 22px 40px; }
  .head-row { align-items: flex-start; }
  .page-title { font-size: 24px; line-height: 30px; }
  .login-sheet { padding: 30px 22px 24px; }
  .record-head { padding: 16px 16px 18px; }
}

/* ---------- the running clock ---------- */
.clock-start { gap: 8px; padding-left: 10px; white-space: nowrap; }
.clock-run { display: inline-flex; align-items: center; gap: 6px; }
.clock-glyph { width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; }
.clock-glyph::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.5px; height: 4px; background: currentColor; transform: translate(-50%, -100%); transform-origin: bottom; }
.clock-chip {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 34px; padding: 0 12px; max-width: 320px;
  background: var(--ink); color: var(--on-ink);
  border: 1px solid var(--ink); border-radius: var(--r-control);
  cursor: pointer; white-space: nowrap;
  font: 500 13px/1 var(--sans);
}
.clock-chip:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.clock-chip .clock-elapsed { font: 600 14px/1 var(--title); font-variant-numeric: tabular-nums; }
.clock-chip .clock-matter { overflow: hidden; text-overflow: ellipsis; max-width: 160px; font-size: 12px; }
.clock-chip .tag { background: var(--on-ink); }
.clock-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: clock-pulse 2s ease-in-out infinite; }
.clock-chip.paused { background: var(--sheet); color: var(--ink); border-color: var(--line-2); }
.clock-chip.paused:hover { background: var(--tint); }
.clock-chip.paused .clock-dot { animation: none; background: var(--line-2); }
@keyframes clock-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .clock-dot { animation: none; } }
.clock-face { padding: 16px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.clock-face.paused .clock-big { color: var(--ink-soft); }
.clock-big { font: 600 40px/1 var(--title); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink); }
.clock-as { margin-top: 8px; font: 400 14px/1.5 var(--sans); color: var(--ink); }
.clock-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.clock-kind {
  min-height: 32px; padding: 0 12px;
  font: 500 13px/1 var(--sans); color: var(--ink);
  background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-control);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.clock-kind:hover { border-color: var(--ink); background: var(--tint); }
.clock-kind.on { color: var(--on-ink); background: var(--ink); border-color: var(--ink); }
.clock-face .figures { margin: 12px 0 0; }
/* The attach panel's recent matters and the client list: one line each, a hairline between. */
.clock-recent { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.clock-recent-m.btn { justify-content: flex-start; gap: 14px; width: 100%; min-height: 40px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; padding: 0 6px; }
.clock-recent-m.btn:hover { background: var(--tint); }
.clock-recent-m .clock-recent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock-recent-m .clock-recent-client { font-size: 13px; }
/* The review bar: the record is on the clock. */
.review-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 8px 12px;
  background: var(--steel-tint); color: var(--steel-ink); border-radius: var(--r-control);
}
.review-bar .clock-dot { background: var(--steel); }
.review-bar.paused .clock-dot { animation: none; background: var(--line-2); }
.review-bar .review-word { font-weight: 600; }
.review-bar .clock-elapsed { font: 600 16px/1 var(--title); font-variant-numeric: tabular-nums; color: var(--ink); }
.review-bar .btn:first-of-type { margin-left: auto; }
@media (max-width: 720px) { .clock-chip .clock-matter { display: none; } .clock-start { padding: 0 10px; } }

/* ---------- legal acceptance (legal.js) and the public pages (/terms, /privacy) ---------- */
.legal-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.legal-changes { margin: 0 0 10px; padding: 0 0 0 18px; font-size: 13px; color: var(--ink); line-height: 1.55; }
.legal-scroll {
  max-height: 300px; overflow-y: auto; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--paper);
  font-size: 13px; line-height: 1.6; color: var(--ink);
}
.legal-scroll h1 { font-family: var(--title); font-size: 15px; margin: 0 0 8px; }
.legal-scroll h2 { font-family: var(--title); font-size: 13.5px; margin: 14px 0 4px; }
.legal-scroll p, .legal-scroll ul { margin: 0 0 8px; }
.legal-accept { margin-top: 14px; }
.legal-accept .checkline { color: var(--ink); }
.legal-accept .checkline a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.legal-body { background: var(--paper); color: var(--ink); font-family: var(--sans); margin: 0; }
.legal-page { max-width: 780px; margin: 0 auto; padding: 28px 24px 60px; }
.legal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.legal-product { margin-right: auto; font-family: var(--title); font-size: 17px; font-weight: 600; }
.legal-nav a.btn { text-decoration: none; }
.legal-text { background: var(--sheet); border: 1px solid var(--line); border-top: 2px solid var(--ink); border-radius: 0 0 var(--r-field) var(--r-field); padding: 26px 30px 30px; font-size: 14px; line-height: 1.65; }
.legal-text h1 { font-family: var(--title); font-size: 26px; letter-spacing: -0.01em; margin: 0 0 10px; }
.legal-text h2 { font-family: var(--title); font-size: 18px; margin: 26px 0 8px; }
.legal-text h3 { font-family: var(--title); font-size: 15px; margin: 18px 0 6px; }
.legal-text p, .legal-text ul { margin: 0 0 10px; }
.legal-text .legal-facts { font-size: 13px; margin-bottom: 12px; }
.legal-text .legal-changes { font-size: 13px; }
.legal-foot { display: flex; justify-content: center; margin-top: 28px; }
@media (max-width: 640px) { .legal-text { padding: 20px 18px 24px; } .legal-page { padding: 18px 14px 40px; } }

/* ---------------- Agreements (views/agreements.js) ---------------- */
.ag-acts { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ag-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 0 0; border-top: 1px solid var(--line); margin-top: 14px; }
.ag-doc { white-space: pre-wrap; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", Times, serif; font-size: 14.5px; line-height: 1.6; color: var(--ink); max-height: 62vh; overflow-y: auto; padding: 4px 2px; }
.ag-val { background: var(--green-tint); color: var(--ink); padding: 0 2px; }
.ag-blank { background: var(--red-tint); color: var(--red-ink); padding: 0 2px; }
.ag-steps { display: flex; gap: 0; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.ag-step { min-height: 34px; display: inline-flex; align-items: center; padding: 0 14px 0 0; font-size: 13px; color: var(--ink-soft); }
.ag-step.on { color: var(--ink); font-weight: 600; }
.ag-left { margin-top: 14px; }
.ag-fields { margin-top: 14px; }
.ag-fields .form-row { row-gap: 12px; }
.sg-panel table.ledger tr.sg-signer td { transition: background 120ms var(--ease); }
.sg-panel table.ledger tr.sg-signer:hover td { background: var(--tint); }
.sg-rows { display: grid; gap: 10px; }
.sg-row { display: grid; grid-template-columns: 1.1fr 1.3fr 0.9fr auto; gap: 10px; align-items: end; }
.sg-row-act { min-width: 70px; display: flex; justify-content: flex-end; }
@media (max-width: 620px) { .sg-row { grid-template-columns: 1fr; } }
.sg-links { display: grid; gap: 14px; }
.sg-link-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sg-link-row { display: flex; gap: 8px; align-items: center; }
.sg-link-row .input { flex: 1; min-width: 0; }
.modal .ag-bar { padding: 12px 0 0; }

/* ---------- the AI staff: the edge, the drawer's conversation, the sheets, the panel ---------- */
.staff-edge { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
.staff-face { position: relative; width: 34px; height: 34px; border-radius: 50%; padding: 0; border: 1px solid var(--line-2); background: var(--sheet); }
.staff-face:hover { border-color: var(--ink); background: var(--tint); }
.staff-face.at-work { border-color: var(--ink); border-width: 2px; }
.staff-face-img { display: block; width: 26px; height: 26px; border-radius: 50%; }
.staff-face-dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--steel); border: 1px solid var(--sheet); }
.staff-thread { display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 290px); overflow-y: auto; padding: 0 0 8px; }
.staff-msg { display: flex; flex-direction: column; gap: 4px; }
.staff-msg.person { align-items: flex-end; }
.staff-msg-who { font-size: 12px; font-weight: 600; }
.staff-msg-body { font-size: 14px; line-height: 1.55; white-space: pre-wrap; max-width: 92%; }
.staff-msg.person .staff-msg-body { background: var(--tint); border-radius: var(--r-field); padding: 8px 12px; }
.staff-msg-working { font-size: 12px; font-weight: 500; color: var(--steel-ink); }
.staff-ask { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.staff-ask-ctx { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.staff-ask textarea.input { width: 100%; resize: vertical; }
.proposal { border-top: 2px solid var(--ink); padding: 10px 0 14px; margin: 10px 0 0; }
.proposal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.proposal-action { font-family: var(--title); font-size: 15px; font-weight: 600; }
.proposal-title { font-size: 14px; font-weight: 500; margin: 4px 0 6px; }
.proposal .kv > dd .was { display: block; text-decoration: line-through; text-decoration-color: var(--red); margin-top: 2px; }
.staff-roster { display: flex; flex-direction: column; margin-top: 14px; }
.staff-roster-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0 14px; align-items: center; min-height: 48px; border-top: 1px solid var(--line); }
.staff-roster-row:first-child { border-top: 0; }
.staff-roster-row .staff-face-img { width: 36px; height: 36px; }
.staff-roster-name { font-weight: 600; }
.staff-roster-title { color: var(--ink); }

/* The office (Phase 3b): the chambers drawn in ink on paper. Every stroke is currentColor and every
   fill a token; no colour literal. The drawing is still, reduced motion or not. */
.office { color: var(--ink); display: flex; flex-direction: column; gap: 16px; }
.office-svg { width: 100%; height: auto; max-height: 62vh; display: block; }
.office-room { cursor: pointer; }
.office-room-floor { fill: var(--sheet); stroke: currentColor; stroke-width: 1.5; transition: fill 120ms; }
.office-room.is-glass .office-room-floor { stroke-dasharray: 6 4; }
.office-room:hover .office-room-floor, .office-room:focus-visible .office-room-floor { fill: var(--tint); }
.office-room:focus { outline: none; }
.office-room:focus-visible .office-room-floor { stroke-width: 2.5; }
.office-room-label { font-family: var(--title); font-weight: 600; font-size: 13px; fill: var(--ink); pointer-events: none; }
.office-furn { fill: none; stroke: currentColor; stroke-width: 1.25; opacity: 0.7; }
.office-glass-table { fill: var(--tint); opacity: 0.6; }
.office-figure { cursor: pointer; }
.office-figure .of-head { fill: var(--sheet); stroke: currentColor; stroke-width: 1.5; }
.office-figure .of-body { fill: var(--tint); stroke: currentColor; stroke-width: 1.5; }
.office-figure .of-chair { fill: none; stroke: currentColor; stroke-width: 1.25; opacity: 0.6; }
.office-figure .of-dot { fill: var(--steel); stroke: var(--sheet); stroke-width: 1; }
.office-figure:hover .of-body, .office-figure:focus-visible .of-body { fill: var(--steel-tint); }
.office-figure.is-call .of-body { fill: var(--steel-tint); }
.office-figure:focus { outline: none; }

.office-dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.office-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.office-chip { position: relative; width: 38px; height: 38px; border-radius: 50%; padding: 0; border: 1px solid var(--line-2); background: var(--sheet); }
.office-chip:hover { border-color: var(--ink); background: var(--tint); }
.office-chip-dot { position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--steel); border: 1px solid var(--sheet); }
.office-chip-dot.is-call { background: var(--green); }

/* The call window, held within the page; it survives navigation (appended to the body). */
.office-call { position: fixed; right: 20px; bottom: 20px; width: 340px; max-width: calc(100vw - 32px); background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--r-field); z-index: 60; display: flex; flex-direction: column; }
.office-call.is-collapsed { width: auto; border: 0; background: transparent; padding: 0; }
.office-call-reopen { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--ink); background: var(--sheet); }
.office-call-live, .office-call-reopen .office-call-live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.office-call-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.office-call-id { display: flex; flex-direction: column; margin-right: auto; }
.office-call-name { font-family: var(--title); font-weight: 600; font-size: 15px; }
.office-call-title { font-size: 12px; }
.office-call-min { width: 28px; height: 28px; padding: 0; }
.office-call-note { padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--steel-tint); color: var(--steel-ink); }
.office-call-thread { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; max-height: 40vh; overflow-y: auto; }
.office-call-turn { display: flex; flex-direction: column; gap: 3px; }
.office-call-turn.me { align-items: flex-end; }
.office-call-who { font-size: 11px; font-weight: 600; }
.office-call-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; max-width: 92%; }
.office-call-turn.me .office-call-text { background: var(--tint); border-radius: var(--r-field); padding: 6px 10px; }
.office-call-working { font-size: 12px; color: var(--steel-ink); }
.office-call-ask { padding: 0 14px 10px; }
.office-call-controls { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px; }
.office-call-controls .is-leave { margin-left: auto; }
.office-meeting { position: fixed; right: 20px; bottom: 20px; width: 420px; max-width: calc(100vw - 32px); background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--r-field); z-index: 60; padding-bottom: 10px; }
.office-meeting #officeMeetForm { padding: 12px 14px; }
.office-meeting #officeMeetAsk { padding: 0 14px 6px; }
