:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --chrome: #121315;
  --panel: #151618;
  --panel-2: #1c1d20;
  --inset: #0c0d0f;
  --border: #242528;
  --border-2: #2e3034;
  --border-3: #3c3e43;
  --text: #e3e4e6;
  --text-2: #c4c6ca;
  --muted: #8e9197;
  --faint: #63666c;
  --green: #43be76;
  --green-hover: #55c985;
  --green-bg: rgba(67, 190, 118, .12);
  --red: #e5615b;
  --red-bg: rgba(229, 97, 91, .12);
  --amber: #d9a441;
  --amber-bg: rgba(217, 164, 65, .12);
  --blue: #7aa5f8;
  --blue-bg: rgba(122, 165, 248, .12);
  --focus: #5b8def;
  --roulette-red: #b8352e;
  --roulette-black: #1c1d20;
  --roulette-green: #1e7a4c;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
html { scrollbar-gutter: stable; } /* switching tabs doesn't shift the page sideways when a scrollbar appears */
/* phones: text keeps its size when turned sideways; a tap flashes faintly instead of a grey box */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(255, 255, 255, .08); }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
::selection { background: rgba(91, 141, 239, .4); }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration-color: rgba(255, 255, 255, .2); text-underline-offset: 3px; }
input, select {
  font: inherit; color: var(--text); background: var(--inset);
  height: 32px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 4px;
  transition: border-color .12s, background-color .12s;
}
input::placeholder { color: var(--faint); }
/* Hover looks are for a mouse only: a touch screen keeps them after a tap (a number just switched off
   in Settings would still look half on). Every :hover in this file is wrapped like this. */
