:root {
  --bg: #0c0d0f;
  --surface: #131417;
  --surface-2: #191b1f;
  --surface-3: #202329;
  --border: #282c33;
  --border-soft: #1e2126;
  --text: #ecebe6;
  --text-dim: #989aa0;
  --text-faint: #7c7f86;
  --green: #37b57e;
  --red: #e5554b;
  --amber: #d2ac54;          /* champagne gold — the signature accent */
  --amber-dim: #9c7e37;
  --amber-tint: rgba(210,172,84,.10);
  --gold-solid: #d2ac54;     /* button fill — stays light so dark text keeps AA in both themes */
  --p: #4f8cf0;              /* baccarat player */
  --b: #e5554b;             /* baccarat banker */
  --t: #37b57e;             /* baccarat tie */
  --r: 3px;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, "Courier New", monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #e9ebef;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --surface-3: #dfe2e8;
  --border: #c6ccd5;
  --border-soft: #d9dce3;
  --text: #14161b;
  --text-dim: #4f545d;
  --text-faint: #62676f;
  --green: #1a7f4b;
  --red: #cf3b32;
  --amber: #7d5f16;                     /* deep aged-gold ink — AA as text on white */
  --amber-dim: #a07d2a;
  --amber-tint: rgba(201,154,46,.16);
  --gold-solid: #c99a2e;                /* rich gold — used as FILL so the identity survives */
  --p: #2f6fd6;
  --b: #cf3b32;
  --t: #1a7f4b;
  color-scheme: light;
}

/* Light isn't a flat inversion: give it real depth (cards lift off a greyer bg)
   and push gold to FILLS so the accent doesn't die as muddy text. */
:root[data-theme="light"] .kpi-strip,
:root[data-theme="light"] .card,
:root[data-theme="light"] .dtable,
:root[data-theme="light"] .acc-table,
:root[data-theme="light"] .stat-cell,
:root[data-theme="light"] .sig-board {
  box-shadow: 0 1px 2px rgba(15,20,32,.05), 0 3px 8px rgba(15,20,32,.05);
}
:root[data-theme="light"] .brand-mark { border-color: color-mix(in srgb, var(--gold-solid) 45%, var(--border)); }
:root[data-theme="light"] .brand-mark .bead i { background: var(--gold-solid); }
:root[data-theme="light"] .nav-item.active,
:root[data-theme="light"] .nav-overview.active { border-left-color: var(--gold-solid); }
:root[data-theme="light"] .panel-domain,
:root[data-theme="light"] .nav-item.active .nav-tag { color: var(--amber-dim); }

* { box-sizing: border-box; }
::selection { background: var(--amber-tint); color: var(--text); }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
svg.i { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; flex-shrink: 0; }

.app { display: flex; min-height: 100vh; }

/* ================= Sidebar ================= */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border-soft); padding: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-bottom: 1px solid var(--border-soft); }
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--r); font-size: 0;
  background: var(--amber-tint); border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--border));
  display: grid; place-items: center;
}
.brand-mark .bead { display: grid; grid-template-columns: repeat(3, 4px); gap: 2px; }
.brand-mark .bead i { width: 4px; height: 4px; border-radius: 50%; background: var(--amber); opacity: .35; }
.brand-mark .bead i.on { opacity: 1; }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: .04em; line-height: 1.1; }
.brand-sub { font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); letter-spacing: .18em; text-transform: uppercase; margin-top: 3px; }

.sidebar-search { position: relative; margin: 13px 14px 4px; }
.sidebar-search .prompt { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); display: flex; }
.sidebar-search input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--sans); font-size: 13px; padding: 8px 10px 8px 32px; outline: none;
}
.sidebar-search input::placeholder { color: var(--text-faint); }
.sidebar-search input:focus { border-color: var(--amber-dim); }

.site-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; }
.site-nav::-webkit-scrollbar { width: 6px; }
.site-nav::-webkit-scrollbar-thumb { background: var(--surface-3); }

