:root {
    --bg: #f6f6f4;
    --panel: #ffffff;
    --line: #e2e2de;
    --ink: #1b1d21;
    --muted: #63666c;
    --accent: #c8372d;
    --accent-dark: #a32a22;
    --accent-soft: #fbe9e7;
    --ok: #1d6b4f;
    --street: #ffffff;
    --block: #d9dbd6;
    --river: #a9cfe0;
    --park: #b9d8a6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1rem; margin: 0 0 .6rem; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
input { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-width: 0; }
label { font-size: .9rem; font-weight: 600; display: block; margin: .8rem 0 .3rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.muted { color: var(--muted); }
.problem { color: var(--accent-dark); background: var(--accent-soft); padding: .5rem .7rem; border-radius: 8px; font-size: .9rem; }

.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); gap: .2rem; }
.boot strong { font-size: 1.6rem; color: var(--ink); }

.top {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem;
    padding: .8rem clamp(16px, 4vw, 40px); padding-top: calc(.8rem + env(safe-area-inset-top, 0px));
    background: var(--accent); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.25rem; display: flex; align-items: baseline; gap: .4rem; }
.brand span { font-weight: 400; font-size: .85rem; opacity: .85; }
.top nav { display: flex; gap: .25rem; }
.top nav a { color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: 999px; font-size: .92rem; opacity: .9; }
.top nav a.active { background: rgba(255,255,255,.2); opacity: 1; }
.banner { padding: .6rem clamp(16px, 4vw, 40px); background: #fff3d6; font-size: .9rem; }
.page { max-width: 1120px; margin: 0 auto; padding: 1.5rem clamp(16px, 4vw, 40px) 3rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px calc(1.5rem + env(safe-area-inset-bottom, 0px)); }

.btn { display: inline-flex; justify-content: center; align-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: .6rem 1rem; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.primary:disabled { background: #d7a5a1; border-color: #d7a5a1; cursor: default; }
.btn.ghost { color: var(--muted); }
.btn.wide { width: 100%; margin-top: 1rem; }
.link { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
.link.danger { color: var(--accent-dark); margin-top: .75rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; }
.pagehead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.pagehead h1 { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--muted); margin: 0 0 .25rem; }
.toast { background: var(--accent-soft); border: 1px solid #f2c4bf; padding: .6rem .9rem; border-radius: 10px; margin-bottom: 1rem; }

.hero { max-width: 640px; margin: 1rem 0 1.5rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.role { display: grid; gap: .3rem; padding: 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.role:hover { border-color: var(--accent); }
.role strong { font-size: 1.1rem; color: var(--accent); }
.role span { color: var(--muted); font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: .35rem .9rem; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.shop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .shop { grid-template-columns: minmax(0, 1fr); } }
.menu h2 { margin-top: 1.2rem; }
.item { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.item p { margin: .15rem 0 .3rem; color: var(--muted); font-size: .88rem; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.qty { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.qty span { min-width: 1.2rem; text-align: center; font-weight: 700; }
.round { width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 1.2rem; cursor: pointer; }
.round.add { background: var(--accent); border-color: var(--accent); color: #fff; }
.checkout { position: sticky; top: 1rem; }
.lines { list-style: none; margin: 0 0 .5rem; padding: 0; font-size: .92rem; }
.lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; font-variant-numeric: tabular-nums; }
.lines .sub { color: var(--muted); border-top: 1px dashed var(--line); margin-top: .3rem; padding-top: .4rem; }
.lines .total { font-weight: 800; font-size: 1.05rem; }
.lines.small { font-size: .85rem; }
.pay { border: 0; padding: 0; margin: .8rem 0 0; }
.pay legend { font-size: .9rem; font-weight: 600; margin-bottom: .3rem; }
.radio { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .3rem 0; }
.radio input { width: auto; }

.map { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--street); border: 1px solid var(--line); }
.map .ground { fill: var(--street); }
.map .block { fill: var(--block); }
.map .river { fill: var(--river); }
.map .park { fill: var(--park); }
.map .street { fill: transparent; }
.map.selectable rect:not(.ground) { cursor: pointer; }
.map.selectable rect.street:hover, .map.selectable rect.block:hover { fill: var(--accent-soft); }
.map .route { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 7; }
.map .store circle { fill: var(--ink); }
.map .pin circle { fill: var(--accent); }
.map text { fill: #fff; font-size: 12px; font-weight: 800; pointer-events: none; }
.map .courier circle { fill: #fff; stroke: var(--accent); stroke-width: 5; }

.track .trackhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.eta { font-size: 1.1rem; margin: .2rem 0 0; }
.steps { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .4rem; counter-reset: s; }
.steps li { border-top: 4px solid var(--line); padding-top: .4rem; font-size: .8rem; color: var(--muted); display: grid; }
.steps li.done { border-color: var(--accent); color: var(--ink); }
.steps li.now span { font-weight: 800; }
.trackgrid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .trackgrid { grid-template-columns: minmax(0, 1fr); } }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; align-items: start; }
@media (max-width: 980px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .board { grid-template-columns: minmax(0, 1fr); } }
.col { background: #ecece8; border-radius: 12px; padding: .8rem; display: grid; gap: .6rem; }
.count { color: var(--muted); font-weight: 400; }
.order { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .75rem; display: grid; gap: .3rem; }
.order.new { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.order header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.order p { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.reason { display: grid; gap: .4rem; margin-top: .4rem; }
.reason label { margin: 0; }
.runs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: .9rem; }
.gate { max-width: 420px; }
.bar { height: 8px; background: #ecece8; border-radius: 999px; overflow: hidden; margin-top: .6rem; }
.fill { height: 100%; background: var(--accent); }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: .6rem 1rem; background: #fff3d6; z-index: 1000; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.cartbar { display: none; }
@media (max-width: 860px) {
    .cartbar {
        display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--accent); color: #fff; text-decoration: none; padding: .85rem 1.1rem; border-radius: 12px;
        box-shadow: 0 6px 20px rgba(27, 29, 33, .25); font-weight: 600; z-index: 10;
    }
    .shop { padding-bottom: 4.5rem; }
}
