/* =========================================================
   Korelya Terminal — Korelya brand theme system
   Dark (default) + Light toggle via [data-theme="light"]
   Palette: red #e30613 · blue #283583 · off-white #fcfbf9
            charcoal #353535 · warm-gray #8c8a86 · green #1b870b
   ========================================================= */

/* ── Design tokens ── */
:root {
  /* backgrounds */
  --bg:           #161514;   /* near-black warm charcoal — body bg */
  --bg-panel:     #1e1d1b;   /* panel / modal bg */
  --bg-hover:     #252320;   /* row / th hover */
  --bg-inset:     #121110;   /* pulse strip, filter bar, th bg */
  --bg-btn:       #2a2724;   /* button default bg */
  --bg-btn-hover: #343028;   /* button hover bg */

  /* borders */
  --border:       #3a3733;   /* main panel / table / modal borders */
  --border-soft:  #272523;   /* dotted row separators */

  /* text */
  --text:         #d8d3cc;   /* body / cell text */
  --text-muted:   #8a8480;   /* secondary / label / muted */
  --text-dim:     #6b6661;   /* placeholder — bumped for ≥2.8:1 readability */

  /* accent — Korelya red, replaces ALL amber chrome */
  --accent:       #e30613;   /* panel headers, active tab, live indicator stale, briefing dates, median EV/Rev */
  --accent-text:  #ff4d57;   /* red as TEXT on dark bg — WCAG contrast-corrected */
  --accent-dim:   #3a0608;   /* accent bg for primary btn */
  --accent-border:#5c1015;   /* accent border for primary btn */

  /* accent-2 — lightened royal blue for tags/links on dark */
  --accent-2:     #7a8ad6;   /* .tag text, secondary link color */
  --accent-2-bg:  #1a1f3a;   /* .tag border/bg hint */

  /* directional */
  --up:           #4ade80;   /* positive change */
  --dn:           #f87171;   /* negative change */
  --warn:         #e8b339;   /* warning (amber kept for actual warnings) */
  --warn-bg:      rgba(232,179,57,0.08); /* subtle amber-tinted dark — stale banner bg */
  --new:          #4ade80;   /* new-item dot */

  /* semantic */
  --shadow:       rgba(0,0,0,0.55);
}

[data-theme="light"] {
  /* backgrounds */
  --bg:           #fcfbf9;
  --bg-panel:     #ffffff;
  --bg-hover:     #f4f2ee;
  --bg-inset:     #f0ede8;
  --bg-btn:       #eae7e1;
  --bg-btn-hover: #dedad3;

  /* borders */
  --border:       #e8e6e1;
  --border-soft:  #dedad3;

  /* text */
  --text:         #353535;
  --text-muted:   #75726d;   /* was #8c8a86 — bumped for WCAG contrast */
  --text-dim:     #a39f99;   /* placeholder — bumped for ≥2.8:1 readability */

  /* accent — Korelya red works on light */
  --accent:       #e30613;
  --accent-text:  #e30613;   /* red as TEXT on light bg — same hex passes 4.5:1 */
  --accent-dim:   #fdf0f0;
  --accent-border:#f5c5c7;

  /* accent-2 — full royal blue on light background */
  --accent-2:     #283583;
  --accent-2-bg:  #e8ebf5;

  /* directional */
  --up:           #1b870b;
  --dn:           #e30613;
  --warn:         #8a6500;   /* was #b07d10 — WCAG contrast-corrected */
  --warn-bg:      #fbf3e0;   /* stale banner bg on light */
  --new:          #1b870b;

  /* semantic */
  --shadow:       rgba(0,0,0,0.12);
}

/* ── Reset & base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 13px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Consolas, "JetBrains Mono", "Cascadia Code", "Fira Mono",
               "DejaVu Sans Mono", "Courier New", monospace;
  font-size: 12px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Scrollbars (WebKit) ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* Firefox scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

/* ── Pulse strip ── */
.pulse-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
  height: 28px;
  overflow-x: auto;
  white-space: nowrap;
}

.pulse-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.pulse-item .label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pulse-item .price {
  color: var(--text);
}

/* ── Directional colours ── */
.up {
  color: var(--up);
}

.dn {
  color: var(--dn);
}

/* ── Tab bar ── */
.tabs {
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  height: 32px;
  gap: 0;
  overflow-x: auto;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  cursor: pointer;
}

.tabs a:hover {
  color: var(--text);
  text-decoration: none;
}

.tabs a.active {
  color: var(--accent-text);
  border-bottom: 2px solid var(--accent);
}

.tab-right {
  margin-left: auto;
}

/* ── Live indicator ── */
.live-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--up);
  white-space: nowrap;
  user-select: none;
}

