/* The Archive · two themes, same layout. Colour means something; it is never the only signal. */
:root, [data-theme="dark"] {
  --bg: #06080B; --panel: #0E1319; --line: #1C2733; --text: #E6EDF3; --muted: #8B9AAB;
  --accent: #3FD0FF; --on-accent: #04121A; --warn: #FFB35C; --bad: #FF8F8F; --ok: #6EE7A0;
  --grid: rgba(63, 208, 255, 0.04);
}
[data-theme="light"] {
  --bg: #FFFFFF; --panel: #F5F6F8; --line: #E3E6EA; --text: #111418; --muted: #5B6470;
  --accent: #0A66C2; --on-accent: #FFFFFF; --warn: #9A5B00; --bad: #B42318; --ok: #1E7A3E;
  --grid: transparent;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
body {
  margin: 0; min-height: 100vh; background-color: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
}
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
main.center { max-width: 420px; padding-top: 12vh; }
h1 { font-size: 26px; margin: 8px 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 24px 0 8px; }
a { color: var(--accent); }
.brand { font: 600 13px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.28em; color: var(--accent); }
.brand.big { font-size: 18px; text-align: center; margin-bottom: 32px; }
.top { display: flex; justify-content: space-between; align-items: center; max-width: 760px; margin: 0 auto; padding: 16px; }
.who { color: var(--muted); font-size: 14px; }
.muted, small { color: var(--muted); }
small { display: block; font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 0 0 16px; }
form.card { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; min-height: 44px; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: 20px; min-height: 20px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button {
  font: 600 15px/1 inherit; font-family: inherit; display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); text-decoration: none; cursor: pointer;
}
button.primary, .button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.link { background: none; border: 0; color: var(--accent); }
button:disabled { opacity: 0.6; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.back { display: inline-block; margin: 4px 0; text-decoration: none; font-size: 15px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; }
.chip.on { border-color: var(--accent); color: var(--text); }
.list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.list > li > a, .list > li > div { display: block; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; }
.list .empty { color: var(--muted); padding: 14px; }
.list strong { margin-right: 8px; }
.amount { display: block; margin-top: 4px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin: 2px 4px 2px 0; }
.tag.warn { color: var(--warn); border-color: currentColor; }
.tag.ok { color: var(--ok); border-color: currentColor; }
.tags { margin-bottom: 12px; }
.facts { display: grid; gap: 10px; margin: 0 0 16px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; white-space: pre-line; }
.form-error:empty { display: none; }
.form-error, .error { color: var(--bad); margin: 0; }
.notice { color: var(--text); background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 12px; }
.steps { padding-left: 32px; display: flex; flex-direction: column; gap: 12px; }
.qr { display: block; width: 200px; height: 200px; margin: 12px 0; background: #fff; border-radius: 8px; padding: 8px; }
code { word-break: break-all; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--bg); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs a { min-height: 44px; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.tabs a.on { color: var(--accent); font-weight: 700; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { background: var(--bg); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 760px; max-height: 85vh; overflow: auto; padding: 16px; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 0; bottom: auto; max-width: 760px; margin: 0 auto; border: 0; }
  main { padding-bottom: 32px; }
  .modal { align-items: center; }
  .sheet { border-radius: 18px; }
}
/* Slice 2: jobs */
.attention { border-color: var(--warn); }
.attention h2 { margin-top: 0; }
form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline input { width: 140px; }
label.service { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; }
label.service input[type="number"] { grid-column: 2; }
label.status { max-width: 320px; margin-bottom: 16px; }
.stages label { padding: 8px 0; }
form[data-form="jobfilter"] input[type="search"] { flex: 1 1 220px; }
form[data-form="jobfilter"] select { width: auto; flex: 0 1 180px; }
form[data-client]:not([data-client="new"]) .only-new-client,
form:not([data-source="referral"]) .only-referral,
form:not([data-kind="retainer"]) .only-retainer,
form:not([data-kind="amc"]) .only-amc { display: none; }
.only-new-client, .only-retainer, .only-amc { display: flex; flex-direction: column; gap: 14px; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
/* Slice 3: money */
h3 { font-size: 16px; margin: 16px 0 8px; }
form.card h3 { margin: 0; }
.sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.sums small { margin-bottom: 4px; }
.amount.bad { color: var(--bad); }
.receipt { max-width: 640px; }
.receipt header { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.receipt header h1 { margin: 0 0 4px; font-size: 22px; }
@media print {
  .no-print, .tabs, .top { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: 0; background: #fff; padding: 0; }
  .receipt dt, .receipt small { color: #444; }
}
/* Slice 4: home and follow-ups */
.tag.bad { color: var(--bad); border-color: currentColor; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.panel { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.panel .big { font-size: 28px; font-weight: 700; margin: 0; }
.panel .big.bad { color: var(--bad); }
.list li.late { border-left: 3px solid var(--bad); padding-left: 10px; }
.biz { max-width: 320px; }
.tabs { overflow-x: auto; grid-auto-columns: minmax(64px, 1fr); }
/* Slice 5: daily routine */
summary.button { list-style: none; display: inline-flex; align-items: center; cursor: pointer; }
summary.button::-webkit-details-marker { display: none; }
.big-button { font-size: 18px; padding: 14px 22px; }
.day details { margin-bottom: 10px; }
.day form { margin-top: 12px; }
fieldset.wrap { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; }
.list.compact li { padding: 6px 0; }
/* Slice 5: reports */
.report-nav { align-items: center; }
.table-wrap { overflow-x: auto; }
table.report { border-collapse: collapse; width: 100%; font-size: 13px; }
table.report th, table.report td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; white-space: nowrap; }
.bad-text { color: var(--bad); }
