/* WOW Kontrol - iOS-inspired design system. No external assets (CSP self-only). */
:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --card-2: #fafaf8;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, .12);
  --fill: rgba(118, 118, 128, .10);
  --accent: #f5b400;          /* WOW DÖNER yellow */
  --accent-press: #dfa300;
  --accent-ink: #8a5c00;      /* yellow-family text on light surfaces */
  --accent-soft: #fff4d4;
  --on-accent: #1c1c1e;
  --side: #ffffff;
  --ok: #248a3d;
  --ok-fill: #34c759;
  --ok-bg: rgba(52, 199, 89, .12);
  --bad: #d70015;
  --bad-fill: #ff3b30;
  --bad-bg: rgba(255, 59, 48, .10);
  --warn: #b25000;
  --warn-fill: #ff9500;
  --warn-bg: rgba(255, 149, 0, .13);
  --info: #0058d0;
  --info-bg: rgba(0, 122, 255, .10);
  --bar: rgba(242, 242, 247, .82);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --text: #f2f2f7;
    --muted: #98989f;
    --line: rgba(84, 84, 88, .55);
    --fill: rgba(118, 118, 128, .24);
    --accent: #ffc21a;
    --accent-press: #e6ab00;
    --accent-ink: #ffcf4d;
    --accent-soft: rgba(255, 194, 26, .14);
    --on-accent: #1c1c1e;
    --side: #111113;
    --ok: #30d158;
    --ok-fill: #30d158;
    --ok-bg: rgba(48, 209, 88, .16);
    --bad: #ff6961;
    --bad-fill: #ff453a;
    --bad-bg: rgba(255, 69, 58, .16);
    --warn: #ffb340;
    --warn-fill: #ff9f0a;
    --warn-bg: rgba(255, 159, 10, .16);
    --info: #64a8ff;
    --info-bg: rgba(10, 132, 255, .18);
    --bar: rgba(22, 22, 24, .78);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.41 var(--font); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 700 2rem/1.15 var(--font-display); letter-spacing: -.025em; margin: .3rem 0 .9rem; }