.live-indicator.stale {
  color: var(--accent-text);
}

/* ── Main view ── */
#view {
  padding: 12px;
  min-height: calc(100vh - 60px);
}

/* ── 2x2 overview grid ── */
.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 10px;
}

@media (max-width: 900px) {
  .grid-2x2 {
    grid-template-columns: 1fr;
  }
}

/* ── Panel ── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.panel h5 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  border-bottom: 1px dotted var(--border-soft);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.panel h5:hover {
  background: var(--bg-hover);
}

.panel h5 .panel-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.panel h5 .panel-link:hover {
  text-decoration: underline;
}

/* ── Row ── */
.row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.35;
  border-bottom: 1px dotted var(--border-soft);
  transition: background 0.1s;
  position: relative;
}

.row:last-child {
  border-bottom: none;
}

.row:hover {
  background: var(--bg-hover);
}

/* New-item marker — green bullet before row */
.row.new::before {
  content: "●";
  color: var(--new);
  font-size: 8px;
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
}

.row.new {
  padding-left: 14px;
}

/* ── Tag chips ── */
.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  padding: 0 3px;
  border: 1px solid var(--accent-2-bg);
  border-radius: 2px;
  white-space: nowrap;
  text-transform: uppercase;
}

/* ── Muted / secondary text ── */
.muted {
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Filters toolbar ── */
.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-inset);
}

/* ── Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-btn);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-btn-hover);
  border-color: var(--text-muted);
  color: var(--accent);
}

.btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.btn:active {
  background: var(--bg-inset);
}

.btn.primary {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn.primary:hover {
  background: var(--accent-border);
}

/* ── Danger button variant (in-app confirm dialogs) ── */
.btn--danger {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn--danger:hover {
  background: var(--accent-border);
  border-color: var(--accent-text);
}

/* ── Input / Select ── */
.input {
  display: inline-block;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: border-color 0.15s;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(227,6,19,0.15); /* NOTE: intentional literal — Korelya red focus ring, cannot use CSS var in box-shadow rgba */
}

.input::placeholder {
  color: var(--text-dim);
}

select.input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 22px;
  /* NOTE: SVG data-URI arrow — cannot use CSS var, kept as hex */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239b958e' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px 5px;
}

/* NOTE: SVG data-URI arrow — cannot use CSS var, kept as hex */
[data-theme="light"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236e6b66' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

/* ── Table (markets / comps) ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table th {
  padding: 5px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-inset);
  user-select: none;
}

.table th:hover {
  color: var(--accent-text);
}

.table td {
  padding: 4px 10px;
  border-bottom: 1px dotted var(--border-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: var(--bg-hover);
}

.table tr.new td:first-child {
  position: relative;
  padding-left: 18px;
}

.table tr.new td:first-child::before {
  content: "●";
  color: var(--new);
  font-size: 8px;
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
}

/* ── Badge (count chip on tabs) ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 14px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  color: #fff; /* NOTE: intentional literal — hard-coded white for badge contrast in both themes */
  background: var(--accent);
  border-radius: 7px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}

/* ── ×N sources badge in news rows ── */
.sources-count {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  vertical-align: middle;
  line-height: 1.4;
}

.badge.green {
  background: var(--up);
}

.badge.red {
  background: var(--dn);
}

/* ── News river: dup-group collapse ── */
.dup-group {
  display: contents;
}
.dup-group > summary {
  display: contents;
  cursor: pointer;
}
.dup-group > summary::-webkit-details-marker {
  display: none;
}
/* When open, dup rows appear below with a soft left indent */
.dup-group[open] .row {
  border-left: 2px solid var(--border-soft);
  padding-left: 10px;
  opacity: 0.85;
}

/* ── Signal context chips ── */
.badge-event {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid var(--accent-2-bg);
  border-radius: 2px;
  padding: 1px 4px;
  line-height: 1.4;
}

.tag-thesis {
  opacity: 0.8;
}

/* ── Modal overlay ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* NOTE: Modal overlay — theme-stable semi-transparent black kept as literal rgba */
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(2px);
}

.modal__box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal__box--wide {
  width: min(900px, calc(100vw - 32px));
}

/* ── Company name clickable links ── */
.co-link {
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--text-muted);
  color: inherit;
}