.nav-overview {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: none; border-left: 2px solid transparent; color: var(--text-dim);
  padding: 8px 10px; cursor: pointer; font-family: var(--sans); border-radius: var(--r);
  font-size: 13.5px; font-weight: 500; margin-bottom: 6px;
}
.nav-overview::before { content: ""; width: 15px; height: 15px; flex-shrink: 0;
  background: currentColor; -webkit-mask: center/contain no-repeat; mask: center/contain no-repeat;
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.8"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>');
          mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.8"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>'); }
.nav-overview:hover { background: var(--surface-2); color: var(--text); }
.nav-overview.active { background: var(--amber-tint); color: var(--text); border-left-color: var(--amber); }

.nav-group { margin-top: 2px; }
.nav-group-label {
  display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .16em;
  padding: 12px 10px 5px;
}
.nav-group-label.static { cursor: default; color: var(--amber); }
.nav-group-label .chev { display: inline-block; width: 9px; transition: transform .12s; color: var(--text-faint); }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left; background: transparent; border: none; border-left: 2px solid transparent;
  color: var(--text-dim); padding: 8px 10px; cursor: pointer; border-radius: var(--r);
  font-family: var(--sans); font-size: 13.5px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--amber-tint); color: var(--text); border-left-color: var(--amber); }
.nav-item.active .nav-item-name { font-weight: 600; }
.nav-tag {
  width: 22px; height: 18px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--text-dim);
}
.nav-item.active .nav-tag { border-color: color-mix(in srgb, var(--amber) 40%, var(--border)); color: var(--amber); }
.nav-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.nav-count.on { color: var(--green); }
.nav-count.warn { color: var(--red); }

.side-foot { padding: 12px 14px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 8px; }
.theme-toggle {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--r); color: var(--text-dim);
  padding: 9px; cursor: pointer; font-family: var(--sans); font-size: 12.5px; font-weight: 500;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle.logout { text-decoration: none; }
.theme-toggle.logout:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }

