/* Zeffer Squin Management System
   Layout: fixed navy sidebar in the company's brand, light working canvas, amber accents for action and attention. */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --sunk: #eaeef6;
  --ink: #0d1838;
  --ink-2: #33405f;
  --muted: #5b6687;
  --line: #dbe1ee;
  --line-strong: #c3cce0;
  --navy: #0f1f5c;
  --navy-2: #172a72;
  --navy-ink: #ffffff;
  --navy-muted: #a7b4dc;
  --accent: #e8961c;
  --accent-strong: #c97c08;
  --accent-ink: #1d1300;
  --blue: #1a6fd6;
  --focus: #1a6fd6;
  --ok: #16804a; --ok-bg: #e1f3e8;
  --warn: #975a00; --warn-bg: #fcefd6;
  --crit: #b42f2f; --crit-bg: #fae3e3;
  --info: #1a5fb8; --info-bg: #e1ecfb;
  --neutral: #4c5670; --neutral-bg: #eaedf3;
  --legal: #6b3fb0; --legal-bg: #efe7fb;
  --c1: #1a6fd6; --c2: #16804a; --c3: #e8961c;
  --shadow: 0 1px 2px rgba(13, 24, 56, .06), 0 6px 20px rgba(13, 24, 56, .06);
  --radius: 10px;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --f-display: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070c20; --surface: #0f1733; --sunk: #0b1229; --ink: #e6ebf8; --ink-2: #c3cbe2; --muted: #97a3c6;
    --line: #233057; --line-strong: #31406e; --navy: #0a1640; --navy-2: #13235c; --navy-muted: #8f9fd0;
    --accent: #f5a623; --accent-strong: #ffb84a; --blue: #5aa2ff; --focus: #7ab4ff;
    --ok: #5ad194; --ok-bg: #0f2e20; --warn: #f2b54a; --warn-bg: #33240a; --crit: #ff8a8a; --crit-bg: #3a1515;
    --info: #82b8ff; --info-bg: #132b4f; --neutral: #b2bad0; --neutral-bg: #1c2441; --legal: #c6a6ff; --legal-bg: #2a1d47;
    --c1: #5aa2ff; --c2: #5ad194; --c3: #f5a623;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .93em; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-crit { color: var(--crit); } .text-warn { color: var(--warn); }
