:root {
  --paper: #f5f2ea;
  --surface: #fffdf8;
  --ink: #1c2421;
  --muted: #5b6660;
  --faint: #8a938e;
  --line: #e0dbcd;
  --line-strong: #cfc8b6;
  --accent: #1f5f4a;
  --accent-ink: #ffffff;
  --accent-soft: #e3eee8;
  --over: #a5401c;
  --over-soft: #f6e4da;
  --wait: #7d6318;
  --wait-soft: #f2ead3;
  --ok: #2c6b43;
  --ok-soft: #e2eee5;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 6px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { text-wrap: pretty; }
.num, td.n, .tab-n { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- staff chrome */
.demo-strip { background: var(--ink); color: #e9e5da; font-size: 12.5px; padding: 6px 24px; display: flex; gap: 16px; align-items: center; }
.demo-strip b { color: #fff; font-weight: 600; }
.demo-strip form { margin-left: auto; }
.demo-strip button { background: transparent; border: 1px solid #5c6661; color: #e9e5da; border-radius: 4px; padding: 2px 8px; font: inherit; cursor: pointer; }
.demo-strip button:hover { border-color: #e9e5da; }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1320px; margin: 0 auto; padding: 14px 24px 0; display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'brand clock' 'nav nav'; column-gap: 24px; align-items: end; }
.brand { grid-area: brand; }
.clock { grid-area: clock; }
nav.tabs { grid-area: nav; margin-left: -12px; }
.brand { padding-bottom: 6px; }
.brand .firm { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.brand .product { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
nav.tabs { display: flex; gap: 2px; align-self: end; flex-wrap: wrap; }
nav.tabs a { display: block; padding: 10px 12px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 500; }
nav.tabs a:hover { color: var(--ink); }
nav.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--over); color: #fff; font-size: 11.5px; line-height: 18px; text-align: center; margin-left: 4px; font-variant-numeric: tabular-nums; }
.badge.neutral { background: var(--line-strong); color: var(--ink); }

.clock { padding-bottom: 10px; min-width: 330px; }
.clock-row { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
.clock-label { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.clock-date { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.clock input[type=date] { font: inherit; font-size: 13px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.season { position: relative; height: 6px; background: var(--line); border-radius: 3px; margin: 8px 0 4px; }
.season .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.season .mark { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--ink); opacity: 0.55; }
.presets { display: flex; gap: 4px; justify-content: space-between; }
.presets button { border: 0; background: none; padding: 2px 3px; font: inherit; font-size: 11.5px; color: var(--muted); cursor: pointer; border-radius: 3px; }
.presets button:hover { color: var(--ink); background: var(--accent-soft); }
.presets button.on { color: var(--accent); font-weight: 600; }

main.wrap { max-width: 1320px; margin: 0 auto; padding: 24px; }
.flash { background: var(--accent-soft); border: 1px solid #c3dbcf; color: #163f31; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; }

/* ---------- buttons, forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 7px 12px; border-radius: var(--radius); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #174a39; }
.btn.small { padding: 4px 8px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.danger:hover { border-color: var(--over); color: var(--over); }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--ink); }
textarea { width: 100%; line-height: 1.5; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.inline { display: inline; margin: 0; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- board */
.lede { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 20px; }
.lede h1 { font-size: 30px; line-height: 1.15; max-width: 820px; }
.lede h1 .over { color: var(--over); }
.lede .sub { margin: 8px 0 0; color: var(--muted); max-width: 760px; }
.lede .actions { display: flex; gap: 8px; }
.meter { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); margin-top: 14px; max-width: 760px; }
.meter span { display: block; }
.meter .m-done { background: var(--ok); }
.meter .m-wait { background: #c9b26a; }
.meter .m-over { background: var(--over); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }

.toolbar { display: flex; gap: 12px; align-items: center; margin: 22px 0 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; text-decoration: none; color: var(--muted); border-right: 1px solid var(--line); font-weight: 500; font-size: 14px; }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ink); color: #fff; }
.seg a .tab-n { opacity: 0.7; margin-left: 4px; }
.toolbar .grow { flex: 1; }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #faf8f2; position: sticky; top: 0; z-index: 1; }
table.grid th:first-child { border-top-left-radius: var(--radius); }
table.grid th:last-child { border-top-right-radius: var(--radius); }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr.link { cursor: pointer; }
table.grid tbody tr.link:hover td { background: #f8f5ec; }
td.client a { color: var(--ink); font-weight: 600; text-decoration: none; }
td.client .em { font-size: 12.5px; color: var(--faint); }
.prog { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.prog .bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; display: flex; }
.prog .bar span { display: block; height: 100%; }
.prog .txt { font-size: 13px; color: var(--muted); width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.over-n { color: var(--over); font-weight: 600; }
.waiting { font-size: 13.5px; color: var(--ink); }
.waiting .more { color: var(--faint); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 3px; letter-spacing: 0.02em; white-space: nowrap; }
.tag.over { background: var(--over-soft); color: var(--over); }
.tag.wait { background: var(--wait-soft); color: var(--wait); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.na { background: #ecebe6; color: var(--muted); }
.tag.ext { background: #e7e4f0; color: #4b3f78; }
.tag.form { background: #eef0ee; color: #2f3a35; font-weight: 600; }
.tag.new { background: #fff1c7; color: #6a5200; }
.empty { padding: 48px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- client detail */
.client-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.client-head .meta { color: var(--muted); margin-top: 6px; font-size: 14px; }
.client-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.panel > .ph { font-family: var(--serif); font-weight: 600; }
.panel > h2, .panel > .ph { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel .pb { padding: 12px 16px; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.items li:last-child { border-bottom: 0; }
.items .iss { font-weight: 600; }
.items .sub { font-size: 13px; color: var(--muted); }
.sec-label { font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; padding: 10px 16px 6px; color: var(--muted); background: #faf8f2; border-bottom: 1px solid var(--line); }
.sec-label.over { color: var(--over); }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--faint); font-size: 12px; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { flex: 1; font-size: 12.5px; font-family: ui-monospace, monospace; }

/* ---------- reminders / email */
.mail { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-width: 720px; }
.mail .hdr { padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.mail .hdr b { color: var(--ink); font-weight: 600; }
.mail .subj { font-family: var(--serif); font-size: 21px; color: var(--ink); margin-top: 6px; }
.mail .body { padding: 18px; white-space: pre-wrap; font-size: 15.5px; line-height: 1.6; }
.mail .cta { display: inline-block; margin-top: 4px; }

/* ---------- drop zone */
.drop { border: 2px dashed var(--line-strong); border-radius: 10px; background: var(--surface); padding: 40px; text-align: center; transition: border-color .15s, background .15s; }
.drop.hot { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { margin-top: 12px; }

/* ---------- login */
.login { max-width: 380px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.login input { width: 100%; margin: 6px 0 14px; }

/* ---------- client portal (large, calm, mobile-first) */
body.portal { background: #f7f4ec; font-size: 18px; line-height: 1.5; }
.p-wrap { max-width: 640px; margin: 0 auto; padding: 22px 18px 60px; }
.p-firm { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--accent); margin-bottom: 26px; }
.p-hello { font-size: 30px; line-height: 1.2; margin-bottom: 10px; }
.p-lead { font-size: 19px; color: #36423d; margin: 0 0 24px; }
.p-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 14px; }
.p-card h3 { font-family: var(--sans); font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.p-card .hint { color: var(--muted); font-size: 16px; margin: 0 0 16px; }
.p-btn { display: flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; gap: 10px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font: inherit; font-size: 19px; font-weight: 600; cursor: pointer; text-decoration: none; }
.p-btn:hover { background: #174a39; }
.p-btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); font-weight: 500; font-size: 17px; min-height: 50px; }
.p-file { position: relative; overflow: hidden; }
.p-file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 100px; }
.p-no { margin-top: 10px; }
.p-no summary { list-style: none; color: var(--muted); font-size: 16px; cursor: pointer; text-align: center; padding: 8px; }
.p-no summary::-webkit-details-marker { display: none; }
.p-no .opts { display: grid; gap: 8px; margin-top: 6px; }
.p-result { border-radius: 12px; padding: 18px 20px; margin-bottom: 22px; font-size: 19px; }
.p-result.ok { background: #e2efe6; border: 1px solid #b9d7c3; color: #173d26; }
.p-result.hm { background: #f4edd9; border: 1px solid #e3d3a6; color: #4a3b10; }
.p-result .big { font-weight: 600; font-size: 21px; display: block; margin-bottom: 2px; }
.p-sec { font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 30px 0 10px; }
.p-list { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.p-list li { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: baseline; }
.p-list li:last-child { border-bottom: 0; }
.p-list .ck { color: var(--ok); font-weight: 700; }
.p-list .when { color: var(--muted); font-size: 15px; margin-left: auto; white-space: nowrap; }
.p-done { text-align: center; padding: 30px 20px; }
.p-done .big { font-family: var(--serif); font-size: 28px; }
.p-foot { margin-top: 40px; color: var(--muted); font-size: 15px; text-align: center; }
.p-demo { margin-top: 36px; border: 1px dashed #b9b3a2; border-radius: 10px; padding: 14px 16px; font-size: 14px; color: var(--muted); background: transparent; }
.p-demo b { color: var(--ink); }
.p-demo ul { margin: 8px 0 0; padding-left: 18px; }
.p-demo li { margin: 4px 0; }
.p-sending { display: none; }
form.busy .p-sending { display: inline; }
form.busy .p-idle { display: none; }

@media (max-width: 980px) {
  .top-inner { grid-template-columns: 1fr; grid-template-areas: 'brand' 'clock' 'nav'; gap: 6px; }
  .clock { min-width: 0; }
  .two { grid-template-columns: 1fr; }
  .lede { grid-template-columns: 1fr; }
  table.grid .hide-m { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
