/* Haldeens order book — Apple-style interface (grouped lists, large titles, system font) */
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f9f9fb;
  --label: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #8e8e93;
  --separator: rgba(60, 60, 67, .16);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --tint: #0066cc;
  --tint-press: #0058b0;
  --tint-soft: rgba(0, 102, 204, .1);
  --red: #d70015;
  --red-soft: rgba(215, 0, 21, .08);
  --green: #1f7a37;
  --orange: #b25000;
  --purple: #7c3bd1;
  --blue: #0066cc;
  --side-bg: rgba(242, 242, 247, .82);
  --bar-bg: rgba(249, 249, 251, .86);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --r: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.25, .1, .25, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --label: #f5f5f7;
    --secondary: #a1a1a6;
    --tertiary: #8e8e93;
    --separator: rgba(84, 84, 88, .55);
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .32);
    --tint: #2997ff;
    --tint-press: #0a84ff;
    --tint-soft: rgba(41, 151, 255, .16);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, .14);
    --green: #30d158;
    --orange: #ff9f0a;
    --purple: #bf5af2;
    --blue: #2997ff;
    --side-bg: rgba(28, 28, 30, .82);
    --bar-bg: rgba(22, 22, 24, .86);
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--label); font: 17px/1.47 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3 { margin: 0; }
small { font-size: 13px; }
.muted { color: var(--secondary); }
.faint { color: var(--tertiary); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
.late-text { color: var(--red); }
.warn-text { color: var(--orange); margin: 8px 0; font-size: 15px; }
.block { display: block; color: var(--secondary); font-weight: 400; font-size: 15px; }
.ico { width: 20px; height: 20px; flex: none; }
.r { text-align: right; }
:focus-visible { outline: 3px solid var(--tint-soft); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Layout ───────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px 14px;
  background: var(--side-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--separator);
}
.brand { display: block; padding: 6px 12px 16px; font: 700 22px/1 var(--display); letter-spacing: -.02em; }
.brand .wm { font: inherit; color: var(--label); }
.sidebar .f-search { margin: 0 0 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 9px; font-size: 15px; font-weight: 500; color: var(--label); transition: background .15s var(--ease); }
.nav a .ico { color: var(--tint); width: 21px; height: 21px; }
.nav a:hover { background: var(--fill); }
.nav a.on { background: var(--fill-2); font-weight: 600; }
.nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--fill-2); font-size: 13px; font-weight: 600; display: grid; place-items: center; color: var(--secondary); }
.nav-label { font-size: 13px; font-weight: 600; color: var(--tertiary); padding: 18px 12px 6px; }
.nav-2 { display: flex; flex-direction: column; gap: 2px; }
.nav-2 a { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 0 12px; border-radius: 9px; font-size: 15px; color: var(--label); }
.nav-2 a .ico { color: var(--tertiary); width: 19px; height: 19px; }
.nav-2 a:hover { background: var(--fill); }
.nav-2 a.on { background: var(--fill-2); font-weight: 600; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; border-top: 1px solid var(--separator); }
.me .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(180deg, #a1a1a6, #8e8e93); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; }
.me .me-who { flex: 1; min-width: 0; line-height: 1.25; }
.me .me-who b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .me-who small { color: var(--secondary); }
.me a, .me button { color: var(--tint); font-size: 13px; border: 0; background: none; padding: 0; cursor: pointer; }
.me form { display: inline; margin: 0; }

.main { min-width: 0; }
.content { max-width: 1100px; margin: 0 auto; padding: 34px 40px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font: 700 34px/1.12 var(--display); letter-spacing: -.025em; }
.page-head .sub { margin: 6px 0 0; color: var(--secondary); font-size: 17px; }
.page-head .sub a { color: var(--tint); }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--tint); font-size: 17px; margin-bottom: 6px; min-height: 32px; }
.back::before { content: ""; width: 10px; height: 10px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); margin-right: 4px; border-radius: 1px; }
.back:hover { opacity: .75; }
.mobile-top, .bottom-bar, .more-sheet { display: none; }

/* ── Buttons ──────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 18px; border-radius: 980px; border: 0; background: var(--fill); color: var(--tint); font-weight: 500; font-size: 15px; cursor: pointer; white-space: nowrap; transition: background .15s var(--ease), opacity .15s var(--ease); }
.btn:hover { background: var(--fill-2); }
.btn:active { opacity: .7; }
.btn.primary { background: var(--tint); color: #fff; }
.btn.primary:hover { background: var(--tint-press); }
.btn.ghost { background: none; }
.btn.ghost:hover { background: var(--fill); }
.btn.danger { color: var(--red); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn.tiny { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 50px; font-size: 17px; border-radius: 12px; }
.btn.wa { color: var(--green); }
.btn .ico { width: 18px; height: 18px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: none; color: var(--tertiary); cursor: pointer; }
.icon-btn:hover { background: var(--fill); color: var(--label); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.link { font-size: 15px; color: var(--tint); }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.push { margin-left: auto; }
form.inline, .inline { display: inline; margin: 0; }

/* ── Alerts ───────────────────────────────────────── */
.flashes { display: grid; gap: 8px; margin-bottom: 20px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); font-size: 15px; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tint); flex: none; }
.flash.ok::before { background: var(--green); }
.flash.warn::before { background: var(--orange); }
.flash.error::before { background: var(--red); }
.flash { justify-content: flex-start; }
.flash .x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--tertiary); }
.note-line { color: var(--secondary); font-size: 15px; margin: -10px 4px 24px; }
.note-line a { color: var(--tint); }

