/* =========================================================================
   Ledger Timesheets — UI mockup stylesheet
   Hand-written CSS, no framework (DEC-04: "plain HTML with hand-written CSS").
   This file is design-direction only: no product code lives here.
   ========================================================================= */

/* ---------- 1. tokens ---------------------------------------------------- */
:root {
  /* paper + ink neutrals: a ledger/paper feel, warm rather than blue-grey */
  --paper: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --surface-3: #f1eee9;
  --line: #e3ded6;
  --line-strong: #cec7bb;

  --text: #1b201d;
  --text-2: #464a46;
  --muted: #6d6862;
  --faint: #938d85;

  /* ledger green as the single brand accent */
  --accent: #14654d;
  --accent-hover: #0f4f3c;
  --accent-ink: #0b3b2d;
  --accent-soft: #e8f2ee;
  --accent-line: #a9cfc1;

  --warn: #8a5710;
  --warn-soft: #fdf4e4;
  --warn-line: #e8d1a4;

  --danger: #9b2b21;
  --danger-soft: #fceeed;
  --danger-line: #e6c5c1;

  --info: #1d5675;
  --info-soft: #eaf3f9;
  --info-line: #b9d5e6;

  /* status colours — three states of one record (TS-02) */
  --st-draft: #565049;
  --st-draft-soft: #f0ede8;
  --st-exported: #14654d;
  --st-exported-soft: #e8f2ee;
  --st-locked: #33415c;
  --st-locked-soft: #eaeef5;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(27, 32, 29, .06), 0 1px 1px rgba(27, 32, 29, .04);
  --shadow-2: 0 12px 32px rgba(27, 32, 29, .16), 0 2px 6px rgba(27, 32, 29, .08);
  --shadow-3: 0 24px 64px rgba(27, 32, 29, .24);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-doc: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --h-top: 52px;
  --gap: 16px;
  --page-max: 1360px;
}

/* ---------- 2. reset / base --------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-synthesis-weight: none;
}

h1, h2, h3, h4 { margin: 0 0 4px; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4 { font-size: 13px; font-weight: 600; color: var(--text-2); }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 12px; }
num, .num { font-variant-numeric: tabular-nums; }

hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

small, .sub { color: var(--muted); font-size: 12px; }
.faint { color: var(--faint); }
.upright { font-style: normal; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. app shell ------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--h-top);
  display: flex; align-items: center; gap: 22px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.015em; white-space: nowrap; }
.brand .mark {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .18);
}
.brand .ver { font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .04em; }

.mainnav { display: flex; gap: 2px; }
.mainnav a {
  color: var(--text-2); padding: 6px 11px; border-radius: 999px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 6px;
}
.mainnav a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.mainnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.mainnav a .n {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-3); border-radius: 999px; padding: 1px 5px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ws-chip {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 10px;
}
.ws-chip b { color: var(--text-2); font-weight: 600; }
.ws-chip .avatar {
  width: 20px; height: 20px; border-radius: 999px; background: var(--surface-3);
  color: var(--text-2); font-size: 10px; font-weight: 700; display: grid; place-items: center;
}

.page { max-width: var(--page-max); margin: 0 auto; padding: 22px 20px 120px; }

.pagehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead .lead { margin-right: auto; }
.pagehead .eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); font-weight: 700; margin-bottom: 3px;
}
.pagehead p { margin: 4px 0 0; color: var(--muted); max-width: 78ch; }
.pagehead .actions { display: flex; gap: 8px; align-items: center; }

/* ---------- 4. cards / panels ------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--gap); }
.card > header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
}
.card > header h2, .card > header h3 { margin: 0; font-size: 13.5px; }
.card > header .hint { color: var(--muted); font-size: 12px; }
.card > header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card > .body { padding: 14px; }
.card > .body.tight { padding: 0; }
.card > footer {
  padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius); font-size: 12px; color: var(--muted);
}
.card.flat { box-shadow: none; }
.card.accent-top { border-top: 3px solid var(--accent); }

.grid { display: grid; gap: var(--gap); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid.side-left { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
@media (max-width: 1080px) {
  .grid.side, .grid.side-left, .grid.three, .grid.two { grid-template-columns: minmax(0, 1fr); }
}

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- 5. buttons --------------------------------------------------- */
.btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.btn.danger:hover { background: #f8e0dd; }
.btn.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.lg { padding: 9px 18px; }
.btn.icon { padding: 5px 8px; }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed; background: var(--surface-2); color: var(--faint);
  border-color: var(--line);
}
.btn .ico { font-size: 13px; line-height: 1; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); z-index: 1; }