/* ================= Main / Topbar ================= */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; border-bottom: 1px solid var(--border-soft);
}
.topbar-title { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.crumb-home { color: var(--text-faint); display: inline-flex; cursor: pointer; background: none; border: none; padding: 0; }
.crumb-home:hover { color: var(--amber); }
.crumb-sep { color: var(--border); }
.crumb-group { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.crumb-current { font-weight: 600; letter-spacing: .02em; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--text-faint); padding-left: 14px; border-left: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; }

.workspace { flex: 1; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.panel-root { padding: 22px; min-width: 0; overflow-y: auto; }

/* ================= Buttons ================= */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  padding: 7px 12px; cursor: pointer; font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  border-radius: var(--r); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary, .btn.live { border-color: color-mix(in srgb, var(--amber) 32%, var(--border)); color: var(--amber); }
.btn.primary:hover, .btn.live:hover { background: var(--amber-tint); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn.sm { padding: 5px 10px; font-size: 11.5px; border-radius: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--text-dim); cursor: default; user-select: none; }
.live-dot { position: relative; width: 7px; height: 7px; }
.live-dot i { position: absolute; inset: 0; border-radius: 50%; background: var(--green); }
.live-dot i.ping { animation: ping 1.8s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 75%,100% { transform: scale(2.2); opacity: 0; } }

/* ================= Log rail ================= */
.log-rail { border-left: 1px solid var(--border-soft); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.workspace.log-collapsed { grid-template-columns: 1fr; }
.workspace.log-collapsed .log-rail { display: none; }
.log-toggle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: transparent; border: 1px solid var(--border); border-radius: var(--r); color: var(--text-faint); cursor: pointer; }
.log-toggle:hover { background: var(--surface-2); color: var(--text); }
.log-toggle.on { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
.log-rail-header {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 16px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .16em; color: var(--text-dim); text-transform: uppercase;
}
.log-rail-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.log-collapse { background: transparent; border: none; color: var(--text-faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.log-collapse:hover { color: var(--text); background: var(--surface-2); }
.log-rail-sub { color: var(--text-faint); font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 10px; }
.log-feed { flex: 1; overflow-y: auto; padding: 4px 0; }
.log-feed::-webkit-scrollbar { width: 6px; }
.log-feed::-webkit-scrollbar-thumb { background: var(--surface-3); }
.log-line {
  display: flex; gap: 8px; padding: 9px 16px; font-family: var(--mono); font-size: 11px; line-height: 1.55;
  border-bottom: 1px solid var(--border-soft);
}
.log-time { color: var(--text-faint); flex-shrink: 0; }
.log-tag { flex-shrink: 0; font-weight: 600; }
.log-tag.success { color: var(--green); }
.log-tag.error { color: var(--red); }
.log-tag.info { color: var(--text-dim); }
.log-tag.win { color: var(--green); }
.log-tag.lose { color: var(--red); }
.log-tag.tie { color: var(--text-faint); }
.log-tag.bet { color: var(--amber); }
.log-tag.warn { color: var(--red); }
.log-body { color: var(--text-dim); min-width: 0; word-break: break-word; }
.log-body strong { color: var(--text); font-weight: 600; }
.log-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 16px; color: var(--text-faint); font-family: var(--mono); font-size: 11.5px; text-align: center; }

/* ================= KPI strip ================= */
.kpi-strip { display: flex; border: 1px solid var(--border-soft); border-radius: var(--r); margin-bottom: 20px; overflow: hidden; }
.kpi-cell { flex: 1; padding: 15px 18px; border-right: 1px solid var(--border-soft); background: var(--surface); }
.kpi-cell:last-child { border-right: none; }
.kpi-value { font-family: var(--mono); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--red); }
.kpi-label { font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .16em; margin-top: 6px; }

/* ================= Data table (overview) ================= */
.section-title {
  font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .14em;
  margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between;
}
.section-title.sec-toggle { cursor: pointer; user-select: none; }
.section-title.sec-toggle:hover { color: var(--text); }
.section-title .sec-toggle-l { display: flex; align-items: center; gap: 7px; }
.section-title .chev { display: inline-block; width: 10px; font-size: 9px; }
/* two-class selector so it beats `.sig-board { overflow: hidden }` (same specificity,
   declared later) which was clipping the list and killing the scroll */
.sig-board.log-scroll { max-height: 520px; overflow-y: auto; }   /* ~12 rows visible, rest scrolls */
.log-scroll::-webkit-scrollbar { width: 6px; }
.log-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); }
.dtable { width: 100%; border-collapse: collapse; border: 1px solid var(--border-soft); border-radius: var(--r); overflow: hidden; }
.dtable th {
  text-align: left; font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-faint); padding: 9px 14px; font-weight: 600; border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; font-size: 13px; }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover { background: var(--surface); }
