:root {
  --ink: #12142b;
  --ink-muted: #5b6088;
  --paper: #f3f5fc;
  --paper-2: #e7eafc;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --input-bg: #ffffff;
  --line: rgba(18, 20, 43, 0.10);
  --teal: #059669;
  --teal-deep: #047857;
  --teal-wash: rgba(5, 150, 105, 0.12);
  --brand-glow: rgba(5, 150, 105, 0.35);
  --amber: #b45309;
  --amber-bg: #fdedd3;
  --rose: #be123c;
  --rose-bg: #fbdce4;
  --mint: #047857;
  --mint-bg: #d3f3e6;
  --sky: #4338ca;
  --sky-bg: #e3e2fb;
  --shadow: 0 18px 40px rgba(30, 41, 90, 0.10);
  --glow-1: rgba(5, 150, 105, 0.16);
  --glow-2: rgba(16, 185, 129, 0.12);
  --nav-bg: rgba(243, 245, 252, 0.72);
  --panel-head-wash: rgba(255, 255, 255, 0.55);
  --th-bg: rgba(231, 234, 252, 0.55);
  --row-hover: rgba(8, 145, 178, 0.05);
  --radius: 14px;
  --font: "Sora", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --muted: var(--ink-muted);
  --border: var(--line);
  --accent: var(--teal);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #e7ecff;
  --ink-muted: #99a2c9;
  --paper: #0a0e1c;
  --paper-2: #121935;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-solid: #131a34;
  --input-bg: #0f1530;
  --line: rgba(255, 255, 255, 0.10);
  --teal: #34d399;
  --teal-deep: #6ee7b7;
  --teal-wash: rgba(52, 211, 153, 0.16);
  --brand-glow: rgba(52, 211, 153, 0.42);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.16);
  --rose: #fb7185;
  --rose-bg: rgba(251, 113, 133, 0.16);
  --mint: #34d399;
  --mint-bg: rgba(52, 211, 153, 0.16);
  --sky: #a5b4fc;
  --sky-bg: rgba(129, 140, 248, 0.18);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  --glow-1: rgba(52, 211, 153, 0.18);
  --glow-2: rgba(16, 185, 129, 0.16);
  --nav-bg: rgba(10, 14, 28, 0.6);
  --panel-head-wash: rgba(255, 255, 255, 0.035);
  --th-bg: rgba(255, 255, 255, 0.04);
  --row-hover: rgba(34, 211, 238, 0.07);
  --muted: var(--ink-muted);
  --border: var(--line);
  --accent: var(--teal);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--glow-1), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, var(--glow-2), transparent 50%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper) 40%, var(--paper-2) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

a { color: var(--teal-deep); text-decoration: none; }
a:hover { color: var(--teal); }

.nb-navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.nb-nav {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
}

.nb-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.nb-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  color: #fff;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px var(--brand-glow);
}

.nb-brand span { color: var(--teal); }

.nb-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nb-nav-links button,
.nb-nav-links a,
.nb-nav-links .is-disabled {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.nb-nav-links button:hover,
.nb-nav-links button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nb-nav-links .is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nb-nav-end {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.nb-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.nb-theme-toggle:hover { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 4px var(--teal-wash); }
.nb-theme-toggle svg { width: 1.05rem; height: 1.05rem; display: block; }
.nb-theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .nb-theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .nb-theme-toggle .icon-moon { display: block; }

.nb-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.nb-hero {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  animation: nb-rise 0.55s ease-out both;
}

.nb-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.nb-hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.nb-lede {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.nb-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--mono);
}

.nb-badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: 0.35;
  animation: nb-pulse 2s ease-in-out infinite;
}

.nb-badge-ok { background: var(--mint-bg); color: var(--mint); }
.nb-badge-dry { background: var(--amber-bg); color: var(--amber); }

.nb-metrics {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1.4fr;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  animation: nb-rise 0.65s ease-out 0.08s both;
}
.nb-metrics-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .nb-metrics-4 { grid-template-columns: 1fr 1fr; }
}

.nb-metric {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.nb-metric-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 0.45rem;
  font-weight: 500;
}

