:root {
  --ink: #1d2733; --muted: #5d6b7a; --line: #dfe4ea; --bg: #f6f7f9; --card: #fff;
  --accent: #1f5f9e; --accent-soft: #e8f0f9; --accent-line: #c9dbef; --ok: #237a4b; --ok-soft: #e3f3ea;
  --ok-line: #b7dfc8; --warn: #9a5f08; --warn-soft: #fbf0dc; --warn-line: #f0d6a6; --err: #b3261e;
  --err-soft: #fbe9e7; --err-line: #f2c3be; --gray-soft: #eef1f4; --head: #f1f4f7; --zebra: #fafbfc;
  --hover: #eaf1fa; --foot-bg: #f8f9fb; --input-line: #c9d1da; --faint: #8c97a3;
  --teal: #11706b; --teal-soft: #e0f2f0; --violet: #5b4bb7; --violet-soft: #ece9f8; --row-act: #fdf6f5;
  --s1: #1f5f9e; --s2: #d9a441; --s3: #d9772b; --s4: #cf4b3d; --s5: #a3261d; --shadow: rgba(29, 39, 51, .14);
  --top-h: 56px;
  color-scheme: light;
  font-size: 14px;
}
[data-theme="dark"] {
  --ink: #e6ebf0; --muted: #9ba8b5; --line: #2b3541; --bg: #10151b; --card: #19212a;
  --accent: #7db3ec; --accent-soft: #1d3044; --accent-line: #2e4a66; --ok: #6bcf98; --ok-soft: #163427;
  --ok-line: #24533d; --warn: #e6ae55; --warn-soft: #3a2c13; --warn-line: #5c4520; --err: #f48a80;
  --err-soft: #3d1f1c; --err-line: #64302b; --gray-soft: #26303b; --head: #202833; --zebra: #1c242d;
  --hover: #22344a; --foot-bg: #1f2731; --input-line: #3a4654; --faint: #7d8a97;
  --teal: #5fcfc6; --teal-soft: #14322f; --violet: #a99cf0; --violet-soft: #2a2546; --row-act: #2a1d1d;
  --s1: #7db3ec; --s2: #e9c46a; --s3: #ef9d58; --s4: #f17e71; --s5: #e0564c; --shadow: rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; font-weight: 600; }

.top { display: flex; align-items: center; gap: 1.2rem; background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 1.5rem; min-height: var(--top-h); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); font-size: .95rem; white-space: nowrap; }
.brand .mark { width: 26px; height: 26px; display: block; flex: none; }
.brand .word { letter-spacing: .14em; color: var(--ink); font-weight: 700; }
.brand span { letter-spacing: .1em; color: var(--accent); font-weight: 600; }
.brand:hover { text-decoration: none; }
.top nav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.top nav a, .top nav .soon { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .75rem; border-radius: 8px; color: var(--ink); }
.top nav a svg { color: var(--area, var(--muted)); flex: none; }
.top nav a.on { background: var(--gray-soft); color: var(--ink); font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--area, var(--accent)); }   /* the area only as icon and line (Fable 0.40.1) */
.top nav a.on svg { color: var(--area, var(--accent)); }
.top nav a:hover { background: var(--bg); text-decoration: none; }
.top nav a.on:hover { background: var(--gray-soft); }
.top nav .soon { color: var(--faint); cursor: default; }
.who { display: flex; gap: .9rem; align-items: center; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.sub { display: flex; gap: .3rem; flex-wrap: wrap; padding: .5rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); }
.sub a { padding: .3rem .7rem; border-radius: 6px; color: var(--muted); }
.sub a.on { color: var(--ink); background: var(--gray-soft); font-weight: 600; }
.sub[class*="area-"] { box-shadow: inset 0 3px 0 var(--area); }   /* the area's colour right under the menu */
.sub-line { height: 3px; box-shadow: inset 0 3px 0 var(--area); }   /* the same line for an area without a sub menu (Stock) */