.co-link:hover {
  text-decoration-style: solid;
  color: var(--accent-2);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.modal__body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

/* ── Form field group ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field .input {
  width: 100%;
}

/* ── Toast / notice ── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  padding: 8px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 2px;
  font-size: 12px;
  color: var(--text);
  max-width: 340px;
  box-shadow: 0 4px 16px var(--shadow);
  animation: toast-in 0.2s ease;
}

.toast.ok {
  border-left-color: var(--up);
}

.toast.err {
  border-left-color: var(--dn);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utility classes ── */
.text-amber  { color: var(--warn); }
.text-green  { color: var(--up); }
.text-red    { color: var(--dn); }
.text-blue   { color: var(--accent-2); }
.text-accent { color: var(--accent); }

.mono { font-family: inherit; }

.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Stale data notice ── */
.stale-banner {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--accent-border);
  border-radius: 2px;
  margin: 6px 0;
}

/* ── Theme toggle button ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  user-select: none;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--accent);
}

/* ── Warn chip (⚠ competitor watch) ── */
.chip-warn {
  display: inline-block;
  font-size: 10px;
  padding: 1px 4px;
  border: 1px solid var(--dn);
  border-radius: 2px;
  color: var(--dn);
  white-space: nowrap;
}

/* ── Table header cell (inline-style replacement) ── */
.table-th-plain {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-muted);
  font-weight: 400;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Comps row (inline-style replacement) ── */
.comps-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 10px;
  border-bottom: 1px dotted var(--border-soft);
}

/* ── Comps status chips ── */
.chip-stale {
  font-size: 10px;
  margin-left: 6px;
  color: var(--warn);
}

.chip-dead {
  font-size: 10px;
  margin-left: 6px;
  color: var(--dn);
}

/* ── Watchlist autofill button ── */
.wl-autofill {
  padding: 3px 6px;
  font-size: 13px;
  line-height: 1;
  margin-right: 4px;
  /* match .btn sizing but slightly narrower for emoji label */
  min-width: 0;
}

