:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --line: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --kitchen: #ea580c;
    --pay: #16a34a;
    --danger: #dc2626;
    --dark: #4b1413;   /* hnědá z loga Café Stodola */
    --gold: #dfa809;   /* zlatý šálek z loga */
    --radius: 10px;
    --touch: 64px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
    color: var(--text);
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

h1, h2, h3 { margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1rem; }
h1:focus { outline: none; }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
code { background: #eef; padding: 0 .3rem; border-radius: 4px; }

/* ---- layout ---- */
.app { display: flex; flex-direction: column; height: 100dvh; }
.topbar {
    display: flex; align-items: center; gap: 1rem;
    background: var(--dark); color: #fff; padding: 0 1rem; height: 60px; flex: none;
}
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-weight: 700; font-size: 1.15rem; margin-right: .5rem; }
.brand-logo { height: 32px; width: 32px; }
.topnav { display: flex; gap: .5rem; flex: 1; }
.navbtn {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1.2rem; border-radius: 999px;
    color: #e8d9cc; font-weight: 600; border: 1px solid transparent; white-space: nowrap; user-select: none;
}
.navbtn:hover { background: rgba(255,255,255,.1); color: #fff; }
.navbtn:active { transform: scale(.97); }
.navbtn.active { background: var(--gold); color: var(--dark); }
.navbtn-logout { border-color: rgba(255,255,255,.45); color: #fff; }
.navbtn-logout:hover { background: rgba(255,255,255,.15); }

.topuser { display: flex; align-items: center; gap: .75rem; }
.user-chip {
    display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; padding: .2rem 1rem .2rem .25rem;
    border-radius: 999px; background: rgba(255,255,255,.1); color: #fff; font-weight: 600;
}
.user-avatar.sm { width: 36px; height: 36px; font-size: .95rem; background: var(--gold); color: var(--dark); }
.username { color: #fff; }
.content { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 1rem; }
.section-title { margin: .75rem 0; color: #4b5563; font-size: 1.3rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* ---- buttons & inputs ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: var(--touch); padding: 0 1.1rem; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--panel); color: var(--text);
    font: inherit; font-weight: 600; cursor: pointer; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-sm { min-height: 40px; padding: 0 .8rem; font-size: .95rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-kitchen { background: var(--kitchen); border-color: var(--kitchen); color: #fff; }
.btn-pay { background: var(--pay); border-color: var(--pay); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.topbar .btn-ghost { color: #d1d5db; }

.input {
    min-height: 44px; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; background: #fff; width: 100%;
}
.input.short { width: 7rem; }
.input.wide { width: 100%; min-width: 18rem; }
label { display: block; margin-bottom: .75rem; }
.form label > .input { margin-top: .25rem; }
.form { max-width: 40rem; }
.form-row { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin-bottom: .75rem; }
.form-row label { flex: 1; min-width: 12rem; margin: 0; }
.toolbar { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin: 1rem 0; }
/* pole s popiskem nad vstupem (formuláře pro přidání i nastavení) */
.field { display: flex; flex-direction: column; gap: .25rem; margin: 0; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field > .input { width: 100%; margin: 0; }
.field > .input.short { width: 10rem; }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.toolbar .field { flex: 1; min-width: 10rem; }
.toolbar .field.short { flex: 0 0 auto; min-width: 7rem; }
.toolbar .field.short .input { width: 9rem; }
.form .field { margin-bottom: .9rem; }
.toolbar .input { width: auto; flex: 1; min-width: 10rem; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin: .75rem 0; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warn { background: #fef3c7; color: #92400e; }

.toast {
    position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
    background: var(--dark); color: #fff; padding: .9rem 1.4rem; border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 100; max-width: 90vw; font-weight: 600;
}
.toast.ok { background: var(--pay); }
.toast.warn { background: var(--kitchen); }

/* ---- stav tiskáren (pravý dolní roh) ---- */
.pstatus { position: fixed; right: .75rem; bottom: .75rem; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.pstatus-pill {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 34px; padding: 0 .7rem; border-radius: 999px;
    background: rgba(31,41,55,.78); color: #e5e7eb; border: none; font: inherit; font-size: .85rem; cursor: pointer; opacity: .85;
}
.pstatus-pill:hover, .pstatus.open .pstatus-pill { opacity: 1; }
.pstatus-icon { font-size: 1rem; line-height: 1; filter: grayscale(1); opacity: .9; }
.pstatus-dot { width: 11px; height: 11px; border-radius: 50%; background: #9ca3af; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.pstatus-dot.ok { background: #22c55e; }
.pstatus-dot.bad { background: #ef4444; }
.pstatus-dot.off { background: #6b7280; }
.pstatus-dot.unknown { background: #d1d5db; }
.pstatus-count { font-weight: 700; padding: 0 .4rem; border-radius: 999px; background: rgba(255,255,255,.18); }
.pstatus-count.bad { background: var(--danger); color: #fff; }
.pstatus-pop { background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: .6rem .8rem; min-width: 16rem; font-size: .95rem; }
.pstatus-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; }
.pstatus-name { font-weight: 600; }
.pstatus-text { color: var(--muted); margin-left: auto; }
.pstatus-jobs { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .5rem; gap: 1rem; color: var(--muted); }
.pstatus-jobs .bad { color: var(--danger); font-weight: 600; }
.pstatus-link { display: block; margin-top: .4rem; font-weight: 600; }

/* ---- login ---- */
.login-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 1rem; }
.login-card { background: var(--panel); padding: 2rem; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.08); width: 22rem; max-width: 100%; text-align: center; }
.pin-input { width: 100%; font-size: 2rem; text-align: center; letter-spacing: .5rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.pinkey { min-height: 74px; font-size: 1.8rem; font-weight: 600; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; }
.pinkey:active { background: #e5e7eb; }
.pinkey-ok { background: var(--pay); color: #fff; border-color: var(--pay); }
.pinkey-muted { color: var(--muted); }
.login-card.login-wide { width: 56rem; max-width: 100%; }
.login-logo { height: 120px; max-width: 100%; margin-bottom: .25rem; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.user-grid form { display: contents; }
.user-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
    min-height: 12rem; width: 100%; padding: 1.25rem .75rem; border: 2px solid var(--line); border-radius: 14px;
    background: #fff; color: var(--text); font: inherit; cursor: pointer; user-select: none;
}
.user-tile:hover { border-color: var(--gold); }
.user-tile:active { background: #f3f4f6; transform: scale(.98); }
.user-avatar { width: 76px; height: 76px; border-radius: 50%; background: var(--dark); color: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 1.6rem; flex: none; }
.login-who .user-avatar { width: 56px; height: 56px; font-size: 1.25rem; }
.user-name { font-weight: 700; font-size: 1.35rem; margin-top: .4rem; }
.user-role { font-size: 1rem; color: var(--muted); }
.login-who { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .5rem 0; }
.login-back { margin-top: 1rem; color: var(--muted); }

/* ---- tables grid ---- */
.tables-layout { display: grid; grid-template-columns: 1fr 24rem; gap: 1.5rem; align-items: start; }
.tables-main { min-width: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.tile {
    display: flex; flex-direction: column; gap: .3rem; min-height: 150px; padding: 1.1rem 1.2rem;
    border-radius: 14px; background: var(--panel); border: 2px solid var(--line); color: var(--text);
}
.tile.occupied { border-color: var(--kitchen); background: #fff7ed; }
.tile:active { transform: scale(.98); }
.tile-name { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.tile-total { font-size: 1.35rem; font-weight: 700; color: var(--kitchen); margin-top: auto; }
.tile-time, .tile-free { color: var(--muted); font-size: 1.05rem; }
.tile-free { margin-top: auto; }
.kitchen { position: sticky; top: 0; }
.kitchen-empty { font-size: 1.05rem; }
.kitchen-table { display: block; background: var(--panel); border: 2px solid var(--line); border-left: 6px solid var(--kitchen); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .75rem; color: var(--text); }
.kitchen-table-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .4rem; }
.kitchen-table-name { font-size: 1.3rem; font-weight: 700; }
.kitchen-since { color: var(--kitchen); font-weight: 600; white-space: nowrap; }
.kitchen-item { display: grid; grid-template-columns: 3rem 1fr; gap: .4rem; padding: .25rem 0; font-size: 1.1rem; }
.kitchen-qty { font-weight: 700; }
.kitchen-name { display: flex; flex-direction: column; }
.tile-badge { align-self: flex-start; background: var(--danger); color: #fff; border-radius: 999px; padding: .2rem .75rem; font-size: .95rem; font-weight: 600; }

/* ---- order screen ---- */
.pos { display: grid; grid-template-columns: 28rem 1fr; height: 100%; }
.menu { display: grid; grid-template-columns: 11rem 1fr; min-height: 0; }
.cats { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; overflow: auto; background: #e5e7eb; }
.cat { min-height: var(--touch); border: none; border-radius: 10px; background: #fff; font: inherit; font-size: 1.1rem; font-weight: 600; cursor: pointer; padding: 0 .6rem; }
.cat.active { background: var(--dark); color: #fff; }
.cat-discount { margin-top: auto; background: #fef3c7; color: #92400e; }
.cat-discount.active { background: var(--gold); color: var(--dark); }
.discount-panel { grid-column: 1 / -1; }
.discount-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; margin-top: .75rem; }
.discount-btn { align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; min-height: 96px; }
.discount-btn.active { background: var(--gold); border-color: var(--gold); color: var(--dark); }
.discount-custom { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1.25rem; }
.discount-custom .input { width: 10rem; font-size: 1.25rem; min-height: var(--touch); }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .75rem; padding: .9rem; overflow: auto; align-content: start; }
.product {
    display: flex; flex-direction: column; justify-content: space-between; gap: .4rem; min-height: 116px; padding: .9rem;
    border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; text-align: left; cursor: pointer;
}
.product:active { background: #dbeafe; transform: scale(.98); }
.product-name { font-weight: 700; font-size: 1.15rem; line-height: 1.2; }
.product-price { color: var(--muted); font-size: 1.05rem; }

.order { display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.order-head { display: flex; align-items: center; gap: .5rem; padding: .6rem; border-bottom: 1px solid var(--line); }
.order-head .btn-ghost { font-size: 1.15rem; padding: 0 .9rem; }
.order-head h1 { flex: 1; text-align: center; font-size: 1.6rem; margin: 0; }
.items { flex: 1; overflow: auto; }
.empty { padding: 1.5rem 1rem; color: var(--muted); font-size: 1.1rem; }
.item {
    display: grid; grid-template-columns: 3.5rem 1fr auto 2rem; align-items: center; gap: .6rem; font-size: 1.15rem;
    padding: .75rem 1rem; border-bottom: 1px solid var(--line); min-height: 68px; cursor: pointer;
}
.item.selected { background: #dbeafe; }
.item.sent .item-mark { color: var(--pay); font-weight: 700; }
.item-qty { font-weight: 700; }
.item-name { display: flex; flex-direction: column; }
.item-note { color: var(--kitchen); }
.item-total { font-variant-numeric: tabular-nums; }
.item-mark { text-align: center; color: var(--muted); font-size: 1.3rem; }
.item-mark.waiting { color: var(--kitchen); font-size: 1.6rem; line-height: 1; }
.btn-kitchen-done { background: #fff7ed; border-color: #fdba74; color: var(--kitchen); }
.btn-kitchen-done:disabled { opacity: 1; }
.item-actions { display: flex; gap: .6rem; align-items: center; padding: .75rem; border-top: 1px solid var(--line); background: #f9fafb; flex-wrap: wrap; }
.item-actions .btn { font-size: 1.3rem; min-width: 64px; }
.item-actions .input { flex: 1; min-width: 8rem; }
.item-actions-qty { min-width: 2.5rem; text-align: center; font-weight: 700; font-size: 1.5rem; }
.order-tools { display: flex; justify-content: flex-end; padding: .4rem .75rem; border-top: 1px solid var(--line); background: #f9fafb; }
.btn-ghost-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-ghost-danger:hover { background: #fee2e2; }
.modal-danger { border-top: 6px solid var(--danger); }
.modal-danger p { font-size: 1.1rem; }
.order-foot { border-top: 1px solid var(--line); padding: .75rem; }
.order-sub { display: flex; justify-content: space-between; font-size: 1.1rem; color: var(--muted); margin-bottom: .2rem; }
.order-sub.discount { color: var(--kitchen); font-weight: 600; }
.order-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.35rem; margin-bottom: .75rem; }
.order-total strong { font-size: 2rem; }
.order-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.order-actions .btn { min-height: 76px; font-size: 1.2rem; }

/* ---- modals ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }
.modal.modal-pay { width: 36rem; }
.modal-pay h2 { font-size: 1.7rem; text-align: center; }
.modal-pay .modal-actions .btn { min-height: 72px; font-size: 1.15rem; }
.modal {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 51;
    background: #fff; border-radius: 16px; padding: 1.5rem; width: 30rem; max-width: 95vw; max-height: 90vh; overflow: auto;
}
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
.modal-actions .btn { flex: 1; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1.25rem 0; }
.pay-method { min-height: 150px; font-size: 1.7rem; font-weight: 700; border-width: 3px; border-radius: 16px; }
.pay-method.active { background: var(--gold); border-color: var(--gold); color: var(--dark); }
.quick-cash { display: flex; gap: .5rem; flex-wrap: wrap; }
/* dělený účet v okně platby */
.seg.pay-mode { display: flex; margin: .75rem 0 0; }
.pay-mode .seg-btn { flex: 1; min-height: 58px; font-size: 1.1rem; white-space: nowrap; }
.split-hint { margin: .75rem 0 .5rem; }
.split-list { max-height: 38vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.split-row { display: grid; grid-template-columns: 2.2rem 1fr auto 6rem; gap: .6rem; align-items: center; min-height: 64px; padding: .3rem .75rem; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 1.1rem; user-select: none; }
.split-row:last-child { border-bottom: none; }
.split-row.on { background: #fff7d6; }
.split-check { width: 1.9rem; height: 1.9rem; border: 2px solid #cbd5e1; border-radius: 7px; display: grid; place-items: center; font-weight: 700; color: var(--dark); background: #fff; }
.split-row.on .split-check { background: var(--gold); border-color: var(--gold); }
.split-name small { color: var(--muted); margin-left: .4rem; }
.split-qty { display: flex; align-items: center; gap: .3rem; }
.split-qty .btn { min-width: 54px; min-height: 54px; font-size: 1.4rem; padding: 0; }
.split-qty b { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.split-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.split-sum { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 0; font-size: 1.05rem; color: var(--muted); }
.split-sum strong { color: var(--text); }
.paid-remaining { font-size: 1.15rem; padding: .6rem .9rem; background: #fff7d6; border-radius: 10px; }
.receipt-part { font-size: .8rem; font-weight: 600; color: var(--dark); background: #fff1b8; border-radius: 999px; padding: .15rem .6rem; align-self: center; }

/* ---- admin ---- */
.subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.subnav a { padding: .6rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.subnav a.active { color: var(--primary); border-color: var(--primary); }
.table { width: 100%; border-collapse: collapse; background: #fff; margin-bottom: 1rem; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .9rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.narrow { width: auto; min-width: 24rem; }
.table tr.selected { background: #dbeafe; }
.table .input { min-height: 38px; min-width: 8rem; }
.table .input.short { min-width: 0; }
.table td:has(> .input.short), .table td:has(> input[type="checkbox"]), .table td:has(> .btn) { width: 1%; white-space: nowrap; }
.split { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem; }
.receipt-list { display: flex; flex-direction: column; gap: .6rem; max-width: 60rem; }
.receipt-row { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "main total btn" "items total btn"; gap: .2rem 1rem; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: .8rem 1rem; }
.receipt-main { grid-area: main; display: flex; gap: .8rem; align-items: baseline; font-size: 1.15rem; }
.receipt-time { font-weight: 700; }
.receipt-table { font-weight: 700; }
.receipt-no { color: var(--muted); }
.receipt-items { grid-area: items; font-size: 1rem; }
.receipt-total { grid-area: total; font-size: 1.3rem; font-weight: 700; text-align: right; }
.receipt-total small { display: block; font-size: .9rem; font-weight: 400; color: var(--muted); }
.receipt-btns { grid-area: btn; display: flex; gap: .5rem; }
.row-btns { white-space: nowrap; }
.row-btns .btn + .btn { margin-left: .4rem; }
.receipt-row.deleted { opacity: .6; border-style: dashed; }
.receipt-row.deleted .receipt-total, .receipt-row.deleted .receipt-no { text-decoration: line-through; }
.receipt-deleted { font-size: .85rem; font-weight: 600; color: var(--danger); background: #fee2e2; border-radius: 999px; padding: .15rem .6rem; align-self: center; }
.confirm-check { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; margin-top: .5rem; background: #fef2f2; border-radius: 10px; font-size: 1.05rem; cursor: pointer; }
.confirm-check input { width: 1.6rem; height: 1.6rem; flex: none; accent-color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; margin: 1rem 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: .9rem; }
.stat strong { font-size: 1.3rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; background: #e5e7eb; font-size: .8rem; font-weight: 600; vertical-align: middle; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.help { margin-top: 1rem; color: var(--muted); }

.deleted-box { margin: .5rem 0 1rem; padding: .6rem 1rem; background: #f9fafb; border: 1px dashed var(--line); border-radius: 10px; }
.deleted-box summary { cursor: pointer; font-weight: 600; color: var(--muted); min-height: 40px; display: flex; align-items: center; }
.deleted-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .35rem 0; border-top: 1px solid var(--line); }

/* přetahování řádků v administraci */
.drag-handle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: grab; touch-action: none; user-select: none; color: var(--muted); font-size: 1.3rem; border-radius: 8px; }
.drag-handle:hover { background: #f3f4f6; color: var(--text); }
.table td:has(> .drag-handle) { width: 1%; }
tr.dragging { position: relative; z-index: 2; background: #eef2ff; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
tr.dragging .drag-handle { cursor: grabbing; }
tr.drop-before td { box-shadow: inset 0 3px 0 var(--primary); }
tr.drop-after td { box-shadow: inset 0 -3px 0 var(--primary); }

/* ---- tržby: přepínač období, KPI, grafy ---- */
.sales-toolbar { align-items: center; flex-wrap: wrap; gap: .75rem; }
.seg { display: inline-flex; gap: .25rem; background: #e5e7eb; padding: .25rem; border-radius: 12px; }
.seg-btn { min-height: 52px; padding: 0 1.1rem; border: none; border-radius: 9px; background: transparent; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg .btn { min-height: 52px; }
.sales-title { margin: .5rem 0 0; font-size: 1.35rem; }
.kpi { grid-template-columns: 2fr repeat(5, 1fr); }
.kpi .stat strong { font-size: 1.6rem; }
.kpi .stat-hero { grid-column: span 2; }
.kpi .stat-hero strong { font-size: 2.6rem; line-height: 1.1; }
.stat .delta { font-style: normal; font-size: .95rem; margin-top: .2rem; color: var(--muted); }
.stat .delta.up { color: #0a7a2f; font-weight: 600; }
.stat .delta.down { color: #b42318; font-weight: 600; }
.stat .delta small { color: var(--muted); font-weight: 400; }
.chart-card h3, .split h3 { margin: 0; font-size: 1.05rem; }
.card-head { margin-bottom: .6rem; }
.sales-split { grid-template-columns: 1fr 1fr; }
.table tr.total-row td { font-weight: 700; border-top: 2px solid var(--line); }

/* graf (SVG) */
.viz { --s-cash: #2a78d6; --s-card: #eb6834; --viz-grid: #e5e7eb; --viz-text: #52514e; }
.viz-legend { display: flex; gap: 1.25rem; font-size: .9rem; color: var(--viz-text); margin-bottom: .25rem; }
.viz-key { display: inline-flex; align-items: center; gap: .4rem; }
.viz-key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz-svg { width: 100%; height: auto; display: block; font-family: inherit; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-axis { stroke: #cfd3d8; stroke-width: 1; }
.viz-tick { fill: var(--viz-text); font-size: 12px; }
.viz-label { fill: var(--text); font-size: 12px; font-weight: 700; }
.viz-hit { fill: transparent; }
.viz-bar:hover .viz-hit { fill: rgba(0,0,0,.04); }
.viz-tip { display: none; pointer-events: none; }
.viz-bar:hover .viz-tip { display: block; }
.viz-bar:hover .viz-label { display: none; }
.viz-tip rect { fill: #1f2937; opacity: .95; }
.viz-tip text { fill: #fff; font-size: 12px; }
.viz-tip-title { font-weight: 700; fill: #fff; }
.viz-tip-val { fill: #fff; font-weight: 700; }

/* žebříček */
.rank { display: flex; flex-direction: column; gap: .35rem; }
.rank-row { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr auto auto; gap: .6rem; align-items: center; font-size: .95rem; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 14px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.rank-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rank-qty { color: var(--muted); font-size: .85rem; white-space: nowrap; min-width: 3.5rem; text-align: right; }

/* nabídka: dva široké seznamy vedle sebe jen na opravdu širokém monitoru */
@media (max-width: 1400px) { .menu-split { grid-template-columns: 1fr; } }

/* ---- responsive ---- */
@media (max-width: 900px) {
    .pos { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .order { border-right: none; border-bottom: 1px solid var(--line); max-height: 48dvh; }
    .menu { grid-template-columns: 8.5rem 1fr; }
    .tables-layout { grid-template-columns: 1fr; }
    .kitchen { position: static; }
    .split { grid-template-columns: 1fr; }
    .kpi { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
    .kpi .stat-hero { grid-column: span 2; }
    .navbtn { padding: 0 .8rem; }
    .user-chip .username { display: none; }
    .user-chip { padding-right: .25rem; }
}

/* ---- blazor ---- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; color: #fff; padding: 1rem; }
.blazor-error-boundary::after { content: "Došlo k chybě."; }
