/* Shared visual tokens. Page modules consume these without changing data or state. */
:root {
  color-scheme:dark;
  font-family:Inter,-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-synthesis:none;
  color:var(--text);
  background:var(--bg);
  --bg:#0b1018;
  --sidebar-bg:#0e1520;
  --surface:#121a26;
  --surface-muted:#0f1722;
  --surface-raised:#1a2636;
  --input-bg:#0d1520;
  --text:#e7edf6;
  --text-secondary:#b4c0d2;
  --muted:#94a3b8;
  --line:#2b3a50;
  --line-soft:#233044;
  --primary:#58a6ff;
  --primary-bg:#172d48;
  --primary-border:#315a87;
  --green:#52c7a0;
  --success-bg:#12332d;
  --success-border:#285948;
  --red:#ff858e;
  --danger-bg:#351e2a;
  --danger-border:#663447;
  --blue:#73b4ff;
  --warning:#edbd69;
  --warning-bg:#342b1d;
  --warning-border:#70552c;
  --on-accent:#07101e;
  --radius:12px;
  --radius-sm:8px;
  --sidebar-width:224px;
  --shadow:0 8px 24px #00000020;
  --font-number:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  scrollbar-color:var(--line) var(--bg);
  scrollbar-width:thin;
}
* {
  box-sizing:border-box
}
body {
  margin:0;
  font-size:13px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased
}
button,input,select {
  font:inherit
}
button,a,input {
  -webkit-tap-highlight-color:transparent
}
button {
  cursor:pointer
}
button:disabled {
  opacity:.5;
  cursor:not-allowed
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible {
  outline:3px solid var(--primary);
  outline-offset:3px
}
[hidden] {
  display:none!important
}
a {
  color:inherit;
  text-decoration:none
}
.sidebar {
  width:var(--sidebar-width);
  background:var(--sidebar-bg);
  color:var(--text);
  position:fixed;
  inset:0 auto 0 0;
  display:flex;
  flex-direction:column;
  padding:22px 16px;
  border-right:1px solid var(--line-soft);
  z-index:40;
  overflow-y:auto
}
.menu-toggle,.sidebar-close { display:none; border:0; background:none; align-items:center; justify-content:center; min-width:44px; min-height:44px; border-radius:7px; font-size:24px }
.menu-toggle {
  display:flex;
  color:var(--muted);
  flex-shrink:0;
}
.sidebar-close {
  display:flex;
  color:var(--muted);
  position:absolute;
  right:10px;
  top:23px;
  font-size:30px;
}
.menu-toggle:hover { background:var(--success-bg) }
.sidebar-close:hover { background:var(--primary-bg) }
.nav-backdrop { position:fixed; inset:0; z-index:30; border:0; padding:0; background:#030711a8 }
.brand {
  display:flex;
  align-items:center;
  gap:11px;
  min-height:44px;
  padding:0 4px;
  font-size:19px;
  font-weight:650;
  letter-spacing:-.4px
}
.brand-icon {
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  border:1px solid var(--primary-border);
  border-radius:10px;
  background:var(--primary-bg);
  font-size:27px;
  color:var(--primary);
  font-weight:600;
  line-height:1
}

.workspace-label {
  margin:30px 12px 12px;
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:10px;
  letter-spacing:1.5px
}

nav {
  display:grid;
  gap:5px
}
.nav-item {
  background:none;
  border:0;
  color:var(--muted);
  text-align:left;
  display:flex;
  align-items:center;
  position:relative;
  gap:12px;
  min-height:44px;
  padding:11px 13px;
  border-radius:8px;
  font-size:13px
}
.nav-item:hover {
  background:var(--primary-bg);
  color:var(--text);
}
.nav-item.active {
  background:var(--primary-bg);
  color:var(--primary);
  box-shadow:inset 3px 0 var(--primary);
  font-weight:600
}
.nav-icon {
  font-size:22px;
  line-height:20px;
  width:22px;
  height:22px;
  flex-shrink:0;
}
svg.nav-icon { flex-shrink:0 }
.nav-dot {
  background:var(--muted);
  width:5px;
  height:5px;
  border-radius:50%;
  margin-left:auto
}
.source-block {
  border-top:1px solid var(--line);
  margin-top:auto;
  padding:22px 10px;
  border-color:var(--line-soft);
}
.small-label {
  font-size:10px;
  color:var(--muted);
  letter-spacing:1px
}
.source-name {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:13px;
  margin-top:14px
}
.source-logo {
  font:600 13px Georgia,serif;
  background:var(--primary-bg);
  border:1px solid var(--line);
  color:var(--primary);
  border-radius:7px;
  padding:11px 8px;
  border-color:var(--primary-border);
}
.source-name small {
  display:block;
  font-size:10px;
  letter-spacing:.5px;
  color:var(--muted);
  margin-top:7px
}

.sidebar-bottom {
  margin-top:0;
  padding:16px 10px 0;
  border-top:1px solid var(--line-soft)
}
.local-badge {
  font-size:11px;
  display:flex;
  align-items:center;
  gap:7px;
  color:var(--muted)
}
.dot {
  display:inline-block;
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--muted);
  flex-shrink:0
}
.local-badge .dot {
  background:var(--green)
}

.main-shell {
  margin-left:var(--sidebar-width);
  min-width:0
}
.nav-collapsed .sidebar { transform:translateX(-100%); visibility:hidden }
.nav-collapsed .main-shell { margin-left:0 }
.topbar-start { display:flex; align-items:center; gap:12px; min-width:0 }
.topbar {
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 28px;
  border-bottom:1px solid var(--line);
  background:var(--bg);
  position:sticky;
  top:0;
  z-index:20
}
.breadcrumb {
  font-size:12px;
  color:var(--muted);
  display:flex;
  align-items:center;
  gap:12px
}
.breadcrumb strong {
  color:var(--text-secondary);
  font-weight:500
}
.topbar-right {
  display:flex;
  align-items:center;
  gap:16px
}
.topbar-divider {
  height:18px;
  width:1px;
  background:var(--line)
}
#clock {
  font-size:11px;
  letter-spacing:1px;
  font-variant-numeric:tabular-nums;
  color:var(--muted)
}
.connection-pill {
  font-size:11px;
  display:flex;
  align-items:center;
  gap:7px;
  color:var(--muted);
  min-height:28px;
  padding:4px 9px;
  border:1px solid var(--line);
  border-radius:20px;
  background:var(--surface);
  white-space:nowrap;
}
.connection-pill.live {
  color:var(--green);
  border-color:var(--success-border);
}
.connection-pill.live .dot {
  background:var(--green);
  box-shadow:0 0 0 4px #52c7a020
}
.connection-pill.error {
  color:var(--warning);
  border-color:var(--warning-border);
}
.connection-pill.error .dot {
  background:var(--warning)
}
#mode-badge {
  font-size:10px;
  color:var(--warning);
  background:var(--warning-bg);
  padding:5px 8px;
  border-radius:4px
}
main {
  max-width:1660px;
  padding:28px 28px 36px;
  margin:auto
}
.page-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:22px;
  gap:20px
}