.page { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.narrow { max-width: 420px; margin: 7vh auto; padding: 1.5rem; }
.foot { text-align: center; color: var(--faint); font-size: .8rem; padding: 2rem 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.4rem; }
.card + .card { margin-top: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem;
  display: flex; gap: .9rem; align-items: flex-start; }
.kpi .label { color: var(--muted); font-size: .85rem; }
.kpi .value { font-size: 1.5rem; font-weight: 600; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .note { color: var(--muted); font-size: .8rem; margin-top: .2rem; }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; }
.grid th, .grid td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: var(--head); font-weight: 600; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.grid thead th { position: sticky; top: var(--top-h); z-index: 2; }
/* a table that scrolls sideways in its own box (order view on a phone): inside that box a sticky header would stick
   below the top bar and cover the first rows on a wide screen (Fable N1) */
.scroll-x { overflow-x: auto; }
.scroll-x .grid thead th { position: static; }
.grid thead tr:first-child th:first-child { border-top-left-radius: 10px; }
.grid thead tr:first-child th:last-child { border-top-right-radius: 10px; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:nth-child(even) { background: var(--zebra); }
.grid tbody tr:hover { background: var(--hover); }
.grid tfoot td { font-weight: 600; background: var(--foot-bg); }
.fw-grid th, .fw-grid td { padding: .4rem .45rem; }
.fw-grid th { white-space: normal; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.tag { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--gray-soft); color: var(--muted); }
.tag.blue { background: var(--accent-soft); color: var(--accent); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }
.tag.red { background: var(--err-soft); color: var(--err); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.green { background: var(--ok-soft); color: var(--ok); }

.bar { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.bar .grow { flex: 1; }
form.inline { display: inline; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=tel],
select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--input-line); border-radius: 6px;
  font: inherit; background: var(--card); color: var(--ink); }
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.bar input, .bar select { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.form-grid .wide { grid-column: 1 / -1; }
.field .help { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); font-size: 1rem; }
.check input { width: auto; }
.actions { display: flex; gap: .6rem; margin-top: 1.4rem; align-items: center; }

button, .btn { display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.light, button.light { background: var(--card); color: var(--accent); }
button.small, .btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.danger, button.danger { background: var(--err); border-color: var(--err); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 400; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.flash.error { background: var(--err-soft); border-color: var(--err-line); color: var(--err); }
.flash.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.flash.info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.flash.closable { display: flex; gap: .8rem; align-items: flex-start; }
.flash.closable > div { flex: 1; }
.issues { margin: 0; padding-left: 1.2rem; }
.issues li { margin: .2rem 0; }

.login-brand { text-align: center; margin: 1rem 0 .4rem; }
.login-brand img { width: 260px; max-width: 80%; height: auto; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 1.5rem; }
.qr { display: flex; justify-content: center; margin: 1rem 0; }
.secret { font-family: Consolas, monospace; background: var(--head); padding: .3rem .5rem; border-radius: 4px;
  word-break: break-all; }
.code-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
.stack > * + * { margin-top: 1rem; }

/* purchasing */
.wide-page { max-width: 1680px; }
.split { display: grid; grid-template-columns: minmax(380px, 42%) 1fr; gap: 1.2rem; align-items: start; }
.split.nodoc { grid-template-columns: 1fr; }
.docpane { position: sticky; top: 64px; }
.docpane iframe { width: 100%; height: calc(100vh - 110px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .wide2 { grid-column: span 2; }
.form-grid .wide4 { grid-column: 1 / -1; }
table.lines { border-collapse: collapse; width: 100%; font-size: .85rem; }
.lines th { text-align: left; color: var(--muted); font-weight: 600; padding: .3rem .25rem; white-space: nowrap; }
.lines td { padding: .15rem .2rem; }
.lines input, .lines select { padding: .3rem .35rem; font-size: .85rem; width: 100%; min-width: 3rem; }
input.num { text-align: right; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .docpane { position: static; } .docpane iframe { height: 60vh; } }
.lines input[name$="_material_no"] { min-width: 8.5rem; }
.lines input[name$="_drawing_no"] { min-width: 10rem; }

/* explicit choices (Storno, returns) */
.sub-choices { margin: .2rem 0 .6rem 1.6rem; font-size: .93rem; }
.choice-q { font-weight: 600; margin: .6rem 0 .15rem; }
label.choice { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; margin: .2rem 0; }
label.choice input { width: auto; margin-top: .25rem; }
.price-warn { font-size: .75rem; color: var(--warn); white-space: normal; text-align: left; margin-top: .2rem; }

/* --- dashboard, to do, notices, empty pages (0.21) --- */
.icon-chip { width: 40px; height: 40px; border-radius: 10px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; background: var(--gray-soft); color: var(--muted); }
.icon-chip.blue { background: var(--accent-soft); color: var(--accent); }
.icon-chip.teal { background: var(--teal-soft); color: var(--teal); }
.icon-chip.violet { background: var(--violet-soft); color: var(--violet); }
.icon-chip.green { background: var(--ok-soft); color: var(--ok); }
.icon-chip.red { background: var(--err-soft); color: var(--err); }
.icon-chip.amber { background: var(--warn-soft); color: var(--warn); }
.icon-chip.small { width: 28px; height: 28px; border-radius: 50%; }
.icon-chip.big { width: 60px; height: 60px; border-radius: 16px; }
.hello { display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.hello h1 { margin: .1rem 0 0; font-size: 1.75rem; letter-spacing: -.01em; }
.hello-pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.pill { padding: .3rem .85rem; border-radius: 99px; font-weight: 600; font-size: .9rem; background: var(--gray-soft); color: var(--muted); }
.pill:hover { text-decoration: none; filter: brightness(.97); }
.pill.red { background: var(--err-soft); color: var(--err); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.green-ok { background: var(--ok-soft); color: var(--ok); }
.todo { margin-bottom: 1.5rem; padding: 1rem 1.2rem .8rem; scroll-margin-top: calc(var(--top-h) + 10px); }
.todo h2 { margin: 0; }
.todo-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .5rem; }
.todo-head .grow { flex: 1; }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: var(--gray-soft); }
.seg a { padding: .25rem .8rem; border-radius: 7px; color: var(--muted); font-size: .9rem; }
.seg a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }
.seg a:hover { text-decoration: none; color: var(--ink); }
.add-task { position: relative; }
.add-task summary { list-style: none; cursor: pointer; padding: .4rem .9rem; }
.add-task summary::-webkit-details-marker { display: none; }
.add-task form { position: absolute; right: 0; top: 2.6rem; z-index: 4; width: 340px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px var(--shadow); padding: 1rem; display: grid; gap: .7rem; }
.todo-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .5rem .6rem; border-top: 1px solid var(--line); }
.todo-row > .tag { min-width: 6.2rem; text-align: center; }
.todo-text { flex: 1 1 340px; min-width: 0; }
.todo-text .muted { font-size: .82rem; }
.todo-row .go { font-weight: 600; white-space: nowrap; }
.assign { display: inline-flex; align-items: center; gap: .4rem; }
.assign select { width: auto; max-width: 12rem; padding: .3rem 1.6rem .3rem .7rem; border-radius: 99px; font-size: .88rem; }
.assign:not(.set) select { border-style: dashed; color: var(--muted); background: transparent; }
.avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center;
  justify-content: center; font-size: .72rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.avatar.teal { background: var(--teal-soft); color: var(--teal); }
.avatar.violet { background: var(--violet-soft); color: var(--violet); }
.avatar.amber { background: var(--warn-soft); color: var(--warn); }
.avatar.green { background: var(--ok-soft); color: var(--ok); }
.todo-more > summary, .todo-soon > summary { list-style: none; cursor: pointer; padding: .55rem .6rem;
  border-top: 1px solid var(--line); color: var(--accent); font-weight: 600; font-size: .88rem; }
.todo-more > summary::-webkit-details-marker, .todo-soon > summary::-webkit-details-marker { display: none; }
.todo-more > summary::before, .todo-soon > summary::before { content: "▸"; display: inline-block; width: 1.1rem; }
.todo-more[open] > summary::before, .todo-soon[open] > summary::before { content: "▾"; }
.todo-more .when-open, .todo-more[open] .when-closed { display: none; }
.todo-more[open] .when-open { display: inline; }
.todo-soon > summary { color: var(--ink); font-weight: 500; }
.todo-soon > summary .tag { margin-right: .4rem; }
.todo-more > summary:hover, .todo-soon > summary:hover { background: var(--hover); }
.todo-empty { display: flex; gap: .9rem; align-items: center; padding: 1rem .6rem; border-top: 1px solid var(--line); }
.todo-foot { font-size: .8rem; margin: 0; padding: .7rem .6rem 0; border-top: 1px solid var(--line); }
.kpi .label { color: var(--muted); font-size: .85rem; }
.ledgers { display: flex; flex-wrap: wrap; gap: 1rem; }
.ledger { flex: 1 1 460px; min-width: 0; }
.card.ledger + .card.ledger { margin-top: 0; }
.ledger-head { display: flex; align-items: center; gap: .8rem; }
.ledger-head h2 { margin: 0; font-size: 1.05rem; }
.ledger-head .grow { flex: 1; min-width: 0; }
.ledger-total { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ledger-bars { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.1rem; }
.ledger-bar { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.ledger-bar > span:first-child { width: 7rem; flex: none; }
.ledger-bar > span:last-child { width: 7rem; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.track { flex: 1; height: 14px; border-radius: 7px; background: var(--gray-soft); overflow: hidden; }
.fill { height: 100%; border-radius: 7px; }
.fill.s1 { background: var(--s1); } .fill.s2 { background: var(--s2); } .fill.s3 { background: var(--s3); }
.fill.s4 { background: var(--s4); } .fill.s5 { background: var(--s5); }
.ledger-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem;
  padding-top: .8rem; border-top: 1px solid var(--line); font-size: .88rem; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.theme-btn .sun { display: none; }
[data-theme="dark"] .theme-btn .sun { display: block; }
[data-theme="dark"] .theme-btn .moon { display: none; }
.x { flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent;
  color: inherit; font-size: 1.2rem; line-height: 1; font-weight: 400; cursor: pointer; }
.x:hover { background: var(--gray-soft); filter: none; }
.toasts { position: fixed; top: calc(var(--top-h) + 12px); right: 16px; z-index: 20; display: flex; flex-direction: column; gap: .6rem; }
.toast { position: relative; display: flex; gap: .7rem; align-items: center; width: 360px; max-width: calc(100vw - 32px);
  background: var(--card); color: var(--ink); border: 1px solid var(--ok-line); border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow); padding: .7rem .6rem .8rem .8rem; overflow: hidden; }
.toast > div { flex: 1; }
.toast .toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--ok);
  animation: toast-bar 5s linear forwards; }
.toast:hover .toast-bar { animation-play-state: paused; }
@keyframes toast-bar { from { width: 100%; } to { width: 0; } }
.empty-row td { padding: 0 !important; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 2.2rem 1rem; }
.empty-state b { font-size: 1.05rem; }
.empty-state p { margin: 0; max-width: 34rem; }
.empty-state .btn { margin-top: .4rem; }
[data-theme="dark"] .login-brand img, [data-theme="dark"] .docpane iframe { background: #fff; border-radius: 8px; }
[data-theme="dark"] .login-brand img { padding: .6rem; }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr; } .add-task form { width: calc(100vw - 48px); } }
/* narrow screens: the menu takes several lines, so it scrolls away with the page and table headers stick to the top */
@media (max-width: 900px) { .top { position: static; } .grid thead th { top: 0; } .toasts { top: 12px; } .todo { scroll-margin-top: 10px; } }
.menu-tall .top { position: static; }
.menu-tall .grid thead th { top: 0; }
.menu-tall .toasts { top: 12px; }
.menu-tall .todo { scroll-margin-top: 10px; }

/* File fields as drop zones (base.html wraps every <input type="file">) */
.dropzone { position: relative; display: flex; flex-direction: column; justify-content: center; gap: .15rem; min-height: 3rem;
  min-width: 0; padding: .55rem .9rem; border: 1.5px dashed var(--input-line); border-radius: 8px; background: var(--head);
  color: var(--muted); font-size: .88rem; text-align: center; cursor: pointer; }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone .dz-names { color: var(--ink); font-weight: 600; word-break: break-word; }
.dropzone.has .dz-hint { font-size: .78rem; }

/* Order check: fields with a point to correct (red) or to check (amber), see sales.field_marks */
input.bad, select.bad, textarea.bad { border-color: var(--err); background: var(--err-soft); box-shadow: 0 0 0 1px var(--err); }
input.check, select.check, textarea.check { border-color: var(--warn); background: var(--warn-soft); box-shadow: 0 0 0 1px var(--warn); }
a.jump { font-size: .8rem; white-space: nowrap; }
@keyframes field-flash { 0%, 100% { outline: 0 solid transparent; } 30% { outline: 3px solid var(--accent); } }
.flashing { animation: field-flash 1.2s ease 2; outline-offset: 2px; }

/* Two columns: a page and its column on the right — "This order" beside a document, "How an order runs" beside the
   other Sales / Purchasing / inquiry pages. From 900 px up the column stays on the right (narrower below 1100 px);
   only below 900 px it goes under the page (user, 18 Nov 2026). */
main.with-process { max-width: 1520px; }
.process-layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 1.5rem; align-items: start; }
.process-main { min-width: 0; }
@media (max-width: 1100px) {
  .process-layout { grid-template-columns: minmax(0, 1fr) 12.5rem; gap: 1rem; }
  aside.thisorder { padding: .8rem .7rem; font-size: .84rem; }
  aside.thisorder .to-step { gap: .5rem; padding: .45rem .4rem; }
}
@media (max-width: 900px) {
  .process-layout { grid-template-columns: minmax(0, 1fr); }
  aside.thisorder { position: static; max-height: none; }
}
/* "Do this" (base.html): the place to act on a page with a next step — a blue frame that breathes and an arrow */
.todo-here { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; animation: todo-pulse 1.6s ease-in-out infinite; }
@keyframes todo-pulse { 0%, 100% { outline-color: var(--accent); } 50% { outline-color: var(--accent-line); } }
.todo-arrow { display: none; position: absolute; z-index: 30; pointer-events: none; white-space: nowrap; background: var(--accent);
  color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em; padding: .2rem .55rem; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.todo-arrow::after { content: ""; position: absolute; right: 14px; bottom: -6px; border: 6px solid transparent; border-bottom: 0;
  border-top-color: var(--accent); }
.todo-arrow.side::after { right: auto; left: -6px; bottom: auto; top: 50%; margin-top: -6px; border: 6px solid transparent;
  border-left: 0; border-right-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .todo-here { animation: none; } }
/* wide lists on a narrow screen (below 900 px): the table scrolls in its own box, not the page. Above 900 px no
   overflow here, so a list too wide for the place beside the column still puts the column under it (N2). */
@media (max-width: 900px) {
  .scroll-narrow { overflow-x: auto; }
  .scroll-narrow .grid thead th { position: static; }
}
.process-layout.stacked .scroll-narrow { overflow-x: auto; }     /* column already under the page, still too wide */
.process-layout.stacked .scroll-narrow .grid thead th { position: static; }
/* set by base.html when the page is wider than its place beside the column (a wide list): the column goes under it */
.process-layout.stacked { grid-template-columns: minmax(0, 1fr); }
.process-layout.stacked aside.thisorder { position: static; max-height: none; }

/* "This order": the one column beside a document (_thisorder.html) */
aside.thisorder { position: sticky; top: calc(var(--top-h) + 1rem); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem 1.1rem; font-size: .9rem;
  max-height: calc(100vh - var(--top-h) - 2rem); overflow-y: auto; }   /* a long column scrolls in itself */
.to-head { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.to-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.to-step { display: flex; gap: .75rem; padding: .55rem .6rem; border-radius: 10px; color: var(--muted); }
.to-dot { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--gray-soft); font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.to-body { display: flex; flex-direction: column; min-width: 0; }
.to-title { font-weight: 600; }
.to-link { overflow-wrap: anywhere; }
.to-step.done, .to-step.next, .to-step.here { color: var(--ink); }
.to-step.done .to-dot { background: var(--ok); color: #fff; }
.to-step.next { border: 2px dashed var(--accent); }   /* states look the same on every page: accent = here / next */
.to-step.next .to-dot { background: var(--accent); color: #fff; }
.to-step.here { background: var(--accent-soft); }
.to-step.ended { color: var(--err); }
.to-step.ended .to-dot { background: var(--err); color: #fff; }
.to-step.skipped { opacity: .65; }
.to-you, .to-next { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
/* how far, what this step is, what to do next */
.to-progress { font-size: .78rem; color: var(--muted); margin: -.15rem 0 .6rem; }
.to-bar { height: 6px; border-radius: 3px; background: var(--gray-soft); overflow: hidden; margin-bottom: .3rem; }
.to-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.to-what { color: var(--muted); font-size: .78rem; line-height: 1.35; margin-top: .1rem; }
.to-hint { font-size: .82rem; line-height: 1.35; margin-top: .15rem; color: var(--ink); }
.to-hint a { font-weight: 600; }
.to-skip { font-weight: 400; font-size: .72rem; color: var(--muted); }
/* "How an order runs" (_process.html): every step opens its list; the step of this page in the colour of "here" */
.howto .to-step { color: var(--ink); }
.howto a.to-title { color: var(--ink); text-decoration: none; }
.howto a.to-title:hover { color: var(--accent); text-decoration: underline; }
.howto .to-step.here .to-dot { background: var(--accent); color: #fff; }
.howto .to-step.here a.to-title { color: var(--accent); }
/* the next step on top of a document */
.next-card { background: var(--card); border: 2px solid var(--accent); border-radius: 14px; overflow: hidden; margin-bottom: 1.1rem; }
.next-card > .nc-head { background: var(--accent-soft); color: var(--accent); padding: .6rem 1.3rem; font-size: .78rem; font-weight: 700; letter-spacing: .06em; }
.next-card > .nc-body { padding: 1rem 1.3rem 1.2rem; display: flex; flex-direction: column; gap: .8rem; }
.next-card h2 { margin: 0; font-size: 1.2rem; }
.next-card .nc-main { font-size: 1rem; padding: .7rem 1.5rem; min-height: 46px; }
.next-card.quiet { border-color: var(--line); }
.next-card.quiet > .nc-head { background: var(--head); color: var(--muted); }

/* order check page: extra line columns only when wanted; quiet notes */
table.lines .more-col { display: none; }
table.lines.all-cols .more-col { display: table-cell; }
.note-line { margin: .4rem 0 0; font-size: .86rem; color: var(--muted); }
.note-line.md { font-size: .82rem; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .form-grid.three { grid-template-columns: minmax(0, 1fr); } }

/* goods receipt: "→ stock of …" and "split…" on one line; the open split takes the whole width below */
.split-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; }
.split-line details[open] { flex-basis: 100%; }
/* (the receipt's split is details.rsplit: .split is the two-column page layout — Fable 0.33.0 point 6) */

/* Areas (user 22 Nov 2026: sales blue, purchasing orange, stock / delivery green, finance violet, master data and
   admin grey). app/areas.py says which page, step and To do line belongs where; .area-<name> gives --area.
   The rule (Fable, 22 Nov 2026): the area colour says "which department" and appears only as icon, line, stripe or
   dot — never as text colour, never as a background. States (accent = here / next, ok = done, warn, err) look the
   same on every page. Used by: the menu icons and the open entry's underline, the line on top of the sub menu, the
   stripe at the page title, the stripe of each step of "This order" / "How an order runs", the stripe and dot of
   the To do lines, the icons of the dashboard's key figures. tests/test_areas.py checks the rule. */
:root { --a-sales: #1f5f9e; --a-pur: #b4530d; --a-stock: #2e7d32; --a-fin: #5b4bb7; --a-grey: #5d6b7a; }
[data-theme="dark"] { --a-sales: #7db3ec; --a-pur: #f0a35e; --a-stock: #82cf88; --a-fin: #a99cf0; --a-grey: #9ba8b5; }
.to-step, .todo-row { --area: transparent; }   /* a step or line without an area: no colour (classes below win) */
.area-sales { --area: var(--a-sales); }
.area-purchasing { --area: var(--a-pur); }
.area-stock { --area: var(--a-stock); }
.area-finance { --area: var(--a-fin); }
.area-master, .area-admin { --area: var(--a-grey); }
.area-dashboard { --area: var(--ink); }
.area-task { --area: var(--faint); }
body[class*="area-"]:not(.area-dashboard) main h1 { border-left: 4px solid var(--area); padding-left: .6rem; }
.to-step { box-shadow: inset 3px 0 0 var(--area); }
.todo-row { box-shadow: inset 3px 0 0 var(--area); }
.todo-row .area-name { color: var(--muted); font-weight: 600; }
.todo-row .area-name::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--area); margin-right: .3rem; vertical-align: .05rem; }   /* the department as a dot */
.icon-chip.in-area { background: var(--gray-soft); color: var(--area); }   /* key figures: the icon in its area's colour */
/* 0.49.1 d: the calculation's Save bar stays at the bottom of the window while the form is on screen */
.savebar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin: 0 0 .5rem;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, .08); }
.savebar .dirty { color: var(--warn); font-weight: 600; white-space: nowrap; }
.savebar .savebar-help { font-size: .8rem; flex: 1 1 18rem; }
.calc-part { scroll-margin-top: calc(var(--top-h) + 1rem); }
@media (max-width: 900px) { .savebar .savebar-help { display: none; } .calc-part { scroll-margin-top: 1rem; } }
html:has(.savebar) { scroll-padding-bottom: 6rem; }     /* a focused field near the bottom is not hidden by the bar */
/* 0.52.0: a part while its numbers are recalculated, and when that failed (not new numbers) */
.calc-part.trying table{opacity:.6;transition:opacity .15s}
.calc-part.stale table{opacity:.35}

/* 0.56.0 / 0.56.1 (the user / Fable 3 Dec): a little Christmas, 1–26 December — body.xmas (the server, by the date);
   off in this browser: html[data-xmas="off"]. The logo wears a hat (an overlay: the hat's box is 50 × 26 where the
   logo's square is 32 wide, from x = 6, top edge at y = 14); snow and a shooting star on every page (0.56.2). */
.mark-wrap { position: relative; display: inline-block; line-height: 0; flex: none; }
.xmas-hat { position: absolute; pointer-events: none; --sq: 26px;
  width: calc(var(--sq) * 50 / 32); height: calc(var(--sq) * 26 / 32);
  left: calc(var(--sq) * -6 / 32); top: calc(var(--sq) * -14 / 32 - var(--lift, 1px)); }
/* the login logo: the hat in % of the image's own box (the square is 112/559 of its width and as high as it) */
.login-logo { display: inline-block; width: 260px; max-width: 80%; line-height: 0; }
.login-logo .mark-wrap { display: block; width: 100%; }
.login-brand .login-logo img { width: 100%; max-width: none; }
[data-theme="dark"] .login-brand .login-logo img { padding: 0; background: none; border-radius: 0; }
[data-theme="dark"] .login-logo { background: #fff; border-radius: 8px; padding: .6rem; }
.login-logo .xmas-hat { width: 31.306%; height: 81.25%; left: -3.757%; top: -43.75%; }
/* the dark-mode button and this one side by side, a little narrower: the menu wraps no earlier than before */
body.xmas .who { gap: .75rem; }
body.xmas .who .theme-btn { width: 25px; }
body.xmas .who .xmas-btn { margin-left: calc(-.75rem + 2px); }
.xmas-btn .xmas-off-line { display: none; }
[data-xmas="off"] .xmas-btn .xmas-off-line { display: inline; }
[data-xmas="off"] .xmas-hat, [data-xmas="off"] .xmas-snow, [data-xmas="off"] .xmas-hello { display: none; }
.xmas-hello { margin: .1rem 0 .4rem; color: #0F6E56; font-size: 1.25rem; font-weight: 600; letter-spacing: .02em; }
[data-theme="dark"] .xmas-hello { color: #5DCAA5; }
.xmas-tree { height: .92em; width: calc(.92em * 14 / 26); vertical-align: baseline; margin: 0 .03em; }
.xmas-snow { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; color: #9fbbd9; }
[data-theme="dark"] .xmas-snow { color: #93a7bd; }
.xmas-snow i { position: absolute; top: -32px; opacity: .85; animation: xmas-fall 14s linear infinite; }
.xmas-snow i svg { width: 100%; height: 100%; display: block; }
.xmas-snow i.part { animation-name: xmas-turn; }
@keyframes xmas-fall { from { transform: translate(0, 0) rotate(0); } 50% { transform: translate(18px, 52vh) rotate(40deg); }
  to { transform: translate(-6px, 105vh) rotate(80deg); } }
@keyframes xmas-turn { from { transform: translate(0, 0) rotate(0); } 50% { transform: translate(14px, 52vh) rotate(180deg); }
  to { transform: translate(-4px, 105vh) rotate(360deg); } }
.xmas-shoot { position: absolute; width: 120px; height: 44px; opacity: 0; line-height: 0; }
.xmas-shoot svg { width: 100%; height: 100%; }
.xmas-shoot.go { animation: xmas-shoot 1.2s ease-in forwards; }
@keyframes xmas-shoot { 0% { opacity: 0; transform: translate(0, 0); } 12% { opacity: 1; } 80% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, -400px), var(--dy, 160px)); } }
.xmas-snow i:nth-child(1) { left: 5%; animation-duration: 11s; animation-delay: -0s; width: 16px; height: 16px; }
.xmas-snow i:nth-child(2) { left: 42%; animation-duration: 18s; animation-delay: -13s; width: 21px; height: 21px; }
.xmas-snow i:nth-child(3) { left: 79%; animation-duration: 16s; animation-delay: -9s; width: 17px; height: 17px; }
.xmas-snow i:nth-child(4) { left: 16%; animation-duration: 14s; animation-delay: -5s; width: 25px; height: 25px; }
.xmas-snow i:nth-child(5) { left: 53%; animation-duration: 12s; animation-delay: -1s; width: 18px; height: 18px; }
.xmas-snow i:nth-child(6) { left: 90%; animation-duration: 19s; animation-delay: -14s; width: 23px; height: 23px; }
.xmas-snow i:nth-child(7) { left: 27%; animation-duration: 17s; animation-delay: -10s; width: 19px; height: 19px; }
.xmas-snow i:nth-child(8) { left: 64%; animation-duration: 15s; animation-delay: -6s; width: 24px; height: 24px; }
.xmas-snow i:nth-child(9) { left: 1%; animation-duration: 13s; animation-delay: -2s; width: 20px; height: 20px; }
.xmas-snow i:nth-child(10) { left: 38%; animation-duration: 11s; animation-delay: -15s; width: 16px; height: 16px; }
.xmas-snow i:nth-child(11) { left: 75%; animation-duration: 18s; animation-delay: -11s; width: 21px; height: 21px; }
.xmas-snow i:nth-child(12) { left: 12%; animation-duration: 16s; animation-delay: -7s; width: 30px; height: 30px; }
.xmas-snow i:nth-child(13) { left: 49%; animation-duration: 14s; animation-delay: -3s; width: 22px; height: 22px; }
.xmas-snow i:nth-child(14) { left: 86%; animation-duration: 12s; animation-delay: -16s; width: 18px; height: 18px; }
.xmas-snow i:nth-child(15) { left: 23%; animation-duration: 19s; animation-delay: -12s; width: 23px; height: 23px; }
.xmas-snow i:nth-child(16) { left: 60%; animation-duration: 17s; animation-delay: -8s; width: 29px; height: 29px; }
.xmas-snow i:nth-child(17) { left: 97%; animation-duration: 15s; animation-delay: -4s; width: 24px; height: 24px; }
.xmas-snow i:nth-child(18) { left: 34%; animation-duration: 13s; animation-delay: -0s; width: 20px; height: 20px; }
.xmas-snow i:nth-child(19) { left: 71%; animation-duration: 11s; animation-delay: -13s; width: 16px; height: 16px; }
.xmas-snow i:nth-child(20) { left: 8%; animation-duration: 18s; animation-delay: -9s; width: 28px; height: 28px; }
@media (prefers-reduced-motion: reduce) { .xmas-snow { display: none; } }
