/* Tokens ------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --page: #f3f3f0;
  --surface: #fcfcfb;
  --surface-2: #ecece8;
  --surface-hover: #f1f1ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, .10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05), 0 1px 1px rgba(11, 11, 11, .03);
  --log-bg: #fcfcfb;
  /* status - reserved, always paired with an icon + label */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --tint: 13%;
  /* profile identity (categorical, fixed order) */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100; --cat-5: #e87ba4; --cat-6: #008300; --cat-7: #6250d6;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #252523;
    --surface-hover: #212120;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, .10);
    --accent: #3987e5;
    --shadow: none;
    --log-bg: #121211;
    --tint: 18%;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9;
  }
}
:root[data-theme="dark"] {
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9;
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #252523;
  --surface-hover: #212120;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, .10);
  --accent: #3987e5;
  --shadow: none;
  --log-bg: #121211;
  --tint: 18%;
}

/* Base ---------------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body {
  font: 15px/1.45 var(--font);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* App bar ------------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.bar .title { flex: 1; min-width: 0; }
.bar h1 { font-size: 18px; line-height: 1.2; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.bar .sub { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.live-dot.down { background: var(--critical); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  cursor: pointer; touch-action: manipulation;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn .lbl { font-size: 13px; color: var(--ink-2); }

main { padding: 14px; max-width: 1180px; margin: 0 auto; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 22px 2px 10px; }
.section-title h2 { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.section-title .hint { margin-left: auto; }
.hint { color: var(--ink-2); font-size: 13px; }
.muted { color: var(--muted); }

/* Overview tiles ------------------------------------------------------------ */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.tile .k { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.tile .v small { font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.tile .s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sources { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 2px 0; font-size: 12.5px; color: var(--ink-2); }
.sources span { display: inline-flex; align-items: center; gap: 5px; }

/* Parser cards -------------------------------------------------------------- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 14px 12px 17px; cursor: pointer;
  transition: background .12s;
}
.card:hover { background: var(--surface-hover); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--rail, var(--hairline)); }
.card[data-level="ok"] { --rail: var(--good); }
.card[data-level="warning"] { --rail: var(--warning); }
.card[data-level="serious"] { --rail: var(--serious); }
.card[data-level="critical"] { --rail: var(--critical); }
.card[data-level="unknown"] { --rail: var(--accent); }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head .who { flex: 1; min-width: 0; }
.card-head .name { font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; }
.card-head .feedkey { font-size: 12.5px; color: var(--ink-2); }

.proc { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.proc .d { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.proc.running .d { background: var(--good); }
.proc.external .d { background: var(--accent); }
.proc.busy .d { background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .25; } }

.health {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 13px; font-weight: 550; color: var(--ink);
  padding: 4px 10px 4px 7px; border-radius: 8px;
  background: color-mix(in srgb, var(--hc, var(--muted)) var(--tint), transparent);
}
.health svg.i { width: 16px; height: 16px; color: var(--hc, var(--muted)); stroke-width: 2.4; }
.health .age { font-weight: 400; color: var(--ink-2); }
.health.ok { --hc: var(--good); }
.health.warning { --hc: var(--warning); }
.health.serious { --hc: var(--serious); }
.health.critical { --hc: var(--critical); }
.health.unknown { --hc: var(--accent); }
.health.off { --hc: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.metric .v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.metric .k { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric.dim .v { color: var(--muted); }

.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.card-foot .meta { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acts { display: flex; gap: 6px; }
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 40px; padding: 0 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); touch-action: manipulation;
}
.act:hover:not(:disabled) { background: var(--surface-hover); }
.act:disabled { opacity: .35; cursor: default; }
.act.go svg { color: var(--good); }
.act.stop svg { color: var(--critical); }
.act.wide { padding: 0 14px; font-weight: 550; }

/* Sparkline ----------------------------------------------------------------- */
.spark { position: relative; height: var(--h, 34px); margin-top: 10px; }
.spark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--accent); opacity: .10; }
.spark .base { stroke: var(--hairline); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .end { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.spark .guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-2); opacity: .5; pointer-events: none; display: none; }
.spark .tip {
  position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); display: none; z-index: 3;
  background: var(--ink); color: var(--page); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
}
.spark.hover .guide, .spark.hover .tip { display: block; }
.spark-empty { height: 100%; display: flex; align-items: center; font-size: 12px; color: var(--muted); border-bottom: 1px dashed var(--hairline); }
.spark-cap { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* Activity ------------------------------------------------------------------ */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.event { display: grid; grid-template-columns: 74px 96px 1fr; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--hairline); font-size: 13px; }
.event:first-child { border-top: 0; }
.event .ts { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.event .who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event .msg { min-width: 0; overflow-wrap: anywhere; }
.event.warn .msg::before, .event.error .msg::before { content: "! "; font-weight: 700; }
.event.warn .msg::before { color: var(--serious); }
.event.error .msg::before { color: var(--critical); }
.more { display: block; width: 100%; padding: 10px; border: 0; border-top: 1px solid var(--hairline); background: none; color: var(--accent); cursor: pointer; }

/* Detail -------------------------------------------------------------------- */
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.hero .path { font-size: 12px; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; font-family: var(--mono); }
.hero .acts { margin-top: 12px; flex-wrap: wrap; }

.tabs {
  position: sticky; z-index: 9; top: var(--bar-h, 60px);
  display: flex; gap: 2px; padding: 3px; margin: 12px 0;
  background: var(--surface-2); border-radius: 12px; overflow-x: auto; scrollbar-width: none;
}
.tabs a {
  flex: 1; text-align: center; padding: 8px 10px; border-radius: 9px; text-decoration: none;
  color: var(--ink-2); font-size: 14px; font-weight: 550; white-space: nowrap;
}
.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.panel h3 { font-size: 14px; margin: 0 0 2px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.field, .toolbar select, .toolbar input[type=text], .toolbar input[type=search] {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 10px; min-height: 38px; min-width: 0;
}
.toolbar select { flex: 1 1 180px; max-width: 100%; }
.toolbar input[type=text], .toolbar input[type=search] { flex: 1 1 140px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.seg button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.grow { flex: 1; }

/* Feed tab ------------------------------------------------------------------ */
.feed-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.game { border-top: 1px solid var(--hairline); }
.game:first-child { border-top: 0; }
.game-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; cursor: pointer; }
.game-row:hover { background: var(--surface-hover); }
.fresh { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.fresh.ok { background: var(--good); }
.fresh.warning { background: var(--warning); }
.fresh.critical { background: var(--critical); }
.game .teams { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.game .lg { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.game .right { text-align: right; white-space: nowrap; }
.score { display: inline-block; font-weight: 650; font-variant-numeric: tabular-nums; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); }
.game .ago { font-size: 12px; color: var(--ink-2); margin-top: 3px; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); vertical-align: 1px; margin-left: 6px; }
/* Inflated-odds check */
.tag.warn { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--ink); }
.tag.crit { background: var(--critical); color: #fff; }
.flagline { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.flagline svg.i { width: 16px; height: 16px; color: var(--warning); stroke-width: 2.4; }
.flagline.major svg.i { color: var(--critical); }
.panel.inflated.hit { border-color: var(--warning); box-shadow: inset 3px 0 0 var(--warning), var(--shadow); }
.chip.flag { outline: 2px solid var(--critical); outline-offset: -2px; }
/* Hidden parsers (home page Edit) */
.card.is-hidden { opacity: .55; }
.icon-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.icon-btn.on .lbl { color: inherit; }
.hidden-note { margin: 8px 2px 0; }
/* Login page (public listener) */
main.login { max-width: 360px; margin: 14vh auto 0; padding: 0 16px; }
main.login h3 { font-size: 18px; }
.odds { padding: 2px 14px 14px 34px; }
.market { margin-top: 10px; }
.market .mh { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.chip { border: 1px solid var(--border); border-radius: 9px; padding: 6px 9px; background: var(--surface); }
.chip .bn { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .bo { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.chip .bo b { font-size: 15px; }
.chip .bo .mv { font-size: 12px; color: var(--ink-2); }
.chip .bo .t { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.chip.susp { opacity: .5; }
.fork { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--hairline); font-size: 13px; }
.fork:first-child { border-top: 0; }
.fork .pct { font-weight: 650; font-variant-numeric: tabular-nums; }
.fork .pct.pos { color: var(--good); }
.fork .d { color: var(--ink-2); overflow-wrap: anywhere; }
.empty { padding: 22px 14px; text-align: center; color: var(--ink-2); font-size: 14px; }

/* Logs ---------------------------------------------------------------------- */
pre.log {
  margin: 0; padding: 12px; background: var(--log-bg); border: 1px solid var(--border); border-radius: 12px;
  height: calc(100dvh - 330px); min-height: 320px; overflow: auto;
  font: 12px/1.5 var(--mono); white-space: pre; color: var(--ink);
  -webkit-overflow-scrolling: touch;
}
pre.log.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Browser ------------------------------------------------------------------- */
.screen { position: relative; background: #000; border-radius: 12px; overflow: hidden; min-height: 160px; border: 1px solid var(--border); }
.screen img { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.screen .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: #c3c2b7; font-size: 14px; pointer-events: none; }
.tap { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 2px solid #3987e5; pointer-events: none; animation: tap .5s ease-out forwards; }
@keyframes tap { to { transform: scale(1.8); opacity: 0; } }

/* Forms --------------------------------------------------------------------- */
.form label { display: block; color: var(--ink-2); font-size: 13px; margin: 12px 0 5px; }
.form input[type=text], .form input[type=password], .form input[type=time] {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; min-height: 42px;
}
.pwrow { display: flex; gap: 6px; }
.pwrow input { flex: 1; }
.err { color: var(--critical); font-size: 13px; white-space: pre-wrap; margin-top: 8px; }
.ok-msg { color: var(--ink); font-size: 13px; margin-top: 8px; }
.ok-msg::before { content: "✓ "; color: var(--good); font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px; cursor: pointer; font-weight: 550;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn:disabled { opacity: .4; cursor: default; }
textarea.editor {
  width: 100%; height: calc(100dvh - 380px); min-height: 320px; resize: vertical;
  background: var(--log-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  font: 12.5px/1.5 var(--mono); white-space: pre; tab-size: 2; color: var(--ink);
}
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days .seg button { min-width: 42px; }
.switch { display: flex !important; align-items: center; gap: 10px; font-size: 15px; color: var(--ink) !important; margin-top: 0 !important; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Timers timeline ------------------------------------------------------------- */
.tl-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-head > div:first-child { flex: 1 1 200px; }
.tl-head .seg { overflow-x: auto; max-width: 100%; }
.tl { display: grid; }
.tl-row {
  display: grid; grid-template-columns: minmax(118px, 30%) 1fr; gap: 12px; align-items: center;
  width: 100%; padding: 10px 6px; border: 0; border-top: 1px solid var(--hairline); background: none; text-align: left; cursor: pointer; border-radius: 0;
}
button.tl-row:hover { background: var(--surface-hover); }
.tl-axis { border-top: 0; padding-top: 0; padding-bottom: 4px; cursor: default; }
.tl-name { min-width: 0; }
.tl-name .n { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-name .s { font-size: 12px; color: var(--ink-2); margin-top: 1px; overflow-wrap: anywhere; }
.proc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.proc-dot.running { background: var(--good); }
.proc-dot.external { background: var(--accent); }
.tl-track { position: relative; height: 28px; background: var(--surface-2); border-radius: 6px; }
.tl-axis .tl-track { height: 16px; background: none; }
.tl-track .tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-track .tick:first-child { transform: none; }
.tl-track .tick:last-child { transform: translateX(-100%); }
.tl-track .grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--hairline); }
.tl-bar { position: absolute; top: 6px; bottom: 6px; background: var(--accent); border-radius: 4px; min-width: 3px; }
.tl-track .mk { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 10px; line-height: 1; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 2px 3px; }
.tl-none { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 10px; font-size: 12px; color: var(--muted); }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend .sw { display: inline-block; width: 18px; height: 8px; border-radius: 3px; background: var(--accent); }
.tl-lbl { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 600; line-height: 1; color: var(--ink); background: var(--surface); border-radius: 3px; padding: 2px 4px; white-space: nowrap; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; }
.sw-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tl-legend .sw.now { width: 2px; height: 12px; background: var(--ink); }
/* A timer that is switched off: its slots stay visible but greyed and hatched. */
.tl-bar.off { opacity: .35; background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(0, 0, 0, .35) 4px 7px) !important; }
.tl-legend .sw.off { background: var(--muted); opacity: .5; background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(0, 0, 0, .35) 3px 5px); }
.days-seg button { flex: 1; }
.days-seg { display: flex; width: 100%; }
.days-seg button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.presets { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.sheet.form { max-height: 92dvh; overflow-y: auto; }
.sheet.wide { max-width: 560px; }
.form select.field { width: 100%; min-height: 42px; }

/* Profiles & schedule (profile plan) ----------------------------------------- */
button.prof-row { width: 100%; border: 0; border-top: 1px solid var(--hairline); background: none; text-align: left; cursor: pointer; color: inherit; grid-template-columns: minmax(64px, auto) 1fr; }
button.prof-row:first-child { border-top: 0; }
button.prof-row:hover { background: var(--surface-hover); }
.plan-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.plan-acts a.hint { margin-left: auto; }
.slot { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-top: 10px; }
.slot-top { display: flex; align-items: center; gap: 8px; }
.slot-top .sw-dot { margin: 0; flex: none; }
.form .slot-top input[type=time] { flex: 1 1 0; min-width: 0; width: auto; }
.slot-top select.field { flex: 1.2 1 0; min-width: 0; width: auto; min-height: 42px; }
.slot .days-seg { margin-top: 8px; }
.slot .hint { margin-top: 6px; }
.wk { display: grid; gap: 5px; margin-bottom: 16px; }
.wk-row { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; font-size: 11px; color: var(--ink-2); }
.wk-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; }
.wk-track .wk-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; min-width: 2px; }
.wk-track .grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--hairline); }
.wk-axis .wk-track { background: none; height: 12px; }
.wk-axis .tick { position: absolute; transform: translateX(-50%); color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-axis .tick:first-child { transform: none; }
.wk-axis .tick:last-child { transform: translateX(-100%); }
textarea.editor.small { height: 160px; min-height: 120px; }
.form input[type=search].field { flex: 1 1 200px; min-height: 42px; border-radius: 10px; }
.octo-list { max-height: 248px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.octo-row { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--hairline); background: none; padding: 8px 10px; cursor: pointer; color: inherit; }
.octo-row:first-child { border-top: 0; }
.octo-row:hover { background: var(--surface-hover); }
.octo-row.on { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.octo-t { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.octo-s { display: block; font: 11px/1.4 var(--mono); color: var(--muted); margin-top: 2px; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); }
.badge.used { border-color: var(--accent); color: var(--accent); }
.badge.warn { border-color: var(--warning); color: var(--warning); }
@media (max-width: 520px) {
  .slot-top { flex-wrap: wrap; }
  .slot-top select.field { flex: 1 1 100%; order: 5; }
}
.linkish { display: block; margin: 14px auto 0; border: 0; background: none; color: var(--ink-2); font-size: 13px; text-decoration: underline; cursor: pointer; }
@media (max-width: 520px) {
  .tl-row { grid-template-columns: 1fr; gap: 6px; }
  .tl-axis > div:first-child { display: none; }
  .tl-track { height: 24px; }
}

/* Sheet (confirm) ------------------------------------------------------------ */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 440px; background: var(--surface); color: var(--ink);
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up .18s ease-out;
}
.sheet h3 { margin: 0 0 6px; font-size: 18px; }
.sheet p { margin: 0 0 18px; color: var(--ink-2); white-space: pre-wrap; }
.sheet .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 640px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 18px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

#banner { background: color-mix(in srgb, var(--critical) 14%, var(--page)); border-bottom: 1px solid var(--critical); padding: calc(10px + env(safe-area-inset-top)) 14px 10px; font-size: 14px; }
#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--page); border-radius: 12px; padding: 10px 16px;
  max-width: 92vw; white-space: pre-wrap; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 40; font-size: 14px;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--critical); color: #fff; }

/* Phone tweaks -------------------------------------------------------------- */
@media (max-width: 520px) {
  main { padding: 12px 10px; }
  .tile { padding: 10px 11px; }
  .tile .v { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
  .event { grid-template-columns: 60px 1fr; }
  .event .who { grid-column: 2; }
  .event .msg { grid-column: 2; }
  .event .ts { grid-row: span 2; }
  .act .lbl { display: none; }
  .odds { padding-left: 14px; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