h2 { font: 600 1.15rem/1.3 var(--font-display); letter-spacing: -.015em; margin: 0 0 .7rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
main { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(32px + env(safe-area-inset-bottom)); }
.eyebrow { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 0; }

/* ---- app shell: sidebar (desktop), top bar + tab bar (phone) ------------ */
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; height: 26px; width: auto; }
@media (prefers-color-scheme: dark) {
  .logo img { background: #fff; padding: 5px 9px; border-radius: 9px; box-sizing: content-box; }
}
.strong-bad { color: var(--bad); font-weight: 700; }
.depot-card { padding: 16px 18px; }
.depot-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.depot-head h2 { margin: 2px 0 0; }
.ico { flex: none; }

.side { display: none; }
.mtop {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--line);
}
.mtop .logo img { height: 24px; }
.mtop.solo { justify-content: center; }
.mtop button.link { color: var(--muted); font-size: .92rem; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; color: var(--muted); font-size: .68rem; font-weight: 500; }
.tabbar a:hover { text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a[aria-current="page"] .ico { color: var(--accent); stroke-width: 2.1; }
body.has-nav main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
@media (max-width: 899px) {
  body.has-nav .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.has-nav .savebar { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

@media (min-width: 900px) {
  .mtop, .tabbar { display: none; }
  body.no-nav .mtop { display: flex; background: transparent; border: 0; padding-top: 40px; }
  body.has-nav { padding-left: 264px; }
  body.has-nav main { padding: 36px 40px 48px; max-width: 980px; margin: 0; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 264px; display: flex; flex-direction: column;
    padding: 30px 18px 22px; background: var(--side); border-right: .5px solid var(--line);
  }
  .side .logo { padding: 0 12px 34px; }
  .side .logo img { height: auto; width: 200px; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-nav a, .side-logout {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 0 14px;
    border-radius: 14px; color: var(--text); font: 500 1rem var(--font); background: none; justify-content: flex-start;
  }
  .side-nav a .ico, .side-logout .ico { color: var(--muted); }
  .side-nav a:hover, .side-logout:hover { background: var(--fill); text-decoration: none; }
  .side-nav a[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
  .side-nav a[aria-current="page"] .ico { color: var(--accent); }
  .side-label { margin: 18px 14px 6px; font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
  .side-bottom { margin-top: auto; padding-top: 14px; border-top: .5px solid var(--line); }
  .side-logout:active { transform: none; }
  .side-logout .muted { font-size: .85rem; }
}

.crumbs { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:last-child { color: var(--text); font-weight: 500; }

/* ---- home: supplier cards ---------------------------------------------- */
h1.display { font-size: 2.6rem; letter-spacing: -.035em; margin: .2rem 0 .3rem; }
.lead { color: var(--muted); font-size: 1.15rem; margin-bottom: 28px; }
.supplier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.supplier {
  display: flex; flex-direction: column; gap: 10px; padding: 26px 24px 22px; min-height: 250px;
  background: var(--card); border-radius: 26px; color: var(--text); box-shadow: var(--shadow);
  border: .5px solid var(--line); transition: transform .15s ease, box-shadow .15s ease;
}
.supplier:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, .07); }
.supplier:active { transform: scale(.985); }
.tile { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--fill); color: var(--muted); margin-bottom: 8px; }
.tile .ico { width: 34px; height: 34px; stroke-width: 1.5; }
.supplier.active .tile, .tile-meat { background: var(--accent-soft); color: var(--accent); }
.s-name { font: 700 1.5rem/1.2 var(--font-display); letter-spacing: -.02em; }
.s-desc { color: var(--muted); font-size: .98rem; line-height: 1.45; }
.s-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; }
.s-stat { font-size: .85rem; color: var(--muted); }
.s-stat b { color: var(--accent-ink); font-weight: 600; }
.go { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.supplier:not(.active) .go { background: var(--fill); color: var(--muted); }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state .tile { margin: 0 auto 14px; }
.list-links { padding: 4px 0; }
.list-links a { display: flex; align-items: center; gap: 14px; padding: 14px 18px; color: var(--text); }
.list-links a + a { border-top: .5px solid var(--line); }
.list-links a span { flex: 1; font-weight: 500; }
.list-links a .ico { color: var(--muted); }
.list-links a:hover { text-decoration: none; background: var(--card-2); }

@media (max-width: 560px) {
  h1.display { font-size: 2rem; }
  .supplier { min-height: 0; padding: 20px; border-radius: 22px; }
}

/* Home: suppliers centred and larger on wide screens */
.home-wrap { width: 100%; }
@media (min-width: 900px) {
  body.has-nav main:has(.home-wrap) { max-width: none; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 56px; }
  .home-wrap { max-width: 1180px; text-align: center; margin-top: -4vh; }
  .home-wrap .lead { margin-bottom: 44px; font-size: 1.25rem; }
  .home-wrap h1.display { font-size: 3.2rem; }
  body.has-nav main:has(.home-wrap) { padding: 40px 32px; }
  .home-wrap .supplier-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
  .home-wrap .supplier { flex: 1 1 220px; max-width: 380px; text-align: left; min-height: 340px; padding: 34px 30px 28px; border-radius: 30px; gap: 12px; }
  .home-wrap .tile { width: 84px; height: 84px; border-radius: 24px; }
  .home-wrap .tile .ico { width: 44px; height: 44px; }
  .home-wrap .s-name { font-size: 1.9rem; }
  .home-wrap .s-desc { font-size: 1.08rem; }
  .home-wrap .s-stat { font-size: .95rem; }
  .home-wrap .go { width: 52px; height: 52px; }
}
@media (min-width: 1500px) {
  .home-wrap { max-width: 1440px; }
  .home-wrap h1.display { font-size: 3.8rem; }
  .home-wrap .lead { font-size: 1.4rem; margin-bottom: 56px; }
  .home-wrap .supplier-grid { gap: 32px; }
  .home-wrap .supplier { max-width: 450px; min-height: 400px; padding: 40px 38px 34px; border-radius: 34px; }
  .home-wrap .tile { width: 100px; height: 100px; border-radius: 28px; margin-bottom: 14px; }
  .home-wrap .tile .ico { width: 52px; height: 52px; }
  .home-wrap .s-name { font-size: 2.2rem; }
  .home-wrap .s-desc { font-size: 1.18rem; }
  .home-wrap .s-stat { font-size: 1.02rem; }
  .home-wrap .go { width: 60px; height: 60px; }
  .home-wrap .go .ico { width: 26px; height: 26px; }
}

/* ---- surfaces --------------------------------------------------------- */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); overflow-x: auto; }
.card.narrow { max-width: 400px; margin: 7vh auto 0; padding: 26px 22px; }
.card.narrow h1 { text-align: center; }
.hint, .muted { color: var(--muted); font-size: .9rem; }
.hint { margin: -.3rem 0 1rem; }

/* ---- forms ------------------------------------------------------------ */
label { display: block; margin-bottom: 14px; font-size: .85rem; font-weight: 500; color: var(--muted); }
input, select, textarea {
  width: 100%; font: 17px var(--font); color: var(--text);
  padding: 12px 14px; border: 0; border-radius: var(--radius-sm);
  background: var(--fill); margin-top: 6px; outline: none;
  transition: box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus { background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 0 0 1px var(--accent); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.5; }
input[type="file"] { padding: 10px; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 1rem var(--font); letter-spacing: -.01em;
  padding: 11px 18px; min-height: 44px; border-radius: 12px; border: 0;
  background: var(--fill); color: var(--text); cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease, opacity .15s ease;
  user-select: none; -webkit-user-select: none;
}
button:hover, .button:hover { text-decoration: none; }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.primary, .button.primary { background: var(--accent); color: var(--on-accent); }
button.primary:active, .button.primary:active { background: var(--accent-press); }
button.small { padding: 6px 12px; min-height: 34px; font-size: .88rem; border-radius: 9px; }
button.link { background: none; padding: 0; min-height: 0; font-weight: 500; }
button.link:active { transform: none; opacity: .6; }
.wide { width: 100%; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input, form.inline select { width: auto; margin: 0; padding-top: 8px; padding-bottom: 8px; font-size: .92rem; }
form.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
form.row input { margin: 0; }
input.short { width: 76px; flex: none; text-align: center; }
.grid { display: grid; gap: 4px 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .95rem; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }

/* ---- tables ----------------------------------------------------------- */
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { padding: 11px 8px; border-bottom: .5px solid var(--line); text-align: left; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- badges ----------------------------------------------------------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--info-bg); color: var(--info); white-space: nowrap; }
.badge.open { background: var(--warn-bg); color: var(--warn); }
.badge.in_progress { background: var(--info-bg); color: var(--info); }
.badge.checked { background: var(--ok-bg); color: var(--ok); }
.badge.problem { background: var(--bad-bg); color: var(--bad); }
.badge.deposit_only { background: var(--fill); color: var(--muted); }

/* ---- delivery lists (inset grouped) ----------------------------------- */
ul.deliveries { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
ul.deliveries li + li a { border-top: .5px solid var(--line); }
ul.deliveries li a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; color: var(--text); }
ul.deliveries li a:hover { text-decoration: none; background: var(--card-2); }
ul.deliveries li a::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); opacity: .5; flex: none; }
ul.deliveries .date { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; min-width: 82px; }
ul.deliveries .li { font-weight: 600; flex: 1; }
ul.deliveries.compact { box-shadow: none; background: var(--card-2); margin-bottom: 4px; }
ul.deliveries.compact li a { padding: 11px 14px; }

/* ---- invoice facts (RechnungsNr / Rechnungsdatum / Lieferdatum) -------- */
dl.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 16px; }
dl.facts > div { min-width: 0; }
dl.facts dt { font-size: .78rem; font-weight: 500; color: var(--muted); }
dl.facts dd { margin: 2px 0 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
dl.facts dd.strong { font-weight: 700; }
dl.facts .total { margin-left: auto; text-align: right; }
dl.facts.card { padding: 14px 18px; }
.invoice-group { margin-bottom: 26px; }
.invoice-head { padding: 0 4px 10px; }
.invoice-head dl.facts { margin: 0; }
ul.deliveries .when { display: flex; flex-direction: column; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; min-width: 92px; line-height: 1.2; }
ul.deliveries .when .lbl { font-size: .72rem; font-weight: 500; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .6rem; }
dl.facts .act { display: flex; align-items: flex-end; }
dl.facts .act.push { margin-left: auto; }
.button.check { background: var(--text); color: var(--bg); min-height: 38px; padding: 8px 16px; font-size: .92rem; }
.mt { margin-top: 12px; }
.inv-list { display: flex; flex-direction: column; gap: 12px; }
.inv-row { display: flex; align-items: center; gap: 16px; padding: 16px 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: .5px solid var(--line); }
.inv-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; color: var(--text); }
.inv-main:hover { text-decoration: none; }
.inv-main dl.facts { flex: 1; margin: 0; }
.inv-main dl.facts .total { margin-left: auto; text-align: right; }
.danger-zone { margin-top: 28px; padding-top: 18px; border-top: .5px solid var(--line); }
button.danger { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 640px) {
  .inv-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .inv-main { flex-direction: column; align-items: flex-start; gap: 10px; }
  .inv-main dl.facts .total { margin-left: 0; text-align: left; }
  .inv-row .button.check { width: 100%; min-height: 46px; }
}