.ok-text { color: var(--ok) !important; } .danger-text { color: var(--crit) !important; }
.selectable { user-select: all; }
.prose { max-width: 70ch; white-space: pre-wrap; }
.pre { white-space: pre-wrap; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); letter-spacing: .2em; }
.loading { padding: 48px 0; color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: var(--navy-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.mark { width: 24px; height: 28px; background: var(--blue); clip-path: polygon(50% 0, 100% 16%, 100% 56%, 50% 100%, 0 56%, 0 16%); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: 9px; height: 3px; background: var(--accent); border-radius: 2px; }
.logo-mark { width: 36px; height: 36px; border-radius: 8px; flex: none; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.wordmark { font: 800 16px/1 var(--f-display); letter-spacing: .1em; }
.wordmark.small { font-size: 14px; }
.sub { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--navy-muted); margin-top: 5px; }
.brand.dark .sub { color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 16px; flex: 1; }
.nav-group { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--navy-muted); padding: 16px 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 7px; color: #dfe5f7; font-weight: 500; position: relative; }
.nav-link:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--navy-2); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 14px 18px; display: grid; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; color: #fff; }
.me:hover { text-decoration: none; }
.me strong { display: block; font-size: 14px; }
.me small { color: var(--navy-muted); font-size: 12px; }
.side-row { display: flex; gap: 8px; align-items: center; }
.side-row select, .portal-top select { flex: 1; background: var(--navy-2); color: #fff; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-weight: 700; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 12px; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.view { padding: 28px max(16px, 3vw) 56px; max-width: 1280px; width: 100%; outline: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(5, 10, 30, .5); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: 10px max(16px, env(safe-area-inset-left)); }
  .topbar .icon-btn { color: #fff; }
  .view { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- page furniture ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 + .phase { margin-top: 12px; max-width: 360px; }
.lede { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.back:hover { color: var(--ink); text-decoration: none; }
.code { font: 500 12.5px/1 var(--f-mono); color: var(--muted); letter-spacing: .02em; }
.notice { background: var(--warn-bg); color: var(--ink); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.notice.crit { background: var(--crit-bg); border-left-color: var(--crit); }
.pad { padding: 0 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 7px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--sunk); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.xs { padding: 3px 8px; font-size: 12px; }
.btn.block { width: 100%; padding: 11px; }
.btn.on-dark { color: #fff; border-color: rgba(255, 255, 255, .25); }
.btn.on-dark:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm .ico { width: 15px; height: 15px; }
.icon-btn.on-dark { color: var(--navy-muted); }
.icon-btn.on-dark:hover { background: var(--navy-2); color: #fff; }
.link { font-size: 13.5px; font-weight: 500; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.toolbar select, .toolbar input[type=search] { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 10px; font-size: 14px; max-width: 100%; }
.inline { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); }
.inline input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.search { position: relative; display: inline-flex; align-items: center; min-width: min(100%, 260px); }
.search.grow { flex: 1; }
.search .ico { position: absolute; left: 10px; color: var(--muted); pointer-events: none; width: 16px; }
.search input { padding-left: 34px !important; width: 100%; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--sunk); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs [role=tab] { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px 9px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; font-size: 14.5px; }
.tabs [role=tab]:hover { color: var(--ink); text-decoration: none; }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-size: 12px; text-align: center; font-weight: 600; }

/* ---------- stats & panels ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stats.small { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); }
a.stat:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: var(--shadow); }
.stat b { font: 700 24px/1.1 var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .stats .stat.wide { grid-column: 1 / -1; } .stat b { font-size: 21px; } }
.stats.small .stat b { font-size: 18px; }
.stat span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat.tone-crit { border-color: var(--crit); }
.stat.tone-crit b { color: var(--crit); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.panel-head h2 { font-size: 15px; }
.panel-title { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.dash-grid .panel { margin: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.side-stack .panel, .main-stack .panel { margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.plain { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.panel .empty { padding: 14px 8px; }
.sub-title { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); min-width: 0; flex-wrap: wrap; }
.list > li:first-child { border-top: 0; }
.list .grow strong { font-weight: 600; display: block; overflow-wrap: anywhere; }
.list .grow small { display: block; }
.row-link { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--ink); min-width: 0; flex-wrap: wrap; }
.row-link:hover { text-decoration: none; }
.row-link:hover strong, .row-link:hover .grow { color: var(--blue); }
.list > li:has(> .row-link) { padding: 0; }
.list > li > .row-link { padding: 9px 2px; }
.date { font-size: 13px; color: var(--muted); min-width: 92px; }
.list input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.is-done strong, tr.is-done td:first-child strong { text-decoration: line-through; color: var(--muted); }
.ledger > li.is-overdue, tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.ledger > li { padding-left: 10px; }
.month { margin-bottom: 18px; }
.month-title { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; display: flex; gap: 10px; }
.month .list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }

/* badges & chips */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.tone-ok { color: var(--ok); background: var(--ok-bg); } .tone-warn { color: var(--warn); background: var(--warn-bg); }
.tone-info { color: var(--info); background: var(--info-bg); } .tone-crit { color: var(--crit); background: var(--crit-bg); }
.tone-neutral { color: var(--neutral); background: var(--neutral-bg); } .tone-muted { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.stat.tone-crit { background: var(--surface); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 5px; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip .ico { width: 12px; height: 12px; }
.chip-crit { color: var(--crit); background: var(--crit-bg); }
.chip-warn { color: var(--warn); background: var(--warn-bg); }
.chip-lock { color: var(--crit); background: transparent; border: 1px solid currentColor; }
.chip-legal { color: var(--legal); background: var(--legal-bg); }
.dir { display: inline-block; font: 600 10.5px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px; }
.dir-in { color: var(--info); background: var(--info-bg); }
.dir-out { color: var(--ok); background: var(--ok-bg); }

/* phase bar: six steps of the delivery process */
.phase { min-width: 140px; }
.phase-bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.phase-bars span { height: 6px; border-radius: 3px; background: var(--line); }
.phase-bars span.done { background: var(--blue); }
.phase-bars span.cur { background: var(--accent); }
.phase-text { font-size: 12.5px; margin-top: 5px; font-weight: 600; white-space: nowrap; }
.phase-text .mono { color: var(--muted); font-weight: 500; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.click tbody tr { cursor: pointer; }
.table.click tbody tr:hover { background: var(--sunk); }
.table td.actions { white-space: nowrap; text-align: right; width: 1%; }
.table th.num, .table td.num { text-align: right; }
.table select { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: 13px; }
.cell-title { font-weight: 600; margin-top: 3px; }
.cell-title a { color: var(--ink); }
.file-link { display: inline-flex; gap: 8px; align-items: flex-start; color: var(--ink); }
.file-link .ico { margin-top: 2px; color: var(--muted); }
.file-link small { display: block; }
@media (max-width: 760px) { .hide-sm { display: none; } }
@media (max-width: 1100px) { .hide-md { display: none; } }

/* switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* boards (tasks, pipeline) */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; }
.board.wide { grid-template-columns: repeat(6, minmax(210px, 1fr)); }
.col { background: var(--sunk); border-radius: var(--radius); padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.col > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.col > header h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.col-total { padding: 0 4px; color: var(--muted); }
.col-body { display: flex; flex-direction: column; gap: 8px; }
.col-empty { color: var(--muted); font-size: 13px; padding: 10px 4px; }
.stage-won { background: var(--ok-bg); } .stage-lost { opacity: .8; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; cursor: pointer; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card h3 { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.card-top, .card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-actions { display: flex; flex-wrap: wrap; gap: 4px; border-top: 1px solid var(--line); padding-top: 6px; }
.task.prio-urgent { border-left: 3px solid var(--crit); }
.task.prio-high { border-left: 3px solid var(--accent); }

/* bars on dashboard */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--blue); border-radius: 5px; min-width: 2px; }
.bar-val { font-size: 12.5px; color: var(--muted); }
.dash-grid .panel:has(.bars) { min-height: 0; }

/* chart */
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; min-width: 560px; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 11px var(--f-body); }
.chart .c1 { fill: var(--c1); } .chart .c2 { fill: var(--c2); } .chart .c3 { fill: var(--c3); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .c1 { background: var(--c1); } .legend .c2 { background: var(--c2); } .legend .c3 { background: var(--c3); }

/* finance documents */
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; max-width: 360px; margin: 14px 0 0 auto; font-size: 14px; }
.totals dt { color: var(--muted); text-align: right; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }
.items-editor .table td { padding: 6px; }
.items-editor input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; }
.items-editor td.num input { text-align: right; max-width: 120px; }
.items-editor { overflow-x: auto; }

/* plans */
.rhythm { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 8px; }
.rhythm div { background: var(--sunk); border-radius: var(--radius); padding: 14px 16px; }
.rhythm b { display: block; font: 700 13px/1.2 var(--f-display); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.rhythm p { font-size: 14px; color: var(--muted); }
.horizon .list { margin-bottom: 10px; }

/* people */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.person small { display: block; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.timeline li { border-left: 2px solid var(--line); padding-left: 12px; }

/* ---------- forms & dialogs ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--crit); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 7px; padding: 9px 11px; font-size: 14.5px; min-width: 0;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.field .invalid, .field input.invalid { border-color: var(--crit) !important; }
.field.check { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.field.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.field.check .help { flex-basis: 100%; }
.help { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 12.5px; color: var(--crit); min-height: 0; }
.field-error:empty { display: none; }
.form-heading { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px; font-size: 14px; }
.checklist label { display: flex; gap: 8px; align-items: center; }
.checklist input { accent-color: var(--accent); }
.form-panel .form-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.form-msg { color: var(--crit); font-size: 14px; min-height: 1.2em; }

dialog.modal { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(5, 10, 30, .35); }
dialog.modal.wide { width: min(860px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(5, 10, 30, .55); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--sunk); border-radius: 0 0 12px 12px; }
.confirm-text { font-size: 15px; }
code.big { font-size: 18px; padding: 4px 8px; background: var(--sunk); border-radius: 6px; margin-right: 8px; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 100; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--crit); color: #fff; }

/* ---------- sign-in ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  linear-gradient(180deg, var(--navy) 0, var(--navy) 38vh, var(--bg) 38vh); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.login-brand { display: grid; justify-items: center; gap: 8px; padding-bottom: 4px; }
.login-logo { width: 132px; height: 132px; border-radius: 16px; display: block; }
.login-brand .sub { color: var(--muted); }
.login-card h1 { font-size: 22px; }
.login-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.login-foot select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }

/* ---------- client portal ---------- */
.portal-shell { min-height: 100vh; }
.portal-top { background: var(--navy); color: #fff; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 6px max(16px, 3vw); }
.portal-top .brand { padding: 12px 0; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portal-main { max-width: 1040px; margin: 0 auto; padding: 28px max(16px, 3vw) 56px; outline: none; }
.portal-project { display: grid; gap: 10px; }
.portal-project h2 { font-size: 19px; margin-top: 6px; }
.portal-project .phase { max-width: 380px; margin: 4px 0 6px; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: inline-grid; place-items: center; color: var(--ok); flex: none; }
.is-done .tick { border-color: var(--ok); background: var(--ok-bg); }
.tick .ico { width: 13px; height: 13px; }

/* ---------- printable invoice ---------- */
.print-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.paper { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 48px 52px; border-radius: 6px; box-shadow: var(--shadow); font-size: 14px; }
.paper-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-bottom: 3px solid #0f1f5c; padding-bottom: 20px; }
.paper-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.paper-brand strong { display: block; font: 800 18px/1.1 var(--f-display); letter-spacing: .08em; color: #0f1f5c; text-transform: uppercase; }
.paper-brand small { letter-spacing: .14em; text-transform: uppercase; color: #555; font-size: 10px; }
.paper-title h1 { font-size: 26px; letter-spacing: .12em; color: #0f1f5c; text-align: right; }
.paper-title dl { display: grid; grid-template-columns: auto auto; gap: 4px 14px; margin: 10px 0 0; justify-content: end; }
.paper-title dt { color: #666; } .paper-title dd { margin: 0; text-align: right; }
.bill-to { margin: 22px 0; }
.bill-to h2, .paper-notes h2 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #666; margin-bottom: 6px; }
.paper-items { width: 100%; border-collapse: collapse; }
.paper-items th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #fff; background: #0f1f5c; padding: 8px 10px; }
.paper-items td { padding: 9px 10px; border-bottom: 1px solid #e3e3e3; }
.paper-items .num { text-align: right; }
.paper-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 28px; max-width: 320px; margin: 16px 0 0 auto; }
.paper-totals dt { text-align: right; color: #555; } .paper-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.paper-totals .grand { font-weight: 700; color: #111; border-top: 1px solid #ccc; padding-top: 6px; }
.paper-notes { margin-top: 24px; }
.paper-foot { margin-top: 36px; padding-top: 12px; border-top: 3px solid #e8961c; color: #555; font-size: 12.5px; text-align: center; }
.paper-logo { width: 52px; height: 52px; border-radius: 10px; flex: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media (max-width: 640px) { .paper { padding: 24px 18px; } .paper-title h1 { text-align: left; } .paper-title dl { justify-content: start; } }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .portal-top, .toast, .scrim { display: none !important; }
  .shell { display: block; }
  .view, .portal-main { padding: 0; max-width: none; }
  .paper { box-shadow: none; padding: 0; max-width: none; }
  .paper-items th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
