/* Farm dashboard. Colour roles live here; light and dark are chosen separately (chart steps from the
   dataviz reference palette, status colours always paired with an icon or label). */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6e6d68;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #1d6b45;
  --accent-ink: #ffffff;
  --link: #1c5cab;
  --series: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --band: rgba(12, 163, 12, 0.10);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a998f;
    --line: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #3fae78;
    --accent-ink: #0b0b0b;
    --link: #86b6ef;
    --series: #3987e5;
    --band: rgba(12, 163, 12, 0.16);
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #9a998f;
  --line: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10); --accent: #3fae78; --accent-ink: #0b0b0b;
  --link: #86b6ef; --series: #3987e5; --band: rgba(12, 163, 12, 0.16); --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; }
h3 { font-size: 0.92rem; margin: 18px 0 6px; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.small { font-size: 0.84rem; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.num { font-variant-numeric: tabular-nums; }
.pad { padding: 0 16px 16px; }

/* ---------- frame ---------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2)); background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.me { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.me form { margin: 0; }
.who { color: var(--ink-2); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--axis); }
.live.on .live-dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.18); }
.live.updating .live-dot { background: var(--series); }
main { max-width: 1240px; margin: 0 auto; padding: 24px 16px 40px; outline: none; }
main.refreshing { opacity: 0.6; transition: opacity 0.15s; }
.foot { max-width: 1240px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 0.8rem; }
.crumb { margin: 0 0 8px; font-size: 0.9rem; }
.pagehead { margin-bottom: 18px; }
.pagehead p { margin: 4px 0 0; }

/* ---------- building blocks ---------- */
.card {
  background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; min-width: 0;
}
.card.flush { padding: 0; }
.card.flush > h2, .card-head { padding: 14px 16px 10px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.more { margin-left: auto; font-size: 0.84rem; font-weight: 400; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + section { margin-top: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--ring);
  border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow);
}
.tile:hover { text-decoration: none; border-color: var(--axis); }
.tile-label { color: var(--ink-2); font-size: 0.86rem; }
.tile-value { font-size: 2rem; font-weight: 650; line-height: 1.2; }
.tile-of { font-size: 1rem; font-weight: 500; color: var(--muted); }
.tile-note { font-size: 0.82rem; color: var(--muted); min-height: 1.4em; }

.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--ring); background: var(--surface); }
.banner.waiting { border-left: 4px solid var(--warning); }
.banner.ok { border-left: 4px solid var(--good); }
.alert { border-left: 4px solid var(--critical); background: var(--surface-2); padding: 8px 12px; border-radius: 6px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filters.inline { margin: 0; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 0.86rem; }
.chip:hover { text-decoration: none; border-color: var(--axis); }
.chip[aria-current="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.button { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 550; }
.button:hover { text-decoration: none; border-color: var(--axis); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }
.pill { display: inline-block; font-size: 0.74rem; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); margin-left: 4px; }
.chatlink { font-size: 0.84rem; white-space: nowrap; }

/* status and severity: a coloured mark beside ink text, never colour alone */
.status, .sev { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; padding: 1px 8px 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); white-space: nowrap; border: 1px solid var(--line); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-open::before, .status-waiting::before, .status-due::before { background: var(--warning); }
.status-in_progress::before, .status-scheduled::before { background: var(--series); }
.status-resolved::before, .status-done::before { background: var(--good); }
.status-closed::before { background: var(--axis); }
.status-late::before, .status-escalated::before, .status-missed::before { background: var(--critical); }
.sev-icon { font-size: 0.7rem; }
.sev-critical .sev-icon { color: var(--critical); }
.sev-high .sev-icon { color: var(--serious); }
.sev-medium .sev-icon { color: var(--warning); }
.sev-low .sev-icon { color: var(--muted); }
.sev-critical { font-weight: 650; }

.row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); color: var(--ink); }
.row:first-of-type { border-top: 0; }
a.row:hover { text-decoration: none; background: var(--surface-2); margin: 0 -8px; padding: 8px; border-radius: 6px; }
.people { list-style: none; padding: 0; margin: 0; }
.people li { padding: 5px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.plain { list-style: none; padding: 0; margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-weight: 550; color: var(--muted); font-size: 0.8rem; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table td.wide { min-width: 220px; }
.table .num { text-align: right; }
.table td a { color: var(--ink); }
.table td a.chatlink { color: var(--link); }
.kv { display: inline-block; font-size: 0.8rem; background: var(--surface-2); border-radius: 5px; padding: 0 6px; margin: 1px 2px 1px 0; }
.kv.bad { outline: 1px solid var(--critical); }
.week .cell { text-align: center; font-size: 0.82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.week .cell-on { color: var(--ink); }
.week .cell-off { color: var(--muted); }
.week .cell-missing { color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 5px, var(--surface-2) 5px 7px); }
.week .today { background: var(--surface-2); }
.week tr.inactive td { opacity: 0.55; }
.onshift { color: var(--good); font-size: 0.8rem; }
details.group { border-top: 1px solid var(--line); }
details.group > summary { cursor: pointer; padding: 10px 0; list-style-position: inside; }
.card.flush details.group > summary { padding: 10px 16px; }
details.steps summary { cursor: pointer; color: var(--muted); }

/* ---------- activity ---------- */
.day { font-size: 0.82rem; color: var(--muted); font-weight: 600; margin: 16px 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.day:first-child { margin-top: 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 3.2em 6.5em 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); align-items: baseline; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.86rem; }
.feed-kind { font-size: 0.74rem; color: var(--ink-2); background: var(--surface-2); border-radius: 999px; padding: 0 8px; justify-self: start; white-space: nowrap; }
.feed-change .feed-kind { background: transparent; border: 1px solid var(--line); }
.feed-text { min-width: 0; overflow-wrap: anywhere; }
.feed-text a { color: var(--ink); }
.card, .row > div, .prewrap, .facts dd { overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 6px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--axis); }
.timeline li:first-child::before { border-color: var(--series); }
.tl-head { font-size: 0.86rem; color: var(--ink-2); }

/* ---------- charts ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick, .chart .band-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .band { fill: var(--band); }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .dot.bad { fill: var(--critical); }
.chart .end-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; visibility: hidden; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart.hovering .crosshair { visibility: visible; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--ring); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  border-radius: 8px; padding: 6px 10px; font-size: 0.82rem; white-space: nowrap; transform: translate(-50%, -110%); }
.tip strong { display: block; font-size: 0.95rem; }

/* ---------- documents and sign-in ---------- */
.doclist { list-style: none; margin: 0; padding: 0 16px 8px; }
.doclist li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.doclist li:first-child { border-top: 0; }
.doc { max-width: 900px; overflow-x: auto; }
.doc table { border-collapse: collapse; margin: 12px 0; font-size: 0.9rem; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; }
.doc h1 { font-size: 1.3rem; }
.doc h2 { font-size: 1.1rem; display: block; margin-top: 22px; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin { max-width: 420px; text-align: center; padding: 32px 28px; }
.signin h1 { margin-top: 10px; }
.signin .button { margin: 14px 0 6px; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
  .who { display: none; }
  main { padding-top: 16px; }
  h1 { font-size: 1.35rem; }
  .cols { grid-template-columns: 1fr; }
  .feed li { grid-template-columns: 3.2em 1fr; }
  .feed-kind { display: none; }
}
@media (forced-colors: active) {
  .status::before, .live-dot { forced-color-adjust: none; }
}

/* ---------- SOP library ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search { flex: 1 1 320px; max-width: 560px; }
.search input { width: 100%; font: inherit; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.search input:focus { outline: 2px solid var(--series); outline-offset: 1px; }
.doclist2 { list-style: none; margin: 0; padding: 0 0 6px; }
.docrow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 14px; padding: 9px 16px; border-top: 1px solid var(--line); }
.docrow:first-child { border-top: 0; }
.docrow-main { display: flex; gap: 12px; align-items: baseline; color: var(--ink); min-width: 0; flex: 1 1 320px; }
.docrow-main:hover { text-decoration: none; }
.docrow-main:hover .doctitle { text-decoration: underline; }
.doccode { font: 0.8rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); white-space: nowrap; min-width: 7.5em; }
.doctitle { overflow-wrap: anywhere; }
.docmeta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.signin-inline { max-width: 640px; }

/* ---------- document view: the controlled copy ---------- */
.doc-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.doc-toolbar .crumb { margin: 0; }
.tabs { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.tab { padding: 6px 14px; border-radius: 8px; font-size: 0.9rem; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow); }
.tab.disabled { color: var(--muted); cursor: not-allowed; }
button.chip { font: inherit; font-size: 0.86rem; cursor: pointer; }
.paper { position: relative; overflow: hidden; max-width: 820px; margin: 0 auto 24px; padding: 48px 56px 36px; background: #ffffff; color: #111111;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 8px 28px rgba(0, 0, 0, 0.08); font-family: "Times New Roman", Georgia, serif; font-size: 15px; line-height: 1.55; }
.paper h2 { display: block; font-size: 1rem; margin: 24px 0 8px; color: #111111; }
.paper p { margin: 0 0 10px; }
.paper p.title { font-size: 1.3rem; font-weight: 700; }
.paper p.subtitle { font-weight: 600; }
.paper ul { margin: 0 0 10px; padding-left: 22px; }
.paper li { margin-bottom: 4px; }
.watermark { position: absolute; left: 50%; top: 420px; transform: translate(-50%, -50%) rotate(-32deg); font-family: system-ui, sans-serif; font-size: 120px;
  font-weight: 800; letter-spacing: 0.12em; color: rgba(208, 59, 59, 0.07); pointer-events: none; white-space: nowrap; }
.ctl, .doctable { position: relative; width: 100%; border-collapse: collapse; font-family: system-ui, sans-serif; font-size: 12.5px; margin-bottom: 8px; }
.ctl td, .doctable td, .doctable th { border: 1px solid #8f8e88; padding: 6px 8px; vertical-align: top; text-align: left; }
.doctable th { background: #f2f2ee; font-weight: 600; }
.ctl-brand { width: 28%; vertical-align: middle !important; font-weight: 700; }
.ctl-brand img { vertical-align: middle; margin-right: 6px; }
.ctl-kind { text-align: center !important; font-weight: 700; font-size: 13.5px; }
.ctl-title { text-align: center !important; font-weight: 700; font-size: 16px; }
.ctl-label { display: block; color: #555555; font-size: 11px; }
.ctl-status-draft, .ctl-status-in_review { color: #a12a2a; }
.ctl-status-effective { color: #1d6b45; }
mark.blank { background: #fdf1ea; color: #7a2a12; outline: 1px dashed #e08a5e; outline-offset: 0; border-radius: 2px; padding: 0 2px; }
.paper-foot { margin-top: 28px; padding-top: 10px; border-top: 1px solid #b9b8b2; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
  font-family: system-ui, sans-serif; font-size: 11px; color: #555555; }
@media (max-width: 720px) {
  .paper { padding: 24px 18px; font-size: 14px; }
  .watermark { font-size: 64px; }
}
@media print {
  .top, .foot, .doc-toolbar { display: none !important; }
  body, main { background: #ffffff !important; padding: 0 !important; }
  .paper { box-shadow: none; max-width: none; margin: 0; padding: 0; }
  mark.blank { background: none; outline: none; color: inherit; }
}

/* ---------- graphical view (made from the document) ---------- */
.kicker { font-size: 0.74rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.ghead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; padding: 22px; }
.ghead-main { display: flex; gap: 18px; align-items: flex-start; flex: 1 1 520px; min-width: 0; }
.ghead-text { min-width: 0; }
.ghead h1 { font-size: 1.9rem; margin: 2px 0 6px; }
.ghead-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.area-tile { width: 64px; height: 64px; border-radius: 16px; flex: none; display: flex; align-items: center; justify-content: center;
  color: var(--area-ink); background: var(--area-wash); }
.area-QMS, .area-MANUAL { --area-ink: #5b4bb7; --area-wash: #ece9fa; }
.area-PER, .area-ROLE { --area-ink: #2a6fb8; --area-wash: #e4eef9; }
.area-FAC { --area-ink: #8a5a00; --area-wash: #f8ecd2; }
.area-SAN { --area-ink: #1c7fa6; --area-wash: #ddf0f7; }
.area-CUL { --area-ink: #1d6b45; --area-wash: #e3f1e7; }
.area-ENV { --area-ink: #b5541c; --area-wash: #fbe8dc; }
.area-HAR { --area-ink: #7a3f9b; --area-wash: #f2e6f8; }
.area-MAT { --area-ink: #6b5d3e; --area-wash: #efeadf; }
.area-SEC { --area-ink: #a12a2a; --area-wash: #f9e3e3; }
.area-OPS { --area-ink: #3d6b8a; --area-wash: #e2edf4; }
.blankpill { background: #fdf1ea; color: #7a2a12; border-color: #e7b49b; }
.missing { display: inline-flex; gap: 6px; align-items: center; font-size: 0.84rem; font-weight: 600; color: #7a2a12; background: #fdf1ea;
  border: 1px dashed #e08a5e; border-radius: 8px; padding: 3px 9px; }
.yours { display: flex; gap: 16px; align-items: center; background: var(--surface); border-color: #b9d9c4; }
.yours-icon { width: 80px; height: 60px; border-radius: 10px; background: #eef3ec; flex: none; }
.yours-text { font-size: 1.05rem; font-weight: 600; }
.stepper { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stepper li { flex: 1 1 120px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; font-size: 0.86rem; }
.stepdot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.stepper li.done .stepdot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stepper li.todo .stepdot { background: #fdf1ea; color: #7a2a12; border: 2px dashed #e08a5e; }
.linked { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.linked-item { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.stat { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.stat-v { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.who { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.who-item { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.split { display: grid; grid-template-columns: 170px 1fr; gap: 6px 20px; align-items: center; }
.split-illus .illus { width: 160px; height: 120px; }
.split-body h2 { margin-bottom: 6px; }
.split .rules { grid-column: 1 / -1; }
.lead { font-size: 1.05rem; margin: 0 0 8px; }
.checks, .crosses { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; }
.checks li, .crosses li { position: relative; padding: 6px 10px 6px 30px; border-radius: 8px; background: #eef3ec; color: #14261b; }
.checks li::before { content: "✓"; position: absolute; left: 10px; top: 6px; color: #1d6b45; font-weight: 700; }
.crosses li { background: #fbeeee; color: #3a1414; }
.crosses li::before { content: "✕"; position: absolute; left: 10px; top: 6px; color: #a12a2a; font-weight: 700; }
.rules { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rule { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.9rem; }
.sect { margin: 6px 0 10px; font-size: 1.15rem; }
.steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.stepcard { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stepcard p { margin: 4px 0 0; font-size: 1.02rem; }
.illus { width: 128px; height: 96px; flex: none; border-radius: 12px; background: #eef3ec; }
.stepnum { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 0.9rem; }
.stepnum.done { background: #8cc19d; color: #0b2a17; }
.plainlist { margin: 4px 0 0; padding-left: 18px; }
.flow { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: none; }
.flowstep { flex: 1 1 150px; position: relative; padding: 12px 12px 12px 14px; border-radius: 12px; font-size: 0.92rem; display: flex; flex-direction: column; gap: 6px; color: #1f1f1d; }
.flownum { font-weight: 700; font-size: 0.8rem; }
.flow-0 { background: #fdecec; } .flow-1 { background: #fff4dc; } .flow-2 { background: #f0efec; } .flow-3 { background: #e8eef8; } .flow-4 { background: #e3f1e7; }
.never { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid #f0c7c7; background: #fff8f8; color: #3a1414; margin: 8px 0 0; }
.never-icon { color: #a12a2a; font-size: 1.2rem; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 6px; }
.formcard { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.formcard.mine { border-color: #7fb894; box-shadow: 0 0 0 2px rgba(29, 107, 69, 0.12); }
.formcard-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.can { border-top: 3px solid #8cc19d; } .cannot { border-top: 3px solid #e2a3a3; }
.sigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.sig { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px dashed var(--axis); border-radius: 10px; }
.madefrom { margin-top: 18px; }
@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; }
  .split-illus { display: none; }
  .ghead-side { align-items: flex-start; }
  .illus { width: 96px; height: 72px; }
  .stepcard { padding: 12px; }
}
@media print {
  .ghead-side, .crumb { display: none !important; }
  .stepcard, .card, .formcard { break-inside: avoid; box-shadow: none; }
}

/* ---------- editing and approval ---------- */
.flash { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; border: 1px solid var(--line); background: var(--surface); }
.flash.ok { border-left: 4px solid var(--good); }
.flash.bad { border-left: 4px solid var(--critical); }
.flash.draftnote { border-left: 4px solid var(--warning); }
.workflow { display: flex; flex-direction: column; gap: 10px; }
.wf-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; align-items: flex-start; }
.wf-actions, .wf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wf-row form { margin: 0; }
.wf-reject { display: flex; gap: 6px; }
.wf-reject input { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 220px; }
.wf-word { border-top: 1px solid var(--line); padding-top: 10px; }
.wf-upload label { cursor: pointer; }
.button.danger { color: var(--critical); border-color: #e8b9b9; background: var(--surface); }
button.button { font: inherit; cursor: pointer; }
button.button:disabled { opacity: 0.5; cursor: not-allowed; }
.editor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.preview-pane { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; border: 1px dashed var(--axis); border-radius: var(--radius); padding: 12px; background: var(--page); }
.preview-pane .tabs { margin-bottom: 10px; }
.preview .crumb, .preview .ghead-side .chip, .preview .madefrom { display: none; }
.editor-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: 56px; z-index: 2; background: var(--page); padding: 6px 0; }
.savestate { font-size: 0.85rem; color: var(--muted); }
.savestate.pending { color: var(--ink-2); }
.savestate.bad { color: var(--critical); font-weight: 600; }
.change-note { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.change-note textarea, .etext, .etitle, .ecell { font: inherit; width: 100%; resize: vertical; border: 1px solid #d9d8d1; border-radius: 8px; padding: 8px 10px;
  background: #ffffff; color: #111111; line-height: 1.5; overflow: hidden; }
.editor-paper { padding: 24px 22px; font-size: 15px; }
.esec { border-top: 1px solid #e4e3dc; padding: 12px 0 6px; }
.esec:first-child { border-top: 0; }
.esec-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.etitle { font-weight: 700; font-family: system-ui, sans-serif; }
.eblock { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-bottom: 6px; }
.eblock.is-bullet .etext { border-left: 4px solid #8cc19d; }
.eblock-side { display: flex; flex-direction: column; gap: 4px; }
.etype { font: inherit; font-size: 0.8rem; padding: 4px; border-radius: 6px; border: 1px solid #d9d8d1; background: #fff; color: #111; }
.eblank { font-size: 0.72rem; color: #7a2a12; background: #fdf1ea; border: 1px dashed #e08a5e; border-radius: 6px; padding: 1px 6px; font-family: system-ui, sans-serif; }
.ectl { display: flex; gap: 2px; flex-wrap: nowrap; }
.ebtn { font: inherit; font-size: 0.8rem; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 6px; border: 1px solid #d9d8d1; background: #fff; color: #333; cursor: pointer; }
.ebtn:hover { background: #f0efec; }
.ebtn.danger { color: #a12a2a; }
.eadd { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px 104px; }
.etable { display: flex; flex-direction: column; gap: 4px; }
.erow { display: flex; gap: 4px; align-items: start; }
.ecell { font-size: 0.85rem; padding: 6px; }
.changes del, .legend-del { background: #fbe1e1; color: #7d1d1d; text-decoration: line-through; }
.changes ins, .legend-ins { background: #def3e3; color: #0f4d27; text-decoration: none; }
.legend-del, .legend-ins { padding: 1px 6px; border-radius: 4px; }
.changes-title { font-size: 1.25rem; }
.chg { margin: 0 0 8px; padding: 2px 6px; border-left: 3px solid transparent; }
.chg-changed { border-left-color: var(--warning); }
.chg-added { border-left-color: var(--good); }
.chg-removed { border-left-color: var(--critical); }
.chg-bullet::before { content: "• "; }
@media (max-width: 1000px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .preview-pane { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .eblock { grid-template-columns: 1fr; }
  .eadd { margin-left: 0; }
}
