/* T-Lab — light by default, dark on request (html[data-theme="dark"]). Tokens first; everything below uses them. */
:root {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --line: #d8dbe1;
  --text: #16181d;
  --muted: #5d6470;
  --accent: #1f6fd1;        /* series 1 / bid, links, primary button */
  --ask: #c9561c;           /* series 2 / ask */
  --good: #0a8a1f;
  --warn: #d99a00;
  --crit: #d33b3c;
  --radius: 10px;
  --series-1: #1f6fd1;      /* chart series, in this fixed order */
  --series-2: #c9561c;
  --series-3: #00866d;
  --heat-mid: #e4e6ea;      /* neutral midpoint of the blue/red scale */
  --backdrop: rgba(20, 24, 31, .45);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0b;
  --surface: #191919;
  --surface-2: #222222;
  --line: #2e2e2e;
  --text: #efefef;
  --muted: #9c9c9c;
  --accent: #338ced;
  --ask: #e76624;
  --good: #0aac23;
  --warn: #fbb315;
  --crit: #eb6263;
  --series-1: #338ced;
  --series-2: #e76624;
  --series-3: #00a888;
  --heat-mid: #383838;
  --backdrop: rgba(0, 0, 0, .65);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }      /* .btn and friends set display; hidden must still win */
html { font-size: 15px; }
body { margin: 0; background: var(--page); color: var(--text); font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .6rem; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; font-weight: 650; }
h3 { font-size: .9rem; margin: 1.2rem 0 .4rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: .4rem 0 .8rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 750; letter-spacing: .02em; color: var(--text); font-size: 1.1rem; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 7px; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--surface-2); }
.who { display: flex; align-items: center; gap: .7rem; margin: 0; }

.page { max-width: 1280px; margin: 0 auto; padding: 1.25rem; display: grid; gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; min-width: 0; }
.card.narrow, .card.auth { max-width: 26rem; width: 100%; margin: 6vh auto 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap; }
.card-head h1, .card-head h2 { margin: 0; }
.grid3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row form { margin: 0; }

.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; border-radius: 999px; font-size: .82rem; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.pill[data-tone="good"] { color: var(--text); } .pill[data-tone="good"]::before { background: var(--good); }
.pill[data-tone="warn"] { color: var(--text); } .pill[data-tone="warn"]::before { background: var(--warn); }
.pill[data-tone="crit"] { color: var(--text); } .pill[data-tone="crit"]::before { background: var(--crit); }

