/* SnookerPOS — no external dependencies (works offline) */
/* Fonts: Noto Sans Lao Looped / Noto Sans Thai / Noto Sans (SIL Open Font License, assets/fonts/OFL.txt) */
@font-face { font-family: "SNK Lao"; src: url(fonts/noto-lao.woff2) format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0E80-0EFF, U+200B-200D, U+25CC; }
@font-face { font-family: "SNK Thai"; src: url(fonts/noto-thai.woff2) format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0E00-0E7F, U+200B-200D, U+25CC; }
@font-face { font-family: "SNK Latin"; src: url(fonts/noto-latin.woff2) format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0000-024F, U+0300-0323, U+1EA0-1EF9, U+2000-206F, U+20A0-20CF, U+2190-2193, U+2212, U+2264-2265, U+2605; }
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --border: #e3e8e6;
  --text: #15201c;
  --muted: #66746f;
  --primary: #0f7a4f;
  --primary-2: #0b5e3d;
  --primary-soft: #e3f4ec;
  --felt: #0b3b2c;
  --felt-2: #0f4a37;
  --gold: #d99a1e;
  --gold-soft: #fdf3dc;
  --ok: #138a52;
  --ok-soft: #e2f5ea;
  --warn: #b7791f;
  --warn-soft: #fdf1d8;
  --bad: #c2362f;
  --bad-soft: #fde7e5;
  --info: #2563a8;
  --info-soft: #e3eefb;
  --paused: #7c5cc4;
  --paused-soft: #efe9fb;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 4px 16px rgba(16, 24, 20, .06);
  --shadow-lg: 0 10px 40px rgba(16, 24, 20, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "SNK Latin", "SNK Lao", "SNK Thai", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #161e1b; --surface-2: #1b2521; --border: #27332f; --text: #e6efeb; --muted: #93a39d;
    --primary: #22a56d; --primary-2: #1b8a5b; --primary-soft: #133126; --felt: #0a2a20; --felt-2: #0e3528;
    --gold: #eab04a; --gold-soft: #3a2e14; --ok: #34c07a; --ok-soft: #12301f; --warn: #e3a845; --warn-soft: #3a2c12;
    --bad: #ef6b63; --bad-soft: #3d1a18; --info: #6aa5ea; --info-soft: #14263c; --paused: #a68be6; --paused-soft: #2a2140;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #161e1b; --surface-2: #1b2521; --border: #27332f; --text: #e6efeb; --muted: #93a39d;
  --primary: #22a56d; --primary-2: #1b8a5b; --primary-soft: #133126; --felt: #0a2a20; --felt-2: #0e3528;
  --gold: #eab04a; --gold-soft: #3a2e14; --ok: #34c07a; --ok-soft: #12301f; --warn: #e3a845; --warn-soft: #3a2c12;
  --bad: #ef6b63; --bad-soft: #3d1a18; --info: #6aa5ea; --info-soft: #14263c; --paused: #a68be6; --paused-soft: #2a2140;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:lang(lo) body, :lang(th) body { font-size: 15.5px; line-height: 1.7; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.3; }
h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; display: flex; align-items: center; gap: .45em; } h4 { font-size: .95rem; margin-top: 1em; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 5px; font-size: .9em; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.ic-xl { width: 56px; height: 56px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .r { text-align: right; }
.b { font-weight: 700; } .nowrap { white-space: nowrap; } .mt { margin-top: 1rem; } .grow { flex: 1; } .inline { display: inline; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); } .text-gold { color: var(--gold); } .text-accent { color: var(--primary); }
.pre { white-space: pre-wrap; }
.hp { position: absolute; left: -9999px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: linear-gradient(180deg, var(--felt), var(--felt-2)); color: #d6e7df; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.brand { display: flex; gap: .7rem; align-items: center; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--gold) 13% 100%);
  display: grid; place-items: center; color: var(--felt); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.brand-logo .ic { width: 22px; height: 22px; }
.brand-logo.big { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto .6rem; }
.brand-logo.big .ic { width: 38px; height: 38px; }
.brand-text strong { display: block; color: #fff; font-size: 1.05rem; }
.brand-text small { display: block; color: #9fc2b3; font-size: .78rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { padding: .6rem; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a, .nav-foot a, .nav-foot button { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 10px; color: #cfe2d9;
  font: inherit; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.nav a:hover, .nav-foot a:hover, .nav-foot button:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-foot { padding: .6rem; border-top: 1px solid rgba(255,255,255,.08); }
.nav-foot small { display: block; font-size: .75rem; color: #9fc2b3; }
.nav-foot form { margin: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.4rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 1.2rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.content { padding: 1.3rem 1.4rem 3rem; max-width: 1500px; width: 100%; }
.announce { background: var(--gold-soft); color: var(--text); padding: .55rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; gap: .5rem; align-items: center; }
.only-mobile { display: none; }
.sidebar-backdrop { display: none; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.narrow { max-width: 640px; }
.card.highlight { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.card.danger { border-color: var(--bad-soft); } .card.danger summary { cursor: pointer; color: var(--bad); font-weight: 600; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty h2 { color: var(--text); margin-top: .6rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.page-grid.wide-aside { grid-template-columns: minmax(0, 1fr) 420px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row-gap { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row-inline { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.row-inline input, .row-inline select { margin: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar h3, .toolbar p { margin: 0; }

label { display: block; font-size: .87rem; color: var(--muted); margin-bottom: .75rem; font-weight: 500; }
label > input, label > select, label > textarea, label > .stars { margin-top: .3rem; }
input, select, textarea { width: 100%; font: inherit; font-size: .95rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .55rem .7rem; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled { opacity: .6; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input[type=file] { padding: .35rem; font-size: .85rem; }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--text); cursor: pointer; }
label.check input { margin: 0; }
.w-sort { width: 70px !important; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2b1d00; }
.btn-gold:hover { filter: brightness(.95); background: var(--gold); }
.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost-bad { color: var(--bad); border-color: var(--bad-soft); }
.btn-ghost-bad:hover { background: var(--bad-soft); }
.btn-lg { padding: .78rem 1.3rem; font-size: 1.02rem; border-radius: 11px; }
.btn-sm { padding: .32rem .65rem; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; gap: .3em; padding: .12em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); } .badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); } .badge-info { background: var(--info-soft); color: var(--info); }
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.token { word-break: break-all; font-size: .95rem; user-select: all; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .38rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none !important; }
.chip:hover { border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip small { opacity: .7; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .6rem 1rem; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; text-decoration: none; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }

.table-wrap { padding: 0; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; padding: .7rem .9rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tbl td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl.compact td, .tbl.compact th { padding: .45rem .5rem; }
.tbl input, .tbl select { padding: .4rem .5rem; }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl tr.dim td { opacity: .55; }
.tbl tr.tot td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--text); }
.card > .tbl:not(.compact) { margin: 0; }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: .35rem .8rem; margin: 0 0 1rem; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; padding: .8rem 1rem; }
.filters label { margin: 0; min-width: 140px; }
.filters .chips { margin: 0; width: 100%; }
.search-inline { display: flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 .9rem; min-width: 240px; }
.search-inline input { border: 0; box-shadow: none !important; padding: .5rem 0; background: transparent; }
.pager { display: flex; gap: .3rem; align-items: center; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.pager a { min-width: 36px; text-align: center; padding: .35rem .6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.pager a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; color: var(--text); text-decoration: none !important; }
.stat-label { color: var(--muted); font-size: .82rem; }
.stat b { font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-accent { background: linear-gradient(135deg, var(--felt), var(--primary)); color: #fff; border-color: transparent; }
.stat-accent .stat-label, .stat-accent small { color: #cfe8dc !important; }
.stat-warn { border-color: var(--warn); background: var(--warn-soft); }
.stat-bad { border-color: var(--bad); background: var(--bad-soft); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(8, 14, 12, .55); z-index: 100; display: grid; place-items: center; padding: 1rem; animation: fade .15s; }
.modal-box { background: var(--surface); border-radius: 18px; padding: 1.2rem 1.3rem; width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal-box.small { max-width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.modal-head h3 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .8rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--text); color: var(--surface); padding: .7rem 1.2rem;
  border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 200; transition: transform .25s; max-width: 90vw; font-weight: 500; }
.toast:not(.show) { opacity: 0; visibility: hidden; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.err { background: var(--bad); color: #fff; }

.seg-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.seg-choice.compact { grid-template-columns: repeat(3, 1fr); }
.seg-choice label { margin: 0; cursor: pointer; }
.seg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.seg-choice span { display: flex; flex-direction: column; gap: .15rem; padding: .8rem; border: 2px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 600; text-align: center; align-items: center; }
.seg-choice.compact span { padding: .5rem; }
.seg-choice small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.seg-choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* ---------- auth ---------- */
.auth-body { background: radial-gradient(1200px 600px at 50% -10%, var(--felt-2), var(--felt) 60%, #061a13); min-height: 100vh; }
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 2.5rem 1rem; }
.auth-wrap:has(.wide) { max-width: 760px; }
.auth-brand { text-align: center; color: #fff; margin-bottom: 1.2rem; }
.auth-brand h1 { margin: 0; font-size: 1.7rem; } .auth-brand p { color: #a9cbbd; margin: 0; }
.auth-card { padding: 1.6rem; border-radius: 20px; }
.auth-card h3 { margin-top: .5rem; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.dash-head .stat-row { flex: 1; margin-bottom: .6rem; }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .82rem; color: var(--muted); margin: .2rem 0 .9rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-free { background: var(--primary); } .dot-busy { background: var(--info); } .dot-paused { background: var(--paused); }
.dot-warn { background: var(--warn); } .dot-over { background: var(--bad); } .dot-maint { background: var(--muted); }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .9rem; }
.tcard { position: relative; border-radius: 16px; padding: .9rem 1rem 1rem; cursor: pointer; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s; overflow: hidden; min-height: 158px; display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit; width: 100%; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--primary); }
.tcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .4rem; }
.tcard-name { font-weight: 700; font-size: 1.12rem; }
.tcard-kind { font-size: .78rem; color: var(--muted); }
.tcard-state { font-size: .78rem; font-weight: 700; padding: .15em .6em; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.tcard-timer { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .5px; margin: .35rem 0 .1rem; }
.tcard-sub { font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; gap: .4rem; margin-top: auto; }
.tcard-amt { font-weight: 700; color: var(--text); }
.tcard-free-cta { margin: auto 0 .2rem; display: flex; align-items: center; gap: .5rem; color: var(--primary); font-weight: 700; }
.tcard-free-cta .ic { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--primary-soft); }
.tcard .light-ind { position: absolute; right: .7rem; bottom: .6rem; font-size: .9rem; }
.tcard.busy::before { background: var(--info); } .tcard.busy .tcard-state { background: var(--info-soft); color: var(--info); }
.tcard.busy { background: linear-gradient(160deg, var(--surface) 55%, var(--info-soft)); }
.tcard.paused::before { background: var(--paused); } .tcard.paused .tcard-state { background: var(--paused-soft); color: var(--paused); }
.tcard.paused .tcard-timer { color: var(--paused); }
.tcard.warn::before { background: var(--warn); } .tcard.warn { border-color: var(--warn); } .tcard.warn .tcard-state { background: var(--warn-soft); color: var(--warn); }
.tcard.over::before { background: var(--bad); } .tcard.over { border-color: var(--bad); animation: pulse 1.2s infinite; } .tcard.over .tcard-state { background: var(--bad); color: #fff; }
.tcard.over .tcard-timer { color: var(--bad); }
.tcard.maint { opacity: .7; } .tcard.maint::before { background: var(--muted); } .tcard.maint .tcard-state { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--bad-soft); } }
.walkin-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.walkin { display: flex; gap: .4rem; align-items: center; padding: .35rem .45rem .35rem .9rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.walkin a { display: flex; gap: .5rem; align-items: center; color: var(--text); text-decoration: none; }
.walkin-x { border: 0; background: var(--bad-soft); color: var(--bad); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 1.15rem; line-height: 1; }

/* ---------- bill page ---------- */
.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.bill-main { position: sticky; top: 76px; }
.bill-top { display: flex; gap: .6rem; align-items: flex-start; }
.bill-title h2 { margin: 0; }
.timer-box { display: flex; justify-content: space-between; gap: 1rem; background: linear-gradient(135deg, var(--felt), var(--felt-2)); color: #fff; border-radius: 14px; padding: 1rem 1.2rem; margin: 1rem 0 .8rem; }
.timer-box .muted { color: #a9cbbd; }
.timer-label { font-size: .8rem; color: #a9cbbd; }
.timer { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer-amount { text-align: right; }
.timer-amount .amount { font-size: 1.6rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.timer-box.paused .timer { color: #c9b6f5; }
.timer-box.warn { background: linear-gradient(135deg, #7a4d07, var(--warn)); }
.timer-box.over { background: linear-gradient(135deg, #7a1a15, var(--bad)); animation: pulse 1.2s infinite; }
.controls { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.light-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.light-switch button { border: 0; background: var(--surface); padding: .5rem .7rem; font: inherit; font-size: .85rem; cursor: pointer; color: var(--muted); display: inline-flex; gap: .3rem; align-items: center; }
.light-switch button.on { background: var(--gold); color: #2b1d00; font-weight: 700; }
.light-switch.sm button { padding: .25rem .5rem; font-size: .78rem; }
.items-head { display: flex; justify-content: space-between; align-items: center; }
.items { border: 1px solid var(--border); border-radius: 12px; margin-bottom: .8rem; min-height: 60px; }
.item { display: grid; grid-template-columns: 1fr auto auto; gap: .6rem; align-items: center; padding: .55rem .7rem; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item-name small { display: block; color: var(--muted); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; }
.qty button { width: 30px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--text); display: grid; place-items: center; border-radius: 50%; }
.qty button:hover { background: var(--surface-2); }
.qty span { min-width: 28px; text-align: center; font-weight: 700; }
.item-amt { font-weight: 700; min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }
.items-empty { padding: 1rem; text-align: center; color: var(--muted); }
.totals { display: grid; gap: .25rem; padding: .3rem .2rem .8rem; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 1.35rem; font-weight: 800; border-top: 2px dashed var(--border); padding-top: .4rem; margin-top: .2rem; }
.totals.big .grand { font-size: 1.6rem; color: var(--primary); }
.bill-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.picker-search { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 12px; padding: 0 .8rem; margin-bottom: .8rem; }
.picker-search input { border: 0; box-shadow: none !important; padding: .7rem 0; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .55rem; max-height: calc(100vh - 260px); overflow-y: auto; padding: 2px; }
.prod { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .7rem .75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  font: inherit; color: var(--text); cursor: pointer; text-align: left; min-height: 82px; transition: border-color .12s, transform .05s; }
.prod:hover { border-color: var(--primary); }
.prod:active { transform: scale(.97); }
.prod.flash { border-color: var(--primary); background: var(--primary-soft); }
.prod.out { opacity: .5; }
.prod-name { font-weight: 600; line-height: 1.3; font-size: .92rem; }
.prod-price { color: var(--primary); font-weight: 700; margin-top: auto; }
.prod-stock { font-size: .74rem; color: var(--muted); }
.prod-stock.low { color: var(--bad); font-weight: 600; }
.move-list { display: grid; gap: .4rem; margin-bottom: .6rem; }
.move-list .btn { justify-content: space-between; }

/* ---------- checkout ---------- */
.checkout-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--felt); color: #fff; padding: .9rem 1.1rem; border-radius: 12px; margin-bottom: .8rem; }
.pay-total b { font-size: 1.9rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.pay-tbl input { font-size: 1.05rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pay-sum { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .4rem 0; }
.pay-sum div { background: var(--surface-2); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.pay-sum span { color: var(--muted); font-size: .85rem; }
.pay-sum b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pay-sum .is-change { background: var(--ok-soft); } .pay-sum .is-change b { color: var(--ok); }
.pay-sum .is-short { background: var(--bad-soft); } .pay-sum .is-short b { color: var(--bad); }
.qr-box { margin: .6rem 0; } .qr-box summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.qr-box img { max-width: 240px; display: block; margin: .6rem auto; border-radius: 10px; background: #fff; padding: 6px; }
.done-banner { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; border-color: var(--ok); }
.done-banner h2 { margin: 0; } .done-banner .change { font-size: 1.3rem; margin: .2rem 0 0; } .done-banner .change b { color: var(--ok); font-size: 1.6rem; }
.done-banner .row-gap { margin-left: auto; }

/* ---------- misc pages ---------- */
.rate-card .grid2 label { margin-bottom: .5rem; }
.periods { display: grid; gap: .4rem; margin: .3rem 0 .7rem; }
.period-row { display: grid; grid-template-columns: 1fr auto 1fr 1.2fr auto; gap: .35rem; align-items: center; }
.period-row input { padding: .4rem .5rem; }
.upload-box { border: 1px dashed var(--border); border-radius: 12px; padding: .7rem; margin-bottom: .8rem; font-size: .85rem; color: var(--muted); }
.upload-box img { display: block; max-height: 90px; max-width: 100%; margin: .4rem 0; border-radius: 8px; background: #fff; }
.sub-card { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: center; justify-content: space-between; }
.info-card ol { margin: 0 0 .6rem; padding-left: 1.3rem; } .info-card li { margin-bottom: .25rem; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.plan { text-align: center; } .plan-price { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.fb-reply { background: var(--primary-soft); border-radius: 10px; padding: .6rem .8rem; }
.fb p { margin: .5rem 0; } .fb textarea { margin: .3rem 0 .5rem; }
.stars { display: inline-flex; flex-direction: row-reverse; gap: .1rem; }
.stars input { display: none; }
.stars label { font-size: 1.8rem; color: var(--border); cursor: pointer; margin: 0; line-height: 1; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--gold); }

/* bar chart (single series, hover tooltip) */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 210px; padding: 8px 0 26px; border-bottom: 1px solid var(--border); position: relative; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; outline: none; min-width: 4px; }
.bar { background: var(--primary); border-radius: 4px 4px 0 0; min-height: 0; transition: opacity .12s; }
.bars:hover .bar { opacity: .55; }
.bar-col:hover .bar, .bar-col:focus .bar { opacity: 1; }
.bar-x { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.bar-col:hover::after, .bar-col:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: .78rem; padding: .3rem .55rem; border-radius: 7px; white-space: nowrap; z-index: 5; pointer-events: none; box-shadow: var(--shadow); }
.bar-col:first-child:hover::after { left: 0; transform: none; } .bar-col:last-child:hover::after { left: auto; right: 0; transform: none; }

/* ---------- realistic pool/snooker table cards ---------- */
.pt-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.7rem 1.2rem; padding-top: 16px; }
.ptable { position: relative; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; transition: transform .18s ease; }
.ptable:hover { transform: translateY(-3px); }
.ptable:focus-visible { outline: 3px solid var(--gold); outline-offset: 5px; border-radius: 22px; }
.pt-rail {
  --rail-shadow: inset 0 2px 0 rgba(255,255,255,.2), inset 0 -3px 7px rgba(0,0,0,.5), 0 12px 26px rgba(0,0,0,.28), 0 2px 4px rgba(0,0,0,.25);
  position: relative; border-radius: 20px; padding: 10px 14px 9px;
  background-image: repeating-linear-gradient(97deg, rgba(255,255,255,.035) 0 2px, transparent 2px 7px, rgba(0,0,0,.05) 7px 8px, transparent 8px 13px),
                    linear-gradient(160deg, #8a5329 0%, #643a19 42%, #43250e 100%);
  box-shadow: var(--rail-shadow); transition: box-shadow .3s;
}
.pt-head { display: flex; align-items: center; gap: .5rem; color: #f3e3c3; margin: 0 2px 8px; min-height: 28px; }
.pt-plate { background: linear-gradient(180deg, #f8e19a, #c99530 60%, #a8771c); color: #3a2405; font-weight: 800; padding: .08rem .65rem; border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 1px 2px rgba(0,0,0,.5); font-size: 1rem; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.pt-kind { font-size: .74rem; opacity: .75; white-space: nowrap; }
.pt-state { margin-left: auto; font-size: .74rem; font-weight: 700; padding: .18em .7em; border-radius: 999px; background: rgba(255,255,255,.16); color: #e6f7ee; white-space: nowrap; }
.pt-cushion { position: relative; padding: 9px; border-radius: 10px; background: linear-gradient(180deg, #0f6a3b, #0a4f2b);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.28), inset 0 3px 7px rgba(0,0,0,.5); }
.kind-pool .pt-cushion, .kind-carom .pt-cushion { background: linear-gradient(180deg, #1c5f9c, #134476); }
.pt-felt { position: relative; aspect-ratio: 2 / 1; border-radius: 4px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #22a35b 0%, #14803f 52%, #0b5c2f 100%);
  box-shadow: inset 0 0 18px rgba(0,0,0,.45); transition: filter .5s ease; }
.kind-pool .pt-felt, .kind-carom .pt-felt { background: radial-gradient(ellipse at 50% 45%, #3591da 0%, #1f6fb5 52%, #154f87 100%); }
.pt-felt::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(ellipse 62% 80% at 50% 50%, rgba(255,247,210,.32), rgba(255,247,210,.08) 55%, transparent 75%); }
.lamp-on .pt-felt::after { opacity: 1; }
.felt-svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 1px .8px rgba(0,0,0,.55)); transition: opacity .5s; }
.felt-line { stroke: rgba(255,255,255,.5); stroke-width: .45; }
.felt-spot { fill: rgba(255,255,255,.6); }
.felt-dots circle { fill: rgba(255,255,255,.75); }
.pk { position: absolute; width: 19px; height: 19px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 50% 42%, #000 52%, #1e1e1e 66%, #b88a3e 69%, #7a5320 82%, #4a300f 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.6); }
.pk.tl { left: -3px; top: -3px; } .pk.tr { right: -3px; top: -3px; } .pk.bl { left: -3px; bottom: -3px; } .pk.br { right: -3px; bottom: -3px; }
.pk.tm { left: 50%; top: -5px; transform: translateX(-50%); } .pk.bm { left: 50%; bottom: -5px; transform: translateX(-50%); }
.pt-center { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 5px; z-index: 1; }
.pt-clock { display: flex; align-items: center; gap: .45rem; background: rgba(4,18,11,.66); color: #fff; padding: .2rem .95rem; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16); box-shadow: 0 6px 16px rgba(0,0,0,.35); backdrop-filter: blur(2px); }
.pt-timer { font-family: "SNK Latin", var(--font); font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .5px; line-height: 1.25; }
.pt-pause svg { width: 18px; height: 18px; display: block; color: #cdb8ff; }
.pt-amount { background: rgba(0,0,0,.58); color: #ffd36b; font-weight: 800; padding: .05rem .65rem; border-radius: 8px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.pt-cta { display: inline-flex; align-items: center; gap: .45rem; background: rgba(255,255,255,.94); color: #0b5a2f; font-weight: 800; padding: .45rem 1.05rem;
  border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: transform .18s, background .18s; }
.kind-pool .pt-cta, .kind-carom .pt-cta { color: #154f87; }
.pt-cta svg { width: 17px; height: 17px; }
.pt-cta.muted { background: rgba(0,0,0,.55); color: #ddd; }
.ptable:hover .pt-cta { transform: scale(1.07); }
.pt-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; color: #f0dfbf; font-size: .82rem; margin: 8px 4px 0; min-height: 22px; }
.pt-cust { font-weight: 700; color: #fff; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-rate { opacity: .85; font-variant-numeric: tabular-nums; }
.pt-bulb { color: #6b5a44; font-size: .9rem; } .pt-bulb.on { color: #ffd54a; text-shadow: 0 0 8px #ffd54a; }
/* overhead lamp */
.pt-lamp { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); display: flex; gap: 22%; width: 62%; justify-content: center; z-index: 3; pointer-events: none; }
.pt-lamp i { display: block; width: 46px; height: 9px; border-radius: 3px 3px 12px 12px; background: linear-gradient(180deg, #4a4a4a, #222); box-shadow: 0 2px 3px rgba(0,0,0,.4); position: relative; }
.pt-lamp i::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: -2px; height: 3px; border-radius: 3px; background: #555; transition: all .4s; }
.lamp-on .pt-lamp i::after { background: #fff4c2; box-shadow: 0 0 10px 3px rgba(255,226,130,.9), 0 6px 22px 6px rgba(255,226,130,.45); }
/* states */
.is-free .pt-felt { filter: saturate(.6) brightness(.74); }
.is-free .felt-svg { opacity: .55; }
.is-free:hover .pt-felt { filter: saturate(.85) brightness(.9); }
.is-busy .pt-state { background: #2563eb; color: #fff; }
.is-busy.is-fixed .pt-state { background: #0d9488; }
.is-paused .pt-state { background: var(--paused); color: #fff; }
.is-paused .pt-felt { filter: saturate(.7) brightness(.82); }
.is-paused .pt-timer { color: #dccbff; }
.is-warn .pt-rail { box-shadow: var(--rail-shadow), 0 0 0 3px #f5a524, 0 0 26px rgba(245,165,36,.55); }
.is-warn .pt-state { background: #f5a524; color: #2b1d00; }
.is-over .pt-rail { animation: ptPulse 1.1s ease-in-out infinite; }
.is-over .pt-state { background: #dc2626; color: #fff; }
.is-over .pt-timer { color: #ff9b91; }
@keyframes ptPulse { 0%, 100% { box-shadow: var(--rail-shadow), 0 0 0 3px #dc2626; } 50% { box-shadow: var(--rail-shadow), 0 0 0 6px rgba(220,38,38,.45), 0 0 32px rgba(220,38,38,.65); } }
.is-maint .pt-felt { filter: grayscale(.85) brightness(.55); }
.is-maint .pt-felt::before { content: ""; position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(45deg, rgba(0,0,0,.28) 0 10px, transparent 10px 20px); }
@media (prefers-reduced-motion: reduce) { .is-over .pt-rail { animation: none; box-shadow: var(--rail-shadow), 0 0 0 4px #dc2626; } .ptable, .ptable:hover { transform: none; } }

/* ---------- language switcher ---------- */
.lang-switch { position: relative; }
.lang-btn { display: flex; gap: .4rem; align-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .32rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; color: var(--text); }
.lang-btn:hover { border-color: var(--primary); }
.lang-code { font-weight: 800; color: var(--primary); }
.lang-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .3rem; min-width: 180px; display: none; z-index: 60; }
.lang-switch.open .lang-menu { display: block; }
.lang-menu a { display: flex; gap: .6rem; align-items: center; padding: .5rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.lang-menu a:hover { background: var(--surface-2); text-decoration: none; }
.lang-menu a.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.lang-menu b { min-width: 26px; color: var(--muted); }
.auth-top { display: flex; justify-content: flex-end; margin-bottom: .4rem; }
.on-dark .lang-btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.on-dark .lang-code { color: var(--gold); }
@media (max-width: 640px) { .lang-name { display: none; } .pt-grid { grid-template-columns: 1fr; } .pt-timer { font-size: 1.6rem; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .bill-layout, .checkout-layout { grid-template-columns: 1fr; }
  .bill-main { position: static; }
  .prod-grid { max-height: none; }
  .page-grid, .page-grid.wide-aside { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: min(280px, 86vw); transform: translateX(-105%); transition: transform .24s ease; box-shadow: var(--shadow-lg); z-index: 60; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); z-index: 55; cursor: pointer; }
  body.nav-open { overflow: hidden; }
  .sidebar-close { display: inline-grid !important; }
  .only-mobile { display: inline-grid; }
}
@media (max-width: 860px) {
  .topbar { padding: .6rem 1rem; }
  .content { padding: 1rem 1rem 3rem; }
  .clock { display: none; }
}
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .table-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .tcard { min-height: 140px; padding: .75rem .8rem; }
  .tcard-timer { font-size: 1.45rem; }
  .timer { font-size: 2rem; }
  .stat b { font-size: 1.2rem; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg-choice { grid-template-columns: 1fr; }
  .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-inline { min-width: 0; width: 100%; }
  .pay-sum { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 100px 1fr; }
}
@media print {
  .sidebar, .topbar, .btn, .icon-btn, .filters { display: none !important; }
  .card { box-shadow: none; }
}

/* ---------- v1.2: product images ---------- */
.prod { padding: .55rem; align-items: stretch; min-height: 0; gap: .25rem; }
.prod-img { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(160deg, var(--surface), var(--primary-soft)); overflow: hidden; margin-bottom: .2rem; }
.prod-img img { width: 100%; height: 100%; object-fit: contain; padding: 8%; transition: transform .2s; }
.prod-img img[src^="uploads/"] { object-fit: cover; padding: 0; }
.prod:hover .prod-img img { transform: scale(1.06); }
.prod-name { font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.prod-grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); }
.prod-cell { display: flex; align-items: center; gap: .7rem; }
.prod-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: var(--primary-soft); padding: 4px; flex: none; }
.prod-thumb[src^="uploads/"] { object-fit: cover; padding: 0; }
.img-pick { display: flex; gap: 1rem; margin-bottom: .8rem; align-items: flex-start; }
.img-preview { width: 110px; height: 110px; flex: none; border-radius: 16px; background: linear-gradient(160deg, var(--surface-2), var(--primary-soft)); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); }
.img-preview img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.img-preview img[src^="uploads/"], .img-preview img[src^="blob:"] { object-fit: cover; padding: 0; }
.img-pick-body { flex: 1; min-width: 0; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .35rem; }
.icon-opt { margin: 0; cursor: pointer; }
.icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.icon-opt span { display: grid; place-items: center; height: 44px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); }
.icon-opt img { width: 30px; height: 30px; }
.icon-opt input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.icon-none { font-size: 1.2rem; color: var(--muted); }
@media (max-width: 640px) { .img-pick { flex-direction: column; } .img-preview { width: 90px; height: 90px; } }

/* ---------- reports ---------- */
.rep-tabs { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: .8rem; scrollbar-width: thin; }
.rep-tabs a { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .55rem .95rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; }
.rep-tabs a:hover { border-color: var(--primary); text-decoration: none; }
.rep-tabs a.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent); }
.rep-filters .grow { flex: 1; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .1rem; position: relative; }
.kpi > span { color: var(--muted); font-size: .82rem; }
.kpi b { font-size: 1.4rem; font-variant-numeric: tabular-nums; line-height: 1.3; }
.kpi small { color: var(--muted); font-size: .76rem; }
.kpi-main { background: linear-gradient(135deg, var(--felt), var(--primary)); color: #fff; border-color: transparent; }
.kpi-main > span, .kpi-main small { color: #cfe8dc; }
.kpi-profit { border-color: var(--ok); background: var(--ok-soft); }
.kpi-profit b { color: var(--ok); }
.kpi-profit.neg { border-color: var(--bad); background: var(--bad-soft); } .kpi-profit.neg b { color: var(--bad); }
.kpi-warn { border-color: var(--warn); background: var(--warn-soft); }
.delta { position: absolute; top: .7rem; right: .8rem; font-size: .74rem; font-weight: 700; padding: .1em .5em; border-radius: 999px; }
.delta.up { background: rgba(52,192,122,.18); color: #0f8a4f; } .delta.down { background: rgba(239,107,99,.18); color: #c2362f; }
.kpi-main .delta.up { background: rgba(255,255,255,.18); color: #b9f5d4; } .kpi-main .delta.down { background: rgba(255,255,255,.18); color: #ffd2cf; }
.hbars { display: grid; gap: .55rem; }
.hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: .6rem; align-items: center; font-size: .88rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.card-pad { padding: 1rem 1.2rem 0; }
.chart-empty { padding: 3rem 0; }
.print-head { display: none; }
@media print {
  .rep-tabs, .rep-filters, .toast, .announce { display: none !important; }
  .print-head { display: block; margin-bottom: .6rem; font-size: 1rem; }
  .content { padding: 0; max-width: none; }
  .kpi, .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; color: #000; }
  .bar-col::after { display: none; }
}

/* ---------- promotions ---------- */
.promo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.promo-card { border-left: 4px solid var(--gold); margin: 0; }
.promo-card h3 { margin: 0; }
.promo-sum { margin: .5rem 0; font-weight: 600; }
.promo-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; }
.promo-code { font-family: Consolas, monospace; background: var(--gold-soft); color: var(--warn); padding: .1em .5em; border-radius: 6px; font-weight: 700; letter-spacing: 1px; }
.promo-box { background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: 12px; padding: .7rem .8rem .3rem; margin: .4rem 0 .8rem; }
.promo-line { color: var(--warn); font-weight: 600; }
.tbl tr.promo-row td { color: var(--warn); }
.fs { border: 1px solid var(--border); border-radius: 12px; padding: .6rem .9rem .2rem; margin: 0 0 .8rem; }
.fs legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
.day-picks { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-bottom: .6rem; }
.day-picks label { margin: 0; }

/* ---------- shifts ---------- */
.shift-open { margin: 1rem auto; text-align: left; }
.count-tbl input { text-align: right; font-weight: 600; }
.dash-banners { display: grid; gap: .5rem; margin-bottom: .8rem; }
.dash-banner { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .65rem .9rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.dash-banner.warn { background: var(--warn-soft); border-color: var(--warn); }
.dash-banner.info { background: var(--info-soft); border-color: var(--info); }
.dash-banner .grow { flex: 1; }

/* ---------- mobile fixes (v1.2) ---------- */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .main { min-width: 0; width: 100%; }
  .table-grid.pt-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .dash-head { flex-direction: column; align-items: stretch; gap: .4rem; }
  .dash-actions .btn { width: 100%; }
  .topbar h1 { font-size: 1.05rem; }
  .rep-filters .btn { flex: 1; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 1.15rem; }
  .hbar { grid-template-columns: minmax(70px, 30%) 1fr auto; }
}


/* ---------- sidebar: close button + desktop icon-only mode ---------- */
.sidebar-close { display: none; margin-left: auto; color: #cfe2d9; }
.sidebar-close:hover { background: rgba(255,255,255,.1); color: #fff; }
@media (min-width: 1025px) {
  .sidebar { transition: width .2s ease; }
  html.nav-mini .sidebar { width: 72px; }
  html.nav-mini .brand { justify-content: center; padding: 1.1rem .5rem; }
  html.nav-mini .brand-text, html.nav-mini .nav a span, html.nav-mini .nav-foot span { display: none; }
  html.nav-mini .nav a, html.nav-mini .nav-foot a, html.nav-mini .nav-foot button { justify-content: center; padding: .7rem 0; }
  html.nav-mini .nav a .ic, html.nav-mini .nav-foot .ic { width: 1.3em; height: 1.3em; }
}

/* ---------- v1.3: reservations ---------- */
.resv-timeline { overflow-x: auto; }
.resv-tl { min-width: 640px; }
.tl-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; min-height: 40px; border-bottom: 1px dashed var(--border); }
.tl-head { min-height: 26px; border-bottom: 1px solid var(--border); }
.tl-name { font-weight: 600; font-size: .9rem; padding-right: .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 100%; min-height: 34px; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 14 - 1px), var(--surface-2) calc(100% / 14 - 1px) calc(100% / 14)); }
.tl-head .tl-track { background: none; }
.tl-hour { position: absolute; top: 4px; font-size: .72rem; color: var(--muted); transform: translateX(-50%); }
.tl-block { position: absolute; top: 5px; bottom: 5px; border-radius: 8px; padding: 0 .45rem; font-size: .76rem; font-weight: 600; color: #fff; background: var(--info);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.tl-block.st-arrived { background: var(--ok); }
.tl-block.st-noshow { background: var(--bad); opacity: .7; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; }
.resv-card { display: flex; gap: 1rem; align-items: flex-start; border-left: 4px solid var(--info); margin-bottom: .7rem; }
.resv-card.st-arrived { border-left-color: var(--ok); }
.resv-card.st-cancelled, .resv-card.st-noshow { border-left-color: var(--muted); opacity: .7; }
.resv-time { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: .35rem .5rem; border-radius: 10px; background: var(--info-soft); color: var(--info); }
.resv-time b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.resv-time small { font-size: .72rem; }
.resv-body { flex: 1; min-width: 0; }
.resv-name { font-size: 1.05rem; }
.up-resv { display: block; padding: .5rem .6rem; border-radius: 10px; color: var(--text); text-decoration: none; border: 1px solid var(--border); margin-bottom: .4rem; }
.up-resv:hover { border-color: var(--primary); text-decoration: none; }
.resv-note { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--info-soft); color: var(--info); border-radius: 10px; padding: .55rem .7rem; margin-bottom: .6rem; }
.resv-note span { flex: 1; font-weight: 600; }
.pt-resv { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 2; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
  background: rgba(37,99,235,.92); color: #fff; font-size: .74rem; font-weight: 700; padding: .12rem .6rem; border-radius: 999px; box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.ptable.resv-soon .pt-rail { box-shadow: var(--rail-shadow), 0 0 0 3px #3b82f6, 0 0 22px rgba(59,130,246,.55); }
.ptable.is-busy .pt-resv, .ptable.is-paused .pt-resv { background: rgba(217,119,6,.92); }

/* ---------- v1.3: member account (debt / points) ---------- */
.pts-badge { color: var(--gold); font-weight: 700; }
.member-acc { border: 1px solid var(--border); border-radius: 12px; padding: .7rem .8rem .2rem; margin: .4rem 0 .6rem; background: var(--surface-2); }
.acc-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.acc-head .muted { margin-left: auto; }
.member-acc label small { display: block; margin-top: .2rem; }
.acc-line { display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border-radius: 10px; margin: .3rem 0 .6rem; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.acc-line b { margin-left: auto; }
.text-gold { color: var(--gold); }

/* ---------- v1.4: SA shop/marketing report ---------- */
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; margin-bottom: 1rem; align-items: start; }
.insight { display: flex; gap: .8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.insight > div { display: flex; flex-direction: column; min-width: 0; }
.insight small { color: var(--muted); font-size: .8rem; }
.insight b { font-size: 1.2rem; line-height: 1.35; }
.ins-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.insight.opp { border-color: var(--gold); background: var(--gold-soft); }
.insight.opp .ins-ic { background: var(--gold); color: #2b1d00; }
.heat-cell { background: color-mix(in srgb, var(--primary) calc(var(--h) * 85%), transparent); font-weight: 700; }
.tips { margin: 0; padding-left: 1.2rem; } .tips li { margin-bottom: .35rem; }