/* ── Grouped lists (the core building block) ──────── */
.section { margin-bottom: 34px; }
section { min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 4px 8px; }
.section-head h2 { font: 600 20px/1.2 var(--display); letter-spacing: -.015em; }
.section-head .link { font-size: 15px; }
.group-label { font-size: 13px; color: var(--secondary); text-transform: uppercase; letter-spacing: .02em; margin: 0 16px 7px; }
.group-foot { font-size: 13px; color: var(--secondary); margin: 7px 16px 0; }
.group, .list, .card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card { padding: 18px 20px; overflow: visible; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 540px; }
.card + .card, .group + .group, .list + .list { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head.pad { padding: 14px 20px 6px; margin: 0; }
.card-head h3 { font-size: 17px; font-weight: 600; }
.list-row, .row-link, .row-item {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 11px 18px; background: var(--surface);
}
.list-row + .list-row, .list-row + .list-empty, .row-link + .row-link, .row-item + .row-item, .row-item + .row-link, .row-link + .row-item { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
a.list-row, a.row-link { cursor: pointer; transition: background .15s var(--ease); }
a.list-row:hover, a.row-link:hover { background: var(--surface-2); }
a.list-row:active { background: var(--fill); }
a.list-row.chev::after, .chev > a.list-row::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--tertiary); border-top: 2px solid var(--tertiary); transform: rotate(45deg); flex: none; margin-left: 2px; opacity: .7; }
.list-row .main-col { flex: 1; min-width: 0; display: block; }
.list-row .main-col b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .main-col span { display: block; color: var(--secondary); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 15px; color: var(--secondary); }
.list-row .side .btn { margin-top: 2px; }
.list-row .side small { color: var(--secondary); font-size: 13px; }
.list-row form { margin: 0; }
.list-row.static .main-col b { font-weight: 400; }
.list-empty { color: var(--tertiary); padding: 16px 18px; margin: 0; background: var(--surface); }
.row-link small, .row-item small { display: block; color: var(--secondary); font-size: 13px; }
.row-item.note p, .row-item p { margin: 2px 0 0; }
.row-item > div { flex: 1; min-width: 0; }
.row-item.note.done { opacity: .5; }
.row-item.note.done p { text-decoration: line-through; }
.row-item form { margin: 0; }
.muted-row { opacity: .55; }

/* Summary tiles */
.stats, .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat, .kpi { display: flex; flex-direction: column; justify-content: space-between; min-height: 104px; padding: 16px 18px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; transition: transform .2s var(--ease); }
a.stat:hover, a.kpi:hover { transform: translateY(-1px); }
a.stat:active { transform: scale(.985); }
.stat .label, .k-label { font-size: 15px; font-weight: 600; color: var(--secondary); }
.k-label .ico { display: none; }
.stat .value, .k-value { font: 700 30px/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .value.late, .kpi.bad .k-value { color: var(--red); }
.k-value.sm { font-size: 20px; }
.k-sub, .stat small { font-size: 13px; color: var(--secondary); }
.stat.c-green .label { color: var(--green); } .stat.c-blue .label { color: var(--tint); } .stat.c-orange .label { color: var(--orange); } .stat.c-red .label { color: var(--red); }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; white-space: nowrap; color: var(--secondary); }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tertiary); flex: none; }
.pill.amber::before { background: var(--orange); }
.pill.blue::before { background: var(--blue); }
.pill.violet::before { background: var(--purple); }
.pill.green { color: var(--green); }
.pill.green::before { background: var(--green); }
.pill.dark::before { background: var(--label); }
.pill.red { color: var(--red); }
.pill.red::before { background: var(--red); }
.tag { display: inline-block; font-size: 13px; font-weight: 600; color: var(--secondary); white-space: nowrap; }
.tag.ok { color: var(--green); }
.tag.warn { color: var(--orange); }
.tag.late { color: var(--red); }
.left { font-size: 15px; white-space: nowrap; color: var(--secondary); }
.left.late { color: var(--red); font-weight: 600; }
.left.soon { color: var(--orange); font-weight: 600; }
.left.done { color: var(--green); }

/* ── Tables (inside white groups) ─────────────────── */
.table-wrap { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card .table-wrap, .group .table-wrap { box-shadow: none; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--secondary); padding: 12px 14px 8px; white-space: nowrap; border-bottom: 1px solid var(--separator); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--separator); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td b { font-weight: 500; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .nowrap { white-space: nowrap; }
.table .clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .wrap { min-width: 240px; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--separator); border-bottom: 0; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
.row-form input, .row-form select { height: 36px; border: 0; border-radius: 8px; padding: 0 10px; background: var(--fill); max-width: 160px; }

/* ── Segmented control (tabs) & search ────────────── */
.tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); margin-bottom: 18px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--label); white-space: nowrap; transition: background .2s var(--ease); }
.tab:hover { background: rgba(255, 255, 255, .5); }
.tab.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 600; }
.tab span { font-size: 13px; color: var(--secondary); font-weight: 500; }
@media (prefers-color-scheme: dark) { .tab.on { background: #636366; } .tab:hover { background: rgba(255, 255, 255, .08); } }
.seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill); }
.seg a, .seg button { min-height: 34px; padding: 0 14px; border-radius: 8px; border: 0; background: none; font-size: 14px; font-weight: 500; color: var(--label); display: inline-flex; align-items: center; cursor: pointer; }
.seg a.on, .seg button.on, .seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.searchbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.f-search { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 200px; height: 40px; border-radius: 10px; padding: 0 12px; background: var(--fill); color: var(--tertiary); }
.f-search .ico { width: 18px; height: 18px; }
.f-search input { border: 0; outline: 0; background: none; width: 100%; height: 100%; color: var(--label); font-size: 16px; }
.f-search input::placeholder { color: var(--tertiary); }
.f-search.slim { flex: 0 1 240px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters select, .filters input[type=date], .searchbar select { height: 40px; border: 0; border-radius: 10px; padding: 0 12px; background: var(--fill); font-size: 15px; }
.filters.card { padding: 0; background: none; box-shadow: none; }
.more-filters { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }
.more-filters[hidden] { display: none; }
.inline-label { display: inline-flex; gap: 6px; align-items: center; color: var(--secondary); font-size: 15px; }
.year-pick select { height: 40px; border: 0; border-radius: 980px; padding: 0 14px; background: var(--fill); font-weight: 600; color: var(--tint); }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; color: var(--secondary); }

