/* The waiter tablet (/t). Drawn for a 10" tablet held sideways at 1280 x 800 and sized to the
   screen it is on: every length is in rem, and the root's type follows the screen (below), so
   a smaller tablet gets a smaller copy of the same page. The bar and the tabs stay put and the
   page between them scrolls — except where a list sits beside what is done with it (the menu and
   the order, the orders and one order): there the two fill the screen and each scrolls on its own,
   so the buttons at the foot of the order are always in reach. */

:root {
    --tb-bg: #070f24;
    --tb-card: #0d1834;
    --tb-card-2: #111f40;
    --tb-line: #1c2b4f;
    --tb-line-2: #26386280;
    --tb-text: #e8eef9;
    --tb-muted: #8da2c0;
    --tb-blue: #3b82f6;
    --tb-blue-2: #2563eb;
    --tb-green: #22c55e;
    --tb-amber: #f59e0b;
    --tb-red: #ef4444;
    --tb-violet: #8b5cf6;
    --tb-top: 4.25rem;
    --tb-tabs: 4.625rem;
    --tb-gap: 0.875rem;
}

/* 14 px type at 1280 x 800, less on a smaller screen (never under 12 px), more never. */
html:has(.tb-shell), html:has(.tb-login) { font-size: clamp(12px, min(1.1vw, 1.75vh), 14px); }

/* ── The shell ──────────────────────────────────────────────────────── */

.tb-shell {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: var(--tb-top) minmax(0, 1fr) var(--tb-tabs);
    overflow: hidden;
    color: var(--tb-text);
    background:
        radial-gradient(ellipse 60% 40% at 25% -10%, rgba(37, 99, 235, 0.35), transparent 70%),
        radial-gradient(ellipse 50% 35% at 90% -5%, rgba(59, 130, 246, 0.18), transparent 70%),
        var(--tb-bg);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.tb-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.375rem;
    border-bottom: 1px solid var(--tb-line);
    background: rgba(7, 15, 36, 0.6);
}

.tb-top-brand { display: flex; align-items: center; gap: 0.625rem; color: inherit; text-decoration: none; min-width: 0; }
.tb-top-logo { color: var(--tb-blue); font-size: 2.125rem !important; }
.tb-top-word { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.04em; line-height: 1.1; }
.tb-top-word span { color: var(--tb-blue); }
.tb-top-venue { font-size: 0.78rem; color: var(--tb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16.25rem; }

.tb-top-right { display: flex; align-items: center; gap: 0.625rem; }

.tb-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 0.875rem;
    border-radius: 0.75rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-text);
    font: inherit;
    font-size: 0.9rem;
    white-space: nowrap;
}
.tb-chip .mud-icon-root { color: var(--tb-muted); }
button.tb-chip { cursor: pointer; }

.tb-user { padding-left: 0.375rem; }
.tb-avatar {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--tb-blue);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    flex: none;
}
.tb-user-name { max-width: 8.75rem; overflow: hidden; text-overflow: ellipsis; }

.tb-bell { position: relative; width: 3rem; justify-content: center; padding: 0; }
.tb-bell.ringing .mud-icon-root { color: var(--tb-amber); }
.tb-bell-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3125rem;
    border-radius: 0.625rem;
    background: var(--tb-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}