.dtable .mirror-note { color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.dtable.bulk-active .lic-edit { display: none; }   /* hide per-row Edit while bulk-selecting */

/* ================= Cards / forms ================= */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.card-title {
  font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .14em;
  padding: 11px 16px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between;
}
.card > .add-form, .card > .form-error, .card > .form-hint, .card > #bulk-bar-wrap, .card > #acc-list-wrap, .card > #ab-bettors { margin: 16px; }
.card > #bulk-bar-wrap:empty { margin: 0; }

.add-form { display: flex; align-items: center; gap: 10px; }
.add-form .prompt { display: none; }
.add-form input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
  padding: 11px 12px; font-family: var(--mono); font-size: 13px; outline: none;
}
.add-form input::placeholder { color: var(--text-faint); }
.add-form input:focus { border-color: var(--amber-dim); }
.add-form button {
  border: none; border-radius: var(--r); background: var(--gold-solid); color: #221a08;
  padding: 11px 20px; font-family: var(--sans); font-weight: 600; font-size: 13px; cursor: pointer;
}
.add-form button:hover { filter: brightness(1.06); }
.form-error { color: var(--red); font-size: 12px; margin-top: 10px; }
.form-hint { color: var(--text-faint); font-family: var(--mono); font-size: 11px; margin-top: 11px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.form-hint code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 2px; color: var(--text-dim); }
.ab-num { width: 64px; background: var(--bg); border: 1px solid var(--border); border-radius: 2px; color: var(--text); font-family: var(--mono); font-size: 11px; padding: 4px 6px; outline: none; }
.ab-num:focus { border-color: var(--amber-dim); }
.ab-site { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); font-family: var(--sans); font-size: 12.5px; padding: 10px 8px; outline: none; }
.ab-site:focus { border-color: var(--amber-dim); }