.wl-autofill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Comps footer ── */
.comps-footer {
  padding: 4px 10px;
  font-size: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* ── Comps median value ── */
.comps-median {
  font-size: 11px;
  font-weight: 400;
  color: var(--accent-text);
}

/* ── Briefing panel header date ── */
.briefing-date {
  color: var(--accent-text);
}

/* ── Briefing details summary ── */
.briefing-summary {
  padding: 6px 10px;
  cursor: pointer;
  color: var(--accent-text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.briefing-summary-arrow {
  color: var(--text-muted);
  font-size: 10px;
}

/* ── Briefing details body ── */
.briefing-body {
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}

/* ── Overview panel-link nav hint ── */
.panel-link-hint {
  font-size: 9px;
  color: var(--text-muted);
}

/* ── Overview briefing "Full note" link ── */
.briefing-link {
  color: var(--accent-text);
  font-size: 11px;
}

/* ── Fundraise filter label (was .rounds-filter-label) ── */
.fundraise-filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Checkbox accent color  ── */
.fundraise-filter-label input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ── Briefing archived notes ── */
.briefing-details {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ── Markets sparkline ── */
.spark {
  display: block;
}

.spark-cell {
  padding: 2px 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.spark-placeholder {
  display: inline-block;
  width: 84px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Markets group-by-portco header row ── */
.group-row-cell {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--bg-inset);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ── Data freshness footer ── */
.freshness {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px 12px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

/* ── DISCOVER tab ── */
.discover-row {
  transition: background 0.1s;
}

.discover-row:hover {
  background: var(--bg-hover);
}

/* ── RADAR tab ── */
.radar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-soft);
  min-height: 26px;
}

.radar-row:last-child {
  border-bottom: none;
}

.radar-tag-label {
  width: 130px;
  flex-shrink: 0;
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-bar-wrap {
  flex: 1;
  height: 10px;
  background: var(--bg-inset);
  border-radius: 2px;
  overflow: hidden;
  min-width: 60px;
  max-width: 260px;
}

.radar-bar {
  height: 100%;
  background: var(--accent-2);
  border-radius: 2px;
  transition: width 0.2s ease;
  min-width: 2px;
}

.radar-count {
  width: 28px;
  text-align: right;
  font-size: 11px;
  color: var(--text);
  flex-shrink: 0;
}

.radar-delta {
  width: 48px;
  text-align: right;
  font-size: 11px;
  flex-shrink: 0;
}

.radar-total {
  width: 52px;
  text-align: right;
  font-size: 11px;
  flex-shrink: 0;
}

.radar-novelty {
  width: 36px;
  text-align: right;
  font-size: 10px;
  flex-shrink: 0;
}

.radar-narrative {
  font-size: 12px;
  color: var(--text);
  margin-top: 10px;
}

/* Week selector buttons */
.radar-week-btn {
  font-size: 10px;
  padding: 2px 8px;
  height: 22px;
}

.radar-week-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

/* Cluster browser */
.radar-clusters {
  margin-top: 4px;
}

.radar-cluster-details {
  border-bottom: 1px solid var(--border-soft);
  padding: 4px 0;
}

.radar-cluster-details:last-child {
  border-bottom: none;
}

.radar-cluster-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  padding: 3px 0;
  font-size: 11px;
  user-select: none;
}

.radar-cluster-summary::-webkit-details-marker {
  display: none;
}

.radar-cluster-summary::before {
  content: "▶";
  font-size: 8px;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.radar-cluster-details[open] > .radar-cluster-summary::before {
  transform: rotate(90deg);
}

.radar-cluster-size {
  background: var(--accent-2-bg);
  color: var(--accent-2);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  flex-shrink: 0;
}

.radar-cluster-id {
  font-size: 10px;
  font-family: inherit;
}

.radar-cluster-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.radar-cluster-titles {
  margin: 4px 0 6px 18px;
  padding: 0;
  list-style: disc;
  font-size: 11px;
  color: var(--text);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════════
   FLOATING WINDOW MANAGER — Phase 2
   ═══════════════════════════════════════════════════════════════ */

/* ── WM control bar (replaces #tabs) ── */
.wm-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  height: 34px;
  overflow-x: auto;
  white-space: nowrap;
}

/* ── Page tab strip ── */
.wm-pages {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-right: 6px;
  margin-right: 2px;
  height: 100%;
}

.wm-page-tab {
  height: 24px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-btn);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.wm-page-tab:hover {
  color: var(--text);
  background: var(--bg-btn-hover);
}

.wm-page-tab.active {
  color: var(--accent-text);
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.wm-page-add {
  height: 24px;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Widget launcher ── */
.wm-launcher {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-right: 6px;
  margin-right: 2px;
  height: 100%;
}

.wm-launcher-btn {
  height: 24px;
  padding: 0 9px;
  font-size: 10px;
  letter-spacing: 0.07em;
  flex-shrink: 0;
  position: relative; /* for badge positioning */
}

/* ── Command line stub ── */
.wm-cmd {
  flex: 1;
  min-width: 120px;
  max-width: 320px;
  height: 24px;
  font-size: 11px;
  opacity: 0.45;
  cursor: not-allowed;
}

.wm-cmd:disabled {
  cursor: not-allowed;
}

/* ── Global chrome controls (live indicator, mark-read, theme) ── */
.wm-chrome {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── WM surface — the canvas where windows float ── */
#wm-surface {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 62px); /* bar + pulse */
  overflow: hidden;
}

/* ── Widget body inside WinBox ── */
.wm-widget-body {
  width: 100%;
  height: 100%;
  overflow: auto;
  contain: layout style paint;
}

/* ═══════════════════════════════════════════════════════════════
   WinBox theme overrides — Korelya brand palette
   ═══════════════════════════════════════════════════════════════ */

/* Dark theme (default) */
.wb-kt.wb-theme-dark {
  --wb-bg:       var(--bg-panel);
  --wb-border:   var(--border);
  --wb-header:   var(--bg-inset);
  --wb-title:    var(--text-muted);
}

/* Light theme */
.wb-kt.wb-theme-light {
  --wb-bg:       var(--bg-panel);
  --wb-border:   var(--border);
  --wb-header:   var(--bg-inset);
  --wb-title:    var(--text-muted);
}

/* WinBox window root */
.wb-kt .wb-header {
  background: var(--wb-header, var(--bg-inset));
  border-bottom: 1px solid var(--wb-border, var(--border));
}

.wb-kt .wb-title {
  color: var(--wb-title, var(--text-muted));
  font-family: Consolas, "JetBrains Mono", "Cascadia Code", "Fira Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wb-kt .wb-body {
  background: var(--wb-bg, var(--bg-panel));
  padding: 0; /* widgets manage their own padding */
}

.wb-kt {
  border: 1px solid var(--wb-border, var(--border));
  box-shadow: 0 8px 32px var(--shadow);
  border-radius: 2px;
}

/* WinBox control buttons */
.wb-kt .wb-control button {
  color: var(--text-muted);
  opacity: 0.7;
}

.wb-kt .wb-control button:hover {
  opacity: 1;
  color: var(--accent-text);
}

/* ── Link-group coloured title bars ── */
.wb-kt.link-a .wb-header {
  border-top: 2px solid #4ade80; /* group A — green */
}

.wb-kt.link-b .wb-header {
  border-top: 2px solid #7a8ad6; /* group B — blue (accent-2) */
}

.wb-kt.link-c .wb-header {
  border-top: 2px solid #e8b339; /* group C — amber */
}

/* ── Body layout hint for discover/insights heavy widgets ── */
.wb-kt .wb-body .panel {
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.wb-kt .wb-body .panel:first-child {
  border-top: none;
}

/* ── Remove dead #view / old .tabs styles are kept (harmless legacy) ── */