h1 {
  font-size:25px;
  letter-spacing:-.6px;
  font-weight:600;
  margin:0;
  line-height:1.3
}

.account-actions {
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.account-actions>span {
  font-size:11px;
  color:var(--muted)
}
.button {
  border-radius:var(--radius-sm);
  min-height:36px;
  padding:8px 13px;
  border:1px solid var(--line);
  font-size:12px;
  font-weight:500;
  background:var(--surface-raised);
  color:var(--text);
  display:inline-flex;
  gap:8px;
  justify-content:center;
  align-items:center
}
.button:hover {
  border-color:var(--primary-border);
  filter:brightness(1.08)
}
.button.dark {
  background:var(--primary);
  color:var(--on-accent);
  border-color:var(--primary);
  font-weight:650
}
.button.subtle {
  background:var(--surface)
}
.metrics {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:20px
}
.metric {
  min-width:0;
  padding:18px 20px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--surface)
}
.metric-label {
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:12px;
  color:var(--muted);
}
.metric-label>span {
  font-size:15px;
  color:var(--primary);
  display:grid;
  place-items:center;
  width:28px;
  height:28px;
  border-radius:8px;
  background:var(--primary-bg);
}
.metric-label>.tiny-wave {
  font-size:11px;
  letter-spacing:1px
}
.metric-number {
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:30px;
  letter-spacing:-1px;
  line-height:1;
  margin:18px 0 2px;
  color:var(--text);
  font-variant-numeric:tabular-nums;
}

