/* Karlsen Trader web console. One dark theme on purpose: the TUI is a dark
   terminal, and the colours here are the same vocabulary — green is good, red
   needs a human, yellow is worth a look, cyan is information, dim is history. */

:root {
  --bg: #0f1520;
  --bg-panel: #162032;
  --bg-panel-2: #1c2839;
  --bg-hover: #23324a;
  --bg-selected: #2b4066;
  --border: #2b3a52;
  --text: #e6edf7;
  --text-muted: #8fa1ba;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --info: #38bdf8;
  --primary: #60a5fa;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
a { color: var(--primary); }
b, .b { font-weight: 700; }
.i { font-style: italic; }
.dim { color: var(--text-muted); }
.c-red { color: var(--bad); }
.c-green { color: var(--good); }
.c-yellow { color: var(--warn); }
.c-cyan { color: var(--info); }
.c-white { color: #fff; }

/* --- top bar -------------------------------------------------------------- */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 150px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--text-muted); font-size: 12px; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.banner {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--bg-panel-2);
  border-left: 5px solid var(--primary);
  font-family: var(--mono);
  font-size: 12.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.banner .banner-state { font-weight: 700; margin-right: 12px; }
.banner-good { border-left-color: var(--good); }
.banner-good .banner-state { color: var(--good); }
.banner-warn { border-left-color: var(--warn); }
.banner-warn .banner-state { color: var(--warn); }
.banner-bad { border-left-color: var(--bad); }
.banner-bad .banner-state { color: var(--bad); }
.killzone { border: 3px double var(--bad); border-radius: 8px; padding: 4px; }
.btn-kill { min-width: 220px; font-weight: 700; }
.user { display: flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: 13px; }

/* --- cards ---------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 14px 0;
}
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 74px;
}
.card h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; }
.card .card-body { font-size: 13px; }
.card.level-good { border-color: rgba(52, 211, 153, 0.7); }
.card.level-warn { border-color: rgba(251, 191, 36, 0.8); }
.card.level-bad { border-color: rgba(248, 113, 113, 0.9); }

/* --- controls and tabs ---------------------------------------------------- */
.controls, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
}
.toolbar { padding: 6px 0 8px; }
.btn {
  background: var(--bg-panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 4px 8px; font-size: 12px; }
.btn-ghost { background: transparent; }
.btn-primary { background: #1d4ed8; border-color: #1d4ed8; }
.btn-primary:hover:not(:disabled) { background: #2563eb; }
.btn-success { background: #047857; border-color: #047857; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-warning { background: #92400e; border-color: #b45309; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-error { background: #991b1b; border-color: #b91c1c; }
.btn-error:hover:not(:disabled) { background: #b91c1c; }
.btn.active { outline: 2px solid var(--primary); }

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 700; }
.tab .badge[hidden] { display: none; }
.tab .badge {
  display: inline-block;
  background: var(--warn);
  color: #000;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  margin-left: 4px;
}

/* --- panes ---------------------------------------------------------------- */
#panes { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 10px 14px; }
.pane { display: none; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow: auto; }
.pane.active { display: flex; }
.pane > .panel, .pane > .activity, .pane > .toolbar, .pane > .hint { flex-shrink: 0; }
.hint { color: var(--text-muted); font-size: 13px; }
.activity {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: pre-wrap;
}
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  overflow: auto;
}
.prose { line-height: 1.5; }
.overview-body { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; flex: 1; min-height: 0; }
.overview-body .table-wrap.grow { min-height: 140px; }
.overview-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.overview-side .panel { flex: 1; min-height: 120px; }

/* --- tables --------------------------------------------------------------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-panel);
  min-height: 80px;
}
.table-wrap.grow { flex: 1 1 auto; min-height: 200px; }
.table-wrap.half { flex: 0 0 auto; max-height: 45vh; }
.table-wrap.short { flex: 0 0 auto; max-height: 260px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky;
  top: 0;
  background: var(--bg-panel-2);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  z-index: 1;
}
thead th:hover { background: var(--bg-hover); }
tbody td { padding: 5px 8px; border-bottom: 1px solid rgba(43, 58, 82, 0.5); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
tbody tr.selectable { cursor: pointer; }
tbody tr.selectable:hover { background: var(--bg-hover); }
tbody tr.selected { background: var(--bg-selected) !important; }
tbody tr.excluded td { color: var(--text-muted); }
.empty { color: var(--text-muted); padding: 12px; font-size: 13px; }

.s-good { color: var(--good); font-weight: 700; }
.s-bad { color: var(--bad); font-weight: 700; }
.s-warn { color: var(--warn); font-weight: 700; }
.s-info { color: var(--info); }
.s-dim { color: var(--text-muted); }
.s-pos { color: var(--good); }
.s-neg { color: var(--bad); }
.s-b { font-weight: 700; }

/* Price flashes, the way trading terminals do it: a solid highlight on the
   refresh that noticed the move, fading to a coloured arrow, then to nothing. */
td.flash-up { background: #065f46 !important; color: #fff; font-weight: 700; }
td.flash-down { background: #7f1d1d !important; color: #fff; font-weight: 700; }
td.moved-up { color: var(--good); font-weight: 700; }
td.moved-down { color: var(--bad); font-weight: 700; }

/* --- chart ---------------------------------------------------------------- */
.chart { width: 100%; height: 190px; display: block; margin: 6px 0; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .series { fill: none; stroke: var(--info); stroke-width: 2; }
.chart .threshold-entry { stroke: var(--good); stroke-dasharray: 5 4; }
.chart .threshold-exit { stroke: var(--bad); stroke-dasharray: 5 4; }
.chart .label { fill: var(--text-muted); font-size: 11px; font-family: var(--mono); }
.chart .point { fill: var(--info); }
.chart .point.highlight { fill: var(--bad); r: 4; }

/* --- footer, toasts, modals ---------------------------------------------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}
.toasts { position: fixed; right: 14px; bottom: 44px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(460px, 90vw); }
.toast {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-left: 5px solid var(--info);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.15s ease-out;
}
.toast .toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-warning { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--bad); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
  background: var(--bg-panel);
  border: 2px solid var(--primary);
  border-radius: 10px;
  width: min(760px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal.modal-danger { border-color: var(--bad); }
.modal.modal-wide { width: min(980px, 100%); }
.modal h2 { margin: 0; padding: 14px 18px 8px; font-size: 16px; }
.modal .modal-body { padding: 4px 18px 14px; overflow: auto; font-size: 13.5px; line-height: 1.45; }
.modal .modal-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--border); }
.modal .hint { margin-bottom: 10px; }
.modal label { display: block; margin: 8px 0 4px; }
.modal input[type="text"], .modal input[type="number"], .modal input[type="password"] {
  width: 100%; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.modal input[type="range"] { width: 100%; }
.modal .row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.modal .row label { margin: 0; display: flex; align-items: center; gap: 8px; }
.modal fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 10px 0; padding: 8px 12px; }
.modal legend { font-weight: 700; padding: 0 4px; }
.modal .criterion { margin: 10px 0 14px; }
.modal .criterion .share { color: var(--primary); font-size: 12px; }
.modal .summary { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-top: 10px; }
.modal .news-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.modal .error { color: var(--bad); margin-top: 6px; }
.modal .warn { color: var(--warn); }
.modal pre { white-space: pre-wrap; font: inherit; margin: 0; }

/* --- compact mode -------------------------------------------------------- */
body.compact #summary, body.compact #controls, body.compact .footer { display: none; }

/* --- login ---------------------------------------------------------------- */
.login-body { align-items: center; justify-content: center; overflow: auto; }
.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 30px;
  width: min(380px, 92vw);
}
.login-box h1 { margin: 0 0 4px; font-size: 20px; }
.login-sub { color: var(--text-muted); margin: 0 0 18px; font-size: 13px; }
.login-box label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-muted); }
.login-box input {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 15px;
}
.login-box .btn { width: 100%; margin-top: 6px; padding: 10px; }
.login-error { color: var(--bad); margin-bottom: 10px; font-size: 13px; }

/* --- data error ---------------------------------------------------------- */
body.data-error .banner { border-left-color: var(--bad); }

/* --- responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .overview-body { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr auto; }
  .banner { grid-column: 1 / -1; order: 3; }
  .user { justify-content: flex-end; }
}
@media (max-width: 680px) {
  .cards { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr; }
  .killzone { justify-self: stretch; }
  .btn-kill { width: 100%; }
  .footer { display: none; }
  #panes { padding: 8px; }
  .controls { padding: 8px; }
  .controls .btn { flex: 1 1 40%; }
}

/* --- table tools: search and level chips ---------------------------------- */
.table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.table-tools input[type="search"] {
  flex: 1 1 200px; min-width: 140px; padding: 6px 9px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.table-tools .count { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.chip {
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.chip.active { color: var(--text); border-color: var(--primary); background: rgba(96, 165, 250, 0.15); }
tbody tr.focused td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* --- the R bar under a position -------------------------------------------- */
.rbar { position: relative; height: 6px; margin-top: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--bad) 0 50%, var(--good) 50% 100%); opacity: 0.55; min-width: 90px; }
.rbar .rbar-entry { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text); }
.rbar .rbar-mark { position: absolute; top: -4px; width: 8px; height: 14px; margin-left: -4px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px var(--bg); }
td.has-bar { overflow: visible; }

/* --- sparklines ---------------------------------------------------------- */
.spark { width: 110px; height: 24px; display: block; }
.spark path { fill: none; stroke: var(--info); stroke-width: 1.5; }
.spark.up path { stroke: var(--good); }
.spark.down path { stroke: var(--bad); }

/* --- result history chart ---------------------------------------------------- */
#pnl-panel { flex-shrink: 0; }
.pnl-chart { width: 100%; height: 150px; display: block; }
.pnl-chart .bar-pos { fill: var(--good); opacity: 0.8; }
.pnl-chart .bar-neg { fill: var(--bad); opacity: 0.8; }
.pnl-chart .cum { fill: none; stroke: var(--info); stroke-width: 2; }
.pnl-chart .axis { stroke: var(--border); }
.pnl-chart .label { fill: var(--text-muted); font-size: 10px; font-family: var(--mono); }
.overview-main { display: flex; flex-direction: column; gap: 10px; min-height: 0; }

/* --- freshness ----------------------------------------------------------------- */
#freshness.stale { color: var(--warn); font-weight: 700; }
#freshness.dead { color: var(--bad); font-weight: 700; }

/* --- detail drawer ------------------------------------------------------------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 92vw);
  background: var(--bg-panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5); z-index: 40; display: flex; flex-direction: column;
  animation: drawer-in 0.15s ease-out;
}
.drawer[hidden] { display: none; }
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-body { padding: 12px 16px; overflow: auto; font-size: 13px; }
.drawer-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.drawer-body dt { color: var(--text-muted); white-space: nowrap; }
.drawer-body dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.drawer-body pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: 12px var(--mono); white-space: pre-wrap; margin: 0; }

/* --- mobile refinements ------------------------------------------------------ */
@media (max-width: 680px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 6px 8px 0; }
  .card { padding: 6px 8px; min-height: 0; }
  .card h3, .card .card-body { font-size: 12px; }
  .brand .clock { display: none; }
  .tabs { position: sticky; top: 0; background: var(--bg); z-index: 5; }
  .drawer { width: 100vw; }
}

/* --- Puls -------------------------------------------------------------------- */
.pulse-head { flex-shrink: 0; font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; flex-shrink: 0; }
.kpi { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; transition: box-shadow 0.4s; }
.kpi-label { color: var(--text-muted); font-size: 12px; }
.kpi-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-sub { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.kpi-pos .kpi-value { color: var(--good); }
.kpi-neg .kpi-value { color: var(--bad); }
.kpi-warn { border-color: var(--warn); }
.kpi-warn .kpi-value { color: var(--warn); }
.kpi-changed { box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.6); }
.budget { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: 4px 0 2px; }
.budget-fill { height: 100%; background: var(--warn); }
.budget-fill.hot { background: var(--bad); }
.pulse-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; flex-shrink: 0; }
.pulse-block { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-height: 90px; }
.pulse-block h4 { margin: 0 0 8px; font-size: 13px; }
.pulse-block-sub { font-weight: 400; font-size: 12px; margin-left: 6px; }
.pulse-wide { grid-column: 1 / -1; }
.mclock { display: flex; flex-wrap: wrap; gap: 8px; }
.mpill { display: grid; grid-template-columns: auto auto; gap: 0 8px; align-items: center; padding: 6px 10px; border-radius: 8px; background: var(--bg-panel-2); border: 1px solid var(--border); font-size: 12.5px; }
.mpill-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); grid-row: span 2; }
.mpill.open .mpill-dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.mpill.open { border-color: rgba(52, 211, 153, 0.5); }
.mpill-name { font-weight: 700; }
.mpill-state { font-size: 11.5px; grid-column: 2; }
.mpill-next, .mpill-count { grid-column: 2; font-size: 11.5px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow-node { background: var(--bg-panel-2); border: 1px solid var(--border); border-left: 4px solid var(--good); border-radius: 6px; padding: 5px 8px; font-size: 11.5px; }
.flow-node.busy { border-left-color: var(--warn); }
.flow-node.bad { border-left-color: var(--bad); }
.flow-name { font-weight: 700; white-space: nowrap; }
.flow-meta { color: var(--text-muted); font-family: var(--mono); }
.flow-arrow { color: var(--text-muted); }
.scores { display: flex; flex-direction: column; gap: 4px; }
.score-row { display: grid; grid-template-columns: 70px 1fr 34px minmax(120px, 1.2fr); gap: 8px; align-items: center; font-size: 12.5px; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.score-row:hover { background: var(--bg-hover); }
.score-row.signal .score-fill { background: var(--good); }
.score-symbol { font-weight: 700; }
.score-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.score-fill { display: block; height: 100%; background: var(--info); }
.score-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.score-reason { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.heat-tile { position: relative; border-radius: 8px; padding: 8px 10px; background: var(--bg-panel-2); border: 1px solid var(--border); cursor: pointer; font-size: 12px; overflow: hidden; }
.heat-tile.up { background: color-mix(in srgb, var(--good) calc(var(--heat) * 55%), var(--bg-panel-2)); }
.heat-tile.down { background: color-mix(in srgb, var(--bad) calc(var(--heat) * 55%), var(--bg-panel-2)); }
.heat-tile:hover { border-color: var(--primary); }
.heat-symbol { font-weight: 700; font-size: 14px; }
.heat-price { font-variant-numeric: tabular-nums; }
.heat-change { font-weight: 700; }
.heat-flag { font-size: 11px; color: var(--warn); }
.heat-tile .spark { width: 100%; height: 22px; margin-top: 4px; opacity: 0.9; }
.timeline { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.tl-item { display: grid; grid-template-columns: 110px 22px 1fr; gap: 6px; padding: 4px 6px; font-size: 12.5px; border-bottom: 1px solid rgba(43, 58, 82, 0.5); cursor: pointer; }
.tl-item:hover { background: var(--bg-hover); }
.tl-time { font-family: var(--mono); color: var(--text-muted); white-space: nowrap; }
.tl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-signal .tl-text { color: var(--info); }
.tl-fill .tl-text { font-weight: 700; }
@media (max-width: 900px) {
  .pulse-grid { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 60px 1fr 30px; }
  .score-reason { display: none; }
  .tl-item { grid-template-columns: 80px 20px 1fr; }
  .tl-text { white-space: normal; }
}

/* --- Innstillinger ---------------------------------------------------------- */
#settings-groups { display: flex; flex-direction: column; gap: 8px; }
.settings-group { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; }
.settings-group > summary { cursor: pointer; padding: 8px 12px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.settings-group > summary .count { color: var(--text-muted); font-weight: 400; font-size: 12px; }
.setting { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(140px, 1fr) auto; gap: 4px 12px; align-items: center; padding: 7px 12px; border-top: 1px solid var(--border); }
.setting:hover { background: var(--bg-hover); }
.setting-key { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.setting-value { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.setting-help { grid-column: 1 / -1; color: var(--text-muted); font-size: 12px; }
.setting-meta { grid-column: 1 / -1; font-size: 12px; color: var(--info); }
.setting.locked .setting-key, .setting.locked .setting-value { color: var(--text-muted); }
.source { border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; font-size: 11px; color: var(--text-muted); margin-left: 6px; font-family: var(--font); white-space: nowrap; }
.source-database { color: var(--info); border-color: var(--info); }
.source-fil { color: var(--text); }
.setting-critical { color: var(--warn); font-size: 11px; margin-left: 6px; font-family: var(--font); }
.settings-status-warn { border-color: var(--warn); }
.settings-status-bad { border-color: var(--bad); }
.modal select, .modal textarea {
  width: 100%; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.modal textarea { font-family: var(--mono); min-height: 70px; }
.modal .facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 12.5px; margin: 8px 0; }
.modal .facts dt { color: var(--text-muted); }
.modal .facts dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .setting { grid-template-columns: 1fr auto; }
  .setting-value { grid-column: 1 / -1; }
}
.account-row { display: grid; grid-template-columns: minmax(120px, auto) 1fr auto; gap: 4px 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.account-row:first-of-type { border-top: 0; }
.account-name { font-weight: 700; }
.account-facts { font-family: var(--mono); font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.account-live { color: var(--warn); }
.account-active { color: var(--good); font-size: 12px; }
.setting-hot { color: var(--good); font-size: 11px; margin-left: 6px; font-family: var(--font); }
.account-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.modal input:disabled, .modal select:disabled { opacity: 0.6; }

/* --- the Gateway's screen ---------------------------------------------------- */
.modal.modal-screen { width: min(1340px, 100%); }
.screen-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.screen-status { color: var(--text-muted); font-size: 12.5px; }
.screen-status.live { color: var(--good); }
.screen-status.control { color: var(--warn); font-weight: 700; }
.screen-canvas { background: #000; border: 1px solid var(--border); border-radius: 6px; height: min(72vh, 820px); overflow: hidden; }
.screen-canvas.control { border-color: var(--warn); }