.nb-metric-value {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.nb-metric-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.nb-health {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.nb-flash {
  min-height: 1.2rem;
  margin: -0.35rem 0 1rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.nb-flash .ask { color: var(--rose); }

.nb-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
  animation: nb-rise 0.75s ease-out both;
}

.nb-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-head-wash), transparent);
}

.nb-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nb-panel-body { padding: 1rem 1.15rem 1.2rem; }

.hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-family: var(--mono);
}

.nb-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  min-width: 0;
  font-weight: 600;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  width: 100%;
  min-width: 110px;
}

.field input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.venue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.venue h3 {
  margin: 0 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

.venue-fields {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 0.7rem;
}

.venue-fields.even {
  grid-template-columns: 1fr 1fr;
}

.nb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.nb-btn:hover { background: var(--surface-solid); box-shadow: var(--shadow); }
.nb-btn-primary { background: var(--teal); color: #fff; border-color: var(--teal-deep); }
.nb-btn-primary:hover { background: var(--teal-deep); color: #fff; }
.nb-btn-danger { background: var(--rose-bg); color: var(--rose); border-color: transparent; }
.nb-btn-danger:hover { background: var(--rose); color: #fff; }
.mkt-toolbar { margin-bottom: 0; }
.mkt-filters { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.nb-btn.is-filter.is-on {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-deep);
}

.pill,
.nb-chip {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--paper-2);
  color: var(--ink);
}

.pill.ok, .nb-chip.ok { background: var(--mint-bg); color: var(--mint); }
.pill.bad, .nb-chip.bad { background: var(--rose-bg); color: var(--rose); }
.pill.warn, .nb-chip.warn { background: var(--amber-bg); color: var(--amber); }

.pair-card {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  border-top: 1px solid var(--line);
  animation: none;
}

.pair-card:first-child { border-top: 0; }

.pair-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-head-wash), transparent);
}

.pair-id {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.row-actions { display: flex; gap: 0.45rem; }
.pair-card .venue-grid { padding: 1rem 1.15rem 1.2rem; }

.empty {
  color: var(--ink-muted);
  padding: 1.5rem 1.15rem;
  text-align: center;
  font-size: 0.92rem;
}

.bid { color: var(--mint); }
.ask { color: var(--rose); }
.spr { color: var(--ink-muted); font-size: 0.75rem; margin-top: 0.15rem; }
.spr.pos { color: var(--mint); }
.spr.pos.strong { color: var(--mint); font-weight: 700; font-size: 0.95rem; }
.spr.neg { color: var(--rose); }

/* Scanner tab */
tr.scanner-hot td { background: rgba(5,150,105,0.06); }
:root[data-theme="dark"] tr.scanner-hot td { background: rgba(52,211,153,0.07); }

.books-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(320px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.nb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.nb-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--th-bg);
}

.nb-table td {
  padding: 0.78rem 1rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.nb-table tbody tr:last-child td { border-bottom: 0; }
.nb-table tbody tr:hover td { background: var(--row-hover); }

.nb-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.nb-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--teal);
  cursor: pointer;
}

tr.pair { cursor: pointer; }
tr.pair.active td { background: var(--teal-wash); }

.books { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.book {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
}

.book h2 {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.55rem;
}

.lvl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  padding: 0.12rem 0;
}

section[hidden] { display: none !important; }

@keyframes nb-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nb-pulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.15; transform: scale(1.35); }
}

@media (max-width: 900px) {
  .nb-metrics,
  .venue-grid,
  .books-layout,
  .books { grid-template-columns: 1fr; }
  .nb-nav { flex-wrap: wrap; }
}

.nb-grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.nb-grid-2.nb-grid-even { grid-template-columns: 1fr 1fr; }
.nb-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.nb-grid-2 > .nb-panel,
.nb-grid-3 > .nb-panel { margin-bottom: 0; }
@media (max-width: 1100px) {
  .nb-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .nb-grid-2,
  .nb-grid-2.nb-grid-even,
  .nb-grid-3 { grid-template-columns: 1fr; }
}