/* ── Forms: grouped rows like iOS Settings ────────── */
.form-page { display: grid; gap: 26px; max-width: 680px; }
.form-page .card + .card { margin-top: 0; }
.form-h { font-size: 13px; font-weight: 400; color: var(--secondary); text-transform: uppercase; letter-spacing: .02em; margin: 0 16px 7px; }
.form-h small { text-transform: none; }
.fields { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card .fields { box-shadow: none; border-radius: 0; margin: 0 -20px; }
.field { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 18px; margin: 0; border: 0; position: relative; }
.field + .field, .fields > p + .field, .fields > .field + p { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.field > span { flex: 0 0 38%; font-size: 17px; color: var(--label); }
.field > span small { display: block; font-size: 13px; color: var(--tertiary); }
.field input, .field select, .field textarea { flex: 1; min-width: 0; width: 100%; min-height: 40px; border: 0; background: none; padding: 6px 0; outline: none; font-size: 17px; text-align: right; color: var(--label); }
.field input::placeholder, .field textarea::placeholder { color: var(--tertiary); }
.field select { appearance: none; -webkit-appearance: none; cursor: pointer; color: var(--secondary); text-align-last: right; padding-right: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M1 5l4-4 4 4M1 9l4 4 4-4' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right center no-repeat; }
.field input[type=date] { color: var(--secondary); }
.field input:focus, .field textarea:focus { color: var(--label); }
.field:focus-within > span { color: var(--tint); }
.field input[readonly] { color: var(--tertiary); }
.field.stack-field, .field:has(textarea), .field.span-2:has(input[name=item]), fieldset.field { flex-direction: column; align-items: stretch; gap: 4px; padding-top: 12px; padding-bottom: 10px; }
.field.stack-field > span, .field:has(textarea) > span, fieldset.field > span { flex: none; font-size: 13px; color: var(--secondary); }
.field textarea { text-align: left; resize: vertical; min-height: 64px; }
.field.stack-field input { text-align: left; }
.field.calc b { font-size: 17px; font-variant-numeric: tabular-nums; }
.hint, .field .hint { color: var(--secondary); font-size: 13px; margin: 2px 0 0; }
.fields > p.hint { padding: 10px 18px 12px; margin: 0; }
.fields > p.hint b { color: var(--label); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 980px; background: var(--fill); font-size: 15px; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check:has(input:checked) { background: var(--tint); color: #fff; }
.check:has(input:focus-visible) { outline: 3px solid var(--tint-soft); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.form-actions.left { justify-content: flex-start; margin-top: 14px; }
.inline-form { margin-top: 14px; }
details.more { }
details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); color: var(--tint); font-size: 17px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--tertiary); border-bottom: 2px solid var(--tertiary); transform: rotate(45deg); transition: transform .2s var(--ease); }
details.more[open] > summary { margin-bottom: 14px; }
details.more[open] > summary::after { transform: rotate(225deg); }
.disclose { margin-top: 12px; }
.disclose summary { cursor: pointer; list-style: none; color: var(--tint); }
.pop { display: inline-block; position: relative; }
.pop summary { list-style: none; }
.pop summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; right: 0; top: calc(100% + 8px); z-index: 15; width: 300px; display: grid; gap: 12px; padding: 14px; background: var(--surface); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .06); text-align: left; }
.pop-body .field { padding: 0 4px; min-height: 44px; }
.pop-body .field > span { font-size: 15px; flex-basis: 40%; }
.pop-body .field input { font-size: 16px; }

/* Toggle switch (export page) */
.switch-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 18px; cursor: pointer; }
.switch-row + .switch-row { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.switch-row .main-col { flex: 1; min-width: 0; }
.switch-row .main-col small { display: block; color: var(--secondary); font-size: 13px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--fill-2); transition: background .25s var(--ease); pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .25s var(--ease); }
.switch input:checked + i { background: #34c759; }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--tint-soft); outline-offset: 2px; }

/* ── Detail pages ─────────────────────────────────── */
.status-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 30px; }
.status-bar .now .pill { font-size: 20px; font-weight: 700; color: var(--label); }
.status-bar .now .pill::before { width: 11px; height: 11px; }
.status-bar .due { color: var(--secondary); font-size: 15px; }
.status-bar form { margin: 0; }
.status-bar .change select { height: 40px; border: 0; border-radius: 980px; padding: 0 30px 0 16px; background: var(--fill); font-size: 15px; color: var(--tint); appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M1 5l4-4 4 4M1 9l4 4 4-4' fill='none' stroke='%230066cc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.money-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--separator); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 18px; }
.money-sum div { background: var(--surface); padding: 14px 16px; }
.money-sum span { display: block; font-size: 13px; color: var(--secondary); }
.money-sum b { font: 600 22px/1.25 var(--display); font-variant-numeric: tabular-nums; }
.progress { height: 6px; background: var(--fill); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.progress span { display: block; height: 100%; background: var(--green); }
.payments { list-style: none; margin: 0 0 14px; padding: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.payments li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: 8px 18px; }
.payments li + li { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.payments li small { display: block; color: var(--secondary); }
.payments form { margin: 0; }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; margin: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.dl dt, .dl dd { padding: 13px 18px; margin: 0; border-top: 1px solid var(--separator); }
.dl dt:first-of-type, .dl dd:first-of-type { border-top: 0; }
.dl dt { color: var(--label); }
.dl dd { color: var(--secondary); text-align: right; overflow-wrap: anywhere; }
.dl.roles dd { text-align: left; font-size: 15px; }
.measures { display: grid; grid-template-columns: 1fr; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.measures div { display: flex; justify-content: space-between; min-height: 46px; align-items: center; padding: 0 18px; font-size: 16px; }
.measures div + div { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.measures span { color: var(--label); }
.measures b { font-weight: 500; color: var(--secondary); font-variant-numeric: tabular-nums; }
.history { margin-top: 6px; }
.history > summary { cursor: pointer; color: var(--tint); padding: 8px 4px; list-style: none; }

/* ── Grid ─────────────────────────────────────────── */
.grid { display: grid; gap: 30px; margin-bottom: 30px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2-1 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.cols-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.grid.align-start { align-items: start; }
.grid > *, .stack > * { min-width: 0; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; min-width: 0; align-content: start; }

/* ── Feed ─────────────────────────────────────────── */
.feed { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.feed li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 12px 18px; font-size: 15px; }
.feed li + li { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.feed time { color: var(--tertiary); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.feed p { margin: 0; }
.feed small { color: var(--secondary); display: block; overflow-wrap: anywhere; font-size: 13px; }
.feed .who { display: none; }
.feed.full li { grid-template-columns: 112px 1fr; }
.who { width: 26px; height: 26px; border-radius: 50%; background: var(--fill); color: var(--secondary); display: inline-grid; place-items: center; font-weight: 600; font-size: 12px; }
.who.sm { width: 22px; height: 22px; font-size: 11px; margin-right: 6px; }
.people-strip { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 16px; font-size: 15px; }
.person { display: inline-flex; gap: 6px; align-items: center; }

/* ── Board ────────────────────────────────────────── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 30px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; font-size: 15px; font-weight: 600; }
.lane-head span:last-child { color: var(--tertiary); font-weight: 500; }
.lane-card { display: grid; gap: 2px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; transition: transform .15s var(--ease); }
.lane-card:hover { transform: translateY(-1px); }
.lane-card b { font-weight: 600; }
.lane-card .clip { color: var(--secondary); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--tertiary); }
.lane-meta .left { font-size: 13px; }
.lane-empty { color: var(--tertiary); margin: 4px; }

/* ── Charts ───────────────────────────────────────── */
.chart-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 18px 8px; margin-bottom: 18px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; margin: 6px 0 4px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.bar, .bar-stack { width: 100%; max-width: 34px; border-radius: 6px; background: var(--fill-2); min-height: 3px; display: flex; flex-direction: column; overflow: hidden; }
.bar.now { background: var(--tint); }
.bar-val { font-size: 12px; color: var(--secondary); white-space: nowrap; }
.bar-label { font-size: 12px; color: var(--secondary); }
.legend { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--secondary); }

/* ── Measurements screen ──────────────────────────── */
.measure-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.mrow { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 18px; background: var(--surface); }
.mrow + .mrow { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.mrow .m-label { flex: 1; min-width: 0; }
.mrow .m-label b { display: block; font-weight: 400; font-size: 17px; }
.mrow .m-label small { display: block; color: var(--secondary); font-size: 13px; line-height: 1.35; }
.mrow .m-input { display: flex; align-items: center; gap: 6px; flex: none; }
.mrow input { width: 96px; height: 44px; border: 0; border-radius: 10px; background: var(--fill); text-align: center; font: 600 20px/1 var(--display); font-variant-numeric: tabular-nums; outline: none; color: var(--label); }
.mrow input:focus { background: var(--tint-soft); box-shadow: 0 0 0 2px var(--tint); }
.mrow input::placeholder { color: var(--tertiary); font-weight: 400; }
.mrow .unit { width: 22px; color: var(--secondary); font-size: 15px; }
.mrow .was { display: block; font-size: 12px; color: var(--tertiary); text-align: center; margin-top: 2px; }
.mrow.changed .m-label b::after { content: " •"; color: var(--tint); }
.mgroup { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 26px; }
/* one-at-a-time mode */
.focus-mode .mgroup { display: none; }
.focus-mode .group-label.m-sec { display: none; }
.focus-card { display: none; }
.focus-mode .focus-card { display: block; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 30px 24px 24px; text-align: center; margin-bottom: 22px; }
.focus-card .f-step { color: var(--secondary); font-size: 15px; }
.focus-card .f-name { font: 700 30px/1.2 var(--display); letter-spacing: -.02em; margin: 6px 0 4px; }
.focus-card .f-hint { color: var(--secondary); margin: 0 auto 22px; max-width: 360px; font-size: 15px; }
.focus-card .f-input { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.focus-card input { width: 200px; height: 78px; border: 0; border-radius: 16px; background: var(--fill); text-align: center; font: 700 44px/1 var(--display); font-variant-numeric: tabular-nums; outline: none; color: var(--label); }
.focus-card input:focus { box-shadow: 0 0 0 3px var(--tint); }
.focus-card .f-unit { font-size: 20px; color: var(--secondary); }
.focus-card .f-was { color: var(--tertiary); font-size: 14px; margin-top: 10px; min-height: 20px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.quick button { min-width: 54px; height: 44px; border: 0; border-radius: 12px; background: var(--fill); font-size: 17px; font-weight: 500; cursor: pointer; color: var(--label); }
.quick button:active { background: var(--fill-2); }
.focus-card .f-nav { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.focus-card .f-nav .btn { min-width: 130px; min-height: 48px; font-size: 17px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--fill-2); }
.dots i.filled { background: var(--tint); opacity: .45; }
.dots i.on { background: var(--tint); opacity: 1; }

/* ── Messages & settings ──────────────────────────── */
.msg-group { margin: 26px 0 8px; }
.group-h { font: 600 20px/1.2 var(--display); margin: 0 4px 10px; }
.msg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.msg-grid .card + .card { margin-top: 0; }
.msg { display: flex; flex-direction: column; }
.msg .card-head { margin-bottom: 4px; }
.msg-body { flex: 1; margin: 0 0 14px; color: var(--secondary); white-space: pre-wrap; font-size: 15px; }
.msg-actions { display: flex; gap: 8px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.settings-grid .card + .card { margin-top: 0; }
.opt-list { list-style: none; margin: 0 -20px 12px; padding: 0; }
.opt-list li { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px 0 20px; font-size: 16px; border-top: 1px solid var(--separator); }
.opt-actions { display: flex; }
.add-opt { display: flex; gap: 8px; }
.add-opt input { flex: 1; height: 38px; border: 0; border-radius: 10px; padding: 0 12px; background: var(--fill); }

/* ── Empty, error, auth ───────────────────────────── */
.empty { color: var(--tertiary); padding: 18px; }
.empty .ico { display: none; }
.empty p { margin: 0 0 10px; }
.error-page { max-width: 520px; margin: 40px auto; text-align: center; display: grid; gap: 12px; justify-items: center; padding: 40px; }
.error-page .code { font: 700 56px/1 var(--display); color: var(--tertiary); }
body.auth { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.auth-wrap { width: min(380px, 100%); }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .wm { font: 700 34px/1 var(--display); letter-spacing: -.025em; color: var(--label); }
.auth-brand small { display: block; color: var(--secondary); font-size: 15px; margin-top: 8px; }
.auth-brand .mark { display: none; }
.auth-card { display: grid; gap: 18px; padding: 0; background: none; box-shadow: none; }
.auth-card h1 { display: none; }
.auth-card p { margin: 0; text-align: center; }
.auth-card .flash { margin: 0; }
.auth-card .field-group { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.auth-card .fields { margin: 0; border-radius: var(--r); box-shadow: var(--shadow); }

/* ── Phones & tablets ─────────────────────────────── */
@media (max-width: 1000px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .content { padding: 8px 16px 120px; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 16px; position: sticky; top: 0; z-index: 20; background: var(--bar-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .mobile-top .wm { font: 600 17px/1 var(--display); }
  .page-head h1 { font-size: 30px; }
  .bottom-bar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--bar-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: .5px solid var(--separator); padding: 6px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-bar a, .bottom-bar button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 48px; font-size: 10.5px; font-weight: 500; color: var(--tertiary); border: 0; background: none; padding: 2px 0; cursor: pointer; }
  .bottom-bar .on { color: var(--tint); }
  .bottom-bar .ico { width: 26px; height: 26px; }
  .bottom-bar .plus { color: var(--tint); }
  .bottom-bar .plus .ico { width: 30px; height: 30px; padding: 4px; border-radius: 50%; background: var(--tint); color: #fff; }
  .more-sheet { display: block; position: fixed; inset: 0; z-index: 40; pointer-events: none; }
  .more-sheet .scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .3); opacity: 0; transition: opacity .25s var(--ease); }
  .more-sheet .sheet { position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); transform: translateY(110%); transition: transform .35s cubic-bezier(.2, .9, .3, 1); }
  .more-sheet .sheet .sheet-group { background: var(--surface); border-radius: 14px; overflow: hidden; margin-top: 8px; }
  .more-sheet .sheet a, .more-sheet .sheet button { display: block; width: 100%; text-align: center; min-height: 56px; padding: 16px; font-size: 18px; color: var(--tint); border: 0; background: none; cursor: pointer; }
  .more-sheet .sheet .sheet-group > * + *, .more-sheet .sheet .sheet-group > form > button { box-shadow: inset 0 .5px 0 var(--separator); }
  .more-sheet .sheet .who-line { color: var(--secondary); padding: 14px; font-size: 13px; text-align: center; }
  .more-sheet .sheet .cancel { font-weight: 600; }
  body.more-open .more-sheet { pointer-events: auto; }
  body.more-open .more-sheet .scrim { opacity: 1; }
  body.more-open .more-sheet .sheet { transform: none; }
  .grid.cols-2, .grid.cols-2-1, .grid.cols-1-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .stats, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 640px) {
  .page-head { margin-bottom: 20px; }
  .page-head h1 { font-size: 28px; }
  .page-head .actions .btn.primary { display: none; }
  .stat, .kpi { min-height: 92px; padding: 14px 16px; }
  .stat .value, .k-value { font-size: 24px; }
  .stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats.three .stat .value { font-size: 18px; }
  .field > span { flex-basis: 42%; font-size: 16px; }
  .field input, .field select { font-size: 16px; }
  .money-sum b { font-size: 17px; }
  .dl { grid-template-columns: 1fr 1fr; }
  .table .hide-sm { display: none; }
  .form-actions { position: sticky; bottom: 76px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
  .form-actions .btn { flex: 1; min-height: 48px; }
  .bar-val { display: none; }
  .mrow input { width: 84px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 0 10px; }
}
@media print { .sidebar, .bottom-bar, .mobile-top, .toolbar, .searchbar, .pager { display: none !important; } .shell { display: block; } body { background: #fff; } }

/* radio segmented control (export) */
.radio-seg { display: flex; width: 100%; flex-wrap: wrap; }
.radio-seg label { flex: 1; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.radio-seg label:has(input:checked) { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.radio-seg input { position: absolute; opacity: 0; pointer-events: none; }
.radio-seg label:has(input:focus-visible) { outline: 3px solid var(--tint-soft); }
@media (prefers-color-scheme: dark) { .radio-seg label:has(input:checked) { background: #636366; } }
.custom-dates { display: none; }
form:has(input[name=period][value=custom]:checked) .custom-dates { display: block; }
.sidebar .f-search { flex: none; height: 38px; min-width: 0; }
@media (prefers-color-scheme: dark) { .seg a.on, .seg button.on, .seg button[aria-pressed="true"] { background: #636366; } }
.focus-mode .form-actions { position: static; background: none; }

/* measurement figures */
.bfig { width: 40px; height: 82px; flex: none; overflow: visible; }
.bfig .body * { fill: none; stroke: var(--tertiary); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .55; }
.bfig .hl { fill: none; stroke: var(--tint); stroke-width: 3; stroke-linecap: round; }
.bfig .tick { stroke: var(--tint); stroke-width: 2; stroke-linecap: round; }
.bfig .guide { stroke: var(--tint); stroke-width: 1.2; stroke-dasharray: 2 3; opacity: .55; }
.bfig .dot { fill: var(--tint); }
.mrow { min-height: 96px; }
.mrow .bfig { margin-right: 2px; }
.focus-card .f-fig .bfig { width: 92px; height: 188px; margin: 0 auto 6px; display: block; }
.focus-card .f-fig .bfig .hl { stroke-width: 2.6; }

/* catalogue */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.cat-card { display: block; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transition: transform .2s var(--ease); }
.cat-card:hover { transform: translateY(-2px); }
.cat-img, .cat-hero { aspect-ratio: 4 / 5; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.cat-img img, .cat-hero img { width: 100%; height: 100%; object-fit: contain; padding: 10px 10px 0; }
.cat-img span, .cat-hero span { font: 700 28px/1 var(--display); color: var(--tertiary); }
.cat-hero { border-radius: var(--r); box-shadow: var(--shadow); background: var(--surface); }
.cat-body { padding: 12px 14px 14px; display: grid; gap: 1px; }
.cat-code { font-size: 13px; color: var(--secondary); }
.cat-body b { font-weight: 600; }
.cat-meta { font-size: 14px; color: var(--secondary); }
@media (max-width: 640px) { .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.mgroup .bfig { width: 48px; height: 98px; margin-right: 6px; }

/* ── Catalogue photos: add or change right on the page ── */
.file-hide { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.cat-card { position: relative; }
.cat-link { display: block; }
.cat-img { position: relative; }
.cat-cam { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  color: var(--label); background: color-mix(in srgb, var(--surface) 80%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.6); backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 10px rgba(0, 0, 0, .08); transition: transform .15s var(--ease); }
.cat-cam::after { content: ""; position: absolute; inset: -4px; }
.cat-cam:active { transform: scale(.92); }
.cat-cam:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; }
.cat-cam .ico { width: 20px; height: 20px; }
.cat-add { display: contents; }
.cat-add-tile { position: relative; display: grid; place-content: center; justify-items: center; gap: 6px; min-height: 220px; padding: 20px 16px; text-align: center; cursor: pointer;
  border-radius: 16px; border: 2px dashed var(--separator); background: var(--surface); color: var(--secondary); font-size: 14px; line-height: 1.35; transition: border-color .15s var(--ease), background .15s var(--ease); }
.cat-add-tile:hover, .cat-add-tile:focus-within { border-color: var(--tint); }
.cat-add-tile:active { background: var(--tint-soft); }
.cat-add-tile b { color: var(--tint); font-size: 17px; font-weight: 600; }
.cat-add-ico { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--tint-soft); color: var(--tint); margin-bottom: 4px; }
.cat-add-ico .ico { width: 26px; height: 26px; }
.cat-start { padding: 20px 22px; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cat-start p { margin: 0; flex: 1 1 260px; }
[data-photo-box] { position: relative; }
.is-busy .cat-img::after, .is-busy .cat-hero::after, .is-busy .pf-img::after { content: ""; position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .7); border-top-color: var(--tint); animation: hd-spin .8s linear infinite; }
.is-busy .cat-img img, .is-busy .cat-hero img { opacity: .55; }
.cat-card.is-busy .cat-cam { display: none; }
.cat-hero { position: relative; }
@keyframes hd-spin { to { transform: rotate(360deg); } }
.cat-card.is-failed .cat-img img { opacity: .35; filter: grayscale(1); }
.cat-card.is-failed .cat-meta { color: var(--red); }
.hero-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-tools .btn .ico, .pf-actions .btn .ico { width: 18px; height: 18px; }
.stack.tight { gap: 10px; }
.photo-field { display: flex; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.pf-img { position: relative; flex: none; width: 96px; aspect-ratio: 4 / 5; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.pf-img img { width: 100%; height: 100%; object-fit: contain; }
.pf-img span { font-size: 12px; color: var(--tertiary); text-align: center; padding: 6px; }
.pf-actions { display: grid; gap: 8px; justify-items: start; }
body.dropping::after { content: "Drop the photos to add them to the catalogue"; position: fixed; inset: 14px; z-index: 200; display: grid; place-items: center; pointer-events: none;
  border: 3px dashed var(--tint); border-radius: 22px; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--tint); font: 600 22px/1.3 var(--display); }
@media (max-width: 640px) { .cat-add-tile { min-height: 0; height: 100%; padding: 16px 10px; } .cat-add-tile > span:not(.cat-add-ico) { font-size: 13px; } }

/* ── Home: charts and order board ───────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ok-text { color: var(--green); }
.dash-block { margin-bottom: 30px; }
.card.chart { padding: 18px 20px; }
.chart-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-top h2 { font: 600 20px/1.2 var(--display); letter-spacing: -.015em; margin: 0; }
.chart-empty { margin: 6px 0; color: var(--secondary); font-size: 15px; }
.chart-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0; font-size: 13px; color: var(--secondary); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--tint); }
.sw.dep { background: var(--tint); } .sw.bal { background: var(--purple); } .sw.rtw { background: var(--orange); }
.sw.ok { background: var(--green); } .sw.late { background: var(--red); } .sw.soon { background: var(--orange); }

/* Money in */
.mc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.mc-total { margin: 0; display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.mc-total b { font: 700 34px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mc-total span { color: var(--secondary); font-size: 15px; }
.delta { margin: 0; font-size: 14px; color: var(--secondary); }
.delta.up b { color: var(--green); }
.delta.down b { color: var(--red); }
.bc { position: relative; outline: none; border-radius: 10px; touch-action: pan-y; }
.bc:focus-visible { box-shadow: 0 0 0 3px var(--tint-soft); }
.bc-plot { position: relative; height: 200px; margin-left: 48px; }
.bc-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--separator); }
.bc-line:first-child { border-top-style: solid; }
.bc-line i { position: absolute; right: calc(100% + 8px); top: -8px; font: normal 12px/16px var(--font); color: var(--tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bc-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.bc-bar { flex: 1; height: 100%; min-width: 0; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; }
.bc-bar i { display: flex; flex-direction: column; width: 100%; max-width: 30px; height: var(--h); min-height: 3px; border-radius: 5px 5px 2px 2px; overflow: hidden; gap: 1px; transition: opacity .15s var(--ease); }
.bc-bar s { display: block; min-height: 2px; }
.bc-bar s.dep { background: var(--tint); } .bc-bar s.bal { background: var(--purple); } .bc-bar s.rtw { background: var(--orange); }
.bc-bar.zero i { background: var(--fill-2); }
.bc.hovering .bc-bar:not(.on):not(.zero) i { opacity: .35; }
.bc-x { display: flex; gap: 3px; margin: 8px 0 0 48px; }
.bc-x span { flex: 1; min-width: 0; font-size: 12px; color: var(--tertiary); text-align: center; white-space: nowrap; }
.bc-x span:last-child { text-align: right; }
.bc-tip { position: absolute; top: -14px; left: 0; z-index: 6; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity .12s var(--ease);
  display: grid; gap: 1px; min-width: 140px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: .5px solid var(--separator);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14); font-size: 13px; color: var(--secondary); white-space: nowrap; }
.bc-tip.show { opacity: 1; }
.bc-tip b { font: 700 18px/1.2 var(--display); color: var(--label); font-variant-numeric: tabular-nums; }
.mc-split { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 16px 0 0; font-size: 14px; color: var(--secondary); }
.mc-split b { color: var(--label); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Order board */
.section-head .muted { font-size: 14px; margin-right: auto; }
.kb { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(214px, 1fr); gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 14px; margin: 0 -2px; overscroll-behavior-x: contain; }
.kb-col { scroll-snap-align: start; display: flex; flex-direction: column; min-height: 150px; padding: 10px; border-radius: 14px; background: var(--fill); transition: background .15s var(--ease), box-shadow .15s var(--ease); }
.kb-col.drop { background: var(--tint-soft); box-shadow: inset 0 0 0 2px var(--tint); }
.kb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.kb-head .pill { font-size: 14px; font-weight: 600; color: var(--label); }
.kb-n { min-width: 26px; padding: 1px 8px; border-radius: 980px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--secondary); text-align: center; font-variant-numeric: tabular-nums; }
.kb-list { display: grid; gap: 8px; align-content: start; flex: 1; }
.kb-card { display: grid; gap: 6px; padding: 10px 12px; border-radius: 11px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); cursor: grab; transition: opacity .15s var(--ease), transform .15s var(--ease); }
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: .35; }
.kb-card.saving { opacity: .6; pointer-events: none; }
.kb-card.moved { animation: kb-in .5s var(--ease); }
@keyframes kb-in { from { transform: scale(.96); box-shadow: 0 0 0 3px var(--tint); } to { transform: none; } }
.kb-link { display: grid; gap: 1px; min-width: 0; }
.kb-link b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-link .clip { font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kb-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; overflow: hidden; white-space: nowrap; }
.kb-meta .left, .kb-meta .faint { font-size: 13px; }
.kb-meta .tag { font-size: 12px; }
.kb-move { position: relative; flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px; border-radius: 980px; background: var(--fill); color: var(--tint); font-size: 13px; font-weight: 600; cursor: pointer; }
.kb-move::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg) translateY(-2px); }
.kb-move select { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
.kb-move:focus-within { box-shadow: 0 0 0 3px var(--tint-soft); }
.kb-more { padding: 4px 6px; font-size: 14px; font-weight: 500; color: var(--tint); }
.kb-empty { display: none; margin: 18px 0; text-align: center; font-size: 14px; color: var(--tertiary); }
.kb-list:not(:has(.kb-card)) .kb-empty { display: block; }

/* Due in the next two weeks */
.ds { display: flex; gap: 12px; align-items: stretch; }
.ds-late { flex: none; width: 66px; display: grid; place-content: center; text-align: center; gap: 2px; border-radius: 12px; background: var(--red-soft); color: var(--red); }
.ds-late b { font: 700 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.ds-late span { font-size: 13px; font-weight: 600; }
.ds-late.none { background: var(--fill); color: var(--secondary); }
.ds-days { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; }
.ds-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-height: 132px; padding: 6px 0; border-radius: 9px; transition: background .15s var(--ease); }
.ds-day:hover { background: var(--fill); }
.ds-day.today { background: var(--tint-soft); }
.ds-dots { flex: 1; display: flex; flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: 3px; }
.ds-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--tint); }
.ds-dots i.ready { background: var(--green); }
.ds-dots em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--secondary); }
.ds-wd { font-size: 11px; color: var(--tertiary); }
.ds-dn { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ds-day.today .ds-wd, .ds-day.today .ds-dn { color: var(--tint); }
.ds-day.empty .ds-dn { color: var(--tertiary); font-weight: 500; }

/* Paid so far */
.ring-wrap { display: flex; align-items: center; gap: 24px; margin-bottom: 16px; }
.ring { position: relative; flex: none; width: 128px; height: 128px; }
.ring svg { display: block; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--fill-2); stroke-width: 5; }
.ring-fill { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ring-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-mid b { font: 700 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.ring-mid span { font-size: 13px; color: var(--secondary); }
.ring-side { display: grid; gap: 8px; min-width: 0; }
.ring-side p { margin: 0; display: grid; }
.ring-side .faint { font-size: 13px; }
.ring-side b { font: 600 19px/1.25 var(--display); font-variant-numeric: tabular-nums; }
.list.flat { box-shadow: none; border-radius: 0; margin: 0 -20px -18px; border-top: .5px solid var(--separator); background: none; }
.list.flat .side { display: grid; justify-items: end; }

/* Horizontal bars (team, order types) */
.hb { display: grid; gap: 2px; margin: -4px -6px 0; }
.hb-row { display: grid; grid-template-columns: minmax(100px, 32%) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 10px; transition: background .15s var(--ease); }
.hb-row:hover { background: var(--fill); }
.hb-name { display: grid; min-width: 0; font-size: 15px; font-weight: 600; }
.hb-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; color: var(--secondary); }
.hb-track { justify-self: start; display: flex; gap: 2px; width: var(--w); min-width: 6px; height: 14px; border-radius: 7px; overflow: hidden; }
.hb-track i { height: 100%; }
.hb-track i.late { background: var(--red); } .hb-track i.soon { background: var(--orange); } .hb-track i.rest { background: var(--tint); }
.hb-n { min-width: 2.4em; text-align: right; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (prefers-color-scheme: dark) { .kb-col { background: var(--surface); } .kb-card { box-shadow: none; background: var(--surface-2); } .kb-n { background: var(--surface-2); } .kb-move { background: rgba(118, 118, 128, .32); } .bc-tip { background: #2c2c2e; } }
@media (max-width: 640px) {
  .card.chart { padding: 16px; }
  .list.flat { margin: 0 -16px -16px; }
  .section-head .hide-sm { display: none; }
  .mc-total b { font-size: 28px; }
  .bc-plot { height: 170px; margin-left: 40px; }
  .bc-x { margin-left: 40px; }
  .bc-bars, .bc-x { gap: 2px; }
  .kb { grid-auto-columns: 78%; margin: 0 -16px; padding: 2px 16px 14px; scroll-padding: 0 16px; }
  .ds { flex-direction: column; gap: 8px; }
  .ds-late { width: auto; display: flex; justify-content: center; align-items: baseline; gap: 6px; padding: 8px; }
  .ds-late b { font-size: 20px; }
  .ds-day { min-height: 110px; }
  .ds-dots i { width: 8px; height: 8px; }
  .ring-wrap { gap: 18px; }
  .ring { width: 112px; height: 112px; }
  .hb-row { grid-template-columns: minmax(88px, 34%) minmax(0, 1fr) auto; gap: 10px; }
}

/* Pipeline above the board */
.pipe { margin-bottom: 14px; }
.pipe-bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; margin: 0 2px 10px; background: var(--fill); }
.pipe-bar i { min-width: 4px; }
.pipe-bar .gray, .pipe-step.gray::before { background: var(--tertiary); }
.pipe-bar .amber, .pipe-step.amber::before { background: var(--orange); }
.pipe-bar .blue, .pipe-step.blue::before { background: var(--blue); }
.pipe-bar .violet, .pipe-step.violet::before { background: var(--purple); }
.pipe-bar .green, .pipe-step.green::before { background: var(--green); }
.pipe-steps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.pipe-step { position: relative; display: grid; justify-items: start; align-content: start; gap: 1px; min-height: 76px; padding: 12px 12px 10px; overflow: hidden; text-align: left;
  border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--label); font: inherit; cursor: pointer; transition: transform .15s var(--ease); }
.pipe-step::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; }
.pipe-step:hover { transform: translateY(-1px); }
.pipe-step:active { transform: scale(.98); }
.pipe-step:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; }
.pipe-step b { font: 700 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.pipe-step.none b { color: var(--tertiary); }
.pipe-name { font-size: 13px; color: var(--secondary); line-height: 1.25; }
.pipe-name .short { display: none; }
.pipe-step small { font-size: 12px; font-weight: 600; color: var(--red); }
.kb-col.jumped { animation: kb-jump 1.2s var(--ease); }
@keyframes kb-jump { 0%, 40% { box-shadow: inset 0 0 0 2px var(--tint); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.hb.types .hb-row { grid-template-columns: minmax(150px, 44%) minmax(0, 1fr) auto; }
@media (max-width: 1180px) { .pipe-name .long { display: none; } .pipe-name .short { display: inline; } .pipe-step { padding: 10px 10px 8px; } }
@media (max-width: 640px) {
  .pipe-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .pipe-step { min-height: 64px; padding: 9px 9px 7px; }
  .pipe-step b { font-size: 21px; }
  .pipe-name { font-size: 12px; }
  .hb.types .hb-row { grid-template-columns: minmax(110px, 42%) minmax(0, 1fr) auto; }
}
.bc-bar s.pos, .sw.pos { background: var(--green); }
.mc-aside { margin: 10px 0 0; font-size: 14px; color: var(--secondary); }

/* ── POS sales ────────────────────────────────────── */
.pos-start { padding: 26px 24px; display: grid; gap: 10px; justify-items: start; }
.pos-start h3 { font: 600 20px/1.2 var(--display); margin: 0; }
.pos-start p { margin: 0; }
.stat .of { font-size: 15px; font-weight: 500; color: var(--secondary); }
.table small.block { font-size: 13px; }
.small-link { font-size: 13px; font-weight: 500; }
.show-sm { display: none !important; }
.steps { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 6px; color: var(--secondary); font-size: 15px; }
.steps b { color: var(--label); font-weight: 600; }
.radio-list { display: grid; }
.radio-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; cursor: pointer; background: var(--surface); }
.radio-row + .radio-row { box-shadow: inset 18px 1px 0 var(--surface), inset 0 1px 0 var(--separator); }
.radio-row input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--tint); }
.radio-row b { display: block; font-weight: 600; }
.radio-row small { display: block; color: var(--secondary); font-size: 14px; line-height: 1.4; }
.copy-line { display: flex; gap: 8px; align-items: center; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 8px 8px 14px; margin-bottom: 10px; }
.copy-line input { flex: 1; min-width: 0; border: 0; background: none; font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--label); outline: none; text-overflow: ellipsis; }
.small-print { font-size: 13px; margin: 0 4px 12px; }
@media (max-width: 640px) { .show-sm { display: block !important; } }

/* ── Measurements sent in by clients ──────────────── */
.banner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 18px; padding: 14px 18px;
  border-radius: var(--r); background: var(--tint-soft); color: var(--tint); transition: background .15s var(--ease); }
.banner b { font-weight: 600; }
.banner span { font-size: 14px; }
.banner:hover { background: color-mix(in srgb, var(--tint-soft) 70%, var(--tint) 12%); }
.share-card { display: grid; gap: 10px; justify-items: start; margin-top: 12px; }
.share-card > p { margin: 0; font-size: 15px; }
.share-card .copy-line { width: 100%; margin: 0; box-shadow: none; background: var(--fill); }
.other-client { display: grid; gap: 10px; justify-items: start; }
.other-client .field { width: 100%; }
.brand-card { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.brand-card .field { flex: 1 1 320px; margin: 0; }

/* ── The public demo (demo mode only) ─────────────── */
.demo-note { display: flex; align-items: baseline; gap: 7px; margin: -8px 12px 16px; font-size: 12px; line-height: 1.35; color: var(--secondary); }
.demo-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex: none; }
.mobile-top .demo-note { flex: 1; min-width: 0; margin: 0 8px 0 12px; font-size: 11px; }
.demo-signin { margin-bottom: 30px; }
.demo-signin h2 { margin: 0 16px 8px; font-size: 13px; font-weight: 600; color: var(--secondary); }
.demo-signin .list-row .main-col span { font-size: 14px; }
