/* ══ CSS VARIABLES ═══════════════════════════════════════════════════════════ */
:root {
    --page-bg:    #f1f5f9;
    --surface:    #ffffff;
    --hdr-bg:     #0f172a;
    --pulse-bg:   #0f172a;
    --today-bg:   #ffffff;
    --text-1:     #0f172a;
    --text-2:     #64748b;
    --text-3:     #94a3b8;
    --border:     #e2e8f0;
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);

    /* Status colours */
    --c-free:     #059669;  --c-free-bg:    #d1fae5;
    --c-running:  #d97706;  --c-running-bg: #fef3c7;
    --c-billed:   #dc2626;  --c-billed-bg:  #fee2e2;
    --c-ready:    #7c3aed;  --c-ready-bg:   #ede9fe;
    --c-call:     #f97316;  --c-call-bg:    #ffedd5;

    /* Order status */
    --c-pending:  #6b7280;
    --c-cooking:  #f59e0b;
    --c-allready: #10b981;

    /* Chart */
    --bar-fill:     #2563eb;
    --split-table:  #3b82f6;
    --split-room:   #f97316;
}

[data-theme="dark"] {
    --page-bg:    #0f172a;
    --surface:    #1e293b;
    --today-bg:   #1e293b;
    --text-1:     #e2e8f0;
    --text-2:     #94a3b8;
    --text-3:     #64748b;
    --border:     #334155;
    --shadow:     0 1px 3px rgba(0,0,0,.3);

    --c-free-bg:    #064e3b;
    --c-running-bg: #78350f;
    --c-billed-bg:  #7f1d1d;
    --c-ready-bg:   #4c1d95;
    --c-call-bg:    #7c2d12;

    --bar-fill:  #3b82f6;
}

/* ══ RESET ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: var(--page-bg);
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
table { border-collapse: collapse; }

/* ══ LAYOUT ROOT ═════════════════════════════════════════════════════════════ */
.dash-root {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 32px;
}

/* ══ HEADER ══════════════════════════════════════════════════════════════════ */
.header {
    background: var(--hdr-bg);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    height: 62px;
    position: sticky; top: 0; z-index: 100;
    flex-shrink: 0;
}

.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #f97316, #ef4444);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.header-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.header-sub   { font-size: 11px; color: #64748b; }

.header-status { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-left: 8px; }

.conn-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.conn-pill.live { background: #14532d; color: #4ade80; }
.conn-pill.off  { background: #7f1d1d; color: #fca5a5; }
.conn-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.35} }
.conn-pill.off .conn-dot { animation: none; }