/* ---- mark check (paper invoice photo) ---------------------------------- */
ol.steps { margin: 0 0 16px; padding-left: 1.2rem; color: var(--muted); font-size: .95rem; }
ol.steps li { margin-bottom: 4px; }
label.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; margin-bottom: 14px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card-2); text-align: center; cursor: pointer; color: var(--text); }
label.drop .drop-title { font-weight: 600; font-size: 1.05rem; }
label.drop input { margin-top: 10px; background: transparent; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 5px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.minus { background: var(--bad-bg); color: var(--bad); }
.chip.unclear { background: var(--warn-bg); color: var(--warn); }
.marklist { padding: 0; overflow: hidden; }
.marklist .li-head { padding: 14px 16px 8px; margin: 0; display: flex; justify-content: space-between; align-items: baseline; }
.small-link { font: 500 .9rem var(--font); }
.mrow { position: relative; display: grid; grid-template-columns: 34px 1fr auto auto; grid-template-areas: "pos info qty seg" "pos came came came"; gap: 4px 12px; align-items: center; padding: 11px 16px 11px 18px; border-top: .5px solid var(--line); }
.mrow::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; }
.mrow .pos { grid-area: pos; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.mrow .info { grid-area: info; min-width: 0; }
.mrow .name { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.mrow .sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.mrow .qty { grid-area: qty; font: 700 1.25rem var(--font-display); font-variant-numeric: tabular-nums; }
.mrow .seg { grid-area: seg; display: inline-flex; background: var(--fill); border-radius: 11px; padding: 3px; gap: 3px; }
.mrow .seg label { margin: 0; }
.mrow .seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mrow .seg span { display: grid; place-items: center; min-width: 52px; min-height: 40px; border-radius: 9px; font-weight: 700; color: var(--text); cursor: pointer; font-size: 1rem; }
.mrow .seg input:focus-visible + span { box-shadow: 0 0 0 2px var(--accent); }
.mrow .seg input[value="ok"]:checked + span { background: var(--ok-fill); color: #fff; }
.mrow .seg input[value="minus"]:checked + span { background: var(--bad-fill); color: #fff; }
.mrow .came { grid-area: came; display: none; margin: 6px 0 0; max-width: 260px; }
.mrow[data-choice="minus"] .came { display: block; }
.mrow[data-choice="ok"]::before { background: var(--ok-fill); }
.mrow[data-choice="minus"]::before { background: var(--bad-fill); }
.mrow[data-choice=""][data-mark]:not([data-mark=""])::before { background: var(--warn-fill); }
.mrow[data-choice=""][data-mark]:not([data-mark=""]) { background: color-mix(in srgb, var(--warn-fill) 7%, transparent); }
b.read.ok { color: var(--ok); } b.read.minus { color: var(--bad); } b.read.none, b.read.unclear { color: var(--warn); }
.savebar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); }
.savebar { display: flex; flex-direction: column; gap: 8px; }
.savebar .primary { min-height: 52px; font-size: 1.05rem; }
.savebar .all-rest { background: var(--ok-bg); color: var(--ok); }
form[aria-busy="true"] button { opacity: .6; pointer-events: none; }

@media (max-width: 560px) {
  .mrow { grid-template-columns: 28px 1fr auto; grid-template-areas: "pos info qty" "pos seg seg" "pos came came"; }
  .mrow .seg { margin-top: 6px; }
  .mrow .seg label { flex: 1; }
  .mrow .came { max-width: none; }
}

/* ---- check screen ----------------------------------------------------- */
#check .head { display: flex; gap: 10px; align-items: flex-end; justify-content: space-between; margin-bottom: .4rem; }
#check .head h1 { margin-bottom: .2rem; }
#check .head .badge { margin-bottom: .9rem; }

details.group { background: var(--card); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden; }
details.group summary { list-style: none; cursor: pointer; padding: 15px 16px; display: flex; align-items: center; gap: 10px; font: 600 1.05rem var(--font-display); letter-spacing: -.015em; }
details.group summary::-webkit-details-marker { display: none; }
details.group summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s ease; opacity: .6; margin-left: 4px; }
details.group[open] summary::after { transform: rotate(45deg); }
details.group summary .gname { flex: 1; }
.count { color: var(--muted); font-weight: 500; font-size: .9rem; font-variant-numeric: tabular-nums; background: var(--fill); padding: 2px 9px; border-radius: 999px; }
.items { padding: 0 0 12px; }

.item {
  position: relative; display: grid; grid-template-columns: 1fr auto auto;
  grid-template-areas: "info qty actions" "panel panel panel";
  gap: 4px 12px; align-items: center;
  padding: 12px 16px 12px 20px; border-top: .5px solid var(--line);
  transition: background .2s ease;
}
.item::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; transition: background .2s ease; }
.item .info { grid-area: info; min-width: 0; }
.item .name { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; line-height: 1.3; }
.item .sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.item .meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.item .meta:empty { display: none; }
.item .qty { grid-area: qty; font: 700 1.35rem var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; min-width: 2.2ch; text-align: right; }
.item .actions { grid-area: actions; display: flex; gap: 8px; }
.item .actions button { min-width: 58px; min-height: 46px; padding: 0 12px; font-size: 1.05rem; font-weight: 700; border-radius: 12px; background: var(--fill); color: var(--text); }
.item .actions button.minus { font-size: 1.5rem; font-weight: 500; }
.item .panel { grid-area: panel; display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: end; margin-top: 10px; padding: 12px; background: var(--card-2); border-radius: 12px; }
.item .panel label { margin: 0; }
.item .panel input { background: var(--card); }
.item .panel[hidden] { display: none; }
.item.saving { opacity: .5; pointer-events: none; }