.nb-rank-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.nb-rank-title svg {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--teal);
  flex-shrink: 0;
}
.nb-rank-table thead th {
  background: transparent;
  border-bottom: 0;
  padding-top: 0.45rem;
  padding-bottom: 0.2rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
  font-weight: 500;
}
.nb-rank-table td,
.nb-rank-table th { border-bottom: 0; }
.nb-rank-table tbody td { padding-top: 0.78rem; padding-bottom: 0.78rem; }
.nb-rank-table tbody tr:hover td { background: transparent; }
.nb-rank-table .num { text-align: right; }
.nb-rank-table .muted { color: var(--ink-muted); }
.nb-rank-table td:first-child { width: 2.4rem; }
.nb-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nb-empty {
  padding: 1.25rem 1.15rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.nb-donate { margin-bottom: 1.35rem; }
.nb-donate-heading {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mint);
}
.nb-donate-card {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  padding: 1.1rem 1.2rem;
  background: var(--mint-bg);
  border: 1px solid color-mix(in srgb, var(--mint) 35%, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.nb-donate-qr {
  width: 148px;
  height: 148px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #ecfdf5;
  padding: 8px;
  box-shadow: inset 0 0 0 1px rgba(4, 120, 87, 0.18);
}
.nb-donate-qr img { width: 100%; height: 100%; display: block; border-radius: 6px; }
.nb-donate-meta { min-width: 0; flex: 1; }
.nb-donate-network {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 0.4rem;
}
.nb-donate-address {
  display: block;
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.nb-donate-copy {
  background: var(--mint);
  color: #fff;
  border-color: transparent;
}
.nb-donate-copy:hover { background: #047857; color: #fff; }
@media (max-width: 640px) {
  .nb-donate-card { flex-direction: column; align-items: stretch; }
  .nb-donate-qr { width: 168px; height: 168px; margin: 0 auto; }
}

.nb-shell { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem 3rem; }
.nb-shell.dash-shell { max-width: 1360px; }
.nb-navbar { margin-bottom: 1.75rem; }
.nb-lede { margin: 0; max-width: 62ch; color: var(--ink-muted); font-size: 0.95rem; line-height: 1.55; }
.nb-badge-live { background: var(--mint-bg); color: var(--mint); }
.nb-chip-on { background: var(--mint-bg); color: var(--mint); }
.nb-panel-body.pad { padding: 1rem 1.15rem; }
.nb-message { padding: 0.7rem 1rem; border-radius: 10px; font-size: 0.88rem; }
.nb-message-error { background: var(--rose-bg); color: var(--rose); }
.dash-layout { display: flex; gap: 1.35rem; align-items: flex-start; }
.dash-side {
  width: 188px;
  flex-shrink: 0;
  position: sticky;
  top: 5.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .7rem .55rem 1rem;
}
.dash-main { min-width: 0; flex: 1; }
.dash-side .nav-label {
  font-size: 0.63rem;
  font-family: var(--mono);
  color: var(--ink-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .35rem .55rem .15rem;
}
.dash-side .nav-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .48rem .65rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: .84rem;
  font-weight: 500;
}
.dash-side .nav-item:hover { background: var(--paper-2); color: var(--ink); }
.dash-side .nav-item.active { background: var(--teal-wash); color: var(--teal-deep); }
.dash-side .nav-item[data-venue] { padding-left: 1.15rem; }
.dash-side .nav-badge {
  margin-left: auto;
  background: var(--teal-wash);
  color: var(--teal);
  font-family: var(--mono);
  font-size: .65rem;
  padding: .1rem .35rem;
  border-radius: 10px;
}
.dash-side-ctrl { margin: .85rem .35rem 0; }
.dash-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-bar { display: flex; gap: .3rem; flex-wrap: wrap; }
.dash-note { font-size: .72rem; color: var(--teal); align-self: center; }
.ingest-status {
  font-size: .72rem;
  font-family: var(--mono);
  color: var(--ink-muted);
  padding: .35rem .5rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex; align-items: center; gap: .4rem;
  margin-bottom: .4rem;
}
.ingest-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); }
.ingest-status.running .dot { background: var(--teal); box-shadow: 0 0 4px var(--teal); }
.ingest-status.running { color: var(--teal); }
.ctrl-btns { display: flex; gap: .4rem; }
.ctrl-btns .nb-btn { flex: 1; justify-content: center; padding: .4rem .5rem; font-size: .75rem; }
.flash {
  margin: 0 0 1rem;
  padding: .55rem .9rem;
  border-radius: 8px;
  font-size: .82rem;
  display: none;
}
.flash.show { display: block; }
.flash.ok  { background: var(--mint-bg); color: var(--mint); }
.flash.err { background: var(--rose-bg); color: var(--rose); }
.status-pill {
  display: flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .72rem; color: var(--ink-muted);
  padding: .3rem .65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); }
.status-pill.ok .dot  { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.status-pill.err .dot { background: var(--rose); }
.status-pill.ok  { color: var(--teal); }
.status-pill.err { color: var(--rose); }
.view { display: none; }
.view.is-on { display: block; }
@media (max-width: 900px) {
  .dash-layout { flex-direction: column; }
  .dash-side { width: 100%; position: static; }
}

/* Compatibility with dashboard view markup */
.page-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.page-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.03em; }
.page-sub { font-size: .82rem; color: var(--ink-muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.metrics-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .metrics-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .metrics { grid-template-columns: 1fr 1fr; } }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.metric-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); margin-bottom: .35rem; font-weight: 500; }
.metric-value { font-family: var(--mono); font-size: 1.2rem; font-weight: 500; }
.metric-value.accent { color: var(--teal); }
.metric-value.red { color: var(--rose); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.25rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--line); }
.venue-switches { display: flex; gap: .35rem; flex-wrap: wrap; }
.venue-switches .chip { cursor: pointer; border: 0; }
.panel-title { font-size: 1rem; font-weight: 600; }
.panel-sub { font-size: .78rem; color: var(--ink-muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-muted); font-weight: 600; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--th-bg); }
.tbl td { padding: .72rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .82rem; }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl tbody tr.clickable { cursor: pointer; }
.pos-drawer {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 1.25rem;
}
.pos-drawer[hidden] { display: none; }
.pos-drawer-card {
  width: min(920px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--surface-solid, var(--surface));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.2rem;
  color: var(--ink);
}
.pos-drawer-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .8rem; }
.pos-vt-chart { color: var(--teal, #0f766e); margin-bottom: .8rem; }
.ht-prune { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-muted); font-size: .78rem; font-weight: 600; }
.ht-prune input, .ht-prune select {
  font-family: var(--mono); font-size: .82rem; font-weight: 500;
  padding: .4rem .5rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--input-bg); color: var(--ink);
}
.ht-prune input { width: 4.2rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-family: inherit; font-weight: 600; font-size: .82rem; cursor: pointer; }
.btn:hover { background: var(--surface-solid); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal-deep); }
.btn.danger { background: var(--rose-bg); color: var(--rose); border-color: transparent; }
.btn.is-filter.on { background: var(--teal); color: #fff; border-color: var(--teal-deep); }
.chip { display: inline-flex; align-items: center; padding: .15rem .5rem; border-radius: 6px; font-size: .7rem; font-family: var(--mono); font-weight: 500; background: var(--paper-2); }
.chip.ok { background: var(--mint-bg); color: var(--mint); }
.chip.err, .chip.bad { background: var(--rose-bg); color: var(--rose); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.chip.dim { background: var(--paper-2); color: var(--ink-muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-muted); }
.muted2 { color: var(--ink-muted); opacity: .7; }
.green { color: var(--mint); }
.form-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.check label { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
input[type=checkbox] { accent-color: var(--teal); }
.pair-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.pair-section { background: var(--surface); padding: .75rem 1rem; }
.pair-section h3 { font-size: .7rem; color: var(--ink-muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .6rem; }
.pair-fields { display: flex; flex-direction: column; gap: .4rem; }
.books-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; }
.book { background: var(--surface); padding: .75rem 1rem; }
.book h3 { font-size: .7rem; color: var(--ink-muted); font-family: var(--mono); text-transform: uppercase; margin-bottom: .6rem; }
.lvl { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .78rem; padding: .2rem 0; }
.lvl-head { color: var(--ink-muted); font-size: .65rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin-bottom: .2rem; }
tr.hot td { background: var(--teal-wash); }
tr.pos-win td { background: var(--teal-wash); }
.accent { color: var(--teal); }
.formula {
  margin: 0;
  padding: 1rem 1.15rem 1.15rem;
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--ink);
  background: var(--th-bg);
}

@media (max-width: 560px) {
  .nb-nav { flex-direction: column; align-items: flex-start; }
  .venue-fields { grid-template-columns: 1fr; }
}