.sync-info   { font-size: 10px; color: #475569; padding-left: 2px; }
.sync-label  { font-variant-numeric: tabular-nums; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-clock { font-size: 12px; color: #94a3b8; font-variant-numeric: tabular-nums; white-space: nowrap; }

.hbtn {
    padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
    color: #94a3b8; background: #1e293b;
    border: 1px solid #334155;
    transition: background .15s, color .15s;
}
.hbtn:hover { background: #334155; color: #e2e8f0; }
.hbtn-green {
    background: #15803d; color: #fff; border-color: #15803d;
}
.hbtn-green:hover { background: #166534; }

/* ══ METRIC CARDS ════════════════════════════════════════════════════════════ */
.metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 0 12px;
}
@media (max-width: 900px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .metrics { grid-template-columns: repeat(2, 1fr); } }

.metric-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.metric-accent {
    height: 4px;
    background: var(--accent);
}
.metric-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px 14px;
}
.metric-icon {
    font-size: 22px;
    line-height: 1;
    padding-top: 2px;
    opacity: .85;
    color: var(--accent);
}
.metric-label {
    font-size: 10px; font-weight: 700; color: var(--text-2);
    text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px;
}
.metric-value { font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--text-1); }
.metric-sub   { font-size: 11px; color: var(--text-2); margin-top: 3px; }

/* ══ KITCHEN PULSE STRIP ═════════════════════════════════════════════════════ */
.pulse-strip {
    background: var(--pulse-bg);
    padding: 0 20px;
    height: 50px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}
.pulse-label {
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    color: #475569; white-space: nowrap;
}
.pulse-num {
    font-size: 26px; font-weight: 800; color: #fff;
    line-height: 1; font-variant-numeric: tabular-nums;
}
.pulse-unit { font-size: 11px; color: #64748b; margin-left: -10px; }
.pulse-stat { font-size: 12px; font-weight: 700; white-space: nowrap; }
.pending-col { color: #60a5fa; }
.cooking-col { color: #fbbf24; }
.ready-col   { color: #34d399; }
.pulse-spacer { flex: 1; }

/* ══ MAIN GRID ═══════════════════════════════════════════════════════════════ */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 10px;
    padding: 0 12px;
}
@media (max-width: 960px) { .main-grid { grid-template-columns: 1fr; } }

/* ══ PANELS ══════════════════════════════════════════════════════════════════ */
.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}
.panel-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text-1);
}
.panel-title-bar {
    display: inline-block;
    width: 3px; height: 16px; border-radius: 2px; flex-shrink: 0;
}

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
}
.badge.blue { background: #1e3a5f; color: #60a5fa; }

.occ-badge {
    font-size: 11px; font-weight: 700; color: var(--text-2);
    background: var(--page-bg); padding: 2px 10px; border-radius: 20px;
}

.no-data {
    padding: 40px; text-align: center; color: var(--text-2); font-size: 13px;
}

/* ══ ORDERS TABLE ════════════════════════════════════════════════════════════ */
.orders-wrap { overflow-x: auto; max-height: 480px; overflow-y: auto; }
.orders-tbl  { width: 100%; }
.orders-tbl::-webkit-scrollbar { width: 4px; height: 4px; }
.orders-tbl thead th {
    background: var(--page-bg);
    color: var(--text-2); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px;
    padding: 8px 12px; text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1;
}
.orders-tbl tbody td {
    padding: 11px 12px; font-size: 12.5px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.orders-tbl tbody tr:last-child td { border-bottom: none; }
.orders-tbl tbody tr:hover td { background: rgba(0,0,0,.025); }
.orders-tbl .num  { text-align: right; font-variant-numeric: tabular-nums; }
.orders-tbl .muted { color: var(--text-2); }
.orders-tbl .small { font-size: 11px; max-width: 180px; }
.orders-tbl .bold { font-weight: 700; }

/* Status dot */
.status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
}
.status-dot.pending   { background: var(--c-pending); }
.status-dot.cooking   { background: var(--c-cooking); }
.status-dot.all-ready { background: var(--c-allready); }

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 2px 9px; border-radius: 20px;
    font-size: 10px; font-weight: 700; white-space: nowrap;
}
.status-pill.pending   { background: #f1f5f9; color: #64748b; }
.status-pill.cooking   { background: #fef3c7; color: #92400e; }
.status-pill.all-ready { background: #d1fae5; color: #065f46; }
[data-theme="dark"] .status-pill.pending   { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .status-pill.cooking   { background: #78350f; color: #fde68a; }
[data-theme="dark"] .status-pill.all-ready { background: #064e3b; color: #6ee7b7; }

/* ══ TABLE GRID ══════════════════════════════════════════════════════════════ */
.section-sub-header {
    font-size: 10px; font-weight: 700; color: var(--text-2);
    text-transform: uppercase; letter-spacing: .6px;
    padding: 10px 16px 6px;
}
.rooms-header { padding-top: 14px; }

.table-grid {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 10px;
}
.table-card {
    width: 82px; height: 76px; border-radius: 10px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; cursor: default;
    transition: transform .15s;
    border: 1.5px solid transparent;
}
.table-card:hover { transform: scale(1.05); }
.tc-num    { font-size: 13px; font-weight: 800; }
.tc-status { font-size: 10px; font-weight: 600; opacity: .85; }
.tc-amt    { font-size: 9px; font-weight: 700; opacity: .8; }

/* Table card status colours */
.table-card.free    { background: var(--c-free-bg);    color: var(--c-free);    border-color: var(--c-free-bg); }
.table-card.running { background: var(--c-running-bg); color: var(--c-running); border-color: var(--c-running-bg); }
.table-card.billed  { background: var(--c-billed-bg);  color: var(--c-billed);  border-color: var(--c-billed-bg); }
.table-card.ready   { background: var(--c-ready-bg);   color: var(--c-ready);   border-color: var(--c-ready-bg); }
.table-card.call    { background: var(--c-call-bg);    color: var(--c-call);    border-color: var(--c-call-bg); }
.room-card          { border-radius: 8px; }

/* Legend */
.legend {
    display: flex; gap: 14px; padding: 10px 16px 14px; flex-wrap: wrap;
}
.leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); }
.leg-dot  { width: 10px; height: 10px; border-radius: 3px; }
.leg-dot.free    { background: var(--c-free); }
.leg-dot.running { background: var(--c-running); }
.leg-dot.billed  { background: var(--c-billed); }
.leg-dot.ready   { background: var(--c-ready); }

/* ══ ANALYTICS ROW ═══════════════════════════════════════════════════════════ */
.analytics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 12px;
}
@media (max-width: 900px) { .analytics-row { grid-template-columns: 1fr; } }

.analytics-card { padding-bottom: 16px; }
.analytics-card .panel-header { margin-bottom: 14px; }

/* Breakdown */
.breakdown-row {
    display: grid;
    grid-template-columns: 72px 72px auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 0 16px 10px;
}
.bd-count { font-size: 11px; color: var(--text-2); }
.bd-amt   { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-bar-track {
    height: 7px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.bd-bar { height: 100%; border-radius: 4px; transition: width .5s; }
.bd-bar.pending   { background: var(--c-pending); }
.bd-bar.cooking   { background: var(--c-cooking); }
.bd-bar.all-ready { background: var(--c-allready); }

/* Revenue split */
.split-bar-wrap { padding: 0 16px 14px; }
.split-bar {
    height: 20px; border-radius: 10px; overflow: hidden;
    display: flex; background: var(--border);
}
.split-fill { height: 100%; transition: width .5s; }
.split-fill.table { background: var(--split-table); }
.split-fill.room  { background: var(--split-room); }
.split-legend { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.split-item {
    display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.split-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.split-dot.table { background: var(--split-table); }
.split-dot.room  { background: var(--split-room); }
.split-item strong { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.split-pct { color: var(--text-2); font-size: 11px; }

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 7px; padding: 0 16px; }
.bar-row {
    display: grid;
    grid-template-columns: 48px 1fr 36px;
    align-items: center; gap: 8px;
}
.bar-label  { font-size: 11px; font-weight: 700; text-align: right; white-space: nowrap; }
.bar-track  {
    height: 24px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.bar-fill {
    height: 100%; background: var(--bar-fill);
    border-radius: 4px; min-width: 4px;
    display: flex; align-items: center; padding: 0 8px;
    transition: width .5s;
}
.bar-val   { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.bar-count { font-size: 10px; color: var(--text-2); }

/* ══ TODAY SUMMARY BAR ═══════════════════════════════════════════════════════ */
.today-bar {
    background: var(--today-bg);
    border-top: 1px solid var(--border);
    padding: 12px 20px 16px;
    margin: 0 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}
.today-label {
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    color: var(--text-3); text-transform: uppercase; display: block; margin-bottom: 12px;
}
.today-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.today-stat  { display: flex; flex-direction: column; gap: 2px; }
.ts-val { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.ts-lbl { font-size: 10px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* Value colours */
.ts-val.blue   { color: #2563eb; }
.ts-val.green  { color: #059669; }
.ts-val.red    { color: #dc2626; }
.ts-val.purple { color: #7c3aed; }
.ts-val.orange { color: #ea580c; }
.ts-val.cyan   { color: #0891b2; }
.ts-val.amber  { color: #d97706; }

/* ══ DISCONNECT BANNER ═══════════════════════════════════════════════════════ */
.disc-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #991b1b; color: #fecaca;
    text-align: center; font-size: 13px; font-weight: 700;
    padding: 10px; z-index: 200; letter-spacing: .3px;
}

/* ══ BLAZOR ERROR UI ═════════════════════════════════════════════════════════ */
#blazor-error-ui {
    display: none; background: #b91c1c; color: #fff;
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 10px 16px; font-size: 13px; z-index: 300;
}
#blazor-error-ui a { color: #fff; font-weight: bold; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ══ SCROLLBAR ═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ══ RESPONSIVE ══════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
    .pulse-strip { gap: 10px; }
    .header { padding: 0 12px; gap: 10px; }
    .today-stats { gap: 18px; }
    .main-grid, .analytics-row { padding: 0 8px; }
    .metrics { padding: 0 8px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   KITCHEN DISPLAY SYSTEM (KDS)  —  Phase 5
   ALL KDS styles are GLOBAL here. NO scoped *.razor.css. NO ::deep.
   Verified: class="ticket" in browser inspector must show these styles.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Pastel palette — 8 colors by kotId hash (identity only, NOT status) ──── */
.kds-paper-0 { --kp: #FFF6D6; --kp-text: #2a2a22; }
.kds-paper-1 { --kp: #FCE4EC; --kp-text: #2a2a22; }
.kds-paper-2 { --kp: #E1F0F7; --kp-text: #2a2a22; }
.kds-paper-3 { --kp: #E6F4E2; --kp-text: #2a2a22; }
.kds-paper-4 { --kp: #F3E8FB; --kp-text: #2a2a22; }
.kds-paper-5 { --kp: #FFE9D6; --kp-text: #2a2a22; }
.kds-paper-6 { --kp: #E0F2F1; --kp-text: #2a2a22; }
.kds-paper-7 { --kp: #F5F0E1; --kp-text: #2a2a22; }

/* dark-mode paper variants */
[data-theme="dark"] .kds-paper-0 { --kp: #403A20; --kp-text: #F0ECD8; }
[data-theme="dark"] .kds-paper-1 { --kp: #3D1A22; --kp-text: #F0D8DE; }
[data-theme="dark"] .kds-paper-2 { --kp: #1A2E3D; --kp-text: #D8E8F0; }
[data-theme="dark"] .kds-paper-3 { --kp: #1E321A; --kp-text: #D8EED4; }
[data-theme="dark"] .kds-paper-4 { --kp: #2C1E3A; --kp-text: #EDE0F8; }
[data-theme="dark"] .kds-paper-5 { --kp: #3D2610; --kp-text: #F0E2D2; }
[data-theme="dark"] .kds-paper-6 { --kp: #0F2B2A; --kp-text: #D0ECEA; }
[data-theme="dark"] .kds-paper-7 { --kp: #2C2818; --kp-text: #EDE8D4; }

/* ── KDS root page ─────────────────────────────────────────────────────────── */
.kds-root {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #1a1c1f;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.kds-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    height: 54px;
    background: #111315;
    color: #e8e6de;
    flex-shrink: 0;
    border-bottom: 1px solid #2a2c2f;
    z-index: 10;
}
.kds-topbar .brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.kds-topbar .station-name { font-size: 14px; color: #a0998a; margin-left: 4px; }
.kds-topbar .spacer { flex: 1; }
.kds-topbar .kpi { font-size: 13px; color: #b0a898; }
.kds-topbar .kpi strong { color: #e8e6de; font-size: 15px; }
.kds-topbar .est-wait { font-size: 13px; color: #b0a898; }
.kds-topbar .est-wait strong { color: #fbbf24; }

/* Connection pill */
.kds-conn {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 20px;
}
.kds-conn.live    { background: rgba(34,197,94,.15);  color: #4ade80; }
.kds-conn.off     { background: rgba(239,68,68,.15);  color: #f87171; }
.kds-conn.retry   { background: rgba(251,191,36,.15); color: #fbbf24; }
.kds-conn-dot     { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Top bar buttons */
.kds-hbtn {
    padding: 6px 14px; border: 1px solid #333;
    border-radius: 6px; background: #1e2023; color: #c8c4b8;
    font-size: 12px; cursor: pointer; transition: background .15s;
}
.kds-hbtn:hover { background: #2a2d31; }

/* ── Board (masonry columns) ───────────────────────────────────────────────── */
.kds-board {
    flex: 1;
    padding: 16px 18px;
    overflow-y: auto;
    /* CSS columns for masonry — tickets grow to content, no fixed height */
    columns: 280px;
    column-gap: 14px;
    column-fill: balance;
}

/* ── Ticket (sticky note) ──────────────────────────────────────────────────── */
.ticket {
    background: var(--kp);
    color: var(--kp-text);
    border-radius: 3px;
    box-shadow: 2px 5px 12px rgba(0,0,0,.18);
    /* break-inside:avoid keeps one ticket from splitting across columns */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

/* Slight per-ticket tilt — applied via inline style from code using (kotId % 5) */
/* Values: -1.5, -0.8, 0, 0.8, 1.5 degrees */

/* 4px status stripe at top */
.ticket-stripe {
    height: 4px;
    width: 100%;
    background: #EF9F27; /* pending default */
}
.ticket-stripe.cooking  { background: #EF9F27; }
.ticket-stripe.allready { background: #639922; }
.ticket-stripe.overdue  { background: #E24B4A; }

/* "Masking tape" bar */
.ticket-tape {
    position: absolute;
    top: -6px; left: 50%; transform: translateX(-50%);
    width: 52px; height: 22px;
    background: rgba(220, 200, 150, .45);
    border-radius: 2px;
    z-index: 2;
}

/* Header */
.ticket-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 14px 6px 14px;
}
.ticket-loc {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}
.ticket-sub {
    font-size: 11px;
    color: rgba(0,0,0,.45);
    margin-top: 2px;
}
.ticket-timer {
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #2a2a22;
    white-space: nowrap;
}
.ticket-timer.warn   { color: #d97706; }
.ticket-timer.danger { color: #dc2626; }

/* Items list */
.ticket-items {
    padding: 0 14px 10px 14px;
}
.ticket-item {
    padding: 8px 0;
    border-top: 1px dashed rgba(0,0,0,.12);
}
.ticket-item:first-child { border-top: none; }

.item-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}
.item-size {
    font-size: 13px;
    font-weight: 400;
    color: rgba(0,0,0,.55);
    margin-left: 4px;
}
.item-notes {
    font-size: 12px;
    color: #B5651D;
    margin-top: 3px;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.item-notes-icon { flex-shrink: 0; font-size: 11px; margin-top: 1px; }

/* Status button — full width, min 44px tap target */
.item-btn {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 7px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .08s;
    line-height: 1.2;
    padding: 8px 0;
}
.item-btn:active { transform: scale(.97); }

.item-btn.pending  { background: rgba(0,0,0,.06); color: #4a4840; }
.item-btn.cooking  { background: #F7D58A; color: #412402; }
.item-btn.ready    { background: #C7E29B; color: #173404; }
.item-btn.disabled { background: transparent; color: rgba(0,0,0,.3); cursor: default; }

/* Removed item row */
.item-removed {
    text-decoration: line-through;
    opacity: .4;
    font-size: 14px;
    padding: 10px 0 4px 0;
    display: flex; align-items: center; gap: 6px;
}
.item-removed-pill {
    font-size: 11px; font-weight: 600;
    background: rgba(0,0,0,.1); color: rgba(0,0,0,.5);
    padding: 2px 7px; border-radius: 10px;
}

/* All-ready banner inside ticket */
.ticket-allready {
    background: #C7E29B;
    color: #173404;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 0;
    margin: 4px 14px 14px 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.ticket-allready .countdown {
    font-size: 12px;
    opacity: .75;
    font-weight: 400;
}

/* ── Empty board ───────────────────────────────────────────────────────────── */
.kds-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 60%;
    color: #555;
    gap: 10px;
}
.kds-empty .big-icon { font-size: 52px; }
.kds-empty p { font-size: 18px; }

/* ── Disconnected overlay banner ───────────────────────────────────────────── */
.kds-disc-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #dc2626; color: #fff;
    text-align: center; font-size: 14px; font-weight: 600;
    padding: 9px; z-index: 100;
    animation: kds-slidein .3s ease;
}
@keyframes kds-slidein { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Footer legend ──────────────────────────────────────────────────────────── */
.kds-footer {
    background: #111315;
    border-top: 1px solid #2a2c2f;
    padding: 6px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.kds-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #888; }
.kds-legend .swatch { width: 20px; height: 4px; border-radius: 2px; }
.kds-legend .pill-demo {
    padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 700;
}
.kds-footer-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ── Setup page ─────────────────────────────────────────────────────────────── */
.kds-setup {
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    background: #1a1c1f;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
.kds-setup-card {
    background: #23262a; border-radius: 12px;
    padding: 36px 40px; width: 100%; max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    color: #e8e6de;
}
.kds-setup-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.kds-setup-card p  { font-size: 13px; color: #888; margin-bottom: 24px; }
.kds-setup-card label { font-size: 12px; font-weight: 600; color: #b0a898; display: block; margin-bottom: 4px; }
.kds-setup-card input {
    width: 100%; padding: 10px 12px; background: #1a1c1f;
    border: 1px solid #3a3d41; border-radius: 6px; color: #e8e6de;
    font-size: 14px; margin-bottom: 14px; box-sizing: border-box;
}
.kds-setup-card input:focus { outline: none; border-color: #4ade80; }
.kds-setup-btn {
    width: 100%; padding: 12px; background: #16a34a; color: #fff;
    border: none; border-radius: 8px; font-size: 15px; font-weight: 700;
    cursor: pointer; margin-top: 6px;
    transition: background .15s;
}
.kds-setup-btn:hover:not(:disabled) { background: #15803d; }
.kds-setup-btn:disabled { opacity: .6; cursor: wait; }
.kds-setup-error { color: #f87171; font-size: 13px; margin-top: 10px; text-align: center; }

/* ── Station filter chips ────────────────────────────────────────────────────── */
.kds-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.kds-chip {
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
    border: 1px solid #333; background: #1e2023; color: #c8c4b8; cursor: pointer;
    transition: background .12s;
}
.kds-chip.active { background: #16a34a; border-color: #16a34a; color: #fff; }

/* ── Dark mode board background ─────────────────────────────────────────────── */
[data-theme="dark"] .kds-board { background: #1a1c1f; }
[data-theme="light"] .kds-board { background: #e8e6de; }
[data-theme="light"] .kds-root  { background: #e8e6de; }
[data-theme="light"] .kds-topbar { background: #1a1c1f; }
[data-theme="light"] .kds-footer  { background: #1a1c1f; }
