/* sbscanner — WebTUI base + Dracula theme, flattened to a real TUI look.
   Loaded AFTER vendor/webtui.css so these override the framework defaults. */

:root {
  --background0: #21222c;
  --background1: #282a36;
  --background2: #2d3040;
  --background3: #44475a;
  --foreground0: #f8f8f2;
  --foreground1: #c5cae0;
  --foreground2: #6272a4;

  --font-family: "JetBrains Mono","IBM Plex Mono","SFMono-Regular",ui-monospace,"Cascadia Code","Fira Code",Menlo,Consolas,monospace;
  --font-size: 14px;
  --line-height: 1.45;

  --table-border-color: #343748;
  --rule: #2a2c3a;

  --purple: #bd93f9;
  --green:  #50fa7b;
  --cyan:   #8be9fd;
  --pink:   #ff79c6;
  --orange: #ffb86c;
  --yellow: #f1fa8c;
  --red:    #ff5555;
}

/* flat, square, terminal: kill web-isms + force monospace everywhere */
* { border-radius: 0 !important; box-shadow: none !important; text-shadow: none !important; }
*, *::before, *::after { font-family: var(--font-family) !important; }

body { word-break: normal; margin: 0; background: var(--background0); color: var(--foreground0); }
::selection { background: var(--purple); color: var(--background0); }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
.crt { position: relative; min-height: 100vh; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1ch;
  padding: 0 2ch; min-height: 2lh;
  border-bottom: 1px solid var(--background3);
  background: var(--background1); position: sticky; top: 0; z-index: 40;
}
.brand { color: var(--purple); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.cursor { color: var(--pink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0 1.6ch; }
.nav a { color: var(--foreground2); }
.nav a:hover { color: var(--purple); }

/* segmented live/history toggle */
.seg { display: inline-flex; border: 1px solid var(--background3); }
.seg .vt { padding: 0 1ch; color: var(--foreground2); }
.seg .vt + .vt { border-left: 1px solid var(--background3); }
.seg .vt:hover { color: var(--purple); text-decoration: none; }
.seg .vt.on { background: var(--purple); color: var(--background0); }
.seg .vt.on:hover { text-decoration: none; }

/* net/brutto toggle */
.nav .vat { cursor: pointer; user-select: none; border: 1px solid var(--background3); padding: 0 .75ch; color: var(--foreground1); }
.nav .vat::before { content: "vat["; color: var(--foreground2); }
.nav .vat::after  { content: "]"; color: var(--foreground2); }
.nav .vat:hover { border-color: var(--purple); color: var(--purple); text-decoration: none; }
.nav .vat.on { border-color: var(--green); color: var(--green); }

.wrap { max-width: 184ch; margin: 0 auto; padding: 1.4lh 2ch; }

/* ---- panels: CSS border + notched title cap ---- */
.panel {
  position: relative;
  border: 1px solid var(--background3);
  background: var(--background1);
  margin: 0 0 1.4lh;
  padding: 1.1lh 1.25ch .9lh;
}
.boxtitle {
  position: absolute; top: 0; left: 1.5ch; transform: translateY(-50%);
  background: var(--background1); padding: 0 .75ch;
  color: var(--purple); text-transform: uppercase; letter-spacing: .15ch;
  font-weight: 700; font-size: .92em; white-space: nowrap;
}
.boxtitle::before { content: "▌ "; }
.boxtitle .muted { color: var(--foreground2); text-transform: none; letter-spacing: 0; }

/* ---- stat grid ---- */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15ch, 1fr)); gap: .6lh 2ch; }
.statgrid > div { display: flex; flex-direction: column; min-width: 0; }
.statgrid .k { color: var(--foreground2); font-size: .8em; text-transform: uppercase; letter-spacing: .1ch; }
.statgrid .v { color: var(--foreground0); font-size: 1.25em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.statgrid .v.gpu { color: var(--pink); }
.statgrid .v.dc { color: var(--cyan); }
.statgrid .v.sp { color: var(--orange); font-size: 1em; }
.statgrid .sub { display: block; color: var(--foreground2); font-size: .72em; font-weight: 400; letter-spacing: 0; }
.pricestats { margin-bottom: 1lh; }

/* ---- filter form ---- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6lh 2ch; }
.filters label { color: var(--foreground2); display: inline-flex; align-items: center; gap: .75ch; }
[is-~="input"], .filters input[type=text], .filters input[type=number] {
  min-width: 0; height: 1.6lh; padding: 0 1ch;
  background: #181922; color: var(--foreground0);
  border: 1px solid var(--background3); font-size: 1em; caret-color: var(--green);
}
.filters input[type=text] { width: 16ch; }
.filters input[type=number] { width: 8ch; }
[is-~="input"]:focus, .filters input:focus { outline: none; border-color: var(--purple); background: #1d1e29; }
[is-~="input"]::placeholder { color: var(--foreground2); }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.filters .chk { color: var(--foreground0); cursor: pointer; user-select: none; }
.filters .chk input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.filters .chk::before { content: "[ ]"; color: var(--foreground2); margin-right: .5ch; }
.filters .chk:has(input:checked)::before { content: "[x]"; color: var(--green); }
.filters .reset { color: var(--foreground2); }
.filters .reset::before { content: "[ "; } .filters .reset::after { content: " ]"; }

/* ---- table: own clean ruled grid (neutralize WebTUI's pseudo borders) ---- */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; padding: 0; font-size: .95em; }
table.grid::before { content: none !important; }
table.grid tr > *::before, table.grid tr > *::after { content: none !important; }
table.grid th, table.grid td {
  padding: .18lh 1ch; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule);
}
table.grid th:last-child, table.grid td:last-child { border-right: 0; }
table.grid thead th {
  color: var(--foreground2); text-transform: uppercase; font-size: .82em;
  border-bottom: 1px solid var(--background3); background: var(--background1);
}
table.grid thead th a.sort { color: var(--foreground2); cursor: pointer; user-select: none; }
table.grid thead th a.sort:hover, table.grid thead th a.sort.active { color: var(--purple); text-decoration: none; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody tr:nth-child(even) td { background: rgba(68,71,90,.10); }
table.grid tbody tr:hover td { background: var(--background2); }
/* family seams (after €/mo and after mark) + cpu clamp */
table.grid td:nth-child(2), table.grid th:nth-child(2),
table.grid td:nth-child(7), table.grid th:nth-child(7) { border-right: 1px solid var(--background3); }
table.grid td:nth-child(3) { max-width: 26ch; overflow: hidden; text-overflow: ellipsis; }

.strong { color: #ffffff; font-weight: 700; }
.dim { color: var(--foreground2); }
.dc { color: var(--cyan); }
.sp { color: var(--orange); font-size: .9em; }
.cpu { color: var(--foreground0); }
.cpu:hover { color: var(--purple); }
.empty { color: var(--foreground2); text-align: center; padding: 1.5lh 1ch; border-right: 0; }

/* deal score: colored text + tier glyph (glyph from template) */
.badge { font-weight: 700; }
.deal-hot  { color: var(--green); }
.deal-warm { color: var(--orange); }
.deal-cold { color: var(--foreground2); }

.tag { font-size: .8em; padding: 0 .5ch; border: 1px solid var(--background3); color: var(--foreground2); }
.fx { color: var(--orange); margin-left: .25ch; }

/* vs.low heat + LOW marker */
.low { color: var(--green); font-weight: 700; }
.low::before { content: "◆ "; }
.pct-near { color: var(--green); }
.pct-mid  { color: var(--foreground1); }
.pct-far  { color: var(--orange); }

/* status (history mode) */
.gone  { color: var(--foreground2); }
.gone::before { content: "○ "; }
.liveb { color: var(--green); }
.liveb::before { content: "● "; }

/* sparkline + trend */
.spark { color: var(--green); letter-spacing: 1px; }
.t-down { color: var(--green); }
.t-up   { color: var(--red); }
.t-flat { color: var(--foreground2); }

/* ---- SVG column chart (Säulendiagramm) ---- */
svg.chart { width: 100%; height: auto; display: block; margin-top: .5lh; }
svg.chart .bar { fill: var(--green); }
svg.chart .bar.last { fill: var(--cyan); }
svg.chart .bar:hover { fill: #ffffff; }
svg.chart .baseline { stroke: var(--background3); stroke-width: 1; }
svg.chart .grid { stroke: var(--background3); stroke-width: .5; }
svg.chart .axis { fill: var(--foreground2); font: 10px var(--font-family); }

.muted { color: var(--foreground2); }
.back { margin: 0 0 1lh; }
.foot { color: var(--foreground2); text-align: center; padding: 1.2lh; font-size: .85em; border-top: 1px solid var(--background3); }
.foot em { color: var(--orange); font-style: normal; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .topbar { min-height: auto; flex-wrap: wrap; padding: .5lh 1ch; }
  .nav { width: 100%; margin-top: .3lh; gap: 0 1.2ch; }
  .wrap { padding: 1lh 1ch; max-width: 100%; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .tablewrap { background: linear-gradient(to left, var(--background0), transparent 2ch) right / 3ch 100% no-repeat; }
}