.tb-bell-list { width: 22.5rem; padding: 0.25rem 0; }
.tb-bell-head { padding: 0.5rem 1rem; font-weight: 700; color: var(--tb-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tb-bell-empty { padding: 0.625rem 1rem 0.875rem; color: var(--tb-muted); }
.tb-bell-row { display: flex; align-items: flex-start; gap: 0.625rem; padding: 0.625rem 1rem; border-top: 1px solid var(--tb-line); }
.tb-bell-text { flex: 1; min-width: 0; }
.tb-bell-sub { color: var(--tb-muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-bell-age { color: var(--tb-muted); font-size: 0.8rem; white-space: nowrap; }

.tb-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    padding: 0.875rem 1.375rem 0.75rem;
    gap: var(--tb-gap);
}
.tb-body > * { flex: none; }

.tb-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.625rem;
    border-top: 1px solid var(--tb-line);
    background: rgba(7, 15, 36, 0.85);
}
.tb-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    border-radius: 0.875rem;
    color: var(--tb-text);
    text-decoration: none;
    font-size: 1.02rem;
    font-weight: 600;
}
.tb-tab .mud-icon-root { font-size: 1.75rem; color: var(--tb-muted); }
.tb-tab.active { background: linear-gradient(180deg, var(--tb-blue), var(--tb-blue-2)); box-shadow: 0 0.375rem 1.125rem rgba(37, 99, 235, 0.35); }
.tb-tab.active .mud-icon-root { color: #fff; }

/* ── A page's title line, and the page parts ─────────────────────────── */

.tb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex: none; min-height: 3.625rem; }
.tb-title { margin: 0; font-size: 1.85rem; font-weight: 800; line-height: 1.1; }
.tb-sub { color: var(--tb-muted); font-size: 0.98rem; margin-top: 2px; }
.tb-head-actions { display: flex; align-items: center; gap: 0.625rem; }

.tb-card { background: var(--tb-card); border: 1px solid var(--tb-line); border-radius: 1rem; }

/* ── Too narrow: a phone held upright ───────────────────────────────── */

.tb-portrait { display: none; }
@media (orientation: portrait) and (max-width: 599px) {
    .tb-portrait {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 2000;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.875rem;
        background: var(--tb-bg);
        color: var(--tb-text);
        font-size: 1.3rem;
        font-weight: 600;
    }
}

/* ── The sign-in screen ─────────────────────────────────────────────── */

.tb-login {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(27.5rem, 32.5rem);
    gap: 2.25rem;
    padding: 2.25rem 3rem;
    overflow-y: auto;
    color: var(--tb-text);
    background:
        radial-gradient(ellipse 55% 45% at 15% 0%, rgba(37, 99, 235, 0.4), transparent 70%),
        radial-gradient(ellipse 45% 40% at 100% 100%, rgba(59, 130, 246, 0.15), transparent 70%),
        var(--tb-bg);
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.tb-login-side { display: flex; flex-direction: column; min-height: 0; }
.tb-brand { display: flex; align-items: center; gap: 0.75rem; }
.tb-wordmark { font-size: 2rem; font-weight: 800; letter-spacing: 0.05em; line-height: 1; }
.tb-wordmark span { color: var(--tb-blue); }
.tb-tag { font-size: 0.72rem; letter-spacing: 0.4em; color: var(--tb-muted); margin-top: 0.25rem; }
.tb-venue { margin-top: 0.625rem; color: var(--tb-muted); font-size: 1rem; }

.tb-login-clock { margin-top: auto; }
.tb-login-time { font-size: 4.2rem; font-weight: 800; line-height: 1; letter-spacing: 0.01em; }
.tb-login-date { color: var(--tb-muted); font-size: 1.1rem; margin-top: 0.375rem; }

.tb-login-role {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
    margin-top: 1.125rem;
    padding: 0.5rem 0.875rem;
    border-radius: 62.4375rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-muted);
    font-weight: 600;
}

.tb-recent-title { margin-top: 1.375rem; color: var(--tb-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tb-recent { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.625rem; margin-top: 0.625rem; }
.tb-recent-chip {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.625rem;
    align-items: center;
    padding: 0.625rem 0.75rem;
    min-height: 3.75rem;
    border-radius: 0.875rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tb-recent-chip .tb-avatar { grid-row: span 2; width: 2.375rem; height: 2.375rem; }
.tb-recent-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-recent-code { color: var(--tb-muted); font-size: 0.82rem; }

.tb-login-main { display: flex; align-items: center; justify-content: center; min-height: 0; }
.tb-login-card {
    width: 100%;
    padding: 1.625rem 1.75rem;
    border-radius: 1.375rem;
    border: 1px solid var(--tb-line);
    background: rgba(13, 24, 52, 0.9);
    box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.45);
}
.tb-login-h { margin: 0; font-size: 1.7rem; font-weight: 800; }
.tb-login-sub { margin: 0.25rem 0 0.875rem; color: var(--tb-muted); }
.tb-login-error { margin-bottom: 0.75rem; padding: 0.625rem 0.875rem; border-radius: 0.75rem; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.45); color: #fecaca; }

.tb-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.875rem; }
.tb-field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; color: var(--tb-muted); font-size: 0.85rem; font-weight: 600; }
.tb-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: 3.5rem;
    padding: 0 1rem;
    border-radius: 0.875rem;
    border: 2px solid var(--tb-line);
    background: var(--tb-bg);
    color: var(--tb-text);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    outline: none;
    caret-color: transparent;
}
.tb-input.active { border-color: var(--tb-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }

.tb-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.625rem; }
.tb-key {
    height: 4rem;
    border-radius: 0.875rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card-2);
    color: var(--tb-text);
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
}
.tb-key:active { background: var(--tb-blue-2); }
.tb-key-muted { font-size: 1.05rem; color: var(--tb-muted); }

