/* D-STAR Network Live Dashboard Stylesheet */

:root {
  --bm-red: #DD4B39;
  --bm-red-hover: #e85948;
  --bm-red-glow: rgba(221, 75, 57, 0.4);
  --bm-red-subtle: rgba(221, 75, 57, 0.12);
  --bm-red-border: rgba(221, 75, 57, 0.35);

  --bg: #12151c;
  --bg-darker: #0d1016;
  --bg-card: #181d26;
  --bg-card-hover: #1f2532;
  --bg-header: #141822;

  --border: #262d3d;
  --border-light: #323b4e;
  --border-subtle: #1c2230;

  --text: #e2e8f0;
  --text-muted: #8c9bb0;
  --text-dim: #566479;
  --text-white: #ffffff;

  --amber: #ffb02e;
  --green: #2dd4a7;
  --green-glow: rgba(45, 212, 167, 0.35);
  --blue: #4da3ff;
  --purple: #a78bfa;

  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, Monaco, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);

  --hover-bg: #252e3e;
  --bg-2: #151922;
  --nav-grad: linear-gradient(90deg, #181d28, #151922);
  --red-tint-bg: #2b1317;
  --red-tint-border: #5a1e26;
  --red-tint-text: #ffb4be;
  --red-flash: #3a1922;
  --amber-tint-bg: #2d2410;
  --amber-tint-border: #4d3d15;
  --green-tint-bg: #11261d;
  --green-tint-border: #1c4834;
  --blue-tint-bg: #102030;
  --blue-tint-border: #1a3c5e;
  --purple-tint-bg: #191024;
  --purple-tint-border: #3d2a58;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-color: var(--border-light) var(--bg); color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Top Navigation ---------------- */
.bm-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.bm-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.bm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.bm-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bm-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  box-shadow: 0 2px 8px var(--bm-red-glow);
}

.bm-brand-text {
  display: flex;
  flex-direction: column;
}

.bm-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text-white);
  line-height: 1.1;
}

.bm-subtitle {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--bm-red);
}

.bm-nav-tabs {
  display: flex;
  gap: 4px;
  height: 100%;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0 16px;
  height: 100%;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.02);
}

.tab.active {
  color: var(--text-white);
  border-bottom-color: var(--bm-red);
}

.tab-icon { font-size: 0.95rem; }

.tab-badge {
  background: var(--bm-red);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 4px;
  box-shadow: 0 0 8px var(--bm-red-glow);
}

.tab-count-badge {
  background: var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.tab.active .tab-count-badge {
  background: var(--hover-bg);
  color: var(--blue);
}

.bm-nav-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bm-btn:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.bm-btn-icon[aria-pressed="true"] {
  border-color: var(--amber);
  color: var(--amber);
}

.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-darker);
  padding: 5px 12px;
  border-radius: 999px;
}

.conn .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}

.conn.ok { color: var(--text); }
.conn.ok .dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.conn.err { color: var(--bm-red); }
.conn.err .dot { background: var(--bm-red); }

/* -+ Main Layout & Cards ---------------- */
.bm-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  flex: 1;
}

.bm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}

/* ---------------- D-STAR Network Stats Grid ---------------- */
.bm-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.bm-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.bm-stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.stat-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.icon-tx { background: var(--amber-tint-bg); border: 1px solid var(--amber-tint-border); color: var(--amber); }
.icon-live { background: var(--red-tint-bg); border: 1px solid var(--red-tint-border); color: var(--bm-red); }
.icon-nodes { background: var(--green-tint-bg); border: 1px solid var(--green-tint-border); color: var(--green); }
.icon-refs { background: var(--blue-tint-bg); border: 1px solid var(--blue-tint-border); color: var(--blue); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-white);
}

.stat-value.text-red { color: var(--bm-red); }
.stat-value.text-green { color: var(--green); }
.stat-value.text-blue { color: var(--blue); }

.stat-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
  white-space: nowrap;
}

.pulse-beacon {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bm-red);
  box-shadow: 0 0 12px var(--bm-red);
  animation: pulseBeacon 1.2s infinite;
}

@keyframes pulseBeacon {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(221, 75, 57, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(221, 75, 57, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(221, 75, 57, 0); }
}

/* ---------------- On Air Hero Strip ---------------- */
.onair-panel {
  padding: 14px 18px;
}

.onair-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.onair-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot-glow {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bm-red);
  box-shadow: 0 0 8px var(--bm-red);
  animation: blink 1.2s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0.3; } }

.onair-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--bm-red);
}

.onair-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.onair-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 38px;
}

.empty-inline {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: var(--mono);
}

.onair-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--red-tint-bg);
  border: 1px solid var(--bm-red-border);
  border-left: 3px solid var(--bm-red);
  border-radius: 7px;
  padding: 6px 12px;
  box-shadow: 0 2px 10px var(--bm-red-subtle);
  animation: cardFadeIn 0.2s ease-out;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.oc-call {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 0.92rem;
}

.oc-call a {
  color: var(--text-white);
  border-bottom: 1px dotted var(--text-muted);
}