.item[data-status="ok"]::before { background: var(--ok-fill); }
.item[data-status="missing"]::before { background: var(--bad-fill); }
.item[data-status="qty_diff"]::before { background: var(--warn-fill); }
.item[data-status="missing"], .item[data-status="qty_diff"] { background: color-mix(in srgb, var(--bad-fill) 5%, transparent); }
.item[data-status="qty_diff"] { background: color-mix(in srgb, var(--warn-fill) 6%, transparent); }
.item[data-status="ok"] button.ok { background: var(--ok-fill); color: #fff; }
.item[data-status="missing"] button.minus { background: var(--bad-fill); color: #fff; }
.item[data-status="qty_diff"] button.minus { background: var(--warn-fill); color: #fff; }
.item.editing button.minus { box-shadow: inset 0 0 0 2px var(--bad-fill); }
.item[data-status="missing"] .meta, .item[data-status="qty_diff"] .meta { color: var(--text); }

button.all-ok { display: flex; width: calc(100% - 32px); margin: 10px 16px 0; font-size: .95rem; color: var(--ok); background: var(--ok-bg); }
.footer-actions { margin: 22px 0 40px; }
.footer-actions .button { min-height: 52px; font-size: 1.05rem; border-radius: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); background: rgba(28, 28, 30, .92); color: #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 12px 18px; border-radius: 14px; text-align: center; font-size: .95rem; font-weight: 500; z-index: 30;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.toast[hidden] { display: none; }

.sum { float: right; color: var(--bad); font-variant-numeric: tabular-nums; }
.alert-price_changed .sum { color: var(--warn); }

@media (max-width: 560px) {
  h1 { font-size: 1.75rem; }
  .item { grid-template-columns: 1fr auto; grid-template-areas: "info qty" "actions actions" "panel panel"; }
  .item .actions { margin-top: 8px; }
  .item .actions button { flex: 1; }
  .item .panel { grid-template-columns: 1fr; }
  table.list { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media print {
  .side, .mtop, .tabbar, .crumbs, .no-print, .toast { display: none !important; }
  body { background: #fff; color: #000; padding: 0 !important; }
  .card { box-shadow: none; padding: 0; }
}
