/*
 * Poker Engine backoffice. Same look as the lotto backoffice: navy sidebar, frosted glass panels, glossy 3D icon
 * chips, Inter for text and Kanit for figures and the wordmark. Fonts come from this server only (strict CSP).
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Kanit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/kanit-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Kanit";
  font-style: italic;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/kanit-latin-800-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --canvas: #f3f5f9;
  --line: #e6eaf0;
  --line-soft: #eef2f7;
  --ink: #0f172a;
  --body: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --brand: #2f6bff;
  --brand-dark: #1a4fe6;
  --brand-soft: #eaf0ff;
  --gold: #f5b62a;
  --gold-light: #ffd166;
  --sans: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display: "Kanit", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 232px;
  /* Phones get a tighter type scale so screens do not look zoomed in; spacing and tap targets stay the same. */
  --fs: 1;
}
@media (max-width: 639.98px) {
  :root { --fs: 0.88; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: calc(14px * var(--fs));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
p, h1, h2, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ───────── background glow ───────── */
.blobs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.blobs span { position: absolute; border-radius: 50%; }
.blobs span:nth-child(1) { top: -192px; right: -160px; width: 620px; height: 620px; background: radial-gradient(circle, rgba(47, 107, 255, 0.24) 0%, rgba(47, 107, 255, 0) 65%); }
.blobs span:nth-child(2) { top: 38%; left: -192px; width: 560px; height: 560px; background: radial-gradient(circle, rgba(245, 182, 42, 0.2) 0%, rgba(245, 182, 42, 0) 65%); }
.blobs span:nth-child(3) { bottom: -224px; right: 18%; width: 540px; height: 540px; background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, rgba(124, 58, 237, 0) 65%); }

/* ───────── sidebar ───────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: clamp(210px, 55vw, 280px);
  display: flex;
  flex-direction: column;
  color: #e6ecf8;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease);
  background:
    radial-gradient(120% 38% at 0% 0%, rgba(47, 107, 255, 0.28) 0%, rgba(47, 107, 255, 0) 70%),
    radial-gradient(90% 28% at 100% 100%, rgba(245, 182, 42, 0.14) 0%, rgba(245, 182, 42, 0) 70%),
    linear-gradient(180deg, #0f1a33 0%, #0b1429 100%);
}
.sidebar.is-open { transform: none; box-shadow: 16px 0 48px rgba(2, 6, 23, 0.35); }

.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 64px; padding: 0 16px; margin: 0 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sb-brand { display: flex; flex-direction: column; min-width: 0; line-height: 1; }
.wordmark { font-family: var(--display); font-weight: 800; font-style: italic; letter-spacing: 0.02em; font-size: calc(17px * var(--fs)); color: #fff; }
.gold-text { padding-right: 4px; background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sb-tagline { display: none; margin-top: 4px; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.24em; color: #8b9ab8; }
.sb-close { width: 32px; height: 32px; margin-right: -6px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: #aab6cc; }
.sb-close:hover { background: rgba(255, 255, 255, 0.1); }

.sb-nav { flex: 1; overflow-y: auto; padding: 16px 10px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.sb-label { padding: 0 8px; margin-bottom: 8px; font-size: max(9.5px, calc(10px * var(--fs))); font-weight: 600; text-transform: uppercase; letter-spacing: 0.18em; color: #5f6f8f; }
.sb-link { width: 100%; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px; border-radius: 12px; font-size: calc(13.5px * var(--fs)); font-weight: 600; text-align: left; transition: background-color 0.15s; }
.sb-link:hover { background: rgba(255, 255, 255, 0.05); }
.sb-link.is-active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sb-ico { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: rgba(255, 255, 255, 0.07); color: #fff; }
.sb-link.is-active .sb-ico { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: 0 6px 16px -4px rgba(47, 107, 255, 0.7); }
.sb-group { margin-top: 4px; }
.sb-grow { flex: 1; }
.sb-chev { color: #8b9ab8; transition: transform 0.2s; }
.sb-toggle[aria-expanded="true"] .sb-chev { transform: rotate(90deg); }
.sb-toggle[aria-expanded="false"] + .sb-list { display: none; }
.sb-list { position: relative; margin: 2px 0 8px 24px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.1); }
.sb-list li { position: relative; }
.sb-dot { position: absolute; left: -16.5px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2); background: #0d1830; transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s; }
.sb-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 10px; border-radius: 9px; font-size: calc(13px * var(--fs)); color: #aab6cc; transition: background-color 0.15s, color 0.15s; }
.sb-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.sb-item.is-active { background: rgba(255, 255, 255, 0.08); color: #fff; font-weight: 600; }
.sb-item.is-active .sb-dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(245, 182, 42, 0.8); }
.sb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-code { flex-shrink: 0; font-size: max(9.5px, calc(11px * var(--fs))); font-weight: 600; letter-spacing: 0.025em; color: #5f6f8f; }
.sb-item.is-active .sb-code { color: var(--gold); }

.sb-foot { display: flex; align-items: center; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, 0.1); background: rgba(2, 6, 23, 0.25); }
.sb-who { min-width: 0; flex: 1; }
.sb-name { font-size: calc(13px * var(--fs)); font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-status { display: flex; align-items: center; gap: 4px; font-size: max(9.5px, calc(11px * var(--fs))); color: #8b9ab8; white-space: nowrap; overflow: hidden; }
.status-dot { width: 6px; height: 6px; margin-right: 2px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-dot.is-off { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.avatar { flex-shrink: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--gold)); color: #fff; font-family: var(--display); font-weight: 800; font-style: italic; font-size: calc(16px * var(--fs)); }
.avatar-sm { box-shadow: 0 6px 14px -6px rgba(47, 107, 255, 0.8); }

.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(11, 20, 41, 0.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade-in 0.2s ease-out; }

/* ───────── shell + top bar ───────── */
.shell { position: relative; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; background: rgba(255, 255, 255, 0.85); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { height: 100%; max-width: 1600px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; color: var(--muted); transition: background-color 0.15s, color 0.15s; }
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.menu-btn { margin-left: -8px; color: var(--ink); }
.topbar-mark { font-family: var(--display); font-weight: 800; font-style: italic; font-size: calc(17px * var(--fs)); letter-spacing: 0.02em; color: var(--ink); }
.topbar-mark span { color: var(--brand); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.clock { display: none; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 10px; background: #f1f5f9; font-size: calc(12.5px * var(--fs)); color: var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ping { position: relative; display: flex; width: 8px; height: 8px; }
.ping span { position: absolute; inset: 0; border-radius: 50%; background: #22c55e; }
.ping span:first-child { opacity: 0.6; animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
.clock-day { color: var(--muted); }
.clock-time { font-weight: 600; color: var(--ink); }
.clock-zone { font-size: max(9.5px, calc(10.5px * var(--fs))); font-weight: 700; letter-spacing: 0.08em; color: var(--faint); }

/* Recessed glass track for the language switch; the active button is the raised thumb. */
.toggle-track {
  position: relative;
  padding: 3px;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.75) 0%, rgba(241, 245, 249, 0.6) 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(15, 23, 42, 0.05), 0 1px 0 rgba(255, 255, 255, 0.9);
}
.lang { display: flex; align-items: center; gap: 2px; }
.lang-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 8px; font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.lang-btn:hover { color: var(--ink); }
.lang-btn[aria-pressed="true"] { background: linear-gradient(180deg, #fff 0%, #f3f6fb 100%); color: var(--ink); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.16); }
.flag { width: 18px; height: 13px; flex-shrink: 0; overflow: hidden; border-radius: 3px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18); opacity: 0.7; transition: opacity 0.2s; }
.flag svg { width: 100%; height: 100%; }
.lang-btn[aria-pressed="true"] .flag { opacity: 1; }
.lang-short { display: none; }

.admin-menu { position: relative; }
.admin-btn { display: flex; align-items: center; gap: 10px; padding: 2px; border-radius: 12px; transition: background-color 0.15s; }
.admin-btn:hover { background: rgba(255, 255, 255, 0.6); }
.admin-who { display: none; text-align: right; line-height: 1.25; }
.admin-name { display: block; font-size: calc(13px * var(--fs)); font-weight: 600; color: var(--ink); }
.admin-role { display: block; font-size: calc(11.5px * var(--fs)); color: var(--muted); }
.admin-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(288px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(15, 23, 42, 0.06), 0 18px 40px -12px rgba(15, 23, 42, 0.35);
  animation: pop-in 0.22s var(--ease);
}
.admin-pop-name { font-size: calc(14px * var(--fs)); font-weight: 600; }
.admin-pop-note { margin-top: 4px; font-size: calc(12.5px * var(--fs)); color: var(--muted); }
.btn-danger-text { width: 100%; margin-top: 16px; color: #dc2626; }
.btn-danger-text:hover { background: #fef2f2; border-color: #fecaca; }

/* ───────── page ───────── */
.main { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 16px 16px 20px; }
.app { display: flex; flex-direction: column; gap: 20px; }
.crumbs { font-size: calc(12px * var(--fs)); font-weight: 500; }
.crumb-current { font-weight: 600; }
.page-title { margin-top: 6px; font-size: calc(22px * var(--fs)); font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
.page-sub { margin-top: 4px; max-width: 42rem; font-size: calc(13.5px * var(--fs)); color: var(--muted); }

.ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ranges-label { display: none; margin-right: 4px; font-size: calc(12px * var(--fs)); color: var(--muted); }
.range { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.7); font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); transition: color 0.15s, border-color 0.15s; }
.range:hover { color: var(--ink); border-color: #cfd8e6; }
.range[aria-pressed="true"] { border-color: transparent; background: linear-gradient(180deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: 0 6px 14px -8px rgba(47, 107, 255, 0.9); }

/* Frosted glass surface: translucent white, blurred backdrop, top bevel highlight, soft layered drop shadow. */
.panel {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.68) 100%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(15, 23, 42, 0.04),
    0 0 0 1px rgba(15, 23, 42, 0.045),
    0 2px 4px rgba(15, 23, 42, 0.04),
    0 14px 32px -16px rgba(15, 23, 42, 0.22);
}

/* Raised card that lifts toward the viewer on hover, with a glossy sheen across the top half. */
.card-3d { isolation: isolate; overflow: hidden; transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease); }
.card-3d::before {
  content: "";
  position: absolute;
  inset: 0 0 50% 0;
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: -1;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card-3d:hover {
    transform: translateY(-4px);
    box-shadow:
      inset 0 1px 0 #fff,
      inset 0 -1px 0 rgba(15, 23, 42, 0.04),
      0 0 0 1px rgba(15, 23, 42, 0.05),
      0 6px 12px -4px rgba(15, 23, 42, 0.08),
      0 26px 48px -20px rgba(30, 58, 138, 0.35);
  }
}

/* Range figures: 2 columns on phones (last one full width), 3 on laptops, 5 in a row on wide screens. */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stats > :last-child { grid-column: span 2; }
/* Live figures ignore the date range: two by two, then four in a row on wide screens. */
.stats-live { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.stat { padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.stat-body { position: relative; min-width: 0; width: 100%; }
.label-caps { font-size: max(9.5px, calc(11px * var(--fs))); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { margin-top: 4px; font-family: var(--display); font-weight: 600; font-size: calc(20px * var(--fs)); line-height: 1; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value.is-loading { color: var(--line); }
.stat-hint { margin-top: 6px; min-height: 1.5em; font-size: calc(12px * var(--fs)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Glossy gem-like icon chip: the tone sets the gradient and glow, the bevel and gloss come from here. */
.chip-3d {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -3px 6px rgba(0, 0, 0, 0.18), 0 10px 20px -8px var(--glow, rgba(47, 107, 255, 0.6));
}
.chip-3d::after { content: ""; position: absolute; left: 10%; right: 10%; top: 4%; height: 45%; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)); pointer-events: none; }
.chip-3d > span { position: relative; z-index: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.tone-blue { background: linear-gradient(135deg, #5b8cff, #1a4fe6); --glow: rgba(47, 107, 255, 0.65); }
.tone-gold { background: linear-gradient(135deg, #ffe08a, #f5a524); --glow: rgba(245, 182, 42, 0.7); }
.tone-green { background: linear-gradient(135deg, #4ade80, #15803d); --glow: rgba(22, 163, 74, 0.6); }
.tone-red { background: linear-gradient(135deg, #fb7185, #e11d48); --glow: rgba(225, 29, 72, 0.55); }
.tone-navy { background: linear-gradient(135deg, #3651a8, #0f1a33); --glow: rgba(15, 26, 51, 0.65); }
.tone-slate { background: linear-gradient(135deg, #a3b1c6, #64748b); --glow: rgba(100, 116, 139, 0.55); }

.pos { color: #15803d; }
.neg { color: #dc2626; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; border: 1px solid #fecaca; background: #fef2f2; font-size: calc(13px * var(--fs)); color: #991b1b; }
.alert svg { margin-top: 2px; }
.notice { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-radius: 12px; border: 1px solid; font-size: calc(13px * var(--fs)); }
.notice.is-ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.notice.is-warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.notice-text { flex: 1; display: flex; align-items: flex-start; gap: 10px; }
.notice-icon svg { margin-top: 2px; }
.notice-action { align-self: flex-start; }

/* ───────── buttons + inputs ───────── */
.btn-primary, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: calc(13px * var(--fs)); font-weight: 600; white-space: nowrap; }
.btn-primary {
  background: linear-gradient(180deg, #4a80ff, var(--brand-dark));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 8px 20px -6px rgba(47, 107, 255, 0.6);
  transition: filter 0.15s, transform 0.15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn-secondary { border: 1px solid #d5dce8; background: linear-gradient(180deg, #fff, #f8fafc); color: var(--body); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(15, 23, 42, 0.06); transition: border-color 0.15s, background 0.15s; }
.btn-secondary:hover { border-color: #c3cddc; background: linear-gradient(180deg, #fff, #f1f5f9); }

.input { height: 34px; width: 100%; min-width: 0; padding: 0 12px; border-radius: 9px; border: 1px solid #d5dce8; background: #fff; font-size: calc(13px * var(--fs)); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #c3cddc; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.15); }
.input[aria-invalid="true"] { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }
.field-label { display: block; margin-bottom: 6px; font-size: calc(12.5px * var(--fs)); font-weight: 600; color: var(--body); }

/* ───────── data tables ───────── */
.dt { overflow: hidden; scroll-margin-top: 80px; }
.dt-head { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.dt-title { display: flex; align-items: center; gap: 10px; }
.panel-title { font-size: calc(15px * var(--fs)); font-weight: 600; color: var(--ink); }
.count-pill { height: 24px; min-width: 24px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: #f1f5f9; font-size: calc(11.5px * var(--fs)); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-search { position: relative; display: block; }
.dt-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.dt-search .input { padding-left: 36px; }
.dt-scroll { overflow-x: auto; border-top: 1px solid var(--line-soft); }
.dt-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: calc(13.5px * var(--fs)); }
.dt-table thead tr { background: rgba(241, 245, 249, 0.6); }
.dt-table th { height: 44px; padding: 8px 12px; text-align: left; white-space: nowrap; font-size: max(9.5px, calc(11px * var(--fs))); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.dt-table th:first-child, .dt-table td.idx { width: 48px; padding-left: 20px; }
.dt-table th:last-child, .dt-table td:last-child { padding-right: 20px; }
.dt-table tbody tr { border-top: 1px solid var(--line-soft); transition: background-color 0.15s; }
.dt-table tbody tr:hover { background: rgba(255, 255, 255, 0.7); }
.dt-table td { padding: 14px 12px; color: var(--body); vertical-align: middle; }
.dt-table td.idx { color: var(--faint); font-variant-numeric: tabular-nums; }
.dt-table .right { text-align: right; }
.sort { display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: inherit; font-weight: inherit; text-align: left; transition: color 0.15s; }
.sort:hover, .sort.is-sorted { color: var(--ink); }

.dt-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 16px; }
.dt-empty-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 16px; border: 1px solid #dbe5ff; background: linear-gradient(135deg, var(--brand-soft), #fff); color: var(--brand); }
.dt-empty-title { margin-top: 16px; font-size: calc(15px * var(--fs)); font-weight: 600; color: var(--ink); }
.dt-empty-hint { margin-top: 4px; max-width: 24rem; font-size: calc(13px * var(--fs)); color: var(--muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
.spinner + .dt-empty-hint { margin-top: 16px; }

.dt-foot { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line-soft); font-size: calc(12.5px * var(--fs)); color: var(--muted); }
.dt-foot b { font-weight: 600; color: var(--ink); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: calc(12.5px * var(--fs)); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; transition: background-color 0.15s, color 0.15s; }
.pager button:hover { background: #f1f5f9; color: var(--ink); }
.pager .pg-arrow { border: 1px solid var(--line); }
.pager .pg-arrow:hover { background: #f8fafc; }
.pager .pg-prev svg { transform: rotate(180deg); }
.pager button:disabled { opacity: 0.4; pointer-events: none; }
.pager button[aria-current="page"] { background: linear-gradient(180deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: 0 6px 14px -6px rgba(47, 107, 255, 0.8); }

/* ───────── cells ───────── */
.cell-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.strong { font-weight: 600; color: var(--ink); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.code-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: #f1f5f9; font-family: var(--mono); font-size: calc(12px * var(--fs)); font-weight: 600; letter-spacing: 0.06em; color: var(--ink); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: calc(11.5px * var(--fs)); font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: #e7f8ee; color: #15803d; }
.pill-green::before { background: #22c55e; }
.pill-amber { background: #fff4e0; color: #b45309; }
.pill-amber::before { background: #f59e0b; }
.pill-red { background: #fff1f2; color: #be123c; }
.pill-red::before { background: #f43f5e; }
.pill-slate { background: #f1f5f9; color: #475569; }
.pill-slate::before { background: #94a3b8; }
.pill-blue { background: #eaf0ff; color: #1d4ed8; }
.pill-blue::before { background: var(--brand); }
.pill-violet { background: #f3e8ff; color: #7e22ce; }
.pill-violet::before { background: #a855f7; }
.pill.is-pulse::before { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 6px; font-size: max(9.5px, calc(10.5px * var(--fs))); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.tag-red { background: #fde8e8; color: #b91c1c; }
.tag-amber { background: #fff4e0; color: #b45309; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.online-dot.is-off { background: #cbd5e1; box-shadow: none; }
.cell-stack { display: inline-flex; flex-direction: column; gap: 4px; line-height: 1.25; }
.sub { font-size: calc(11.5px * var(--fs)); color: var(--muted); white-space: nowrap; }
/* Seats taken out of the seats at a table (or a game). */
.occ { display: inline-flex; align-items: center; gap: 8px; }
.occ-bar { width: 64px; height: 6px; overflow: hidden; border-radius: 3px; background: #e2e8f0; }
.occ-bar > span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #5b8cff, var(--brand-dark)); }
/* How the house earns: a rake from player-vs-player pots, or the banker's win/loss. */
.house { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: max(9.5px, calc(11px * var(--fs))); font-weight: 600; white-space: nowrap; }
.house-rake { background: #f3e8ff; color: #7e22ce; }
.house-banker { background: #fff1e6; color: #c2410c; }

.dt-table tbody tr.is-clickable { cursor: pointer; }
.dt-table tbody tr.is-selected { background: rgba(47, 107, 255, 0.07); box-shadow: inset 3px 0 0 var(--brand); }
.dt-table tbody tr.is-selected:hover { background: rgba(47, 107, 255, 0.1); }

/* ───────── seats of the selected table ───────── */
.seats { overflow: hidden; scroll-margin-top: 80px; }
.seat-meta { font-size: calc(12.5px * var(--fs)); color: var(--muted); }
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; padding: 0 16px 16px; }
.seat-none { grid-column: 1 / -1; padding: 24px 0; text-align: center; max-width: none; }
.seat-tile { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.72); transition: border-color 0.15s, box-shadow 0.15s; }
.seat-tile.is-turn { border-color: rgba(47, 107, 255, 0.55); box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12); }
.seat-tile.is-open { border-style: dashed; background: rgba(255, 255, 255, 0.35); }
.seat-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.seat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: calc(12.5px * var(--fs)); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ───────── sign in ───────── */
.login { max-width: 420px; margin: 32px auto 0; padding: 28px 24px; display: flex; flex-direction: column; align-items: flex-start; }
.login-chip { margin-bottom: 16px; }
.login-title { font-size: calc(20px * var(--fs)); font-weight: 700; letter-spacing: -0.01em; }
.login-hint { margin-top: 6px; font-size: calc(13px * var(--fs)); color: var(--muted); }
.login-form { width: 100%; margin-top: 20px; display: flex; flex-direction: column; }
.login-error { margin-top: 8px; font-size: calc(12.5px * var(--fs)); color: #dc2626; }
.login-form .btn-primary { width: 100%; margin-top: 16px; }

/* ───────── footer ───────── */
.footer { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); }
.footer-inner { padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; font-size: calc(12px * var(--fs)); }

/* ───────── breakpoints (sm 640, md 768, lg 1024, 2xl 1536) ───────── */
@media (min-width: 640px) {
  .topbar-inner { padding: 0 24px; }
  .topbar-right { gap: 16px; }
  .clock { display: flex; }
  .lang-btn { height: 30px; padding: 0 10px; }
  .lang-short { display: inline; }
  .main { padding: 20px 24px 28px; }
  .app { gap: 24px; }
  .page-title { font-size: calc(26px * var(--fs)); }
  .ranges-label { display: inline; }
  .stats, .stats-live { gap: 16px; }
  .stat { padding: 20px; flex-direction: row; align-items: center; gap: 16px; }
  .chip-3d { width: 48px; height: 48px; }
  .stat-value { font-size: calc(24px * var(--fs)); }
  .notice { flex-direction: row; align-items: center; }
  .notice-action { align-self: auto; }
  .btn-primary, .btn-secondary { height: 36px; padding: 0 16px; }
  .input { height: 36px; }
  .dt-head { padding: 16px 20px; }
  .dt-search { width: 256px; }
  .seat-grid { padding: 0 20px 20px; }
  .dt-foot { flex-direction: row; padding: 14px 20px; }
  .footer { padding-left: 24px; padding-right: 24px; }
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}
@media (min-width: 768px) {
  .admin-btn { padding-left: 8px; }
  .admin-who { display: block; }
}
@media (min-width: 1024px) {
  .sidebar { width: var(--sidebar); transform: none; box-shadow: none; }
  .sb-head { height: 68px; }
  .sb-tagline { display: block; }
  .sb-close, .overlay, .menu-btn, .topbar-mark { display: none; }
  .blobs { left: var(--sidebar); }
  .shell { padding-left: var(--sidebar); }
  .topbar { background: rgba(255, 255, 255, 0.4); -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%); border-bottom-color: rgba(255, 255, 255, 0.6); box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.05); }
  .topbar-inner { padding: 0 32px; }
  .clock { background: rgba(255, 255, 255, 0.5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 1px rgba(15, 23, 42, 0.06); }
  .main { padding: 20px 32px 28px; }
  .dt-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .footer { padding-left: 32px; padding-right: 32px; }
}
/* Laptops: 3 cards on the first row and 2 wider ones on the second, so no row is left with a hole. */
@media (min-width: 1024px) and (max-width: 1535.98px) {
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats > *, .stats > :last-child { grid-column: span 2; }
  .stats > :nth-child(n + 4) { grid-column: span 3; }
}
@media (min-width: 1536px) {
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats > :last-child { grid-column: auto; }
  .stats-live { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