.section-index {
  font:9px ui-monospace,monospace;
  letter-spacing:1.6px;
  color:var(--muted)
}

#collector-error {
  font-size:11px;
  line-height:1.7;
  color:var(--red);
  margin:10px 0 0
}
.section-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px
}
.section-heading h2 {
  font-size:16px;
  font-weight:600;
  margin:0;
  display:flex;
  gap:9px;
  align-items:center
}
.section-heading h2 span {
  font:10px ui-monospace,monospace;
  background:var(--surface-raised);
  padding:3px 6px;
  border-radius:4px;
  color:var(--muted);
  min-width:22px;
  text-align:center
}
.update-note {
  font-size:10px;
  color:var(--muted);
  display:flex;
  align-items:center;
  gap:6px
}
.table-toolbar {
  display:flex;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px
}
.filters {
  display:flex;
  gap:3px;
  flex-wrap:wrap;
  padding:3px;
  background:var(--surface-muted);
  border:1px solid var(--line-soft);
  border-radius:9px;
}
.filters button {
  font-size:11px;
  padding:9px 12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  border-radius:5px
}
.filters button:hover {
  background:var(--surface-raised)
}
.filters .selected {
  background:var(--surface-raised);
  border:1px solid var(--line);
  color:var(--primary);
  box-shadow:none;
  border-color:var(--line);
}
.search-wrap {
  position:relative;
  min-width:174px;
  display:flex;
  align-items:center;
}
.search-wrap span {
  position:absolute;
  left:11px;
  top:6px;
  font-size:21px;
  color:var(--muted);
}
.search-wrap input {
  width:100%;
  height:38px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
  padding:0 10px 0 31px;
  font-size:12px;
  color:var(--text-secondary);
}
.search-wrap input::placeholder {
  color:var(--muted)
}
.empty-state {
  border:1px dashed var(--line);
  background:var(--surface);
  border-radius:8px;
  min-height:197px;
  padding:28px;
  text-align:center
}
.empty-symbol {
  font-size:27px;
  color:var(--primary);
  line-height:30px;
}
.empty-state h3 {
  font-size:13px;
  font-weight:500;
  color:var(--text-secondary);
  margin:10px 0;
}
.empty-state p {
  font-size:12px;
  color:var(--muted);
  margin:10px 0;
}
.empty-legend {
  display:flex;
  justify-content:center;
  gap:17px;
  margin-top:17px;
  color:var(--muted);
  font-size:9px
}
.empty-legend span {
  display:flex;
  gap:5px;
  align-items:center
}
.empty-legend i {
  width:5px;
  height:5px;
  border-radius:50%;
  opacity:.55
}
.legend-banker {
  background:var(--red)
}
.legend-player {
  background:var(--blue)
}
.legend-tie {
  background:var(--green)
}
.table-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px
}
.table-card {
  padding:14px 16px 11px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:none;
  transition:border-color .15s,box-shadow .15s;
  border-color:var(--line);
}
.table-card:hover {
  border-color:var(--primary-border);
  box-shadow:var(--shadow)
}
.table-card.stale {
  background:var(--surface)
}
.card-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px
}
.table-link {
  padding:0;
  border:0;
  background:none;
  font-size:15px;
  font-weight:650;
  color:var(--text);
  display:flex;
  min-width:0;
  flex-wrap:wrap;
  overflow-wrap:anywhere;
  text-align:left;
  gap:8px;
  align-items:center;
}
.table-link small {
  font-size:10px;
  letter-spacing:.5px;
  color:var(--muted);
  font-weight:400
}
.state-tag {
  flex-shrink:0;
  font-size:10px;
  color:var(--muted);
  background:var(--surface-muted);
  border:1px solid var(--line);
  padding:4px 6px;
  border-radius:4px;
  white-space:nowrap;
}
.state-tag.shuffling {
  background:var(--warning-bg);
  color:var(--warning)
}
.state-tag.betting {
  font-variant-numeric:tabular-nums;
  background:var(--success-bg);
  color:var(--green);
  border-color:var(--success-border);
}
.state-tag.payout {
  background:var(--warning-bg);
  color:var(--warning);
  border-color:var(--warning-border)
}
.state-tag.betting.urgent {
  background:var(--warning-bg);
  border-color:var(--danger-border);
  color:var(--warning)
}
.recording-panel {
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:16px 20px;
  margin:0 0 24px;
  border:1px solid var(--success-border);
  border-radius:8px;
  background:var(--surface);
  color:var(--text-secondary);
  font-size:12px;
  margin-bottom:18px;
  border-color:var(--line);
}
.recording-panel p { margin:6px 0;line-height:1.6 }