/* ================= Panel header ================= */
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 16px; }
.panel-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.panel-domain { font-family: var(--mono); font-size: 12.5px; color: var(--amber); margin-top: 2px; }
.badge-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.badge { font-family: var(--mono); font-size: 9.5px; font-weight: 600; padding: 3px 7px; border: 1px solid var(--border); border-radius: 2px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .12em; }
.badge.mirror { border-color: color-mix(in srgb, var(--amber) 40%, var(--border)); color: var(--amber); }
.badge.blocked { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
.badge.betting { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.sig-row.betting { background: color-mix(in srgb, var(--amber) 6%, transparent); }
/* inline "pool is on this table" marker, sits left of the BET side label */
.sig-here { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; color: var(--amber); display: inline-flex; align-items: center; gap: 4px; }
.sig-here::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: sig-pulse 1.6s ease-out infinite; }
@keyframes sig-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--amber) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .sig-here::before { animation: none; } }
.stat-active { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.pool-row.blocked td { background: color-mix(in srgb, var(--red) 5%, transparent); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 6px; }
.btn.sm.retry { color: var(--amber); }
.btn.sm.retry:hover { background: color-mix(in srgb, var(--amber) 12%, transparent); border-color: color-mix(in srgb, var(--amber) 40%, var(--border)); }
.stat-row { display: flex; gap: 10px; }
.stat-cell { min-width: 92px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 16px; text-align: center; }
.stat-value { font-family: var(--mono); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-family: var(--mono); font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .16em; margin-top: 5px; }

/* ================= Accounts table ================= */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px; font-size: 12px; font-weight: 500;
}
.bulk-bar .spacer { flex: 1; }
.acc-table { width: 100%; border-collapse: collapse; border: 1px solid var(--border-soft); border-radius: var(--r); overflow: hidden; }
.acc-table th {
  text-align: left; font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-faint); padding: 9px 12px; font-weight: 600; background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
}
.acc-table td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; font-size: 13px; }
.acc-table tbody tr:last-child td { border-bottom: none; }
.acc-table tbody tr:hover { background: var(--surface); }
.acc-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 28px; height: 22px; border: 1px solid var(--border); border-radius: 2px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: 9px;
}
.acc-username { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.copy-btn { color: var(--text-faint); cursor: pointer; font-family: var(--mono); font-size: 10px; }
.copy-btn:hover { color: var(--amber); }
.acc-added { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.status-tag { font-family: var(--mono); font-weight: 600; font-size: 10.5px; letter-spacing: .04em; padding: 2px 8px; border-radius: 2px; }
.status-tag.off { color: var(--text-faint); background: color-mix(in srgb, var(--text-faint) 12%, transparent); }
.status-tag.connecting { color: var(--amber); background: var(--amber-tint); }
.status-tag.online { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.status-tag.error { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); cursor: help; }
.status-tag .blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.meta-text { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.toggle-switch {
  border: 1px solid var(--border); background: transparent; color: var(--text-faint); border-radius: 2px;
  font-family: var(--mono); font-weight: 600; font-size: 10.5px; padding: 4px 10px; cursor: pointer;
  width: 50px; text-align: center;
}
.toggle-switch.on { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); }
.toggle-switch:disabled { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.checkbox { width: 14px; height: 14px; accent-color: var(--amber); cursor: pointer; }
.saldo-cell { font-family: var(--mono); font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.saldo-cell.stale { color: var(--amber); }

.empty-state { text-align: center; padding: 44px 16px; color: var(--text-faint); font-size: 13px; }
.empty-state-title { font-size: 13.5px; font-weight: 500; color: var(--text-dim); }
.empty-state-sub { font-size: 12px; margin-top: 4px; color: var(--text-faint); }

/* ================= Skeleton ================= */
.skeleton-row { height: 44px; margin-bottom: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ================= Toasts ================= */
.toast-stack { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 200; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 2px solid var(--text-dim); border-radius: var(--r);
  color: var(--text); padding: 10px 14px; font-size: 12.5px;
  min-width: 220px; max-width: 340px; transition: opacity .2s, transform .2s;
}
.toast b { font-family: var(--mono); font-weight: 600; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* ================= Modal ================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 300; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 22px; width: 340px; }
.modal-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.modal-body { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ================= Baccarat log (baccarat.html legacy) ================= */
.bac-status { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--text-dim); }
.bac-counts { display: flex; gap: 16px; margin-bottom: 12px; }
.bac-counts:empty { display: none; }
.bac-count { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.bac-count.P { color: var(--p); }
.bac-count.B { color: var(--b); }
.bac-count.T { color: var(--t); }
.bac-count.total { color: var(--text-faint); }
.hist { display: flex; gap: 4px; flex-wrap: wrap; }
.bead {
  width: 22px; height: 22px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 2px;
}
.bead.P { color: var(--p); border-color: color-mix(in srgb, var(--p) 45%, var(--border)); }
.bead.B { color: var(--b); border-color: color-mix(in srgb, var(--b) 45%, var(--border)); }
.bead.T { color: var(--t); border-color: color-mix(in srgb, var(--t) 45%, var(--border)); }
.bac-table tr.bac-old td { color: var(--text-faint); }

/* ===== Baccarat signal board ===== */
.sig-board { border: 1px solid var(--border-soft); border-radius: var(--r); overflow: hidden; }
.sig-group-title {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--amber); background: var(--surface); padding: 7px 16px;
  border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 8px;
}
.sig-group-title::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sig-group-title.muted { color: var(--text-faint); }
.sig-group-title.sub { color: var(--text-dim); padding-left: 26px; font-size: 9px; }
.sig-group-title.sub::before { width: 4px; height: 4px; opacity: .6; }
.sig-group-title.mid-toggle { cursor: pointer; user-select: none; }
.sig-group-title.mid-toggle::before { display: none; }
.sig-group-title.mid-toggle:hover { color: var(--text-dim); }
.sig-group-title .chev { display: inline-block; width: 10px; font-size: 9px; }
.sig-count { color: var(--text-faint); font-weight: 400; }
.sig-row {
  display: grid; grid-template-columns: 176px 1fr auto; align-items: center; gap: 14px;
  padding: 11px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px;
}
.sig-row:last-child { border-bottom: none; }
.sig-row:hover { background: var(--surface); }
.sig-row.off { opacity: .5; }
.sig-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sig-name .sig-sep { color: var(--text-faint); font-weight: 400; margin: 0 2px; }
.ab-bal { cursor: pointer; font-family: var(--mono); white-space: nowrap; }
.ab-bal:hover .ab-bal-num { color: var(--amber); }
.ab-bal-num { font-weight: 600; }

/* auto-bet control panel — plain-language fields */
.ab-power { display: flex; flex-wrap: wrap; gap: 24px 40px; padding: 16px; border-bottom: 1px solid var(--border-soft); }
.ab-power-item { display: flex; align-items: center; gap: 11px; }
.ab-fl { display: flex; flex-direction: column; gap: 1px; }
.ab-fl b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ab-fl .meta-text { font-size: 11px; max-width: 230px; }
.ab-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 18px; padding: 16px; }
.ab-field { display: flex; flex-direction: column; gap: 5px; }
.ab-field-l { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.ab-field-h { font-size: 10.5px; color: var(--text-faint); line-height: 1.35; }
.ab-field .ab-num { width: 100%; box-sizing: border-box; font-size: 12.5px; padding: 7px 8px; }
.ab-sel { width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border); border-radius: 2px; color: var(--text); font-family: var(--sans); font-size: 12.5px; padding: 7px 8px; outline: none; }
.ab-sel:focus { border-color: var(--amber-dim); }
.ab-ladder-row { display: flex; align-items: baseline; gap: 10px; padding: 0 16px 14px; }
.ab-ladder-row .meta-text { font-family: var(--mono); color: var(--amber); }
.ab-save-row { padding: 0 16px 16px; }
.log-tag { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .1em; padding: 1px 5px; border-radius: 2px; border: 1px solid var(--border); color: var(--text-faint); vertical-align: middle; }
.log-tag.latihan { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
.sig-seq { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.sig-seq i { color: var(--text-faint); font-style: normal; margin-left: 6px; }
.sig-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.sig-dot.P { background: var(--p); }
.sig-dot.B { background: var(--b); }
.sig-dot.T { background: var(--t); }
.sig-dot.none { background: transparent; border: 1px solid var(--border); }
.sig-right { justify-self: end; white-space: nowrap; display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
.sig-bet { font-family: var(--sans); font-weight: 600; padding: 3px 10px; border-radius: 2px; color: #fff; }
.sig-bet.P { background: var(--p); }
.sig-bet.B { background: var(--b); }
.sig-bet.none { background: var(--surface-3); color: var(--text-dim); }
.sig-hit { color: var(--green); font-weight: 600; }
.ab-saldo { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-left: 2px; }
.ab-saldo.stuck { color: var(--amber); }   /* balance never moved despite a win/loss = phantom bet, flag it */
.sig-miss { color: var(--red); font-weight: 600; }
.sig-skip { color: var(--text-faint); font-weight: 600; letter-spacing: .03em; }

/* Bead plate roadmap */
.bp-grid {
  --bp: 26px;
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(6, var(--bp)); grid-auto-columns: var(--bp);
  border-top: 1px solid var(--border-soft); border-left: 1px solid var(--border-soft);
  overflow-x: auto; width: 100%;
}
.bp-cell { border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); display: grid; place-items: center; }
.bp-bead { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 10px; font-weight: 600; color: #fff; cursor: default; }
.bp-bead.P { background: var(--p); }
.bp-bead.B { background: var(--b); }
.bp-bead.T { background: var(--t); }

/* ================= Responsive ================= */
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 1fr; }
  .log-rail { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ================= Login ================= */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); padding: 28px 24px;
  display: flex; flex-direction: column; gap: 12px; }
.login-title { font-family: var(--sans); font-size: 20px; margin: 4px 0 0; color: var(--text); }
.login-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 4px; }
.login-label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-faint); }
.login-input { width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); padding: 10px 12px; font-size: 14px; }
.login-input:focus { outline: 2px solid var(--gold-solid); outline-offset: 1px; border-color: var(--gold-solid); }
.login-btn { background: var(--gold-solid); color: #1a1204; border: 0; border-radius: var(--r);
  padding: 11px 14px; font-family: var(--sans); font-weight: 600; font-size: 14px; cursor: pointer; }
.login-btn:hover { filter: brightness(1.05); }
.login-btn:disabled { opacity: .6; cursor: progress; }
.login-error { background: var(--amber-tint); border: 1px solid var(--red);
  color: var(--red); border-radius: var(--r); padding: 8px 10px; font-size: 12.5px; }

/* ================= Admin ================= */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-title { font-family: var(--sans); font-size: 18px; margin: 0; color: var(--text); }
.admin-create { display: flex; gap: 8px; }
.admin-newkey { background: var(--amber-tint); border: 1px solid var(--amber);
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 14px; font-size: 13px; color: var(--text); }
.admin-newkey code { color: var(--amber); }
.admin-copy, .admin-toggle { background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--r); padding: 5px 9px; font-size: 12px; cursor: pointer; }
.admin-copy:hover, .admin-toggle:hover { border-color: var(--gold-solid); }
.admin-empty { color: var(--text-dim); text-align: center; padding: 20px; }
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table-wrap .dtable { min-width: 620px; }

/* ================= Admin panel (redesign) ================= */
.admin-nav { display: flex; flex-direction: column; padding: 8px 8px 0; gap: 2px; flex: 1; }
.anav { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent; color: var(--text-dim);
  font-family: var(--sans); font-size: 13px; padding: 9px 12px; border-radius: 0 var(--r) var(--r) 0; cursor: pointer; }
.anav .i { stroke: currentColor; fill: none; stroke-width: 1.7; flex-shrink: 0; }
.anav:hover { background: var(--surface-2); color: var(--text); }
.anav.active { background: var(--amber-tint); color: var(--text); border-left-color: var(--amber); }

.tb-crumb { font-family: var(--sans); font-weight: 600; font-size: 14px; }
.loading { color: var(--text-dim); font-family: var(--mono); font-size: 12px; padding: 24px 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; max-width: 720px; }
.stat-grid .stat-cell { text-align: left; padding: 16px 18px; }
.stat-grid .stat-value { font-size: 30px; }
.tone-good { color: var(--green); }
.tone-muted { color: var(--text-faint); }

.fld { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); padding: 9px 11px; font-size: 13.5px; font-family: var(--sans); width: 100%; }
.fld:focus { outline: 2px solid var(--gold-solid); outline-offset: 1px; border-color: var(--gold-solid); }
select.fld { cursor: pointer; }
.btn-gold { background: var(--gold-solid); color: #1a1204; border: 0; border-radius: var(--r);
  padding: 9px 15px; font-family: var(--sans); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r); padding: 8px 13px; font-size: 12.5px; cursor: pointer; font-family: var(--sans); }