.note { padding: .55rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); margin: 0; overflow-wrap: anywhere; }
.note.good { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.note.crit { border-color: color-mix(in srgb, var(--crit) 60%, var(--line)); }
.hint { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: .2rem; }

/* forms */
label { display: block; margin: .75rem 0; font-weight: 550; font-size: .92rem; }
input:not([type=checkbox]):not([type=radio]) { display: block; width: 100%; margin-top: .3rem; padding: .5rem .65rem; background: var(--page); color: var(--text); border: 1px solid var(--line); border-radius: 7px; font: inherit; }
input:focus-visible, button:focus-visible, a:focus-visible, pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: .75rem 0; padding: .4rem .8rem; }
legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
label.check { display: block; font-weight: 400; margin: .45rem 0; }
label.check input { margin-right: .45rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .45rem .9rem; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--crit); }
.btn.small { padding: .25rem .65rem; font-size: .88rem; }
.btn.wide { width: 100%; margin-top: .5rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.unlock { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin: .5rem 0 1rem; }
.unlock label { margin: 0; flex: 1 1 14rem; }
form.inline { display: flex; gap: .5rem; align-items: center; margin: 0; }
form.inline input { margin-top: 0 !important; min-width: 9rem; }
form.inline.add { max-width: 40rem; }

/* tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .45rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 550; font-size: .82rem; padding: .4rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.env td:first-child .hint { font-size: .78rem; }

/* dashboard tiles */
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: .5rem 0 .75rem; }
.tile { background: var(--surface-2); border-radius: 8px; padding: .7rem .85rem; display: grid; gap: .15rem; min-width: 0; }
.tile .k { color: var(--muted); font-size: .82rem; }
.tile .val { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .sub { color: var(--muted); font-size: .8rem; }
.tile.hero { grid-column: span 2; }
.tile.hero .val { font-size: 1.9rem; }
.val[data-sign="up"]::before { content: "▲ "; color: var(--good); font-size: .7em; }
.val[data-sign="down"]::before { content: "▼ "; color: var(--crit); font-size: .7em; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.2rem; margin: .5rem 0 1rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.log { background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; font: .8rem/1.45 var(--mono); max-height: 20rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; color: var(--muted); }
.qr { background: #fff; border-radius: 8px; padding: .25rem; width: max-content; margin: .75rem auto; line-height: 0; }
.secret { user-select: all; letter-spacing: .06em; }

/* FX Lab */
.fx-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }
.fx-head h1 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: .3rem .8rem; font: inherit; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.legend { display: flex; gap: 1rem; color: var(--muted); font-size: .85rem; align-items: center; }
.legend i { display: inline-block; width: 1rem; height: 2px; vertical-align: middle; margin-right: .35rem; }
.legend .bid i { background: var(--accent); } .legend .ask i { background: var(--ask); }
.fx-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.fx-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem .6rem; min-width: 0; }
.fx-card header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.fx-card .pair { font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; }
.fx-card .age { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.quote { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: .5rem; margin: .5rem 0 .4rem; }
.quote .side { display: grid; }
.quote .side.ask { text-align: right; }
.quote .lbl { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.quote .lbl i { display: inline-block; width: .7rem; height: 2px; vertical-align: middle; margin-right: .3rem; }
.quote .bid .lbl i { background: var(--accent); } .quote .ask .lbl i { background: var(--ask); }
.quote .px { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.quote .px b { font-size: 1.25em; font-weight: 750; }
.quote .px sup { font-size: .6em; color: var(--muted); }
.quote .spread { text-align: center; padding-bottom: .25rem; }
.quote .spread .v { font-variant-numeric: tabular-nums; font-weight: 650; }
.fx-card .stats { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; margin-top: .25rem; gap: .5rem; flex-wrap: wrap; }
.chart { position: relative; height: 150px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.tip { position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; display: none; z-index: 2; }
.tip span { color: var(--muted); }
.px[data-dir]::before { font-size: .45em; vertical-align: middle; margin-right: .3em; }
.px[data-dir="up"]::before { content: "▲"; color: var(--good); }
.px[data-dir="down"]::before { content: "▼"; color: var(--crit); }
.fx-card .stats { flex-wrap: nowrap; white-space: nowrap; font-size: .76rem; }
/* Equity Lab: the FX Lab cards plus a watchlist box, a remove button and quoted sizes */
.watch-add { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }
.watch-add input { margin-top: 0 !important; flex: 1 1 16rem; max-width: 26rem; text-transform: uppercase; }
.watch-add input::placeholder { text-transform: none; }
.eq-grid .fx-card header { align-items: center; }
.eq-grid .pair { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-grid .name { color: var(--muted); font-weight: 400; font-size: .8rem; letter-spacing: 0; margin-left: .5rem; }
.eq-grid .age { white-space: nowrap; }
.fx-card .x { background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 1.15rem; line-height: 1; width: 1.6rem; height: 1.6rem; border-radius: 6px; cursor: pointer; margin-right: -.4rem; flex: none; }
.fx-card .x:hover { color: var(--text); background: var(--surface-2); }
.fx-card .x:disabled { opacity: .4; cursor: not-allowed; }
.quote .sz { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.eq-grid .quote .spread { padding-bottom: 1.4rem; }
.card-err { margin: 0 0 .4rem; font-size: .8rem; color: var(--text); border-left: 2px solid var(--warn); padding-left: .5rem; overflow-wrap: anywhere; }
/* Pop-up shown on any page when IB Gateway asks for input (a code by SMS, for example) */
dialog.gwp { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; }
dialog.gwp::backdrop { background: var(--backdrop); }
dialog.gwp h2 { margin-bottom: .2rem; }
dialog.gwp p { margin: .3rem 0; }
.gwp-shot { display: block; max-width: 100%; height: auto; min-height: 3rem; margin: .6rem auto .3rem; border: 1px solid var(--line); border-radius: 6px; cursor: crosshair; }
dialog.gwp .row { margin: .8rem 0 .2rem; }
dialog.gwp .note { margin-top: .6rem; }
/* ---------- data tab ---------- */
.btn { white-space: nowrap; }
.table td.num, .table td.nw { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.drop { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 1.4rem 1rem; text-align: center; background: var(--page); }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--page)); }
.drop p { margin: .2rem 0; }
.drop .link { display: inline; margin: 0; font-weight: 550; font-size: inherit; color: var(--accent); cursor: pointer; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.queue { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.queue li { display: flex; gap: .6rem; align-items: baseline; }
.queue .nm { font-family: var(--mono); overflow-wrap: anywhere; }
.findings { list-style: none; margin: .3rem 0 .8rem; padding: 0; display: grid; gap: .45rem; }
.findings li { display: grid; grid-template-columns: 6.2rem 1fr; gap: .6rem; align-items: baseline; }
.findings li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.filecards { display: grid; gap: .6rem; margin-bottom: .8rem; }
.filecard { background: var(--surface-2); border-radius: 8px; padding: .65rem .85rem; }
.filecard header { display: flex; flex-wrap: wrap; gap: .2rem .9rem; align-items: baseline; }
.filecard header code { overflow-wrap: anywhere; font-weight: 600; }
.filecard p { margin: .35rem 0 0; }
.tabs { overflow-x: auto; } .tabs a { white-space: nowrap; }
.findings.tight { margin: .35rem 0 0; font-size: .9rem; }
.findings code { overflow-wrap: anywhere; }
.pill[data-tone="idle"]::before { background: var(--muted); }
.token { overflow-wrap: anywhere; background: var(--page); border: 1px solid var(--line); border-radius: 7px; padding: .4rem .6rem; }
.tile .val.small { font-size: 1rem; }
.spin { display: inline-block; width: .8rem; height: .8rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; vertical-align: -1px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 4s; } }

/* ---------- FX Lab: live trading and backtest ---------- */
.small { font-size: .85rem; }
.tabs.wide a { flex: 1; text-align: center; padding: .6rem .9rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; margin-bottom: 0; }
.tabs.wide a.on { background: var(--surface-2); box-shadow: inset 0 2px 0 var(--accent); border-bottom-color: transparent; }
.tabs.wide a:hover { text-decoration: none; color: var(--text); }
select { background: var(--page); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: .4rem .6rem; font: inherit; }
label select { display: block; width: 100%; margin-top: .3rem; padding: .5rem .65rem; }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 3px; margin-right: .5rem; vertical-align: baseline; }
.row.between { justify-content: space-between; }
.grid2.even { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); align-items: stretch; }
.grid2.even > * { min-width: 0; }
.strat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.card.strat { display: grid; gap: .35rem; align-content: start; }
.card.strat .card-head { margin-bottom: 0; }
.card.strat .tiles { grid-template-columns: 1.3fr 1fr 1fr; margin: .4rem 0 .5rem; }
.card.strat .tile.hero { grid-column: auto; }
.card.strat .tile.hero .val { font-size: 1.6rem; }
.card.strat p { margin: .3rem 0 0; }
.card.strat .pill, .fx-head .pill { white-space: normal; border-radius: 14px; }
.card.strat .pill::before, .fx-head .pill::before { flex: none; }
.card.strat p.note { margin-top: .5rem; padding: .4rem .65rem; }
#trade-note { margin-bottom: .75rem; }
#orders .pill, #cross .pill { font-size: .78rem; padding: .05rem .5rem; }
.table-wrap.scroll:has(#orders) { max-height: 22rem; }
.tile .sub { overflow-wrap: anywhere; }
td[data-sign="up"]::before { content: "▲ "; color: var(--good); font-size: .65em; }
td[data-sign="down"]::before { content: "▼ "; color: var(--crit); font-size: .65em; }
.table.sig th.grp { text-align: right; }
.table.sig thead tr:first-child th { border-bottom: 0; padding-bottom: 0; color: var(--text); font-size: .88rem; }
.table.sig .pairname { font-weight: 700; letter-spacing: .02em; }
.table.sig td { font-variant-numeric: tabular-nums; }
.table.sig tr.stale td:nth-child(-n+4) { color: var(--muted); }
.sigcell { text-align: right; white-space: nowrap; }
.sigcell .sv { display: inline-block; min-width: 3.6rem; font-weight: 600; }
.sigcell .sp { display: inline-block; width: 6.2rem; text-align: left; color: var(--muted); }
.sigcell .sp[data-side] { color: var(--text); }
.sigcell .sp[data-side="long"]::before { content: "▲ "; color: var(--series-1); font-size: .65em; }
.sigcell .sp[data-side="short"]::before { content: "▼ "; color: var(--crit); font-size: .65em; }
.sigcell.off { opacity: .45; }
.gauge { display: inline-block; position: relative; width: 4.6rem; height: 6px; border-radius: 3px; background: var(--surface-2); vertical-align: middle; margin: 0 .6rem; overflow: hidden; }
.gauge::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.gauge i { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-radius: 3px; }
.gauge i[data-side="up"] { background: var(--series-1); }
.gauge i[data-side="down"] { background: var(--crit); }
.chart.tall { height: 290px; }
.tip .key { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .4rem; }
.legend i { height: 3px; border-radius: 2px; }
label.check.inline { margin: 0; color: var(--muted); font-size: .88rem; }
.table-wrap.scroll { max-height: 30rem; overflow-y: auto; }
.table-wrap.scroll.short { max-height: 16.5rem; }
.table-wrap.scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
tr.past td { color: var(--muted); }
.imp { display: inline-block; width: 1.05rem; height: 1.05rem; line-height: 1.05rem; text-align: center; border-radius: 50%; border: 1px solid var(--warn); color: var(--text); font-size: .72rem; font-weight: 700; margin-right: .4rem; }
/* the input mask */
dialog.mask { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.35rem; width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; }
dialog.mask::backdrop { background: var(--backdrop); }
dialog.mask h2 { margin-bottom: .3rem; }
.mask-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 1.2rem; }
.mask-grid label { margin: .6rem 0; }
.mask-grid .unit { color: var(--muted); font-weight: 400; }
fieldset.pairs { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
fieldset.pairs label.check { margin: .3rem 0; }
.problems { margin: .5rem 0; padding: .5rem .8rem .5rem 1.8rem; border: 1px solid color-mix(in srgb, var(--crit) 60%, var(--line)); border-radius: 8px; background: var(--surface-2); }
.mask-foot { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.mask-foot .grow { flex: 1; }
/* backtest */
.bt-layout { display: grid; gap: 1.2rem; }
.bt-layout > * { min-width: 0; }
.seg { max-width: 100%; overflow-x: auto; }
.filter { min-width: 0; max-width: 100%; }
.heat-box { max-width: 46rem; }
.bt-layout[hidden] { display: none; }
.bt-layout h3 { margin-top: .4rem; }
.filters { gap: .5rem 1.1rem; margin-bottom: .7rem; align-items: flex-end; }
.filter { display: grid; gap: .15rem; }
.seg button { white-space: nowrap; }
.table.pick tbody tr { cursor: pointer; }
.table.pick tbody tr:hover td, .table.pick tbody tr:focus-visible td { background: var(--surface-2); }
.table.pick tbody tr[aria-current] td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
table.heat { border-collapse: separate; border-spacing: 2px; width: 100%; font-variant-numeric: tabular-nums; }
table.heat th { color: var(--muted); font-weight: 550; font-size: .82rem; padding: .3rem .5rem; text-align: right; white-space: nowrap; }
table.heat thead th:first-child, table.heat tbody th { text-align: left; }
table.heat td { padding: 0; }
table.heat td button { display: block; width: 100%; min-width: 3.6rem; padding: .55rem .4rem; border: 0; border-radius: 4px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; text-align: center; cursor: pointer; }
table.heat td button:hover { outline: 2px solid var(--muted); outline-offset: -2px; }
table.heat td button[aria-current] { outline: 2px solid var(--text); outline-offset: -2px; }
.heat-key { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; margin: .6rem 0 .2rem; }
.heat-key i { flex: 1; max-width: 14rem; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--crit) 78%, var(--heat-mid)), var(--heat-mid), color-mix(in srgb, var(--series-1) 78%, var(--heat-mid))); }
#detail .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { #detail .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.page.wide { max-width: 1560px; }
.grid2.even.lean-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
@media (max-width: 1000px) { .grid2.even.lean-right { grid-template-columns: minmax(0, 1fr); } }
.table.compact { font-size: .88rem; }
.table.compact td, .table.compact th { padding: .38rem .5rem; }
label select, label input { font-weight: 400; }

@media (max-width: 760px) {
  .topbar { gap: .5rem 1rem; }
  .who { margin-left: auto; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 560px) { .tile.hero { grid-column: span 1; } .page { padding: .75rem; } }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: .1rem; } .facts dd { margin-bottom: .55rem; } }

/* theme switch in the top bar */
.theme-switch { margin-left: auto; }
.theme-switch + .who { margin-left: 0; }
.theme-switch button { padding: .2rem .65rem; font-size: .85rem; }

/* Logs */
.table-wrap.scroll.tall { max-height: 70vh; }
.logtable td.msg { overflow-wrap: anywhere; min-width: 20rem; }
.logtable td.msg details { margin-top: .25rem; }
.logtable td.msg summary { color: var(--muted); font-size: .8rem; cursor: pointer; }
.logtable tr[data-lvl="ERROR"] td, .logtable tr[data-lvl="CRITICAL"] td { background: color-mix(in srgb, var(--crit) 7%, transparent); }
.logtable tr[data-lvl="WARNING"] td { background: color-mix(in srgb, var(--warn) 7%, transparent); }
.nw { white-space: nowrap; }

/* problem banner under the top bar (static/js/alerts.js) */
.alertbar { background: color-mix(in srgb, var(--crit) 12%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--crit) 45%, var(--line)); padding: .5rem 1.25rem; font-size: .9rem; }
.alertbar .alert-line { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; max-width: 1560px; margin: 0 auto; }
.alertbar .alert-head { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.alertbar strong::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--crit); margin-right: .45rem; vertical-align: 1px; }
.alertbar .alert-list { margin: .4rem auto 0; padding-left: 1.2rem; max-width: 1560px; max-height: 12rem; overflow: auto; }
.filters .filter input { margin-top: 0; }