.round-line {
  overflow-wrap:anywhere;
  font:10px var(--font-number);
  color:var(--muted);
  letter-spacing:.4px;
  margin-top:9px
}
.hands {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:5px;
  margin:10px 0 7px
}
.hand {
  --hand-color:var(--red);
  --hand-background:var(--danger-bg);
  --hand-border:var(--line);
  display:grid;
  grid-template-columns:24px max-content minmax(0,1fr);
  align-items:center;
  gap:7px;
  width:100%;
  min-width:0;
  min-height:56px;
  padding:8px;
  border:1px solid var(--hand-border);
  border-radius:6px;
  background:var(--hand-background);
  color:var(--hand-color);
  text-align:left
}
.hand.player { --hand-color:var(--blue); --hand-background:var(--primary-bg); --hand-border:var(--line) }
.hand.tie { --hand-color:var(--green); --hand-background:var(--success-bg); --hand-border:var(--line); min-height:36px; padding-block:5px }
.hand-label {
  display:flex;
  align-items:center;
  justify-content:center;
  width:24px;
  height:26px;
  border-radius:4px;
  background:var(--surface-raised);
  font-size:12px;
  font-weight:650
}
.hand-main { display:flex; align-items:center; gap:6px; min-width:0 }
.hand-points { display:flex; align-items:baseline; gap:2px; flex-shrink:0 }
.hand-points strong {
  font:500 16px ui-monospace,monospace
}
.hand-points small {
  font-size:8px;
  color:var(--muted)
}
.playing-cards {
  display:flex;
  gap:4px;
  min-width:0
}
.playing-card {
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--line);
  background:var(--surface-raised);
  border-radius:4px;
  height:42px;
  width:31px;
  font:19px Georgia,serif;
  color:var(--text);
  position:relative;
  box-shadow:var(--shadow);
  border-color:var(--line);
}
.hands .playing-card { flex-shrink:0; width:26px; height:36px; font-size:17px }
.playing-card.hidden {
  color:var(--muted);
  font-size:15px;
  background:repeating-linear-gradient(45deg,var(--surface-muted),var(--surface-muted) 2px,var(--surface-raised) 2px,var(--surface-raised) 5px);
}
.playing-card.absent {
  color:var(--muted);
  border-style:dashed;
  background:var(--surface);
  box-shadow:none;
  font-size:13px
}
.playing-card.unknown { color:var(--warning); border-style:dashed; background:var(--warning-bg) }
.hand-volume { display:block; min-width:0; text-align:right; overflow-wrap:anywhere; font-variant-numeric:tabular-nums }
.hand-volume .bet-volume-amount { color:var(--hand-color); font-size:12px; font-weight:650; line-height:1.35 }
.hand-volume .bet-volume-count { color:var(--muted); font-size:10px; margin-top:2px }
.hand.tie .hand-volume { grid-column:2 / 4; display:flex; justify-content:flex-end; align-items:baseline; flex-wrap:wrap; gap:8px }
.hand.tie .bet-volume-count { margin-top:0 }

.result-bar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  font-size:10px;
  background:var(--surface-muted);
  border-radius:4px;
  padding:6px 8px;
  color:var(--muted);
  min-height:28px
}
.result-bar strong {
  font-weight:500
}
.result-bar.banker strong {
  color:var(--red)
}
.result-bar.player strong {
  color:var(--blue)
}
.result-bar.tie strong {
  color:var(--green)
}