@media (hover: hover) {
  a:hover { color: var(--text); text-decoration-color: currentColor; }
  input:hover, select:hover { border-color: var(--border-3); }
}
input:focus, select:focus { outline: none; border-color: var(--focus); }
select {
  appearance: none; -webkit-appearance: none; height: 30px; padding-right: 30px; cursor: pointer;
  background: var(--inset) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238e9197' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
}
input[type="number"] { font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.icon { flex: none; display: block; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 140px 20px; color: var(--muted); }
.num, .money { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
/* a button that looks like a link (moves within the panel) */
.link { padding: 0; border: 0; background: none; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .2); text-underline-offset: 3px; }
@media (hover: hover) { .link:hover { color: var(--text); text-decoration-color: currentColor; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  min-height: 57px; padding: 8px max(24px, calc((100% - 1400px) / 2)); background: var(--chrome);
  border-bottom: 1px solid var(--border);
}
.topbar.live { box-shadow: inset 0 2px 0 var(--red); } /* the mode, along the very top edge */
.topbar.dry { box-shadow: inset 0 2px 0 var(--amber); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.brand-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--green); display: grid; place-items: center; }
.brand-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.mode-tag { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; line-height: 1; padding: 5px 7px 4px; border-radius: 0; border: 1px solid; }
.mode-tag.live { color: var(--red); border-color: rgba(229, 97, 91, .45); background: var(--red-bg); }
.mode-tag.dry { color: var(--amber); border-color: rgba(217, 164, 65, .4); background: var(--amber-bg); }
.mode-tag.off { color: var(--muted); border-color: var(--border-2); background: var(--panel-2); }
.topbar.off { box-shadow: inset 0 2px 0 var(--border-3); }
/* website menu: the site on show as its mode dot and square logo; the other sites drop below, joined by hairlines */
.site-menu { position: relative; display: inline-flex; }
.site-pick, .site-option { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; color: inherit; text-decoration: none; }
.site-pick { border: 1px solid var(--border-2); border-radius: 2px; background: none; cursor: pointer; transition: background-color .12s, border-color .12s; }
.site-pick[aria-expanded="true"] { background: #26272b; border-color: var(--border-3); }
.site-chev { display: inline-flex; margin-left: -2px; color: var(--muted); transform: rotate(90deg); transition: transform .15s, color .12s; }
.site-pick[aria-expanded="true"] .site-chev { transform: rotate(-90deg); color: var(--text); }
.site-pick:focus-visible, .site-option:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.site-logo { display: block; flex: none; width: 20px; height: 20px; border-radius: 2px; outline: 1px solid rgba(255, 255, 255, .1); outline-offset: -1px; }
.site-logo.letters { display: grid; place-items: center; background: var(--border-2); font-size: 9px; font-weight: 700; }
.sdot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sdot.live { background: var(--green); }
.sdot.dry { background: var(--amber); }
.sdot.off { background: transparent; box-shadow: inset 0 0 0 1px var(--faint); }
.site-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 100%; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border-3); border-radius: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.site-option { height: 36px; transition: background-color .12s; }
.site-option + .site-option { border-top: 1px solid var(--border); }
.site-option.on { background: #26272b; box-shadow: inset 2px 0 0 var(--green); }
@media (hover: hover) {
  .site-pick:hover { border-color: var(--border-3); }
  .site-pick:hover .site-chev { color: var(--text); }
  .site-option:not(.on):hover { background: rgba(255, 255, 255, .04); }
}
.loading-sites { display: flex; justify-content: center; gap: 16px; margin-top: -120px; color: var(--muted); }
.conn { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn.warn { color: var(--amber); }
.conn.bad { color: var(--red); }
.cdots { display: inline-flex; gap: 4px; }
.topstats { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.topstat { display: flex; flex-direction: column; align-items: flex-end; }
.topstat + .topstat { padding-left: 20px; border-left: 1px solid var(--border); }
.topstat .label { font-size: 12px; color: var(--muted); }
.topstat .value { font-size: 15px; font-weight: 600; }
.topstat .unit { font-size: 12px; font-weight: 500; color: var(--muted); }
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 1.3; }
.pill.ok { color: var(--green); background: var(--green-bg); }
.pill.info { color: var(--blue); background: var(--blue-bg); }
.pill.warn, .pill.dry { color: var(--amber); background: var(--amber-bg); }
.pill.bad { color: var(--red); background: var(--red-bg); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; border: 1px solid var(--border-2); background: var(--panel-2); padding: 0 12px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--green); border-color: var(--green); color: #062612; font-weight: 600; }
.btn.danger { background: transparent; border-color: rgba(229, 97, 91, .4); color: var(--red); }
.btn.big { height: 34px; padding: 0 14px; }
.btn.ghost { background: transparent; }
.btn.small { font-size: 12px; }
.btn.icon { width: 28px; height: 28px; padding: 0; background: transparent; border-color: transparent; color: var(--faint); }
/* each kind of button with its own background has its own :hover, so these can follow them all */
@media (hover: hover) {
  .btn:hover { background: #232427; border-color: var(--border-3); }
  .btn:disabled:hover { background: var(--panel-2); border-color: var(--border-2); }
  .btn.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
  .btn.primary:disabled:hover { background: var(--green); border-color: var(--green); }
  .btn.danger:hover { background: var(--red-bg); border-color: rgba(229, 97, 91, .55); }
  .btn.ghost:hover { background: var(--panel-2); }
  .btn.icon:hover { color: var(--red); background: var(--red-bg); border-color: transparent; }
}

/* ---------- tabs ---------- */
/* editor-style tabs: the active one opens into the page below, with a green line on top */
.tabs { display: flex; padding: 0 max(24px, calc((100% - 1400px) / 2)); background: var(--chrome); box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; }
.tab { height: 40px; padding: 0 16px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; transition: color .12s; }
@media (hover: hover) { .tab:hover { color: var(--text); } }
.tab:focus-visible, .seg button:focus-visible, .link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tab.active { color: var(--text); background: var(--bg); box-shadow: inset 0 2px 0 var(--green), inset 1px 0 0 var(--border), inset -1px 0 0 var(--border); }

/* ---------- frame: panels stacked in one grid with shared hairlines ---------- */
/* The frame draws the top and left edges; every block in it draws its own right and bottom edge. */
main { width: calc(100% - 48px); max-width: 1400px; margin: 24px auto 56px; }
.frame { border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.card, .toolbar, .errors { border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.grid { display: grid; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
/* the period tiles wrap; a short last row stretches, so the grid never has holes */
.grid.cols-5 { display: flex; flex-wrap: wrap; }
.grid.cols-5 > * { flex: 1 1 200px; }
.stack { display: flex; flex-direction: column; }
.stack > :last-child { flex: 1 0 auto; }
.card { background: var(--panel); padding: 20px 22px; min-width: 0; }
.card h2 { margin: 0 0 16px; min-height: 24px; font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px; }
.card h2 .right { margin-left: auto; font-weight: 400; }
/* strips: filters, section titles, the settings buttons */
.toolbar { background: var(--chrome); padding: 12px 22px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- lost connection: the numbers below may be out of date ---------- */
.notice { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 18px; border: 1px solid rgba(217, 164, 65, .4); background: rgba(217, 164, 65, .06); box-shadow: inset 3px 0 0 var(--amber); color: var(--amber); }
main.stale .frame, main.stale .switcher { opacity: .55; transition: opacity .3s; }

/* ---------- attention banner: above the panels, on every section ---------- */
.attention { border: 1px solid rgba(229, 97, 91, .4); background: rgba(229, 97, 91, .06); box-shadow: inset 3px 0 0 var(--red); padding: 18px 22px; margin-bottom: 16px; }
.attention .title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--red); margin-bottom: 6px; }
.attention .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- strategy state ---------- */
.phase { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.phase .big { font-size: 28px; font-weight: 600; letter-spacing: -.5px; }
.phase .sub { color: var(--muted); }
/* misses: green, amber close to the trigger, red while money is on the table */
.meter { height: 8px; background: #232427; border-radius: 4px; overflow: hidden; margin: 14px 0 8px; }
.meter > div { height: 100%; background: var(--green); border-radius: 4px; transition: width .4s ease; }
.meter.hot > div { background: var(--amber); }
.meter.betting > div { background: var(--red); }

/* ---------- roulette numbers ---------- */
.nums { display: flex; gap: 6px; flex-wrap: wrap; }
.n { width: 30px; height: 30px; border-radius: 4px; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; font-variant-numeric: tabular-nums; flex: none; }
.n.red { background: var(--roulette-red); }
.n.black { background: var(--roulette-black); border: 1px solid #303135; }
.n.green { background: var(--roulette-green); }
.n.ours { outline: 2px solid var(--amber); outline-offset: 1.5px; }
.n.first { width: 38px; height: 38px; font-size: 16px; }

/* number picker (settings) */
.picker { display: grid; grid-template-columns: 44px repeat(12, 1fr); grid-template-rows: repeat(3, 40px); gap: 4px; max-width: 640px; }
.picker button { border: 0; border-radius: 4px; font-weight: 600; cursor: pointer; color: #fff; opacity: .4; transition: opacity .12s; }
.picker .n { width: auto; height: auto; }
@media (hover: hover) { .picker button:hover { opacity: .7; } }
.picker button.on { opacity: 1; box-shadow: inset 0 0 0 2px var(--amber); }
.picker .zero { grid-row: 1 / span 3; }
/* the customer's numbers, shown (set by the admin): the same layout, nothing to click */
.picker.readonly > span { display: grid; place-items: center; border-radius: 4px; font-weight: 600; color: #fff; opacity: .28; }
.picker.readonly > span.on { opacity: 1; box-shadow: inset 0 0 0 2px var(--amber); }
.ro-value { font-weight: 600; }

/* ---------- round / countdown ---------- */
.round { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.countdown { height: 3px; background: #232427; border-radius: 2px; overflow: hidden; margin-top: 12px; }
.countdown > div { height: 100%; background: var(--blue); transition: width 1s linear; }

/* ---------- tables ---------- */
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data td { padding: 8px 10px; border-bottom: 1px solid #1e1f22; }
table.data td.r, table.data th.r { text-align: right; }
table.data tr.current td { background: var(--amber-bg); }
table.data tr.current td:first-child { box-shadow: inset 2px 0 0 var(--amber); }
table.data tr.done td { color: var(--faint); }
table.data tr.clickable { cursor: pointer; }
@media (hover: hover) { table.data tr.clickable:hover td { background: var(--panel-2); } }
table.data tr.open td { background: var(--panel-2); }
/* a row's "wide-only" columns again, as a line under its first cell: shown on phones only */
.meta { display: none; }
.chev { display: inline-block; margin-right: 8px; color: var(--faint); vertical-align: -1px; transition: transform .15s; }
tr.open .chev { transform: rotate(90deg); color: var(--text); }

/* ---------- stat tiles ---------- */
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 24px; font-weight: 600; margin-top: 2px; letter-spacing: -.4px; }
.tile .detail { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- log ---------- */
.log { font-size: 13px; max-height: 420px; overflow: auto; margin: 0 -8px; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.log.full { max-height: none; }
.log .day { position: sticky; top: 0; z-index: 1; background: var(--panel); padding: 10px 8px 6px; font-size: 12px; font-weight: 500; color: var(--faint); }
.log .day:first-child { padding-top: 0; }
.log .line { display: grid; grid-template-columns: 58px 2px 1fr; gap: 0 12px; align-items: baseline; padding: 4px 8px; border-radius: 4px; }
.log.with-src .line { grid-template-columns: 58px 2px 104px 1fr; }
@media (hover: hover) { .log .line:hover { background: var(--panel-2); } }
.log .t { font-family: var(--mono); font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.log .lv { align-self: stretch; border-radius: 1px; margin: 2px 0; }
.log .src { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .msg { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.log .line.money .lv { background: var(--green); }
.log .line.warn .lv { background: var(--amber); }
.log .line.error .lv { background: var(--red); }
.log .line.money .msg, .log .line.warn .msg { color: var(--text); }
.log .line.error .msg { color: #f08a84; }
.seg .count { margin-left: 7px; font-size: 11px; font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
/* button group: joined segments with hairline dividers */
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 4px; overflow: hidden; background: var(--panel); }
.seg button { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border: 0; border-left: 1px solid var(--border-2); background: none; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; transition: color .12s, background-color .12s; }
.seg button:first-child { border-left: 0; }
@media (hover: hover) { .seg button:hover { color: var(--text); background: rgba(255, 255, 255, .03); } }
.seg button.on { color: var(--text); background: #26272b; cursor: default; }
.seg button.live::before, .seg button.dry::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; background: var(--faint); opacity: .6; }
.seg button.on.live::before { background: var(--red); opacity: 1; }
.seg button.on.dry::before { background: var(--amber); opacity: 1; }
.errors { background: rgba(229, 97, 91, .06); box-shadow: inset 3px 0 0 var(--red); color: var(--red); padding: 12px 22px; }
.errors div + div { margin-top: 4px; }
.save-bar { display: contents; } /* Save and Discard: part of the strip here, a bar of their own on phones */
.prog input { width: 84px; text-align: right; }
input.cell { height: 30px; background: var(--inset); border-color: transparent; }
@media (hover: hover) { input.cell:hover { border-color: var(--border-2); } }
input.cell:focus { border-color: var(--focus); }

/* settings rows: label + hint on the left, control on the right */
.setting { display: grid; grid-template-columns: 1fr auto; gap: 3px 24px; align-items: center; padding: 13px 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; padding-top: 2px; }
.setting:last-child { padding-bottom: 0; }
.setting-label { font-weight: 500; }
.setting-hint { grid-column: 1; font-size: 12px; color: var(--muted); }
.setting-control { grid-column: 2; grid-row: 1 / span 2; }
.setting input.tz { width: 180px; }
.setting input.proxy-field { width: 280px; }
.proxy-foot { margin-top: 14px; }
.proxy-live { gap: 6px 12px; }
.proxy-note { margin-top: 12px; }
.affix { display: inline-flex; align-items: center; height: 32px; width: 132px; background: var(--inset); border: 1px solid var(--border-2); border-radius: 4px; cursor: text; transition: border-color .12s; }
@media (hover: hover) { .affix:hover { border-color: var(--border-3); } }
.affix:focus-within { border-color: var(--focus); }
.affix input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; padding: 0 0 0 10px; text-align: right; }
.affix .unit { padding: 0 10px 0 6px; color: var(--faint); font-size: 12px; white-space: nowrap; }

/* on/off switch (a styled checkbox) */
input.switch { appearance: none; -webkit-appearance: none; position: relative; width: 28px; height: 16px; padding: 0; margin: 0; border: 0; border-radius: 999px; background: var(--border-3); cursor: pointer; vertical-align: middle; transition: background-color .15s; }
input.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #b9bbc0; transition: transform .15s, background-color .15s; }
input.switch:checked { background: var(--green); }
input.switch:checked::before { transform: translateX(12px); background: #fff; }
input.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input.switch:disabled { opacity: .5; cursor: not-allowed; }
.chart-box { position: relative; height: 240px; }
.empty { color: var(--faint); padding: 30px 0; text-align: center; }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--border-2); padding: 11px 15px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.toast .icon { color: var(--green); }
.toast.err { border-color: rgba(229, 97, 91, .45); color: var(--red); }
.toast.err .icon { color: var(--red); }

/* ---------- table switcher: two or more tables ---------- */
/* Kept apart from the panels: rounded tiles that read as buttons; the one on show is green. */
.switcher { margin-bottom: 24px; }
.switcher-head { display: flex; align-items: baseline; gap: 12px; margin: 0 2px 10px; }
.switcher-head .label { font-size: 13px; font-weight: 600; }
.warn-text { color: var(--amber); }
.switcher-grid { display: grid; grid-template-columns: repeat(var(--per-row), minmax(0, 1fr)); gap: 8px; }
.ttile { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 13px 16px 15px; text-align: left; cursor: pointer; background: var(--panel); border: 1px solid var(--border-2); border-radius: 6px; transition: border-color .12s, background-color .12s; }
@media (hover: hover) { .ttile:hover { border-color: var(--border-3); background: #18191c; } }
.ttile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ttile.alert { border-color: rgba(229, 97, 91, .55); }
.ttile.selected { border-color: var(--green); background: #15201a; box-shadow: inset 0 0 0 1px var(--green); }
.ttile-head { display: flex; align-items: center; gap: 8px; font-weight: 600; min-height: 22px; min-width: 0; }
.ttile-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttile-head .pill, .ttile-head .money { flex: none; }
.ttile-phase { display: flex; align-items: baseline; gap: 2px 10px; flex-wrap: wrap; }
.ttile-phase .big { font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.ttile-phase .sub { color: var(--muted); font-size: 12px; }
.meter.thin { height: 5px; margin: auto 0 0; } /* pinned to the bottom, so meters line up across a row */
.cdot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--faint); }
.cdot.online { background: var(--green); }
.cdot.starting { background: var(--blue); }
.cdot.recovering { background: var(--amber); }
.cdot.offline { background: var(--red); }
/* Follow mode: no window until a streak is close (not a problem). */
.cdot.asleep { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.tables-list .url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.tables-edit td { vertical-align: middle; }
.tables-edit input.cell { width: 100%; }
.tables-edit .url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }

@media (max-width: 1279px) {
  .switcher-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}
/* ---------- phones (and narrow windows) ---------- */
@media (max-width: 720px) {
  /* top bar: name, mode and connection on the first line; money and the betting button on the second */
  .topbar { min-height: 0; padding: 8px 14px 10px; gap: 6px 12px; }
  .conn { margin-left: auto; }
  .conn.proxy { margin-left: 0; }
  /* wide fields go under their label */
  .setting.wide { grid-template-columns: minmax(0, 1fr); }
  .setting.wide .setting-control { grid-column: 1; grid-row: auto; margin-top: 6px; }
  .setting input.proxy-field { width: 100%; }
  .topstats { width: 100%; margin-left: 0; gap: 14px; }
  .topstat { align-items: flex-start; }
  .topstat + .topstat { padding-left: 14px; }
  .topstats .btn { margin-left: auto; }
  /* the tabs share the width, so none is hidden past the edge */
  .tabs { padding: 0; }
  .tab { flex: 1 0 auto; padding: 0 8px; }

  /* panels run edge to edge: the frame's outer hairlines would only outline the screen */
  main { width: 100%; margin: 12px 0 32px; overflow-x: hidden; overflow-x: clip; }
  .frame { border-left: 0; margin-right: -1px; }
  .notice, .attention, .switcher { margin-left: 12px; margin-right: 12px; }
  .card { padding: 16px; }
  .toolbar, .errors { padding: 10px 16px; }
  .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .card h2 { flex-wrap: wrap; }

  /* attention: the answers as full-width buttons, one per line */
  .attention { padding: 14px 16px; }
  .attention .actions .btn { flex: 1 1 100%; }

  /* table switcher: compact rows, the count with its meter beside it */
  .switcher { margin-bottom: 16px; }
  .switcher-grid { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 6px; }
  .ttile { display: grid; grid-template-columns: minmax(0, 1fr) 30%; align-items: center; gap: 6px 14px; padding: 10px 14px 12px; }
  .ttile-head { grid-column: 1 / -1; }
  .ttile-phase .big { font-size: 18px; }
  .meter.thin { margin: 0; }
  /* many tables: two small tiles per row (name / count and badge / meter), so the list stays short */
  .switcher-grid.many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .switcher-grid.many .ttile {
    grid-template-columns: auto max-content minmax(0, 1fr); grid-template-areas: "dot name name" "big big badge" "meter meter meter";
    gap: 6px 8px; padding: 9px 11px 11px;
  }
  .switcher-grid.many .ttile-head { display: contents; }
  .switcher-grid.many .ttile-head .spacer, .switcher-grid.many .ttile-phase .sub { display: none; }
  .switcher-grid.many .cdot { grid-area: dot; }
  .switcher-grid.many .name { grid-area: name; font-weight: 600; }
  .switcher-grid.many .ttile-badge { grid-area: badge; display: flex; justify-content: flex-end; min-width: 0; }
  .switcher-grid.many .ttile-badge > * { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .switcher-grid.many .ttile-phase { grid-area: big; }
  .switcher-grid.many .ttile-phase .big { font-size: 17px; white-space: nowrap; }
  .switcher-grid.many .meter { grid-area: meter; }

  /* dashboard: today's numbers and the activity come before the long progression table */
  .progression { order: 1; }
  .phase .big { font-size: 24px; }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile .value { font-size: 20px; }

  /* tables: tighter cells; the "wide-only" columns move into each row's "meta" line */
  table.data th, table.data td { padding: 8px 6px; }
  .wide-only { display: none; }
  .meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
  td.bets { padding: 4px 0 8px; }
  tr.clickable td:first-child { white-space: nowrap; } /* the chevron stays beside the sequence number */

  /* statistics */
  .grid.cols-5 > * { flex-basis: 140px; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  .chart-box { height: 200px; }

  /* button groups wrap instead of running off the screen; the hairlines between buttons become shadows */
  .seg { flex-wrap: wrap; max-width: 100%; }
  .seg button { flex: 1 1 auto; justify-content: center; border-left: 0; box-shadow: -1px 0 0 var(--border-2), 0 -1px 0 var(--border-2); }
  .card h2 .filters { flex-basis: 100%; margin-left: 0; }
  .filters .seg { width: 100%; }

  /* log: the table's name above the message, so the message gets the full width */
  .log { max-height: none; }
  .log.with-src .line { grid-template-columns: 58px 2px minmax(0, 1fr); }
  .log.with-src .t, .log.with-src .lv { grid-row: span 2; }
  .log.with-src .src:empty { display: none; } /* an account-wide event: the message moves up next to its time */

  /* settings: each table on two lines, the switch and name on top, the URL under the name */
  .tables-edit, .tables-edit thead, .tables-edit tbody { display: block; }
  .tables-edit tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 6px 0; border-bottom: 1px solid #1e1f22; }
  .tables-edit thead tr { border-bottom-color: var(--border); }
  table.data.tables-edit th, table.data.tables-edit td { padding: 2px 0; border: 0; }
  .tables-edit th:nth-child(3), .tables-edit td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .tables-edit .url { max-width: none; }

  /* unsaved settings: Save and Discard stay at the bottom of the screen, wherever you are on the page */
  .save-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .toolbar.dirty { margin-bottom: 110px; }
  .toolbar.dirty .save-bar {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--chrome); border-top: 1px solid var(--border-2); box-shadow: 0 -8px 24px rgba(0, 0, 0, .4);
  }
  .toolbar.dirty .save-bar .btn { flex: 1; }
  .toolbar.dirty .save-bar .warn-text { order: -1; flex-basis: 100%; }

  .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast.lifted { bottom: calc(110px + env(safe-area-inset-bottom)); } /* above the save bar */
}

/* the smallest phones: the five tabs still fit side by side */
@media (max-width: 359px) {
  .tab { padding: 0 4px; font-size: 12.5px; }
}

/* the number picker stands up, as on a phone: 0 on top, then rows 1-2-3 … 34-35-36 */
@media (max-width: 560px) {
  .picker { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(13, 34px); max-width: 420px; }
  .picker .zero { grid-row: 1; grid-column: 1 / -1; }
  .picker .n:not(.zero) { grid-row: var(--row); grid-column: var(--col); }
  .picker button { font-size: 15px; }
}

/* ---------- touch screens: bigger targets for a finger ---------- */
@media (pointer: coarse) {
  .btn, .btn.big { height: 40px; }
  .site-pick { height: 40px; }
  .site-option { height: 48px; }
  .site-logo { width: 24px; height: 24px; }
  .btn.small { height: 36px; }
  .btn.icon { width: 40px; height: 40px; }
  .seg button { height: 36px; padding: 0 12px; }
  .tab { height: 44px; }
  /* 16px text: an iPhone zooms the page into any field with smaller text when it is tapped */
  input, select, .affix { height: 40px; font-size: 16px; }
  input.cell { height: 38px; }
  input.switch { width: 40px; height: 24px; }
  input.switch::before { width: 20px; height: 20px; }
  input.switch:checked::before { transform: translateX(16px); }
  /* small text links get a taller tap area without moving anything */
  .link, .card h2 a { padding: 10px 0; margin: -10px 0; }
  .tables-edit .url { padding: 6px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; }
}

/* progression steps that cannot be clicked before bets close */
.slow-steps { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: grid; gap: 4px; }

/* sign-in page (public/login.html) */
.signin-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 18px; }
.signin-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; justify-content: center; }
.signin-card { display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 24px; }
.signin-card h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field input { width: 100%; height: 38px; }
.signin-card .btn { width: 100%; margin-top: 4px; }
.signin-error { background: var(--red-bg); color: var(--red); border-radius: 4px; padding: 8px 10px; font-size: 13px; }
.signin-foot { margin: 0; text-align: center; color: var(--faint); font-size: 12px; }

/* Settings → Accounts: one block per site */
.account + .account { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.account-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }

/* Get started (public/onboarding.js) */
.onboarding { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.ob-rail { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 2px; }
.ob-rail-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ob-progress { height: 3px; background: var(--border); border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.ob-progress > div { height: 100%; background: var(--green); transition: width .4s ease; }
.ob-step { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 4px; cursor: pointer; color: var(--muted); }
.ob-step.current { background: var(--panel-2); color: var(--text); }
.ob-step.done { color: var(--text-2); }
.ob-step-mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-3); font-size: 11px; font-weight: 600; }
.ob-step.done .ob-step-mark { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.ob-step.current .ob-step-mark { border-color: var(--green); }
.ob-content { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 28px; animation: ob-in .35s ease both; }
@keyframes ob-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ob-title { margin: 0 0 10px; font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.ob-lead { margin: 0 0 22px; color: var(--text-2); max-width: 760px; }
.ob-nav { display: flex; gap: 10px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.ob-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; color: var(--text-2); font-size: 13px; }
.demo { background: var(--inset); border: 1px solid var(--border); border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.demo-head { display: flex; align-items: center; gap: 10px; }
.demo-results { display: flex; gap: 4px; min-height: 30px; flex-wrap: wrap; }
.demo-new { animation: demo-drop .35s ease both; }
@keyframes demo-drop { from { opacity: 0; transform: translateX(-10px) scale(.8); } to { opacity: 1; transform: none; } }
.demo-pop { animation: demo-pop .4s ease both; }
@keyframes demo-pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: none; } }
.demo-counter { display: flex; align-items: baseline; gap: 10px; }
.demo-counter .big { font-size: 26px; font-weight: 600; }
.demo-counter .sub { color: var(--muted); }
.demo-ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.demo-rung { border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); transition: all .25s; }
.demo-rung.now { border-color: var(--amber); background: var(--amber-bg); color: var(--text); }
.demo-rung.lost { border-color: rgba(229, 97, 91, .35); color: var(--red); }
.demo-rung.won { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.ob-wheel-row { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.ob-wheel { width: 300px; height: 300px; }
.ob-wheel-spin { animation: ob-spin 90s linear infinite; transform-origin: 0 0; }
@keyframes ob-spin { to { transform: rotate(360deg); } }
.ob-numbers { display: flex; flex-wrap: wrap; gap: 6px; max-width: 360px; }
.ob-site + .ob-site { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.ob-site h2 { font-size: 15px; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; }
.grid.cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid.ob-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ob-tiles .tile { background: var(--inset); border: 1px solid var(--border); border-radius: 4px; padding: 12px; }
.ob-chart { height: 220px; margin: 16px 0; }
.ob-relay { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; }
.ob-relay-lane { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; }
.ob-relay-bar { position: relative; height: 26px; }
.ob-relay-bar > span { position: absolute; left: calc(var(--from) / var(--max) * 100%); width: calc((var(--to) - var(--from)) / var(--max) * 100%); top: 0; bottom: 0; border-radius: 4px; display: grid; place-items: center; font-size: 11px; font-weight: 600; animation: ob-grow .8s ease both; transform-origin: left; }
.ob-relay-bar.first > span { background: var(--green-bg); border: 1px solid var(--green); color: var(--green); }
.ob-relay-bar.second > span { background: var(--amber-bg); border: 1px solid var(--amber); color: var(--amber); animation-delay: .5s; }
@keyframes ob-grow { from { transform: scaleX(0); } to { transform: none; } }
.ob-relay-axis { position: relative; height: 16px; margin-left: 100px; color: var(--faint); font-size: 11px; }
.ob-relay-axis > span { position: absolute; left: calc(var(--at) / var(--max) * 100%); white-space: nowrap; }
.ob-relay-axis > span::before { content: ""; position: absolute; left: 0; top: -36px; height: 34px; border-left: 1px dashed var(--border-2); }
.ob-note { margin: -8px 0 22px; padding: 10px 12px; border-left: 2px solid var(--amber); background: var(--amber-bg); color: var(--text-2); font-size: 13px; max-width: 760px; }
.ob-embed .card { border: 0; padding: 0; background: none; }
.ob-checks { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.ob-check { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none; }
.ob-check.ok .ob-dot { background: var(--green); }
.ob-check.optional .ob-dot { background: var(--faint); }
.ob-rules { display: flex; flex-direction: column; gap: 10px; }
.ob-rule { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.ob-rule.on { border-color: var(--green); background: var(--green-bg); }
.ob-rule input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--green); }
.ob-rule > span { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 720px) {
  .onboarding { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px 12px 0; }
  .ob-rail { position: static; }
  /* a phone shows the progress and the current step only; Back and Next move between steps */
  .ob-rail .ob-step:not(.current) { display: none; }
  .ob-content { padding: 18px; }
  .ob-facts, .grid.cols-4, .grid.ob-tiles { grid-template-columns: minmax(0, 1fr); }
  .ob-wheel { width: 240px; height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .ob-wheel-spin, .demo-new, .demo-pop, .ob-content, .ob-relay-bar > span { animation: none; }
}

/* Settings → Live browser (admin) */
.remote-bar { gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.remote-bar .btn.icon { width: 32px; padding: 0; }
.remote-go { flex: 1; min-width: 200px; }
.remote-address { width: 100%; font-family: var(--mono); font-size: 12px; }
.remote-screen { border: 1px solid var(--border-2); border-radius: 4px; overflow: hidden; background: var(--inset); outline: none; min-height: 200px; }
.remote-screen:focus { border-color: var(--focus); }
.remote-screen img { display: block; width: 100%; height: auto; cursor: default; user-select: none; }

/* control plane (public/control.js) */
.customers td { vertical-align: top; }
.customers .btn.small { white-space: nowrap; }
.pay-form, .notes-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pay-form input { width: 130px; }
.pay-form input[type="number"] { width: 100px; }
.notes-form { margin-top: 12px; }
.notes-form input { flex: 1 1 220px; }
.notes-form textarea { flex: 1 1 100%; font: inherit; color: var(--text); background: var(--inset); border: 1px solid var(--border-2); border-radius: 4px; padding: 8px 10px; resize: vertical; }
.sites-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; margin-bottom: 4px; }
.sites-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.sites-form label > input:not(.switch), .sites-form label > select { width: 100%; }
.site-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 6px; grid-column: span 1; }
.site-form.off { opacity: .6; }
.site-form label.row { flex-direction: row; color: var(--text); font-size: 14px; }
.created .v.mono, .v.mono { font-family: var(--mono); }

.telegram-link { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.table-picker { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 6px; }
.table-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.table-pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border: 1px solid var(--border); border-radius: 4px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.table-pick .tick { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--border-2); border-radius: 3px; font-size: 11px; line-height: 1; }
.table-pick.on { color: var(--text); border-color: rgba(74, 222, 128, .45); background: var(--green-bg); }
.table-pick.on .tick { color: #0e0f11; background: var(--green); border-color: var(--green); }
.table-pick:disabled { cursor: default; }
.switches { display: flex; flex-direction: column; gap: 14px; }
.switches.alert { box-shadow: inset 3px 0 0 var(--red); }
.switch-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.switch-row + .switch-row { border-top: 1px solid var(--border); padding-top: 14px; }