.tb-signin {
    width: 100%;
    height: 3.875rem;
    margin-top: 0.875rem;
    border: 0;
    border-radius: 0.875rem;
    background: linear-gradient(180deg, var(--tb-blue), var(--tb-blue-2));
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0.5rem 1.5rem rgba(37, 99, 235, 0.35);
}
.tb-signin span { margin-left: 0.5rem; }

/* Sign in, and beside it the clock: same code and PIN, nobody signed in. */
.tb-actions { display: grid; grid-template-columns: 3fr 2fr; gap: 0.75rem; margin-top: 0.875rem; }
.tb-actions .tb-signin { margin-top: 0; }
.tb-clock {
    border-radius: 0.875rem; background: transparent; color: inherit; font: inherit;
    font-weight: 700; cursor: pointer; border: 1px solid rgba(148, 163, 184, 0.45);
}
.tb-login-notice {
    margin-bottom: 0.75rem; padding: 0.625rem 0.875rem; border-radius: 0.625rem; color: #a7f3d0;
    background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.4);
}

/* A shorter screen (1194 x 834 and the like, or a browser's own bars): everything a little tighter. */
@media (max-height: 760px) {
    .tb-login { padding: 1.5rem 2.25rem; }
    .tb-key { height: 3.5rem; }
    .tb-input { height: 3.125rem; }
    .tb-signin { height: 3.375rem; }
    .tb-login-time { font-size: 3.4rem; }
}

/* ── Shared bits for the tablet's pages ─────────────────────────────── */

.tb-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 3rem;
    width: 17.5rem;
    padding: 0 0.875rem;
    border-radius: 0.75rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-muted);
}
.tb-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: var(--tb-text); font: inherit; font-size: 0.98rem; }

.tb-pill {
    height: 2.625rem;
    padding: 0 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-text);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.tb-pill.on { background: linear-gradient(180deg, var(--tb-blue), var(--tb-blue-2)); border-color: transparent; }
.tb-pill.muted { color: var(--tb-muted); }
.tb-pill:disabled { opacity: 0.5; }

.tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.875rem;
    padding: 0 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card-2);
    color: var(--tb-text);
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.tb-btn.primary { background: linear-gradient(180deg, var(--tb-blue), var(--tb-blue-2)); border-color: transparent; }
.tb-btn.amber { background: linear-gradient(180deg, #d97706, #b45309); border-color: transparent; }
.tb-btn:disabled { opacity: 0.45; cursor: default; }
.tb-icon-btn { width: 3rem; height: 3rem; border-radius: 0.75rem; border: 1px solid var(--tb-line); background: var(--tb-card-2); color: var(--tb-text); display: grid; place-items: center; cursor: pointer; flex: none; }

.tb-empty { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; color: var(--tb-muted); font-size: 1.05rem; }
.tb-empty.small { font-size: 0.9rem; padding: 0.75rem 0; place-items: start; }

.tb-kot { padding: 3px 0.625rem; border-radius: 62.4375rem; font-size: 0.78rem; font-weight: 700; white-space: nowrap; background: var(--tb-card-2); color: var(--tb-muted); }
.tb-kot.kot-new { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.tb-kot.kot-preparing { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.tb-kot.kot-ready { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.tb-kot.kot-served { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }

/* ── Games ───────────────────────────────────────────────────────────── */

.tbg-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); align-content: start; }

.tbg-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    padding: 0;
    border-radius: 1rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-text);
    font: inherit;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}
.tbg-card:active { border-color: var(--tb-blue); }
.tbg-pic { position: relative; display: block; height: 8rem; flex: none; }
.tbg-pic .station-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }
.tbg-pic .station-img img { width: 100%; height: 100%; object-fit: cover; }
.tbg-status {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 1.75rem;
    padding: 0 0.75rem;
    border-radius: 62.4375rem;
    background: rgba(7, 15, 36, 0.8);
    font-size: 0.82rem;
    font-weight: 700;
}
.tbg-status .dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; background: var(--tb-muted); }
.state-running .tbg-status .dot { background: var(--tb-red); }
.state-paused .tbg-status .dot { background: var(--tb-blue); }
.state-readytobill .tbg-status .dot { background: var(--tb-amber); }
.state-booked .tbg-status .dot { background: var(--tb-violet); }
.state-free .tbg-status .dot { background: var(--tb-blue); }
.state-running .tbg-status { background: rgba(185, 28, 28, 0.85); }
.state-readytobill .tbg-status { background: rgba(180, 83, 9, 0.85); }
.state-paused .tbg-status { background: rgba(3, 105, 161, 0.85); }
.state-running .tbg-status .dot, .state-readytobill .tbg-status .dot, .state-paused .tbg-status .dot { background: #fff; }

.tbg-name { display: flex; align-items: baseline; gap: 0.625rem; padding: 0.625rem 0.75rem 2px; min-width: 0; }
.tbg-who { display: flex; align-items: center; gap: 0.375rem; padding: 0 0.75rem; min-width: 0; color: var(--tb-muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbg-who .mud-icon-root { font-size: 1rem; flex: none; }
.tbg-order { margin: 0 0.75rem 0.75rem; height: 2.875rem; }
.tbg-name b { font-size: 1.2rem; font-weight: 800; white-space: nowrap; }
.tbg-name span { color: var(--tb-muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Three figures, each in its own box: the value over its label, so none can run into the next. */
.tbg-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.375rem; padding: 0.5rem 0.75rem 0.625rem; }
.tbg-stats > span { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 0.375rem 0.25rem; border-radius: 0.625rem; border: 1px solid var(--tb-line); background: var(--tb-card-2); }
.tbg-stats b { max-width: 100%; font-size: 0.95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tbg-stats small { display: flex; align-items: center; gap: 0.1875rem; max-width: 100%; color: var(--tb-muted); font-size: 0.72rem; white-space: nowrap; overflow: hidden; }
.tbg-stats small .mud-icon-root { font-size: 0.875rem; flex: none; color: var(--tb-muted); }
.tbg-stats .ready b, .tbg-stats .ready small, .tbg-stats .ready .mud-icon-root { color: #86efac; }
.tbg-stats > span.ready { border-color: rgba(34, 197, 94, 0.45); }

/* ── A station opened: a sheet over the right of the page ─────────── */

.tb-sheet-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(3, 7, 18, 0.55); }
.tb-sheet {
    position: fixed;
    top: calc(var(--tb-top) + 0.625rem);
    right: 0.875rem;
    bottom: calc(var(--tb-tabs) + 0.625rem);
    z-index: 1201;
    width: min(35rem, 92vw);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.125rem;
    border-radius: 1.25rem;
    border: 1px solid var(--tb-line);
    background: #0b1530;
    box-shadow: 0 1.5rem 3.75rem rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.tb-sheet > * { flex: none; }
.tbs-head { display: flex; align-items: center; gap: 0.875rem; }
.tbs-head .tbs-pic { width: 7rem; height: 4.5rem; border-radius: 0.75rem; overflow: hidden; flex: none; }
.tbs-head .tbs-pic img { width: 100%; height: 100%; object-fit: cover; }
.tbs-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tbs-title b { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.tbs-title > span:not(.tbg-status) { color: var(--tb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tbs-section-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--tb-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tbs-section-title span { text-transform: none; letter-spacing: 0; font-weight: 500; }

.tbs-reasons { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* At the foot of the sheet, and still there when the sheet scrolls. */
.tbs-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0.625rem;
    margin-top: auto;
    position: sticky;
    bottom: -1.125rem;
    margin-bottom: -1.125rem;
    padding: 0.625rem 0 1.125rem;
    background: #0b1530;
}
.tbs-actions .tb-btn { height: 3.375rem; }

.tbs-note { display: flex; align-items: flex-start; gap: 0.625rem; padding: 0.75rem 0.875rem; border-radius: 0.875rem; background: var(--tb-card); border: 1px solid var(--tb-line); }
.tbs-note.warn { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.1); }
.tbs-stepper.big { transform: scale(1.25); transform-origin: left center; margin: 0.375rem 0; }

/* ── New order ───────────────────────────────────────────────────────── */

.tb-search.wide { width: 100%; flex: none; }

/* Who the order is for: a game, a bill, or a customer at the counter. */
.tbo-bar {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 4.75rem;
    padding: 0.625rem 0.875rem 0.625rem 0.625rem;
    border-radius: 1rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
}
.tbo-bar-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tbo-bar-text b { font-size: 1.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbo-bar-text small { color: var(--tb-muted); font-size: 0.85rem; }

.tbo-where-pic { width: 6rem; height: 3.5rem; border-radius: 0.625rem; overflow: hidden; flex: none; }
.tbo-where-pic img { width: 100%; height: 100%; object-fit: cover; }
.tbo-avatar { display: grid; place-items: center; width: 2.875rem; height: 2.875rem; border-radius: 0.875rem; background: linear-gradient(135deg, #7c3aed, #5b21b6); color: #fff; font-weight: 700; flex: none; }

.tbo-main { flex: 1 1 0; min-height: 20rem; display: grid; grid-template-columns: minmax(0, 1fr) 25rem; grid-template-rows: minmax(0, 1fr); gap: 0.75rem; }

.tbo-menu { display: flex; flex-direction: column; gap: 0.625rem; min-height: 0; min-width: 0; }
.tbo-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    display: grid;
    gap: 0.625rem;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    align-content: start;
    padding-right: 0.25rem;
}

.tbo-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-height: 7.25rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.875rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-text);
    font: inherit;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}
.tbo-cat-head { grid-column: 1 / -1; padding: 0.375rem 0.125rem 0; color: var(--tb-muted); font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.tbo-cat-head:first-child { padding-top: 0; }
.tbo-item::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 0.25rem; background: var(--cat); }
.tbo-item:active { border-color: var(--tb-blue); }
.tbo-item.out { opacity: 0.45; cursor: default; }
.tbo-item-band { display: grid; place-items: center; width: 2.125rem; height: 2.125rem; border-radius: 0.625rem; background: color-mix(in srgb, var(--cat) 30%, transparent); margin-bottom: 2px; }
.tbo-item-band .mud-icon-root { font-size: 1.25rem; color: #fff; }
.tbo-item-band.has-pic { width: 3rem; height: 3rem; overflow: hidden; background: none; }
.tbo-item-band.has-pic > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tbo-item-name { font-size: 1rem; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbo-item-cat { color: var(--tb-muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbo-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.375rem; margin-top: auto; }
.tbo-price { font-weight: 700; font-size: 0.92rem; }
.tbo-add { margin-left: auto; padding: 0.25rem 0.625rem; border-radius: 0.5625rem; border: 1px solid rgba(59, 130, 246, 0.6); color: #93c5fd; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.tbo-tag { padding: 2px 0.5rem; border-radius: 0.5rem; font-size: 0.74rem; font-weight: 700; }
.tbo-tag.out { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.tbo-tag.low { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

.tbo-cart {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    min-height: 0;
    padding: 0.75rem 0.875rem 0.875rem;
    border-radius: 1rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
}
.tbo-cart-head { display: flex; align-items: center; gap: 0.5rem; flex: none; height: 2.5rem; }
.tbo-cart-head > b { font-size: 1.2rem; font-weight: 800; flex: 1; }
.tbo-clear { display: inline-flex; align-items: center; gap: 0.25rem; height: 2.5rem; padding: 0 0.625rem; border: 0; border-radius: 0.625rem; background: transparent; color: var(--tb-muted); font: inherit; cursor: pointer; }
.tbo-clear:disabled { opacity: 0.4; }
.tbo-place { flex: none; width: 100%; height: 3.5rem; font-size: 1.05rem; }

.tbo-lines { flex: 1 1 0; min-height: 4rem; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.tbo-empty-cart { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; color: var(--tb-muted); }
.tbo-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.5rem; height: 3.875rem; border-bottom: 1px solid var(--tb-line); flex: none; }
.tbo-line.failed .tbo-line-text small { color: #fca5a5; }
.tbo-line-text { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--tb-text); font: inherit; text-align: left; cursor: pointer; }
.tbo-line-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbo-line-text small { color: var(--tb-muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbo-qty { display: flex; align-items: center; gap: 0.25rem; }
.tbo-qty button { width: 2.5rem; height: 2.5rem; border-radius: 0.625rem; border: 1px solid rgba(59, 130, 246, 0.5); background: var(--tb-card-2); color: var(--tb-text); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.tbo-qty span { min-width: 1.75rem; text-align: center; font-weight: 700; font-size: 1.05rem; }
.tbo-remove { width: 2.5rem; height: 2.5rem; border: 0; border-radius: 0.625rem; background: transparent; color: var(--tb-muted); cursor: pointer; display: grid; place-items: center; }

.tbo-note-input { width: 100%; min-width: 0; box-sizing: border-box; height: 3.25rem; padding: 0 0.875rem; border-radius: 0.75rem; border: 1px solid var(--tb-line); background: var(--tb-bg); color: var(--tb-text); font: inherit; outline: none; flex: none; }

.tbo-choices { display: flex; flex-direction: column; gap: 0.625rem; }
.tbo-customers { display: flex; flex-direction: column; gap: 0.5rem; }
.tbo-customer-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    height: 3.625rem;
    padding: 0 0.75rem 0 0.375rem;
    border-radius: 0.875rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    color: var(--tb-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    flex: none;
}
.tbo-customer-row .tbo-avatar { width: 2.625rem; height: 2.625rem; border-radius: 0.75rem; font-size: 0.85rem; }
.tbo-customer-row small { color: var(--tb-muted); }

/* ── Orders ──────────────────────────────────────────────────────────── */

.tb-bell-row.link { width: 100%; border: 0; border-top: 1px solid var(--tb-line); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }

.tbr-filters { display: flex; align-items: center; gap: 0.5rem; flex: none; height: 3rem; overflow-x: auto; scrollbar-width: none; }
.tbr-count { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.375rem; margin-left: 0.375rem; padding: 0 0.375rem; border-radius: 0.5rem; background: rgba(255, 255, 255, 0.12); font-size: 0.8rem; }
.tbr-filter.f-ready:not(.on) { border-color: rgba(34, 197, 94, 0.5); }
.tbr-filter.f-draft:not(.on) { border-color: rgba(59, 130, 246, 0.5); }

.tbr-main { flex: 1 1 0; min-height: 20rem; display: grid; grid-template-columns: minmax(0, 1fr) 23.75rem; grid-template-rows: minmax(0, 1fr); gap: 0.75rem; }

.tbr-list { display: flex; flex-direction: column; min-height: 0; border-radius: 1rem; border: 1px solid var(--tb-line); background: var(--tb-card); overflow: hidden; }
.tbr-rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; }
.tbr-row {
    display: grid;
    grid-template-columns: 5.25rem minmax(0, 1.4fr) minmax(0, 1fr) 3rem 6.125rem 6.5rem 9rem;
    align-items: center;
    gap: 0.5rem;
    height: 3.125rem;
    padding: 0 0.875rem;
    border: 0;
    border-bottom: 1px solid var(--tb-line);
    background: transparent;
    color: var(--tb-text);
    font: inherit;
    font-size: 0.92rem;
    text-align: left;
    flex: none;
    cursor: pointer;
}
.tbr-row > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbr-head { height: 2.5rem; cursor: default; color: var(--tb-muted); font-size: 0.8rem; font-weight: 600; background: rgba(255, 255, 255, 0.02); }
.tbr-row.selected { background: rgba(59, 130, 246, 0.14); box-shadow: inset 3px 0 0 var(--tb-blue); }
.tbr-no { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.tbr-no .dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; background: var(--tb-muted); flex: none; }
.tbr-muted { color: var(--tb-muted); }
.tbr-type { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--tb-muted); }

.tbr-state { display: inline-block; padding: 0.25rem 0.625rem; border-radius: 62.4375rem; font-size: 0.8rem; font-weight: 700; background: var(--tb-card-2); }
.st-draft .tbr-state { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
.st-sent .tbr-state, .st-preparing .tbr-state { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.st-ready .tbr-state { background: rgba(34, 197, 94, 0.22); color: #86efac; }
.st-served .tbr-state { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.st-draft .tbr-no .dot { background: var(--tb-blue); }
.st-sent .tbr-no .dot, .st-preparing .tbr-no .dot { background: var(--tb-amber); }
.st-ready .tbr-no .dot { background: var(--tb-green); }
.st-served .tbr-no .dot { background: var(--tb-violet); }

.tbr-detail {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.875rem;
    border-radius: 1rem;
    border: 1px solid var(--tb-line);
    background: var(--tb-card);
    min-height: 0;
}
.tbr-detail > * { flex: none; }
.tbr-detail > .tb-empty { flex: 1; }
/* The items take what the head and the buttons leave, and scroll when there are many. */
.tbr-detail > .tbr-items { flex: 1 1 0; min-height: 3rem; overflow-y: auto; overscroll-behavior: contain; }
.tbr-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.625rem; }
.tbr-detail-head b { display: block; font-size: 1.3rem; font-weight: 800; }
.tbr-detail-head small { color: var(--tb-muted); }
.tbr-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem 0.625rem; color: var(--tb-muted); font-size: 0.86rem; }
.tbr-meta span { display: flex; align-items: center; gap: 0.375rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbr-items { display: flex; flex-direction: column; }
.tbr-item { display: grid; grid-template-columns: 2.125rem minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; min-height: 2.875rem; border-bottom: 1px solid var(--tb-line); flex: none; }
.tbr-item .q { color: var(--tb-muted); font-weight: 700; }
.tbr-item .n { display: flex; flex-direction: column; min-width: 0; }
.tbr-item .n b, .tbr-item .n small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbr-item .n small { color: var(--tb-muted); font-size: 0.78rem; }
.tbr-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.625rem; }
.tbr-actions .tb-btn { height: 3.375rem; }

/* ── Home ────────────────────────────────────────────────────────────── */

/* ── A narrower screen: a small tablet, or one held upright ──────────── */

@media (max-width: 1000px) {
    /* Orders: the type goes (the table's name says it), the rest gets the room. */
    .tbr-main { grid-template-columns: minmax(0, 1fr) 20rem; }
    .tbr-row { grid-template-columns: 4.5rem minmax(0, 1.2fr) minmax(0, 1fr) 2.5rem 6.5rem 7.5rem; }
    .tbr-row > :nth-child(5) { display: none; }
}

@media (max-width: 900px) {
    .tb-top { padding: 0 0.875rem; }
    .tb-top-right .tb-chip.tb-date { display: none; }
    .tb-body { padding: 0.75rem 0.875rem; }
    .tb-head { flex-wrap: wrap; align-items: flex-start; row-gap: 0.5rem; }
    .tb-tab { gap: 0.375rem; }
}

@media (max-width: 760px) {
    .tbo-main, .tbr-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; flex: none; min-height: 0; }
    .tbo-grid, .tbr-rows, .tbr-detail > .tbr-items { overflow: visible; flex: none; }
    .tbo-bar { flex-wrap: wrap; }
    .tbo-lines { max-height: 22rem; }
    .tb-head-actions { width: 100%; }
    .tb-search { flex: 1; width: auto; }
    .tb-login { grid-template-columns: minmax(0, 1fr); padding: 1.25rem; }
    .tb-login-clock, .tb-recent-title, .tb-recent { display: none; }
}