.table-bet-statistics { display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:4px; margin-top:5px; color:var(--muted); font-size:9px }
.table-bet-statistics .bet-volume-time { margin:0; font-size:9px }
.bet-volume-amount { display:block; color:var(--text); font-size:11px; font-weight:550; font-variant-numeric:tabular-nums }
.bet-volume-count,.bet-volume-time { display:block; margin-top:3px; color:var(--muted); font-size:9px; font-weight:400 }
.bet-volume-cell { vertical-align:top; font-variant-numeric:tabular-nums }
.bet-volume-cell .bet-volume-amount { font:inherit; color:inherit }

.road {
  display:flex;
  gap:3px;
  margin-top:8px;
  align-items:center;
  min-height:12px;
  overflow:hidden
}
.road-label {
  font-size:8px;
  color:var(--muted);
  margin-right:5px;
  white-space:nowrap
}
.road-dot {
  display:block;
  flex-shrink:0;
  width:7px;
  height:7px;
  border:1.5px solid var(--red);
  border-radius:50%
}
.road-dot.player {
  border-color:var(--blue)
}
.road-dot.tie {
  border-color:var(--green)
}
.road-placeholder {
  font-size:9px;
  color:var(--muted)
}
.card-footer {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:space-between;
  margin-top:9px;
  padding-top:8px;
  border-top:1px solid var(--line-soft);
  align-items:center;
  font-size:8px;
  color:var(--muted)
}
.card-footer button {
  border:0;
  background:none;
  color:var(--muted);
  font-size:9px;
  padding:1px
}
.coverage-banner {
  display:flex;
  gap:9px;
  align-items:center;
  background:var(--warning-bg);
  border:1px solid var(--warning-border);
  color:var(--warning);
  border-radius:6px;
  padding:11px 13px;
  margin-bottom:23px;
}
.coverage-banner p {
  margin:0;
  font-size:12px;
  line-height:1.8;
  flex:1;
}
.notice-icon {
  border:1px solid var(--warning-border);
  border-radius:50%;
  height:14px;
  width:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  flex-shrink:0
}
.coverage-banner button {
  background:none;
  border:0;
  font-size:11px;
  white-space:nowrap;
  color:var(--warning);
}