.oc-ref {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber);
  background: var(--amber-tint-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.oc-time {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bm-red);
}

.onair-card .eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.onair-card .eq i {
  width: 2.5px;
  background: var(--bm-red);
  border-radius: 1px;
  animation: eqBounce 0.75s ease-in-out infinite;
}

.onair-card .eq i:nth-child(1) { height: 4px; }
.onair-card .eq i:nth-child(2) { height: 10px; animation-delay: 0.15s; }
.onair-card .eq i:nth-child(3) { height: 7px; animation-delay: 0.3s; }
.onair-card .eq i:nth-child(4) { height: 12px; animation-delay: 0.45s; }

@keyframes eqBounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

/* ---------------- Table Panel & Toolbar ---------------- */
.table-panel {
  margin-bottom: 24px;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.01em;
}

.panel-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover { color: var(--text-white); }
.pill-btn.active {
  background: var(--bg-card);
  color: var(--text-white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.pill-btn[data-filter="live"].active { color: var(--bm-red); }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 0.75rem;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  background: var(--bg-darker);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 30px 6px 30px;
  font-size: 0.78rem;
  font-family: var(--sans);
  width: 260px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--bm-red-border);
  box-shadow: 0 0 0 2px var(--bm-red-subtle);
}

.search-input::placeholder { color: var(--text-dim); }

.search-clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
}

.search-clear:hover { color: var(--text-white); }

/* ---------------- D-STAR Network Table ---------------- */
.table-wrap {
  overflow-x: auto;
  max-height: calc(100vh - 330px);
  min-height: 380px;
  overflow-y: auto;
}

table.bm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.bm-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-header);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.bm-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.bm-table tbody tr {
  background: var(--bg-card);
  transition: background 0.15s ease;
}

.bm-table tbody tr:nth-child(even) {
  background: var(--bg-2);
}

.bm-table tbody tr:hover {
  background: var(--bg-card-hover) !important;
}

/* live active row */
tr.onair-tr {
  background: var(--red-tint-bg) !important;
}

tr.onair-tr td {
  border-bottom-color: var(--red-tint-border);
}

tr.new-row td {
  animation: highlightRow 1.4s ease-out;
}

@keyframes highlightRow {
  0% { background: var(--red-flash); }
}

/* Status Column */
.col-status { width: 68px; text-align: center; }
td.c-status { text-align: center; white-space: nowrap; }

.status-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red-tint-bg);
  border: 1px solid var(--bm-red);
  color: var(--bm-red);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-badge-idle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
}

.tx-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bm-red);
  box-shadow: 0 0 6px var(--bm-red);
  animation: blink 1.1s steps(2) infinite;
}

.idle-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
}

/* Time Column */
.col-time { width: 140px; }
td.time-cell {
  font-family: var(--mono);
  white-space: nowrap;
  font-size: 0.78rem;
}

.time-clock {
  color: var(--text);
  font-weight: 600;
}

.time-rel {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-left: 6px;
}

tr.onair-tr .time-clock { color: var(--bm-red); font-weight: 700; }
tr.onair-tr .time-rel { color: var(--bm-red); }

/* Callsign Column */
.col-call { width: 140px; }
td.call-cell {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.94rem;
  white-space: nowrap;
}

td.call-cell a {
  color: var(--text-white);
  border-bottom: 1px dotted var(--text-dim);
}

td.call-cell a:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* Destination (TG/Reflector) Column */
.col-dest { width: 130px; }
td.dest-cell { white-space: nowrap; }

.bm-badge-tg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--text-white);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 2px 8px;
}

.bm-badge-tg .tg-mod {
  color: var(--amber);
  font-weight: 800;
}

/* Gateway / Node Column */
.col-node { width: 130px; }
td.node-cell {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.node-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-darker);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
}

.node-none { color: var(--text-dim); }

/* Duration Column */
.col-dur { width: 110px; }
td.dur-cell {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--text-muted);
}

.dur-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bm-red);
  font-weight: 700;
}

/* Source Column */
.col-src { width: 80px; }
td.src-cell { white-space: nowrap; }

.src-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 4px;
  padding: 1px 6px;
}

.src-rf { color: var(--amber); border: 1px solid var(--amber-tint-border); background: var(--amber-tint-bg); }
.src-net { color: var(--blue); border: 1px solid var(--blue-tint-border); background: var(--blue-tint-bg); }
.src-web { color: var(--purple); border: 1px solid var(--purple-tint-border); background: var(--purple-tint-bg); }

/* Action / Audio Column */
.col-action { width: 80px; text-align: right; }
td.action-cell { text-align: right; white-space: nowrap; }

.bm-tune-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bm-tune-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.bm-tune-btn.tuned {
  background: var(--green-tint-bg);
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-icon { font-size: 2.2rem; margin-bottom: 8px; opacity: 0.6; }
.empty-title { font-weight: 700; font-size: 1.05rem; color: var(--text-white); margin-bottom: 4px; }
.empty-desc { color: var(--text-dim); font-size: 0.84rem; max-width: 420px; margin: 0 auto; }

/* ---------------- Reflectors Tab ---------------- */
.ref-panel {
  margin-bottom: 24px;
}

.panel-subtitle {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.ref-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ref-count-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--blue);
}