.btn-ghost:hover { border-color: var(--gold-solid); }
.btn-ghost.sm { padding: 4px 9px; font-size: 11.5px; }
.btn-danger { background: color-mix(in srgb, var(--red) 15%, var(--surface)); border: 1px solid var(--red);
  color: var(--red); border-radius: var(--r); padding: 8px 13px; font-size: 12.5px; cursor: pointer; font-weight: 600; font-family: var(--sans); }
.btn-danger:hover { background: var(--red); color: #fff; }

.admin-create { display: flex; gap: 8px; margin-bottom: 14px; max-width: 520px; }
.admin-create .fld { flex: 1; }
.newkey { background: var(--amber-tint); border: 1px solid var(--amber); border-radius: var(--r);
  padding: 10px 12px; margin-bottom: 14px; font-size: 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.newkey[hidden] { display: none; }
.newkey code { color: var(--amber); }
.hint { color: var(--text-faint); font-size: 11.5px; margin-top: 10px; }
.empty { color: var(--text-dim); text-align: center; padding: 30px; display: flex; flex-direction: column; gap: 4px; }
.empty span { color: var(--text-faint); font-size: 12px; }

.dtable.selectable tbody tr { cursor: pointer; }
.dtable.selectable tbody tr:hover { background: var(--surface-2); }
.dtable.selectable tbody tr.sel { background: var(--amber-tint); box-shadow: inset 2px 0 0 var(--amber); }
.dtable.selectable tbody tr.op-row { cursor: default; opacity: .8; }
.dtable.selectable tbody tr.op-row:hover { background: none; }
.pill { font-family: var(--mono); font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 2px;
  text-transform: uppercase; letter-spacing: .08em; }
.pill.on { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.pill.off { background: color-mix(in srgb, var(--text-faint) 16%, transparent); color: var(--text-faint); }
.tag-op { font-family: var(--mono); font-size: 9px; color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border));
  padding: 1px 5px; border-radius: 2px; text-transform: uppercase; letter-spacing: .1em; margin-left: 6px; }
.dot-on { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.dim { color: var(--text-faint); }

.bulkbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 10px 8px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45); z-index: 50; animation: bulkup .16s ease; max-width: calc(100vw - 32px); }
.bulkbar[hidden] { display: none; }
@keyframes bulkup { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.bulkbar-count { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.bulkbar-count b { color: var(--text); font-family: var(--mono); }
.bulkbar-actions { display: flex; gap: 6px; }
.bulk-clear { border-radius: 50%; width: 30px; height: 30px; padding: 0; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .bulkbar { animation: none; } }

.key-cell { display: flex; align-items: center; gap: 8px; }
.key-val { color: var(--text); letter-spacing: .02em; }
.eye { display: inline-flex; align-items: center; background: none; border: 0; padding: 2px; cursor: pointer;
  color: var(--text-faint); border-radius: 3px; }
.eye svg { stroke: currentColor; fill: none; stroke-width: 1.7; }
.eye:hover { color: var(--text); }
.eye.on { color: var(--gold-solid); }
.row-actions { text-align: right; }

.card-form { max-width: 460px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.card-form[hidden] { display: none; }
.edit-form { margin-top: 14px; }
.card-form-head { font-family: var(--sans); font-weight: 600; font-size: 15px; }
.card-form-sub { color: var(--text-dim); font-size: 12.5px; margin: 0 0 6px; line-height: 1.5; }
.fld-label { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-top: 4px; }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.form-msg { font-size: 12px; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }

/* ================= Bulk import bettors ================= */
.card-title-actions { display: flex; gap: 6px; }
.btn.ghost { color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); }
.import-panel { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2);
  padding: 12px; margin: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.import-panel[hidden] { display: none; }
.import-head { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.import-head code { color: var(--amber); font-family: var(--mono); font-size: 11.5px; }
.imp-file { font-size: 12px; color: var(--text-dim); }
.imp-text { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--mono); font-size: 12.5px; padding: 9px 11px; resize: vertical; }
.imp-text:focus { outline: 2px solid var(--gold-solid); outline-offset: 1px; border-color: var(--gold-solid); }
.import-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-msg { font-size: 12px; }
.import-msg.ok { color: var(--green); }
.import-msg.warn { color: var(--amber); }
.import-msg.err { color: var(--red); }
.import-errs { margin: 4px 0 0; padding-left: 18px; color: var(--red); font-size: 12px; }
.import-errs li { margin: 2px 0; }

/* ================= Bettor pool: search + pagination + select ================= */
.pool-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pool-search { width: 260px; max-width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: var(--sans); font-size: 12.5px; padding: 10px 12px; }
.pool-search::placeholder { color: var(--text-faint); }
.pool-search:focus { border-color: var(--amber-dim); outline: none; }
.pool-count { font-family: var(--mono); font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.acc-table tbody tr.pool-row.sel { background: var(--amber-tint); box-shadow: inset 2px 0 0 var(--amber); }
.cb-cell { width: 36px; text-align: center; padding-left: 12px !important; }
.row-cb, #pool-cb-all { width: 15px; height: 15px; accent-color: var(--gold-solid); cursor: pointer; vertical-align: middle; }
.pool-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.pool-page { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.btn.sm[disabled] { opacity: .4; cursor: not-allowed; }