dialog {
  border:1px solid var(--line);
  border-radius:12px;
  padding:27px;
  color:var(--text);
  background:var(--surface);
  max-height:88vh;
  box-shadow:0 24px 80px #00000080
}
dialog::backdrop {
  background:#030711b8;
  backdrop-filter:blur(3px)
}
.table-dialog {
  width:830px;
  max-width:calc(100vw - 30px)
}
.table-dialog .dialog-header > div { min-width:0; }
.table-dialog .dialog-header h2 { overflow-wrap:anywhere; }
.table-dialog .dialog-header .icon-button { flex-shrink:0; }
.status-dialog {
  width:540px;
  max-width:calc(100vw - 30px)
}
.bet-records-cleanup-dialog { width:430px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:22px;overflow:auto }
.bet-records-cleanup-dialog .dialog-header { margin-bottom:12px;gap:12px }
.dialog-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:21px
}
.dialog-header h2 {
  font-size:22px;
  font-weight:550;
  margin:9px 0 0
}
.icon-button {
  border:1px solid var(--line);
  background:var(--surface);
  color:var(--muted);
  border-radius:8px;
  width:30px;
  height:30px;
  font-size:20px;
  line-height:20px;
  display:inline-grid;
  place-items:center;
}
.history-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:25px;
  font-size:11px;
  color:var(--muted)
}
.history-heading h3 {
  font-size:14px;
  font-weight:550;
  color:var(--text-secondary)
}
.history-note {
  font-size:10px;
  color:var(--muted);
  margin:0 0 13px
}
.history-scroll {
  max-height:350px;
  overflow:auto
}
table {
  width:100%;
  border-collapse:collapse;
  text-align:left;
  white-space:nowrap
}
th {
  font-size:11px;
  color:var(--muted);
  font-weight:500;
  padding:12px 10px;
  background:var(--surface-muted);
  position:sticky;
  top:0;
}
td {
  padding:12px 8px;
  font:12px var(--font-number);
  border-bottom:1px solid var(--line);
  color:var(--text-secondary)
}
td small {
  display:block;
  font-size:10px;
  color:var(--muted);
  margin-top:4px;
}
.text-banker {
  color:var(--red)
}
.text-player {
  color:var(--blue)
}
.text-tie {
  color:var(--green)
}
.pagination {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:16px;
  font-size:10px;
  color:var(--muted)
}
.detail-table {
  max-width:430px;
  margin:auto
}
dl {
  margin:0;
  display:grid;
  grid-template-columns:125px 1fr;
  font-size:11px;
  line-height:2.5
}
dt {
  color:var(--muted)
}
dd {
  margin:0;
  overflow-wrap:anywhere;
  color:var(--text)
}
.status-note {
  border-top:1px solid var(--line);
  margin-top:20px;
  padding-top:15px;
  font-size:11px;
  color:var(--muted);
  line-height:1.9
}
@media(min-width:1650px) {
  .table-grid {
    grid-template-columns:repeat(4,minmax(0,1fr))
  }
}
@media(max-width:1200px) {
  body.nav-open { overflow:hidden }
  .sidebar {
    width:min(280px,calc(100vw - 48px));
    padding:30px 22px;
    transform:translateX(-100%);
    visibility:hidden;
    transition:transform .18s ease
  }
  .nav-open .sidebar { transform:translateX(0); visibility:visible }
  .menu-toggle,.sidebar-close { display:flex }
  .sidebar-close { top:18px }
  .main-shell {
    margin-left:0
  }
  .topbar {
    position:sticky;
    top:0;
    z-index:20;
    padding:0 24px;
    gap:16px
  }
  .topbar-right { gap:12px }
  main {
    padding:28px 24px
  }
  .table-grid {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }

}
@media(max-width:860px) {
  .topbar {
    height:61px;
    padding:0 18px
  }
  .topbar-start { gap:6px }
  .breadcrumb { font-size:10px; gap:8px }
  .topbar-divider,#clock { display:none }
  main {
    padding:28px 22px
  }
  .page-heading {
    align-items:flex-start
  }
  .account-actions {
    max-width:140px
  }

  .metric {
    padding:18px 16px
  }

  .table-toolbar {
    flex-direction:column
  }
  .search-wrap {
    max-width:230px
  }
}
@media(max-width:600px) {
  .topbar {
    height:56px;
    padding:0 12px;
    gap:8px
  }
  .breadcrumb { display:none }
  .topbar-right {
    gap:11px
  }
  #clock,.topbar-divider {
    display:none
  }
  main {
    padding:24px 16px
  }
  h1 {
    font-size:24px
  }
  .page-heading {
    gap:10px;
    margin-bottom:22px
  }

  .account-actions>span {
    display:none
  }
  .account-actions {
    max-width:100px
  }
  .account-actions .button {
    font-size:10px;
    padding:8px 10px
  }
  .metrics {
    grid-template-columns:repeat(2,1fr);
    margin-bottom:22px
  }
  .metric {
    padding:16px
  }
  .metric-number {
    font-size:28px;
    margin:14px 0 11px
  }

  .table-grid {
    grid-template-columns:1fr
  }
  .table-toolbar {
    gap:12px
  }
  .filters button {
    font-size:10px;
    padding:8px 11px
  }
  .search-wrap {
    max-width:none
  }
  .section-heading h2 {
    font-size:15px
  }
  .update-note {
    font-size:9px
  }
  .coverage-banner {
    flex-wrap:wrap
  }
  .coverage-banner p {
    min-width:210px
  }
  .coverage-banner button {
    margin-left:auto
  }
  .empty-state {
    padding:24px 14px
  }
  .empty-state p {
    line-height:1.9
  }
  .playing-card {
    width:37px;
    height:48px
  }

  dialog {
    padding:20px
  }
  .table-dialog {
    max-width:calc(100vw - 20px)
  }
  .dialog-header h2 {
    font-size:19px
  }
  dl {
    grid-template-columns:105px 1fr
  }
}
@media(prefers-reduced-motion:reduce) { .sidebar { transition:none } }