.ref-list {
  list-style: none;
  margin: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 270px);
  overflow-y: auto;
}

.ref-item {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr auto auto;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ref-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.ref-item.live {
  border-left-color: var(--bm-red);
  background: #1f1419;
}

.ref-item.tuned {
  border-left-color: var(--green);
  box-shadow: inset 0 0 14px rgba(45, 212, 167, 0.05);
}

.ref-id { display: flex; flex-direction: column; }
.ref-id b { font-family: var(--mono); font-size: 1rem; color: var(--amber); }
.ref-name { color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ref-mods { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.chip {
  min-width: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  min-height: 32px;
}

.chip .cm { color: var(--text-dim); font-weight: 700; }
.chip .cc { color: var(--text-white); font-weight: 700; }

.chip.on {
  border-color: var(--bm-red);
  background: #291116;
}

.chip.on .cm { color: var(--bm-red); }

.chip .eq { display: none; align-items: flex-end; gap: 2px; height: 11px; }
.chip.on .eq { display: flex; }
.chip .eq i { width: 2px; background: var(--bm-red); border-radius: 1px; animation: eqBounce 0.7s ease-in-out infinite; }
.chip .eq i:nth-child(1) { height: 4px; }
.chip .eq i:nth-child(2) { height: 9px; animation-delay: 0.15s; }
.chip .eq i:nth-child(3) { height: 7px; animation-delay: 0.3s; }

.ref-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ref-links { font-family: var(--mono); font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }

.ref-expand {
  width: 28px;
  height: 26px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.ref-expand:hover { border-color: var(--blue); color: var(--text-white); }
.ref-item.expanded .ref-expand { border-color: var(--blue); color: var(--blue); transform: rotate(180deg); }

.ref-details {
  grid-column: 1 / -1;
  background: #11151e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.det-mod { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.78rem; }
.det-m {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.det-active { font-family: var(--mono); font-weight: 700; color: var(--bm-red); }
.det-linked { font-family: var(--mono); color: var(--green); font-size: 0.72rem; }
.det-recent { display: flex; gap: 6px; flex-wrap: wrap; }
.det-call {
  font-family: var(--mono);
  color: var(--text);
  font-size: 0.74rem;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.det-none { color: var(--text-dim); font-size: 0.72rem; font-style: italic; }
.det-nodes-head {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.ref-item mark {
  background: var(--amber-tint-border);
  color: var(--amber);
  border-radius: 2px;
  padding: 0 2px;
}

/* ---------------- Footer ---------------- */
.bm-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-header);
  padding: 14px 20px;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.bm-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bm-foot-brand { font-weight: 700; color: var(--text-muted); }
.foot-sep { margin: 0 6px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 960px) {
  .bm-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .col-node, .col-src { display: none; }
  .search-input { width: 180px; }
}

@media (max-width: 640px) {
  .bm-stats-grid { grid-template-columns: 1fr; }
  .bm-header-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .bm-nav-tabs { order: 3; width: 100%; justify-content: space-around; }
  .col-dur { display: none; }
  .ref-item { grid-template-columns: 1fr auto; }
  .ref-mods { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- light theme ---------------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f9;
  --bg-darker: #e9edf3;
  --bg-card: #ffffff;
  --bg-card-hover: #eef2f8;
  --bg-header: #ffffff;

  --border: #d8dfe8;
  --border-light: #c6cfdb;
  --border-subtle: #e5eaf1;

  --text: #1c2532;
  --text-muted: #57677c;
  --text-dim: #8794a6;
  --text-white: #161e2b;

  --bm-red-glow: rgba(221, 75, 57, 0.25);
  --bm-red-subtle: rgba(221, 75, 57, 0.08);
  --bm-red-border: rgba(221, 75, 57, 0.45);
  --green-glow: rgba(45, 212, 167, 0.25);

  --shadow-sm: 0 2px 6px rgba(20, 30, 50, 0.08);
  --shadow-md: 0 4px 16px rgba(20, 30, 50, 0.12);
  --shadow-lg: 0 8px 30px rgba(20, 30, 50, 0.16);

  --hover-bg: #e7ecf3;
  --bg-2: #eef1f6;
  --nav-grad: linear-gradient(90deg, #ffffff, #f4f6fa);
  --red-tint-bg: #fdeef0;
  --red-tint-border: #efb9c0;
  --red-tint-text: #a82634;
  --red-flash: #f8d7dc;
  --amber-tint-bg: #fdf3da;
  --amber-tint-border: #e2c477;
  --green-tint-bg: #e2f6ed;
  --green-tint-border: #a4ddc5;
  --blue-tint-bg: #e7f0fc;
  --blue-tint-border: #b0d0f2;
  --purple-tint-bg: #f1ebfd;
  --purple-tint-border: #cdbdf2;
}
html[data-theme="light"] { scrollbar-color: var(--border-light) var(--bg); }
