/* Internal work tool: system fonts, paper/ink palette, one ink-blue accent for actions and links,
   green only for "confirmed", red only for problems. Mobile first; desktop from 760px. */
:root {
  --ink: #1d232a;
  --muted: #5b6570;
  --line: #d9dee3;
  --paper: #ffffff;
  --wash: #f4f6f8;
  --accent: #1f5582;
  --accent-wash: #e8eff6;
  --ok: #2e6b45;
  --ok-wash: #e6f1ea;
  --warn: #8a5a00;
  --warn-wash: #fbf1dc;
  --bad: #a3271f;
  --bad-wash: #f8e7e5;
  --grey: #9aa3ad;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--wash);
}
* { box-sizing: border-box; }
body { margin: 0; overflow-wrap: break-word; }
a { color: var(--accent); }
h1 { font-size: 1.375rem; line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 1.0625rem; margin: 0 0 8px; }
h3 { font-size: 0.9375rem; margin: 14px 0 6px; color: var(--muted); }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85em; }
.pre { white-space: pre-line; }
.break { word-break: break-all; }
.bad, .warn { color: var(--bad); }
.ok-text { color: var(--ok); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; color: var(--ink); text-decoration: none; margin-right: auto; }
.topnav { display: flex; gap: 14px; order: 3; width: 100%; }
.topnav a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.topnav a[aria-current] { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
.who { display: flex; gap: 10px; align-items: center; margin: 0; font-size: 0.875rem; }
main { max-width: 1180px; margin: 0 auto; padding: 14px 16px 40px; }

/* Controls */
button, .button {
  font: inherit; padding: 8px 14px; border-radius: 6px; cursor: pointer; min-height: 40px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.secondary { background: var(--paper); color: var(--accent); }
button.secondary.on { background: var(--accent); color: #fff; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; }
button.small-btn { padding: 4px 10px; min-height: 32px; font-size: 0.875rem; }
button:disabled, button[disabled] { opacity: 0.55; cursor: default; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%;
  background: var(--paper); color: var(--ink); min-height: 40px;
}
textarea { resize: vertical; }
label { font-size: 0.875rem; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stack { display: grid; gap: 8px; margin: 12px 0; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.inline input, .inline select { width: auto; flex: 1 1 160px; }
.inline input.short, .inline select.short { flex: 0 1 120px; }
.inline label { display: flex; flex-direction: column; gap: 2px; flex: 1 1 160px; }
.inline label input, .inline label select { width: 100%; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.note { background: var(--accent-wash); padding: 10px 12px; border-radius: 6px; }
.note.warn { background: var(--bad-wash); }
.narrow { max-width: 460px; margin: 32px auto; background: var(--paper); padding: 24px;
  border: 1px solid var(--line); border-radius: 8px; }

/* Lists */
.search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search input { flex: 1; }
.search .reset { white-space: nowrap; font-size: 0.875rem; }
.tabs { display: flex; gap: 4px; margin: 0 -16px 12px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; white-space: nowrap; border: 1px solid transparent; }
.tab b { color: var(--ink); font-weight: 600; margin-left: 2px; }
.tab.current { background: var(--paper); border-color: var(--line); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--muted); background: var(--paper); font-size: 0.875rem; }
.chip.current { color: var(--ink); border-color: var(--accent); }
.rows { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.row { display: grid; gap: 4px; padding: 12px 14px; border-top: 1px solid var(--line); }
.row:first-of-type, .row.head + .row { border-top: 0; }
.row.head { display: none; }
.row .title { color: var(--ink); font-weight: 500; text-decoration: none;
  /* The full title stays in the DOM; only the view is clamped. */
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row .title:hover { color: var(--accent); text-decoration: underline; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row .reason { margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl { display: inline-block; min-width: 88px; color: var(--muted); font-size: 0.8125rem; margin-right: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--wash); color: var(--muted); font-size: 0.8125rem; line-height: 1.6; }
.tag.ok { background: var(--ok-wash); color: var(--ok); }
.tag.bad { background: var(--bad-wash); color: var(--bad); }
.tag.warn { background: var(--warn-wash); color: var(--warn); }
.forecast { font-style: normal; color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
#more { padding: 0; }
.more { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--line); text-decoration: none; }
.empty { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }

/* Card */
.card-head { margin-bottom: 12px; }
.card-title { font-size: 1.25rem; font-weight: 600; margin: 6px 0; }
.decision { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.decision .state { display: grid; gap: 4px; margin-bottom: 10px; }
.decide { display: grid; gap: 8px; }
.decide .buttons button { flex: 1 1 auto; }
.moves { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.indicators { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 12px; }
.ind { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.ind .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.ind.on { color: var(--ok); border-color: var(--ok); background: var(--ok-wash); }
.ind.on .dot { background: var(--ok); }
.ind .hint { display: none; }
.block { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.8125rem; margin-top: 6px; }
.facts dd { margin: 0; }
.grid { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.grid th, .grid td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.grid th { font-size: 0.8125rem; color: var(--muted); font-weight: 500; }
.grid .num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.reqs, .plain, .history { list-style: none; padding: 0; margin: 0; }
.reqs li, .plain li, .history li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.reqs li:last-child, .plain li:last-child, .history li:last-child { border-bottom: 0; }
.verdict { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 0.8125rem; line-height: 1.6; background: var(--warn-wash); color: var(--warn); }
.verdict.ok { background: var(--ok-wash); color: var(--ok); }
.verdict.bad { background: var(--bad-wash); color: var(--bad); }
blockquote { margin: 6px 0; padding: 6px 10px; background: var(--wash); border-radius: 6px; }
details summary { cursor: pointer; color: var(--accent); }
.comment { white-space: pre-line; margin-top: 2px; }
.fixform input { max-width: 520px; }

/* Admin */
.subnav { margin-top: 0; }
.settings { display: grid; gap: 10px; }
.setting, .pcard { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.setting-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cards { display: grid; gap: 10px; }
.addform { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.rollback { margin-top: 0; }
.setting .inline input, .setting .inline select { flex: 0 1 260px; }

@media (max-width: 759px) {
  .row-cust, .row-sum, .row-date { display: flex; gap: 6px; }
  .row .lbl { flex: none; }
}
@media (min-width: 760px) {
  .top { padding: 10px 24px; flex-wrap: nowrap; }
  .topnav { order: 0; width: auto; }
  .brand { margin-right: 8px; }
  .who { margin-left: auto; }
  main { padding: 20px 24px 48px; }
  h1 { font-size: 1.5rem; }
  .tabs { margin: 0 0 12px; padding: 0; flex-wrap: wrap; }
  .row { grid-template-columns: minmax(0, 3fr) minmax(0, 1.4fr) 10rem 10.5rem; gap: 16px; align-items: start; }
  .row.head { display: grid; padding: 8px 14px; font-size: 0.8125rem; color: var(--muted); border-bottom: 1px solid var(--line); }
  .row .lbl { display: none; }
  .row-sum, .row.head .num { text-align: right; }
  .card-title { font-size: 1.375rem; }
  .decision .state { grid-template-columns: 1fr 1fr; }
  .decide .buttons button { flex: 0 0 auto; }
  .ind .hint { display: inline; color: var(--muted); font-weight: 400; }
  .ind.on .hint { color: var(--ok); }
  .facts { grid-template-columns: 12rem 1fr; }
  .facts dt { margin-top: 0; }
  .cards, .settings { grid-template-columns: 1fr 1fr; align-items: start; }
}