.database-view { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:24px }
.database-filters { display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; margin:24px 0 }
.database-filters label { display:grid; gap:8px; font-size:12px; color:var(--muted); flex:1 1 140px }
.database-date-field { display:grid; gap:8px; flex:1.6 1 280px; min-width:0 }
.database-date-controls { display:flex; gap:6px; align-items:stretch; min-width:0 }
.database-date-controls .date-range-trigger { flex:1; min-height:40px }
.database-date-controls .button { flex-shrink:0; padding:8px 10px; min-height:40px }
.database-date-field .date-range-heading input,.database-date-field .date-range-heading select { width:100%; min-width:0; min-height:30px; padding:5px 3px; font-size:12px; text-align:center }
.database-filters select,.database-filters input { width:100%; min-height:40px; border:1px solid var(--line); border-radius:6px; padding:8px 10px; background:var(--surface); color:var(--text); font:inherit }
.database-filters select:focus-visible { outline:3px solid var(--primary) }
.database-scroll { max-height:65vh; border:1px solid var(--line); border-radius:6px }
.database-scroll table { min-width:1350px; width:100% }
.database-scroll th { position:sticky; top:0; background:var(--surface-muted); z-index:1 }
#database-error { color:var(--red); font-size:13px }
@media(max-width:760px) { .database-view { padding:16px } .database-filters label { flex-basis:42% } }

.database-scroll .shoe-heading th { position:static; background:var(--success-bg); color:var(--green); text-align:left }
#database-shoe-summary { color:var(--green); line-height:1.8 }

.bet-records-view { min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:24px }
.bet-records-view .section-heading { gap:14px; flex-wrap:wrap }
.bet-records-note { margin:9px 0 0; color:var(--muted); font-size:12px; line-height:1.6 }
.bet-records-day-controls { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px; margin-top:20px }
.bet-records-day-controls label { display:grid; gap:8px; min-width:0; color:var(--muted); font-size:12px }
.bet-records-date-field { display:grid; gap:8px; width:242px; max-width:100%; min-width:0 }
.bet-records-day-controls input,.bet-records-day-controls select { width:180px; max-width:100%; min-width:0; min-height:40px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:var(--text) }
.bet-records-date-field .date-range-heading input,.bet-records-date-field .date-range-heading select { width:100%; min-height:30px; padding:5px 3px; text-align:center }
.bet-records-cleanup-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; flex-wrap:wrap }
.bet-records-totals { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin-top:18px }
.bet-records-total {
  min-width:0;
  border:1px solid var(--line);
  border-radius:8px;
  padding:14px 16px;
  background:var(--surface-muted);
}
.bet-records-total span,.bet-records-total small { display:block; color:var(--muted); font-size:11px; line-height:1.6 }
.bet-records-total strong {
  display:block;
  margin:5px 0;
  font-family:var(--font-number);
  font-size:22px;
  line-height:1.4;
  overflow-wrap:anywhere;
  color:var(--text);
}
.bet-records-total-notes { grid-column:1/-1; margin:0; color:var(--muted); font-size:12px; line-height:1.7 }
.bet-records-filters { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; margin:22px 0 18px }
.bet-records-filters label { display:grid; gap:8px; min-width:0; flex:1 1 130px; color:var(--muted); font-size:12px }
.bet-records-filters input,.bet-records-filters select { min-width:0; width:100%; min-height:40px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:var(--text) }
.bet-records-filter-actions { display:flex; gap:8px }
.bet-records-scroll { max-width:100%; max-height:65vh; overflow:auto; border:1px solid var(--line); border-radius:6px }
.bet-records-scroll table { min-width:1570px }
.bet-records-scroll th { background:var(--surface-muted); z-index:1 }
.bet-records-scroll td { font-size:12px; padding:13px 10px }
.bet-records-scroll td small { font-size:10px; color:var(--muted); max-width:240px; overflow-wrap:anywhere; white-space:normal }
.bet-record-side,.bet-record-status { display:inline-flex; padding:4px 8px; border-radius:5px; background:var(--surface-muted); color:var(--muted); font-family:inherit; font-size:11px }
.bet-record-side.banker { color:var(--red); background:var(--danger-bg) }
.bet-record-side.player { color:var(--blue); background:var(--primary-bg) }
.bet-record-side.tie { color:var(--green); background:var(--success-bg) }
.bet-record-status.settled { color:var(--green); background:var(--success-bg) }
.bet-record-status.unknown { color:var(--warning); background:var(--warning-bg) }
.bet-record-status.rejected { color:var(--red); background:var(--danger-bg) }
.bet-record-status.prohibited { color:var(--muted); background:var(--surface-muted) }
.bet-record-profit { color:var(--green) }
.bet-record-loss,#bet-records-error { color:var(--red) }
#bet-records-error { font-size:13px; line-height:1.6 }
@media(max-width:760px) { .bet-records-view { padding:16px } .bet-records-filters label { flex-basis:42% } .bet-records-filter-actions { width:100% } .bet-records-totals { grid-template-columns:repeat(2,minmax(0,1fr)) } .bet-records-total { padding:12px } .bet-records-total strong { font-size:18px } .bet-records-day-controls .button { padding:8px 10px; font-size:11px } }

