/* base.css - layout and components for the app (sidebar, cards, charts, popups).
   Colours and fonts get overridden in theme.css */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --sunk: #eef0f4;
  --ink: #0c1322;
  --ink2: #2b3446;
  --mute: #667085;
  --line: #e3e6ec;
  --line2: #d3d8e1;
  --acc: #2747e0;
  --acc2: #5a74f0;
  --accsoft: #e9edff;
  --accink: #1a2fa8;
  --ok: #11845f;
  --oksoft: #e3f4ec;
  --warn: #b7740a;
  --warnsoft: #fbf1de;
  --bad: #c93a33;
  --badsoft: #fbe7e5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
  --shadow2: 0 24px 60px -24px rgba(16, 24, 40, 0.28);
  --f-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --f-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 16px;
  --r2: 22px;
  --fs: 15px;
  color-scheme: light;
}
:root[data-nt-theme='dark'] {
  --bg: #0a0d14;
  --surface: #111622;
  --sunk: #0d121c;
  --ink: #eef1f7;
  --ink2: #c9d0dd;
  --mute: #8b95a8;
  --line: #1f2736;
  --line2: #2a3446;
  --acc: #7d93ff;
  --acc2: #9fb0ff;
  --accsoft: #1a2244;
  --accink: #c3cdff;
  --ok: #3dc795;
  --oksoft: #0f2a22;
  --warn: #f0b142;
  --warnsoft: #2e2410;
  --bad: #ff7a70;
  --badsoft: #33171a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow2: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}
:root.big {
  --fs: 17px;
}
:root.hc {
  --mute: #3e4757;
  --line: #b9c0cc;
}
:root.hc[data-nt-theme='dark'] {
  --mute: #c4cbd8;
  --line: #4a5568;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs) / 1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.15;
  text-wrap: balance;
  font-weight: 650;
  letter-spacing: -0.015em;
}
p {
  margin: 0;
}
a {
  color: var(--acc);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 8px;
}
.serif {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: 0;
}
em.i,
.h-xl em,
.h-l em {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 400;
  color: var(--acc);
}
.mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}
.num {
  font-variant-numeric: tabular-nums;
}
.eyebrow {
  font: 600 11px/1 var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}
.mut {
  color: var(--mute);
}
.small {
  font-size: 0.86em;
}
.h-xl {
  font-size: clamp(44px, 6.4vw, 84px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.98;
}
.h-xl em {
  font-size: 1.08em;
}
.h-l {
  font-size: clamp(28px, 3.4vw, 42px);
  letter-spacing: -0.025em;
}
.lede {
  font-size: 1.12em;
  color: var(--ink2);
  max-width: 58ch;
}
[hidden] {
  display: none !important;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.93em;
  transition:
    transform 0.15s,
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--ink2);
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: var(--ink2);
}
.btn.acc {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--sunk);
}
.btn.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
}
.btn.sm {
  height: 34px;
  padding: 0 13px;
  font-size: 0.85em;
}
.btn.block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.iconbtn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  color: var(--ink2);
}
.iconbtn:hover {
  border-color: var(--line2);
  color: var(--ink);
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--sunk);
  border: 1px solid var(--line);
  gap: 2px;
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 0.86em;
  font-weight: 600;
  color: var(--mute);
}
.seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font: 600 11px/1 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--sunk);
  color: var(--ink2);
}
.chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.chip.l0 {
  background: var(--oksoft);
  color: var(--ok);
}
.chip.l1 {
  background: var(--warnsoft);
  color: var(--warn);
}
.chip.l2 {
  background: var(--badsoft);
  color: var(--bad);
}
.chip.acc {
  background: var(--accsoft);
  color: var(--acc);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}