kbd {
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); padding: 0 5px; min-width: 18px; display: inline-block;
  text-align: center; color: var(--text-2); font-weight: 600; box-shadow: inset 0 -1px 0 var(--line);
}
.kbd-hint { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 6. badges, chips, flags -------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; border: 1px solid;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.draft { color: var(--st-draft); background: var(--st-draft-soft); border-color: #ddd7cd; }
.badge.exported { color: var(--st-exported); background: var(--st-exported-soft); border-color: var(--accent-line); }
.badge.locked { color: var(--st-locked); background: var(--st-locked-soft); border-color: #c3cddf; }
.badge.superseded { color: var(--muted); background: var(--surface-3); border-color: var(--line-strong); text-transform: none; letter-spacing: .01em; font-weight: 600; }
.badge.current { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); text-transform: none; letter-spacing: .01em; font-weight: 600; }
.badge.archived { color: var(--muted); background: var(--surface-3); border-color: var(--line-strong); }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.badge.info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.badge.plain { border-style: dashed; color: var(--faint); background: transparent; border-color: var(--line-strong); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2);
  border-radius: 999px; padding: 2px 9px;
}
.chip.inherit { border-style: dashed; color: var(--muted); }
.chip .tick { color: var(--accent); }

.flag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  border-radius: 4px; padding: 1px 6px; border: 1px solid;
}
.flag.weekend { color: #6b6152; background: #f2efe9; border-color: #ddd7cd; }
.flag.holiday { color: #8a5710; background: var(--warn-soft); border-color: var(--warn-line); }
.flag.future { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.flag.granted { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

.ot-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #7a4a12; border: 1px solid var(--warn-line); background: var(--warn-soft);
  border-radius: 3px; padding: 0 4px;
}

/* ---------- 7. forms ----------------------------------------------------- */
label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 3px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .help.warn { color: var(--warn); }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; font-weight: 600; }
.req { color: var(--danger); font-weight: 700; margin-left: 2px; }

input[type=text], input[type=email], input[type=url], input[type=number],
input[type=time], input[type=search], textarea, select {
  font: inherit; color: var(--text); width: 100%;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 6px 9px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible,
a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
input[readonly], textarea[readonly], input[disabled], textarea[disabled], select[disabled] {
  background: var(--surface-3); color: var(--muted); border-style: dashed; cursor: not-allowed;
}
textarea { min-height: 68px; resize: vertical; }
select {
  appearance: none; padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%236d6862'/>");
  background-repeat: no-repeat; background-position: right 9px center;
}
input[type=number] { font-variant-numeric: tabular-nums; }
.inline-fields { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-fields > * { flex: 1 1 8rem; }
.inline-fields > .fixed { flex: 0 0 auto; }

.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 400; color: var(--text-2); }
.check input { margin: 2px 0 0; flex: none; }
.check.stack-col { flex-direction: column; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button {
  appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600;
  padding: 5px 12px; color: var(--text-2); cursor: pointer; border-left: 1px solid var(--line);
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.seg button:hover { background: var(--surface-3); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { appearance: none; width: 34px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; border: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 999px; background: #fff; transition: transform .15s; box-shadow: var(--shadow-1); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

.form-readonly-note {
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px;
}

/* fieldset grouping inside drawers/cards */
fieldset.group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; background: var(--surface-2); }
fieldset.group > legend { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); padding: 0 6px; }

/* ---------- 8. tables ---------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data caption { text-align: left; color: var(--muted); font-size: 12px; padding: 0 0 8px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.is-archived { color: var(--muted); background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(0, 0, 0, .018) 6px 12px); }
table.data tr.ot td { background: var(--warn-soft); }
table.data tr.totals td { border-top: 2px solid var(--line-strong); font-weight: 700; background: var(--surface-2); }
table.data .indent { padding-left: 18px; position: relative; }
table.data .indent::before {
  content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--warn-line);
}
.rowkind { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #7a4a12; }

/* ---------- 9. calendar -------------------------------------------------- */
.cal { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 6px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: right; }
.cal-head div.wknd { color: #8b8177; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cell {
  min-height: 92px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 6px; position: relative; background: var(--surface); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; text-align: left; font: inherit;
}
.cell:nth-child(7n) { border-right: 0; }
.cell:hover { background: #fcfbf9; }
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 2; }
.cell .d { font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cell .dur { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cell .deq { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell .sum {
  font-size: 11px; color: var(--muted); line-height: 1.35; max-height: 2.7em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cell .mini-flags { display: flex; gap: 3px; flex-wrap: wrap; }
.cell .mini-flags .flag { font-size: 10px; padding: 0 4px; }
.cell.empty .dur { color: var(--faint); font-weight: 600; }
.cell.wknd { background: #f7f5f1; }
.cell.wknd .d { color: #8b8177; }
.cell.holiday { background: #fdf7ea; }
.cell.holiday::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(160, 110, 20, .06) 7px 14px);
}
.cell.future .d { color: var(--info); }
.cell.today { box-shadow: inset 0 0 0 2px var(--accent-line); }
.cell.today .d::before { content: "● "; color: var(--accent); font-size: 9px; vertical-align: 2px; }
.cell.has-exception .ot-corner { position: absolute; top: 4px; right: 5px; font-size: 10px; color: var(--accent); font-weight: 800; }
.cell.ot-cell::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--warn-line);
}
.cell .ot-line { font-size: 11px; color: #7a4a12; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell.out { background: var(--surface-3); color: var(--faint); cursor: default; }
.cell.out .d { color: var(--faint); font-weight: 500; }
.cell.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cell.readonly { cursor: default; }
.cell .quick { position: absolute; bottom: 4px; right: 5px; font-size: 10px; color: var(--faint); }

.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 8px 2px 0; }
.cal-legend i { width: 12px; height: 12px; border: 1px solid var(--line-strong); border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -2px; }
.cal-legend i.wknd { background: #f7f5f1; }
.cal-legend i.hol { background: #fdf7ea; }
.cal-legend i.ex { background: var(--accent-soft); border-color: var(--accent-line); }

/* ---------- 10. totals strip -------------------------------------------- */
.totals {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 10px 12px; box-shadow: var(--shadow-1);
}
.totals .t { padding: 2px 14px 2px 0; margin-right: 4px; border-right: 1px solid var(--line); min-width: 118px; }
.totals .t:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.totals .t .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.totals .t .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.totals .t .v small { font-size: 12px; font-weight: 600; color: var(--muted); }
.totals .t .sub2 { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.totals .t.ot .v { color: #7a4a12; }
.totals .t.comb .v { color: var(--accent-ink); }
.totals .t.note { display: flex; align-items: center; }
.formula { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 4px; padding: 2px 6px; }

/* ---------- 11. history / artifacts -------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 14px 22px; border-left: 1px solid var(--line); margin-left: 7px; }
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.timeline > li.strong::before { border-color: var(--accent); background: var(--accent-soft); }
.timeline .tl-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-kind { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.timeline time { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.timeline .tl-text { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.timeline blockquote {
  margin: 6px 0 0; padding: 7px 10px; border-left: 3px solid var(--warn-line);
  background: var(--warn-soft); font-size: 13px; color: #6d4610; border-radius: 0 4px 4px 0;
}

.artifacts { list-style: none; margin: 0; padding: 0; }
.artifacts > li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.artifacts > li:last-child { border-bottom: 0; }
.art-no {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; background: var(--surface-2); flex: none;
}
.art-main { flex: 1 1 auto; min-width: 0; }
.art-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.artifacts li.sup { opacity: .72; }
.artifacts li.sup .art-no { text-decoration: line-through; }

/* ---------- 12. snapshot card ------------------------------------------- */
.snap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.snap .col { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.snap h4 { margin-bottom: 6px; }
.diff { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.diff th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 4px 0; }
.diff td { padding: 4px 8px 4px 0; border-top: 1px solid var(--line); vertical-align: top; }
.diff td.old { color: var(--muted); }
.diff td.new { color: var(--accent-ink); font-weight: 600; }
.diff .fname { font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- 13. banners / callouts / toasts ------------------------------ */
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px;
  border-radius: var(--radius); border: 1px solid; margin-bottom: var(--gap);
}
.banner .bi { font-size: 16px; line-height: 1.2; }
.banner h3 { font-size: 13.5px; margin: 0 0 2px; }
.banner p { margin: 0; font-size: 13px; }
.banner .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
.banner.info { background: var(--info-soft); border-color: var(--info-line); color: #14405c; }
.banner.locked { background: var(--st-locked-soft); border-color: #c3cddf; color: #24314a; }
.banner.exported { background: var(--st-exported-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.banner.warn { background: var(--warn-soft); border-color: var(--warn-line); color: #6d4610; }
.banner.danger { background: var(--danger-soft); border-color: var(--danger-line); color: #7c211a; }
.banner.plain { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }

.callout {
  border-left: 3px solid var(--accent); background: var(--surface-2); padding: 9px 12px;
  font-size: 12.5px; color: var(--text-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.callout.warn { border-left-color: var(--warn); }
.callout.avoid { border-left-color: var(--danger); }
.callout code { background: var(--surface-3); padding: 0 3px; border-radius: 3px; }

.empty {
  text-align: center; padding: 34px 20px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
}
.empty h3 { color: var(--text-2); }
.empty .glyph { font-size: 26px; opacity: .5; display: block; margin-bottom: 6px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast {
  background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 10px 12px; font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .code { font-family: var(--font-mono); font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.toast .x { margin-left: auto; }

/* ---------- 14. dialogs / drawers ---------------------------------------- */
dialog.dlg {
  border: 0; border-radius: var(--radius-lg); padding: 0; max-width: 560px; width: calc(100% - 32px);
  box-shadow: var(--shadow-3); color: var(--text); background: var(--surface);
}
dialog.dlg::backdrop { background: rgba(27, 32, 29, .45); backdrop-filter: blur(1px); }
dialog.dlg > header { padding: 16px 20px 0; }
dialog.dlg > header h2 { font-size: 17px; }
dialog.dlg > .body { padding: 12px 20px 4px; }
dialog.dlg > footer { padding: 14px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 14px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
dialog.dlg .dlg-note { font-size: 12px; color: var(--muted); }
dialog.dlg .no-reason {
  background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 12px; color: var(--muted);
}
dialog.dlg.danger > header h2 { color: var(--danger); }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow-3);
  z-index: 70; display: flex; flex-direction: column; transform: translateX(0);
}
.drawer[hidden] { display: none; }
.drawer > header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer > header h2 { font-size: 16px; margin: 0; }
.drawer > .body { padding: 16px 18px; overflow: auto; flex: 1 1 auto; }
.drawer > footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--surface-2); }
.drawer > footer .left { margin-right: auto; }
.drawer .close { margin-left: auto; }
.scrim { position: fixed; inset: 0; background: rgba(27, 32, 29, .35); z-index: 60; }

/* ---------- 15. mockup-only chrome -------------------------------------- */
.mockbar {
  position: fixed; left: 14px; bottom: 14px; z-index: 80;
  background: #23282a; color: #e9e6e0; border-radius: 999px;
  box-shadow: var(--shadow-2); font-size: 12.5px;
  display: flex; align-items: center; gap: 4px; padding: 4px;
}
.mockbar > button {
  appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.mockbar > button:hover { background: #343b3e; }
.mockbar .tag { background: #4a3f22; color: #f0d9a5; border-radius: 999px; padding: 3px 9px; font-weight: 700; font-size: 11px; letter-spacing: .04em; }
.mockpanel {
  position: fixed; left: 14px; bottom: 58px; z-index: 80; width: min(380px, calc(100vw - 28px));
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-3); max-height: 70vh; overflow: auto; display: none;
}
.mockpanel.open { display: block; }
.mockpanel > header { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mockpanel .body { padding: 12px 14px; }
.mockpanel .body > * + * { margin-top: 10px; }
.mockpanel .label { font-size: 12px; }

.notes {
  border: 1px solid var(--info-line); background: var(--info-soft); border-radius: var(--radius);
  padding: 14px 16px; font-size: 13px; color: #17415a;
}
.notes h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: #1d5675; margin-bottom: 8px; }
.notes ul { margin: 0 0 0 18px; padding: 0; }
.notes li { margin-bottom: 5px; }
.notes .id { font-family: var(--font-mono); font-size: 11.5px; background: #fff; border: 1px solid var(--info-line); border-radius: 3px; padding: 0 4px; }
body:not(.show-notes) .notes { display: none; }

/* ---------- 16. page index cards ----------------------------------------- */
.cards-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.ncard { display: block; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1); }
.ncard:hover { border-color: var(--accent-line); text-decoration: none; box-shadow: var(--shadow-2); }
.ncard .n-k { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.ncard h3 { margin: 4px 0 4px; }
.ncard p { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.ncard .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.ncard .tags .chip { font-size: 11px; padding: 1px 7px; }

.specimen { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.specimen .sw { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.specimen .sw .chipcolor { height: 42px; }
.specimen .sw .meta { padding: 6px 8px; font-size: 11.5px; font-family: var(--font-mono); color: var(--muted); }

/* ---------- 17. print ----------------------------------------------------- */
@media print {
  .topbar, .mockbar, .mockpanel, .notes, .pagehead .actions, .no-print { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- 18. small screens -------------------------------------------- */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 10px; }
  .mainnav { order: 3; width: 100%; overflow: auto; }
  .page { padding: 14px 12px 120px; }
  .cell { min-height: 66px; }
  .cell .sum { display: none; }
  .totals .t { border-right: 0; }
}

/* ---------- 19. state machine diagram (index) --------------------------- */
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid.four { grid-template-columns: minmax(0, 1fr); } }

.fsm { display: flex; flex-direction: column; gap: 10px; }
.fsm-row { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.fsm-node {
  flex: 1 1 150px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; background: var(--surface-2); min-width: 150px;
}
.fsm-node b { display: block; font-size: 13.5px; }
.fsm-node span { font-size: 11.5px; color: var(--muted); }
.fsm-node.draft { border-color: #ddd7cd; background: var(--st-draft-soft); }
.fsm-node.exported { border-color: var(--accent-line); background: var(--st-exported-soft); }
.fsm-node.locked { border-color: #c3cddf; background: var(--st-locked-soft); }
.fsm-arrow {
  flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 0 6px; font-size: 11px; color: var(--muted); min-width: 84px;
}
.fsm-arrow::before { content: "⟶"; font-size: 17px; color: var(--line-strong); line-height: 1; }
.fsm-arrow b { font-size: 11.5px; color: var(--text-2); }
.fsm-back { border-top: 1px dashed var(--line-strong); padding-top: 8px; }
.fsm-backline { font-size: 12px; color: var(--muted); }
.fsm-backline b { color: var(--warn); }

/* ---------- 20. misc --------------------------------------------------- */
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, #f1eee9 25%, #f8f6f3 37%, #f1eee9 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
h2[id], h3[id] { scroll-margin-top: 70px; }
.anchor-nav a { text-decoration: none; }
a.chip:hover { text-decoration: none; border-color: var(--accent-line); color: var(--accent-ink); }

/* ---------- 21. correctness guards ------------------------------------- */
/* a utility class setting `display` must never beat the hidden attribute */
[hidden] { display: none !important; }

/* side column refinements discovered while reviewing at 1440 px */
/* wide screens only — must not override the 1080 px collapse above */
@media (min-width: 1361px) { .grid.side { grid-template-columns: minmax(0, 1fr) 384px; } }
.art-main strong { font-size: 12.5px; word-break: break-word; }
.art-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px 10px; }
.timeline time { display: inline-block; }
table.mini-ro { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini-ro th { text-align: left; width: 34%; font-weight: 600; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px 6px 0; vertical-align: top; }
table.mini-ro td { padding: 6px 0; border-bottom: 1px dotted var(--line); }
table.mini-ro tr:last-child td { border-bottom: 0; }

/* snapshots sit in the wide column, so the two-panel comparison fits */
.snap { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-ink); text-decoration: underline; }
.fsm-node { flex: 1 1 0; min-width: 118px; }
.fsm-arrow { min-width: 62px; padding: 0 3px; }

/* ---------- 22. tables inside cards -------------------------------------- */
/* A table that cannot fit scrolls inside its own card — it must never paint
   over the card border or the column beside it (dashboard at 1440 px did). */
.card > .body.tight, .scroll-x { overflow-x: auto; }
.card > .body.tight > table.data th, .scroll-x > table.data th { white-space: normal; }   /* wrapping headers shrink column min-widths */
.card > .body.tight > table.data td, .scroll-x > table.data td { overflow-wrap: anywhere; }
.card > .body.tight > table.data td .row, .scroll-x > table.data td .row { flex-wrap: wrap; }  /* button groups wrap rather than force width */
.card > .body.tight > table.data th, .card > .body.tight > table.data td, .scroll-x > table.data th, .scroll-x > table.data td { padding: 8px; }
.card > .body.tight > table.data, .scroll-x > table.data { font-size: 12.5px; }
/* the action column stays reachable while a wide table scrolls */
.card > .body.tight > table.data th:last-child, .card > .body.tight > table.data td:last-child,
.scroll-x > table.data th:last-child, .scroll-x > table.data td:last-child {
  position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 0 var(--line);
}
.card > .body.tight > table.data thead th:last-child, .scroll-x > table.data thead th:last-child { background: var(--surface-2); }
.card > .body.tight > table.data tbody tr:hover td:last-child, .scroll-x > table.data tbody tr:hover td:last-child { background: var(--surface-2); }
.card > .body.tight > table.data tr.is-archived td:last-child {
  background: repeating-linear-gradient(-45deg, var(--surface) 0 6px, rgba(0, 0, 0, .018) 6px 12px);
}
/* the dashboard/timesheet tables need the full width before a 384 px rail is worth it */
@media (min-width: 1081px) and (max-width: 1360px) { .grid.side { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 23. topbar before it collapses -------------------------------- */
/* Nav labels must not stack into three lines, and the workspace chip must not
   squeeze the company name into a column. */
.mainnav a { white-space: nowrap; }
.ws-chip { flex: none; }
.ws-chip .who { display: inline-block; vertical-align: middle; max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 861px) and (max-width: 1300px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .mainnav a { padding: 5px 8px; }
  .brand .ver { display: none; }
  .ws-chip .muted { display: none; }
  .ws-chip .who { max-width: 128px; }
}
