:root {
    --bg: #0f1410;
    --card: #1a221c;
    --ink: #f4f1e8;
    --muted: #b7c0b4;
    --accent: #d4a017;
    --pay: #0d7a3f;
    --danger: #c44536;
    --line: #2c382f;
    font-family: "Segoe UI", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    min-height: 100%;
}

body {
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: var(--accent); }

.shell {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.25rem;
}

.hero { padding: 2.5rem 0; }
.hero h1 { font-size: 2.1rem; line-height: 1.15; margin: 0.4rem 0 1rem; }
.lede { color: var(--muted); font-size: 1.1rem; }
.eyebrow { letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.72rem; color: var(--accent); margin: 0; }
.hero-links { display: flex; gap: 1rem; margin-top: 1.5rem; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.1rem 1.2rem;
    margin: 0.9rem 0;
}

.card h2 { margin: 0 0 0.8rem; font-size: 1rem; }

.items { list-style: none; padding: 0; margin: 0; }
.items li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.items label { display: flex; gap: 0.5rem; align-items: center; }
.items label.item-pick { cursor: pointer; flex: 1; }
.items .item-pick { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.qty-row { display: flex; align-items: center; gap: 0.5rem; }
.qty-btn { width: 2rem; height: 2rem; border: 1px solid var(--line); background: var(--surface, #fff); border-radius: 0.35rem; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-val { min-width: 3.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.items input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); flex-shrink: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.pill, .btn, .shift {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    font: inherit;
    cursor: pointer;
}
.pill.active, .shift.on { background: var(--accent); color: #1a1400; border-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.8rem 0; color: var(--muted); }
.field input {
    background: #101610;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    font: inherit;
}

.btn-primary, .btn-pay {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    margin: 0.45rem 0;
    padding: 0.95rem;
    border-radius: 16px;
    font-weight: 700;
}
.btn-primary { background: var(--accent); color: #1a1400; border: 0; }
.btn-pay.apple, .btn-pay.google { background: #fff; color: #111; border: 0; }
.btn-ghost { width: 100%; background: transparent; }

.tip { border-color: #3d5a2f; }
.tip-note, .fine { color: var(--muted); font-size: 0.88rem; }
.remaining { font-size: 1.2rem; }
.checkout-pay { position: sticky; bottom: 0.5rem; background: var(--bg); padding: 0.6rem 0 1rem; }

.green-screen {
    min-height: 100dvh;
    margin: -1.25rem;
    padding: 2.5rem 1.4rem;
    background: #0a7a3a;
    color: #f4fff4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.green-screen h1 { font-size: 4.2rem; margin: 0.2rem 0; }
.green-screen .paid { font-size: 2.6rem; font-weight: 800; margin: 0.3rem 0; }
.green-screen .watermark {
    position: absolute;
    inset: 0;
    font-size: 1.1rem;
    opacity: 0.18;
    animation: drift 7s linear infinite;
    pointer-events: none;
    mix-blend-mode: overlay;
    white-space: nowrap;
}
@keyframes drift {
    from { transform: translate3d(-10%, 40%, 0) rotate(-18deg); }
    to { transform: translate3d(40%, -10%, 0) rotate(-18deg); }
}

.waiter-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 0.6rem; }
.table-tile {
    aspect-ratio: 1;
    border-radius: 16px;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #151c17;
}
.table-tile.open { background: #5a3d12; }
.table-tile.partial { background: #3d4a16; }
.table-tile.paid { background: #0d5a30; }
.pos-badge { display: inline-block; padding: 0.35rem 0.7rem; border-radius: 999px; margin: 0.8rem 0; font-size: 0.85rem; }
.pos-badge.online { background: #0d5a30; }
.pos-badge.retrying { background: #5a3d12; }
.pos-badge.offline { background: var(--danger); }

.device-list { list-style: none; padding: 0; }
.device-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.center { text-align: center; }
.error { color: #ffb4ab; }

.table-map {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto auto;
    gap: 0.45rem;
    align-items: center;
    margin: 0.6rem 0;
}
.table-map input, .table-map select {
    background: #101610;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    font: inherit;
    min-width: 0;
}
.app-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--line);
}
.app-nav a { text-decoration: none; }
.app-cards { display: grid; gap: 0.8rem; }
@media (min-width: 800px) {
    .app-cards { grid-template-columns: repeat(3, 1fr); }
    .shell { max-width: 960px; }
}
.pos-badge.pending, .pos-badge.inflight, .pos-badge.retrying { background: #5a3d12; }
.pos-badge.synced { background: #0d5a30; }
.pos-badge.failed, .pos-badge.offlinealerted { background: var(--danger); }
.pos-badge.manuallyresolved { background: #2c382f; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.8rem;
    background: #7a1f1f;
}