.page-help { margin-top:16px; color:var(--muted); font-size:12px; line-height:1.7 }
.page-help summary { cursor:pointer; width:fit-content }
.page-help p { margin:8px 0 }

.system-user{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
@media(max-width:600px){.system-user{max-width:70px}.topbar #clock{display:none}.topbar-right{gap:8px}#system-logout{padding:7px 9px}}

.accounts-search-form { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; margin:20px 0 12px }
.accounts-search-form label { display:grid; gap:8px; min-width:0; flex:0 1 320px; color:var(--muted); font-size:12px }
.accounts-search-form input { width:100%; min-width:0; min-height:40px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:var(--text) }
.accounts-pagination,.shoe-pagination { gap:10px }
.accounts-pagination span,.shoe-pagination span { min-width:0; text-align:center; overflow-wrap:anywhere }
.bet-records-account-search-actions { display:flex; align-items:flex-end }
@media(max-width:760px) { .accounts-search-form label { flex-basis:100% } .accounts-pagination .button,.shoe-pagination .button { padding:8px 10px; font-size:11px } }

/* Common presentation primitives used by every authenticated page. */
::selection { background:var(--primary-bg); color:var(--text); }

button,input,select,textarea { accent-color:var(--primary); }
input,select,textarea { color:var(--text); }
input::placeholder,textarea::placeholder { color:var(--muted); opacity:.8; }
input:focus-visible,select:focus-visible,textarea:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
button:focus-visible,a:focus-visible,summary:focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
.sidebar nav { margin-bottom:30px; }
.brand-copy { display:grid; gap:1px; }
.brand-copy small { color:var(--muted); font-size:9px; font-weight:400; letter-spacing:1px; }

.nav-item.active:hover { color:var(--primary); }

.page-eyebrow { margin:0 0 7px; color:var(--primary); font:10px var(--font-number); letter-spacing:1.6px; }

.metric:nth-child(2) .metric-label>span { background:var(--success-bg); color:var(--green); }
.metric:nth-child(3) .metric-label>span { background:var(--warning-bg); color:var(--warning); }

.table-link:hover { color:var(--primary); }

.state-tag.shuffling,.state-tag.payout,.state-tag.betting.urgent { color:var(--warning); }
.table-bet-statistics,.road-label,.road-placeholder,.card-footer,.card-footer button { font-size:10px; }

.recording-panel strong { color:var(--green); }

tbody tr:hover td { background:var(--surface-raised); }

.database-view,.bet-records-view { padding:22px; }
.database-scroll,.bet-records-scroll,.sim-table-scroll { scrollbar-gutter:stable; }

.bet-records-total .bet-record-profit { color:var(--green); }
.bet-records-total .bet-record-loss { color:var(--red); }
@media(max-width:600px) {
  main { padding:22px 14px 28px; }
  .topbar-right { gap:7px; }
  .connection-pill { font-size:10px; padding-inline:7px; }
  .metrics { gap:10px; }
  .metric { padding:14px; }
  .metric-number { font-size:27px; }
  .filters { width:100%; }
  .database-view,.bet-records-view { padding:16px; }
}