.dot.pulse {
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent);
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
.cite {
  border: 0;
  background: var(--accsoft);
  color: var(--acc);
  font: 600 10px/1 var(--f-mono);
  padding: 3px 5px;
  border-radius: 5px;
  vertical-align: 2px;
  margin-left: 2px;
}

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.flat {
  box-shadow: none;
}
.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-h h3 {
  font-size: 1.02em;
}
.grid {
  display: grid;
  gap: 18px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.between {
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}

/* ================= APP SHELL ================= */
.shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100%;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 6px;
}
.side .logo {
  padding: 6px 10px 18px;
}
.navi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink2);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93em;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
}
.navi svg {
  color: var(--mute);
  flex: none;
}
.navi:hover {
  background: var(--sunk);
}
.navi.on {
  background: var(--accsoft);
  color: var(--accink);
}
.navi.on svg {
  color: var(--acc);
}
.navi kbd {
  margin-left: auto;
  font: 500 10px/1 var(--f-mono);
  color: var(--mute);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 5px;
}
.side .grow {
  flex: 1;
}
.capcard {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.85em;
}
.capcard b {
  display: block;
  font-size: 0.95em;
}
.capcard small {
  color: var(--mute);
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
}
.who:hover {
  background: var(--sunk);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8em;
  flex: none;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top h1 {
  font-size: 1.25em;
}
.top .sp {
  flex: 1;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--mute);
  font-size: 0.86em;
  min-width: 220px;
}
.search kbd {
  margin-left: auto;
  font: 500 10px/1 var(--f-mono);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 5px;
}
.page {
  padding: 28px 32px 60px;
  max-width: 1360px;
  width: 100%;
}
.view {
  animation: in 0.35s ease both;
}
@keyframes in {
  from {
    opacity: 0.4;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.tabbar {
  display: none;
}

/* overview */
.ov {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.c8 {
  grid-column: span 8;
}
.c4 {
  grid-column: span 4;
}
.c6 {
  grid-column: span 6;
}
.c12 {
  grid-column: span 12;
}
.c3 {
  grid-column: span 3;
}
.c5 {
  grid-column: span 5;
}
.c7 {
  grid-column: span 7;
}
.statusc {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
.statusc canvas.bg {
  position: absolute;
  right: -40px;
  top: -30px;
  width: 62%;
  height: 130%;
  opacity: 0.95;
  pointer-events: none;
}
.statusc .word {
  font: 400 clamp(64px, 8vw, 104px) / 0.9 var(--f-display);
  letter-spacing: -0.02em;
  margin: 16px 0 10px;
}
.statusc .word.l0 {
  color: var(--ink);
}
.statusc .word.l1 {
  color: var(--warn);
}
.statusc .word.l2 {
  color: var(--bad);
}
.halo-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 46ch;
  margin-top: auto;
}
.halo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 35% 30%, #fff, var(--acc2) 45%, var(--acc) 80%);
  box-shadow: 0 0 0 4px var(--accsoft);
  position: relative;
  animation: breathe 4s ease-in-out infinite;
}
.halo::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 13px;
  width: 16px;
  height: 5px;
  background: radial-gradient(circle, #fff 2px, transparent 2.5px) 0 0/8px 5px repeat-x;
}
@keyframes breathe {
  50% {
    transform: scale(1.06);
  }
}
.ring {
  position: relative;
  width: 180px;
  height: 180px;
  flex: none;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring .v {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.ring .v b {
  font: 400 58px/1 var(--f-display);
}
.ring .v small {
  display: block;
  color: var(--mute);
  font-size: 0.75em;
  margin-top: 2px;
}
.sub {
  display: grid;
  grid-template-columns: 76px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: 0.88em;
  font-weight: 600;
}
.meter {
  height: 6px;
  border-radius: 9px;
  background: var(--sunk);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 9px;
  background: var(--acc);
  transition: width 0.6s;
}
.tile {
  padding: 18px;
}
.tile .k {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tile b {
  display: block;
  font: 400 38px/1.05 var(--f-display);
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.tile b small {
  font: 600 0.38em var(--f-body);
  color: var(--mute);
  margin-left: 3px;
}
.tile p {
  font-size: 0.8em;
  color: var(--mute);
  margin-top: 4px;
}
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 120px;
}
.week .d {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  border: 0;
  background: none;
  padding: 0;
}
.week .d i {
  width: 100%;
  max-width: 34px;
  border-radius: 9px;
  background: var(--sunk);
  display: block;
}
.week .d span {
  font: 600 10px/1 var(--f-mono);
  color: var(--mute);
}
.heat {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.heat i {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--sunk);
  display: block;
  position: relative;
}
.heat i.l0 {
  background: color-mix(in srgb, var(--ok) 55%, var(--surface));
}
.heat i.l1 {
  background: color-mix(in srgb, var(--warn) 60%, var(--surface));
}
.heat i.l2 {
  background: color-mix(in srgb, var(--bad) 65%, var(--surface));
}
.heat i.today {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.linkcard {
  display: flex;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
.linkcard:hover {
  border-color: var(--line2);
}
.linkcard .ic {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accsoft);
  color: var(--acc);
  display: grid;
  place-items: center;
  flex: none;
  font: 600 15px var(--f-mono);
}
.linkcard b {
  display: block;
}
.linkcard small {
  color: var(--mute);
}
.linkcard .chev {
  margin-left: auto;
  color: var(--mute);
}

/* live */
.live {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}
.tracewrap {
  position: relative;
  height: 620px;
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.tracewrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.bands {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.bandc {
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--sunk);
  text-align: center;
}
.bandc .s {
  font: 400 22px/1 var(--f-display);
  color: var(--acc);
}
.bandc b {
  display: block;
  font-size: 1.05em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.bandc small {
  display: block;
  font-size: 0.68em;
  color: var(--mute);
  font-family: var(--f-mono);
}
.bandc .bar {
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}
.bandc .bar i {
  display: block;
  height: 100%;
  background: var(--acc);
}
.evs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}
.ev {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 11px;
  background: var(--sunk);
  border: 0;
  text-align: left;
  width: 100%;
}
.ev:hover {
  background: var(--badsoft);
}
.ev .t {
  font: 600 11px var(--f-mono);
  color: var(--mute);
}
.ev b {
  font-size: 0.86em;
}
.ev small {
  display: block;
  font-size: 0.75em;
  color: var(--mute);
}
.ev .r {
  text-align: right;
  font: 600 12px var(--f-mono);
}
.empty {
  color: var(--mute);
  font-size: 0.88em;
  padding: 10px 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84em;
  font-weight: 600;
}
.field select,
.field input,
.inp {
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line2);
  background: var(--surface);
  padding: 0 12px;
  font-weight: 500;
  width: 100%;
}
.inp:focus,
.field select:focus,
.field input:focus {
  outline: 2px solid var(--accsoft);
  border-color: var(--acc);
}
.fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hint {
  font-size: 0.8em;
  color: var(--warn);
  background: var(--warnsoft);
  padding: 8px 10px;
  border-radius: 10px;
  margin-top: 10px;
}
.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}
.msg {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.88em;
  max-width: 88%;
}
.msg.n {
  background: var(--sunk);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.u {
  background: var(--ink);
  color: var(--surface);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.qchips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.qchips button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.8em;
  font-weight: 600;
}
.qchips button:hover {
  border-color: var(--acc);
  color: var(--acc);
}
.chatin {
  display: flex;
  gap: 8px;
}
.spec {
  height: 150px;
}

/* insights */
.verdict {
  border-left: 5px solid var(--ok);
}
.verdict.l1 {
  border-left-color: var(--warn);
}
.verdict.l2 {
  border-left-color: var(--bad);
}
.verdict .word {
  font: 400 64px/1 var(--f-display);
  margin: 10px 0 8px;
}
.reasons {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reasons li {
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--sunk);
  border-left: 3px solid var(--c);
  font-size: 0.88em;
}
.reasons li b {
  display: block;
}
.reasons li span {
  color: var(--mute);
}
.topo {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
}
.topo canvas {
  width: 260px;
  height: 260px;
}
.tlegend {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 11px var(--f-mono);
  color: var(--mute);
  margin-top: 8px;
}
.tlegend i {
  flex: 1;
  height: 8px;
  border-radius: 8px;
}
.metric {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.metric:last-child {
  border-bottom: 0;
}
.metric .r1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.metric .r1 b {
  font-size: 0.92em;
}
.metric .r1 small {
  display: block;
  color: var(--mute);
  font-size: 0.78em;
}
.metric .v {
  font: 600 15px var(--f-mono);
}
.range {
  position: relative;
  height: 8px;
  border-radius: 8px;
  background: var(--sunk);
}
.range .zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--oksoft);
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
}
.range .pt {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c, var(--ink));
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line2);
  transform: translate(-50%, -50%);
  transition: left 0.5s;
}
ol.todo {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
ol.todo li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.92em;
}
ol.todo .n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accsoft);
  color: var(--acc);
  display: grid;
  place-items: center;
  font: 700 12px var(--f-mono);
  flex: none;
}
.sos {
  background: var(--badsoft);
  border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
  border-radius: var(--r);
  padding: 16px 18px;
  font-size: 0.9em;
}
.sos b {
  color: var(--bad);
}
.sos ul {
  margin: 8px 0;
  padding-left: 18px;
}
.chart {
  width: 100%;
  height: 190px;
  display: block;
}
.chart text {
  fill: var(--mute);
  font: 600 10px var(--f-mono);
}

/* history */
.hlist {
  display: flex;
  flex-direction: column;
}
.hrow {
  display: grid;
  grid-template-columns: 130px 120px 1fr 90px 80px 24px;
  gap: 14px;
  align-items: center;
  padding: 14px 6px;
  border-bottom: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: none;
  text-align: left;
  width: 100%;
  font-size: 0.9em;
}
.hrow:hover {
  background: var(--sunk);
}
.hrow .src {
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* atlas */
.atlas {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 18px;
}
.headwrap {
  position: relative;
  aspect-ratio: 1;
  max-height: 560px;
  border-radius: var(--r2);
  background: radial-gradient(90% 80% at 50% 40%, var(--surface), var(--sunk));
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.headwrap:active {
  cursor: grabbing;
}
.headwrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.headwrap .hint2 {
  position: absolute;
  left: 16px;
  bottom: 14px;
  font: 600 10.5px var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.headwrap .bsel {
  position: absolute;
  right: 12px;
  top: 12px;
}
.spec4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.spec4 div {
  padding: 14px;
  border-radius: 14px;
  background: var(--sunk);
}
.spec4 small {
  font: 600 10px var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.spec4 b {
  display: block;
  font: 400 28px/1.1 var(--f-display);
  margin: 6px 0 2px;
}
.spec4 span {
  font-size: 0.8em;
  color: var(--mute);
}
dl.sinfo {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 14px;
  margin: 14px 0 0;
  font-size: 0.9em;
}
dl.sinfo dt {
  color: var(--mute);
  font-weight: 600;
}
dl.sinfo dd {
  margin: 0;
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tags span {
  font-size: 0.78em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accsoft);
  color: var(--accink);
  font-weight: 600;
}
.sgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.scard {
  padding: 16px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  font: inherit;
  color: inherit;
}
.scard:hover {
  border-color: var(--acc);
}
.scard .code {
  font: 400 30px/1 var(--f-display);
  color: var(--acc);
}
.scard small {
  display: block;
  color: var(--mute);
  font-size: 0.78em;
  margin-top: 2px;
}
.scard p {
  font-size: 0.85em;
  margin-top: 10px;
  color: var(--ink2);
}
.rhy {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.rhy .card canvas {
  width: 100%;
  height: 56px;
  display: block;
  margin: 10px 0;
}
.loopwave {
  width: 100%;
  height: 56px;
}

/* science */
.sci {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.scinav {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.prose {
  max-width: 74ch;
}
.prose p {
  margin: 0 0 14px;
  color: var(--ink2);
}
.rulefull {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.rulefull .card h3 {
  display: flex;
  gap: 10px;
  align-items: center;
}
.rulefull .lab {
  font: 600 10.5px var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  margin-top: 12px;
  display: block;
}
.rulefull p {
  font-size: 0.92em;
  margin-top: 4px;
}
.conf {
  display: grid;
  grid-template-columns: 150px repeat(3, 1fr);
  gap: 6px;
  font-size: 0.85em;
}
.conf > * {
  padding: 10px;
  border-radius: 9px;
  text-align: center;
}
.conf .h {
  font: 600 10.5px var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.conf .rl {
  text-align: left;
  font-weight: 600;
  background: var(--sunk);
}
.conf .c {
  background: var(--sunk);
  font: 600 15px var(--f-mono);
}
.conf .c.hit {
  background: var(--oksoft);
  color: var(--ok);
}
.conf .c.miss {
  background: var(--badsoft);
  color: var(--bad);
}
.road {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.road .st {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.road .st b {
  font: 600 11px var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--acc);
}
.road .st.now b {
  color: var(--ok);
}
ol.refs {
  padding-left: 22px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9em;
}
ol.refs li b {
  display: block;
  font-weight: 600;
}
ol.refs li span {
  color: var(--mute);
  display: block;
}
ol.refs li:target {
  background: var(--accsoft);
  border-radius: 8px;
}
.whol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.whol li {
  padding: 14px;
  border-radius: 14px;
  background: var(--sunk);
}
.whol li b {
  display: block;
  margin-bottom: 4px;
}
.whol li span {
  font-size: 0.88em;
  color: var(--mute);
}
.fbq {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.fbq .opts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.fbq .opts button {
  border: 1px solid var(--line2);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.84em;
  font-weight: 600;
}
.fbq .opts button.on {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

/* profile */
.cells {
  display: flex;
  flex-direction: column;
}
.cell {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  text-align: left;
}
.cell:last-child {
  border-bottom: 0;
}
.cell .main {
  flex: 1;
  display: block;
}
.cell .main b {
  display: block;
  font-size: 0.93em;
}
.cell .main small {
  color: var(--mute);
  font-size: 0.82em;
}
.cell.red b {
  color: var(--bad);
}
.switch {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: var(--line2);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex: none;
  margin: 0;
}
.switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.switch:checked {
  background: var(--acc);
}
.switch:checked::after {
  transform: translateX(18px);
}

/* modal */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--ink) 38%, transparent);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade 0.2s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  background: var(--surface);
  border-radius: 26px;
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  box-shadow: var(--shadow2);
  border: 1px solid var(--line);
  padding: 28px;
  animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal.wide {
  width: min(860px, 100%);
}
@keyframes pop {
  from {
    transform: translateY(14px) scale(0.98);
    opacity: 0;
  }
}
.modal h2 {
  font-size: 1.5em;
  margin-bottom: 8px;
}
.modal .acts {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.modal .x {
  float: right;
  margin: -6px -6px 0 0;
}
textarea.box {
  width: 100%;
  min-height: 220px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: var(--sunk);
  padding: 12px;
  font: 12px/1.5 var(--f-mono);
  resize: vertical;
}
.steps {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
}
.steps i {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
}
.steps i.on {
  background: var(--acc);
}
.crow {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
}
.crow .ic {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accsoft);
  color: var(--acc);
  display: grid;
  place-items: center;
  flex: none;
}
.crow b {
  display: block;
}
.crow small {
  color: var(--mute);
  font-size: 0.88em;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9em;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--sunk);
}
.check input {
  margin-top: 3px;
  accent-color: var(--acc);
  width: 18px;
  height: 18px;
}
.err {
  color: var(--bad);
  font-size: 0.85em;
  margin-top: 8px;
}
.pinrow {
  display: flex;
  gap: 8px;
}
.plist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.plist button {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  text-align: left;
}
.plist button.on {
  border-color: var(--acc);
  background: var(--accsoft);
}
.contact {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 14px 0;
}
.contact div {
  padding: 8px 4px;
  border-radius: 9px;
  background: var(--sunk);
  text-align: center;
  font-size: 0.78em;
  transition: background 0.3s;
}
.contact div b {
  display: block;
  font-family: var(--f-mono);
}
.contact div span {
  font-family: var(--f-mono);
  color: var(--mute);
  font-size: 0.9em;
}
.contact div.ok {
  background: var(--oksoft);
}
.contact div.ok span {
  color: var(--ok);
}
.contact div.bad {
  background: var(--warnsoft);
}
.contact div.bad span {
  color: var(--warn);
}
.scan {
  width: 160px;
  height: 160px;
  margin: 20px auto;
  position: relative;
  display: grid;
  place-items: center;
}
.scan i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--acc);
  opacity: 0;
  animation: ripple 2.4s infinite;
}
.scan i:nth-child(2) {
  animation-delay: 0.8s;
}
.scan i:nth-child(3) {
  animation-delay: 1.6s;
}
@keyframes ripple {
  0% {
    transform: scale(0.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}
.checkring {
  width: 240px;
  height: 240px;
  margin: 12px auto;
  position: relative;
}
.checkring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.checkring .v {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.checkring .v b {
  font: 400 72px/1 var(--f-display);
}
.breath {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accsoft), transparent 70%);
  animation: br 8s ease-in-out infinite;
}
@keyframes br {
  0%,
  100% {
    transform: scale(0.75);
  }
  50% {
    transform: scale(1);
  }
}

/* doctor report (paper) */
.paper {
  background: #fff;
  color: #111;
  border-radius: 6px;
  padding: 34px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid #ddd;
  color-scheme: light;
}
.paper h3 {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  margin: 18px 0 8px;
  font-family: var(--f-mono);
}
.paper .phead {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #111;
  padding-bottom: 12px;
}
.paper table {
  width: 100%;
  border-collapse: collapse;
}
.paper td,
.paper th {
  border-bottom: 1px solid #e5e5e5;
  padding: 6px 4px;
  text-align: left;
}
.paper .wv {
  border: 1px solid #eee;
  border-radius: 4px;
  margin-top: 4px;
}

/* tour */
.tourbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  width: min(680px, calc(100% - 24px));
  background: var(--ink);
  color: var(--surface);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow2);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.tourbar p {
  font-size: 0.95em;
}
.tourbar .k {
  font: 600 10.5px var(--f-mono);
  letter-spacing: 0.12em;
  opacity: 0.6;
  display: block;
  margin-bottom: 4px;
}
.tourbar .prog {
  grid-column: 1/-1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.tourbar .prog i {
  display: block;
  height: 100%;
  background: var(--acc2);
  width: 0;
}
.tourbar .btn {
  height: 34px;
  background: transparent;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.25);
}
:root[data-nt-theme='dark'] .tourbar {
  background: #1b2233;
  color: var(--ink);
}

/* palette */
.pal {
  width: min(560px, 100%);
  padding: 0;
  overflow: hidden;
}
.pal input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  height: 56px;
  padding: 0 20px;
  background: transparent;
  font-size: 1.05em;
  outline: none;
}
.pal .it {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 20px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 550;
}
.pal .it.on {
  background: var(--accsoft);
  color: var(--accink);
}
.pal .it small {
  margin-left: auto;
  color: var(--mute);
  font-family: var(--f-mono);
  font-size: 0.72em;
}
.pal .list {
  max-height: 340px;
  overflow: auto;
  padding: 6px 0;
}

.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--ink);
  color: var(--surface);
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 0.9em;
  font-weight: 600;
  box-shadow: var(--shadow2);
  animation: pop 0.3s;
}

/* responsive */
@media (max-width: 1180px) {
  .live {
    grid-template-columns: 1fr;
  }
  .c8,
  .c4,
  .c6,
  .c3,
  .c5,
  .c7 {
    grid-column: span 12;
  }
  .ov .c3 {
    grid-column: span 6;
  }
  .atlas {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .sechead,
  .band-cta {
    grid-template-columns: 1fr;
  }
  .pipe,
  .rules4,
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    display: none;
  }
  .top {
    padding: 12px 16px;
  }
  .search {
    display: none;
  }
  .page {
    padding: 20px 16px 110px;
  }
  .tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .tabbar button {
    border: 0;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.68em;
    font-weight: 600;
    color: var(--mute);
    padding: 4px 8px;
    border-radius: 10px;
  }
  .tabbar button.on {
    color: var(--acc);
  }
  .sci {
    grid-template-columns: 1fr;
  }
  .scinav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }
  .scinav .navi {
    white-space: nowrap;
    width: auto;
  }
  .hrow {
    grid-template-columns: 1fr auto;
    gap: 4px;
  }
  .hrow .src,
  .hrow .hx {
    display: none;
  }
  .nav .links {
    display: none;
  }
  .tourbar {
    bottom: 86px;
  }
}
@media (max-width: 620px) {
  .pipe,
  .rules4,
  .stats,
  .whol,
  .spec4,
  .fgrid {
    grid-template-columns: 1fr;
  }
  .ov .c3 {
    grid-column: span 6;
  }
  .tile b {
    font-size: 30px;
  }
  .statusc canvas.bg {
    opacity: 0.3;
    width: 90%;
  }
  .statusc .word {
    font-size: 60px;
  }
  .topo {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .sec {
    padding: 56px 16px;
  }
  .band-cta {
    padding: 32px 22px;
  }
  .tracewrap {
    height: 480px;
  }
  .conf {
    grid-template-columns: 96px repeat(3, 1fr);
    font-size: 0.78em;
  }
  .modal {
    padding: 22px;
    border-radius: 22px;
  }
  .ring {
    width: 150px;
    height: 150px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
:root.rm * {
  animation: none !important;
  transition: none !important;
}

/* shared with the landing page */
.pipe {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.pipe .st {
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.pipe .st .k {
  font: 600 11px/1 var(--f-mono);
  letter-spacing: 0.1em;
  color: var(--gold);
}
.pipe .st h4 {
  margin: 10px 0 6px;
  font-size: 1em;
}
.pipe .st p {
  font-size: 0.88em;
  color: var(--mute);
}
.pipe .st .v {
  margin-top: 12px;
  font: italic 400 15px var(--f-display);
  color: var(--ink2);
}
.tblwrap {
  overflow-x: auto;
}
table.cmp {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.93em;
}
table.cmp th,
table.cmp td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.cmp tr:last-child td {
  border-bottom: 0;
}
table.cmp td:first-child {
  width: 16%;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat p {
  font-size: 0.88em;
  color: var(--mute);
  margin-top: 12px;
}
@media (max-width: 980px) {
  .pipe,
  .stats {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .pipe,
  .stats {
    grid-template-columns: 1fr;
  }
}
