/* =====================================================================
   WERRALEM · Gözlem Köprüsü  —  v6.0
   Koyu uzay tabanlı, veri-dürüst bilim kurgu arayüzü.
   ===================================================================== */

:root {
  --bg: #04060b;
  --bg-2: #070b14;
  --panel: rgba(10, 16, 29, 0.78);
  --panel-solid: #0b1220;
  --panel-hi: rgba(18, 28, 48, 0.9);
  --line: #16223a;
  --line-2: #22334f;
  --ink: #e6edf7;
  --ink-2: #a3b3ca;
  --ink-3: #6b7d98;
  --accent: #5ee6ff;
  --accent-dim: rgba(94, 230, 255, 0.14);
  --bio: #3cf2a0;
  --bio-dim: rgba(60, 242, 160, 0.14);
  --violet: #b69cff;
  --warn: #ffb547;
  --crit: #ff5d78;

  /* grafik serileri (doğrulanmış kategorik palet, koyu zemin) */
  --s1: #169fc4;
  --s2: #8c6cea;
  --s3: #c4841a;
  --grid: rgba(120, 150, 190, 0.12);

  --r: 4px;
  --gap: 14px;
  --top-h: 58px;
  --rail-w: 88px;
  --f-ui: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 78% -10%, #0c1a33 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #0a1f24 0%, transparent 55%),
              var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--f-mono); }

#starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.grid-veil {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(94, 230, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 230, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}

/* ------------------------------------------------------------ common */
.eyebrow {
  margin: 0 0 4px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--accent); text-transform: uppercase;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r);
  background: transparent; border: 1px solid var(--line-2); color: var(--ink);
  font-weight: 600; letter-spacing: 0.08em; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(180deg, rgba(94,230,255,.18), rgba(94,230,255,.06));
  border-color: rgba(94, 230, 255, 0.55); color: #dffaff;
  box-shadow: 0 0 0 1px rgba(94,230,255,.08) inset, 0 0 24px -8px rgba(94,230,255,.6);
}
.btn-primary:hover { background: rgba(94,230,255,.22); }
.btn[disabled] { opacity: .5; cursor: progress; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line-2); background: rgba(10,16,29,.6); border-radius: var(--r);
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg, .railnav svg, .brand-mark {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.chip {
  height: 28px; padding: 0 10px; border-radius: 3px; cursor: pointer;
  background: transparent; border: 1px solid var(--line-2); color: var(--ink-2);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em;
}
.chip:hover, .chip[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 7px;
  font-family: var(--f-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.12em;
  border: 1px solid; border-radius: 2px; white-space: nowrap; cursor: help;
}
.badge.live   { color: var(--bio);    border-color: rgba(60,242,160,.45); background: var(--bio-dim); }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bio); box-shadow: 0 0 8px var(--bio); animation: blink 2.4s infinite; }
.badge.calc   { color: var(--accent); border-color: rgba(94,230,255,.45); background: var(--accent-dim); }
.badge.model  { color: var(--violet); border-color: rgba(182,156,255,.45); background: rgba(182,156,255,.12); }
.badge.static { color: var(--ink-3);  border-color: var(--line-2); border-style: dashed; }
.badge.assume { color: var(--warn);   border-color: rgba(255,181,71,.5); background: rgba(255,181,71,.1); }
@keyframes blink { 50% { opacity: .35; } }

.status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 12px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: currentColor; }
.status.ok   { color: var(--bio); }
.status.warn { color: var(--warn); }
.status.bad  { color: var(--crit); }
.status.idle { color: var(--ink-3); }

/* ------------------------------------------------------------ vault */
.vault {
  position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
body:not(.is-locked) .vault { display: none; }
.vault-core { width: min(420px, 100%); text-align: center; position: relative; }
.vault-rings { width: 180px; height: 180px; margin: 0 auto 18px; }
.vault-rings svg { width: 100%; height: 100%; overflow: visible; }
.ring { fill: none; stroke-width: 1; transform-origin: 100px 100px; }
.ring.r1 { stroke: rgba(94,230,255,.5); stroke-dasharray: 2 6; animation: spin 38s linear infinite; }
.ring.r2 { stroke: rgba(60,242,160,.55); stroke-dasharray: 60 18 4 18; animation: spin 22s linear infinite reverse; }
.ring.r3 { stroke: rgba(182,156,255,.5); stroke-dasharray: 120 240; stroke-width: 2; animation: spin 9s linear infinite; }
.core-dot { fill: var(--accent); filter: drop-shadow(0 0 10px var(--accent)); animation: breathe 3s ease-in-out infinite; transform-origin: 100px 100px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.45); opacity: .7; } }
.vault-title { margin: 0; font-size: 44px; letter-spacing: 0.32em; font-weight: 600; padding-left: .32em; }
.vault-sub { color: var(--ink-2); margin: 8px 0 26px; }
.vault-form { display: grid; gap: 12px; }
.vault-input { position: relative; }
.vault-input input, .dialog input {
  width: 100%; height: 46px; padding: 0 48px 0 14px; border-radius: var(--r);
  background: rgba(6,10,20,.85); border: 1px solid var(--line-2); color: var(--ink);
  font-family: var(--f-mono); font-size: 15px; letter-spacing: .08em;
}
.vault-input input:focus, .dialog input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(94,230,255,.12); }
.vault-input .icon-btn { position: absolute; right: 5px; top: 5px; border: 0; background: transparent; }
.vault-form .btn { height: 46px; }
.vault-msg { min-height: 20px; margin: 0; font-family: var(--f-mono); font-size: 12px; color: var(--crit); }
.vault-msg.ok { color: var(--bio); }
.vault-foot { margin-top: 26px; font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }
.rc-legal { margin: 8px auto 0; max-width: 360px; font-size: 10.5px; color: var(--ink-3); line-height: 1.5; }
.rc-legal a { color: var(--ink-2); }
/* Rozet gizlenir; Google'ın izin verdiği metin atfı kilit ekranında yer alır */
.grecaptcha-badge { visibility: hidden !important; }
.vault.shake .vault-core { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

/* ------------------------------------------------------------ shell */
.app { position: relative; z-index: 1; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: rgba(4,6,11,.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94,230,255,.6), transparent);
  opacity: .5;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-name { font-weight: 700; letter-spacing: .28em; font-size: 16px; }
.brand-sub { color: var(--ink-3); font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; border-left: 1px solid var(--line-2); padding-left: 10px; }
.topbar-center { flex: 1; display: flex; justify-content: center; gap: 22px; min-width: 0; }
.tb-stat { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.tb-k { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .16em; color: var(--ink-3); }
.tb-v { font-size: 14px; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.link-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 14px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em;
}
.link-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.link-pill[data-state="ok"] { color: var(--bio); border-color: rgba(60,242,160,.4); }
.link-pill[data-state="ok"] i { background: var(--bio); box-shadow: 0 0 8px var(--bio); animation: blink 2s infinite; }
.link-pill[data-state="warn"] { color: var(--warn); border-color: rgba(255,181,71,.5); }
.link-pill[data-state="warn"] i { background: var(--warn); }
.link-pill[data-state="bad"] { color: var(--crit); border-color: rgba(255,93,120,.5); }
.link-pill[data-state="bad"] i { background: var(--crit); }

.railnav {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--rail-w); z-index: 15;
  display: flex; flex-direction: column; gap: 4px; padding: 14px 8px;
  background: rgba(4,6,11,.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-right: 1px solid var(--line);
}
.railnav a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 4px; border-radius: var(--r); color: var(--ink-3); text-decoration: none;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; transition: color .15s, background .15s;
}
.railnav a svg { width: 22px; height: 22px; }
.railnav a:hover { color: var(--ink); background: rgba(94,230,255,.05); }
.railnav a[aria-current="page"] { color: var(--accent); background: var(--accent-dim); }
.railnav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 2px;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}

.main { padding: calc(var(--top-h) + 22px) 24px 40px calc(var(--rail-w) + 24px); max-width: 1680px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: .06em; }
.page-note { margin: 0; max-width: 560px; color: var(--ink-2); font-size: 13px; }
.page[hidden] { display: none; }
.page { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------ panel */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.panel {
  position: relative; min-width: 0; padding: 14px 16px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.panel::before, .panel::after {
  content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
  border-color: rgba(94,230,255,.55); border-style: solid;
}
.panel::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.ph { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 22px; }
.ph h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; flex: 1; min-width: 0; }
.ph-code { font-family: var(--f-mono); font-size: 10px; color: var(--accent); opacity: .8; padding: 2px 5px; border: 1px solid rgba(94,230,255,.25); border-radius: 2px; }
.ph-meta { font-size: 11px; color: var(--ink-3); }
.panel-note { margin: 10px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.sub { margin: 16px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }

.kv { display: grid; gap: 10px 16px; margin: 0; }
.kv-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.kv-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.kv > div { min-width: 0; }
.kv dt { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; margin-bottom: 2px; }
.kv dd { margin: 0; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }

.hero-num { display: flex; flex-direction: column; margin: 4px 0 14px; }
.hero-k { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .18em; color: var(--ink-3); }
.hero-v { white-space: nowrap; font-size: 38px; line-height: 1.1; font-weight: 500; color: var(--ink); text-shadow: 0 0 22px rgba(94,230,255,.25); }
.hero-d { font-size: 12px; color: var(--ink-2); }

/* meters */
.meter-row { display: grid; grid-template-columns: 130px 1fr 70px; align-items: center; gap: 10px; margin-top: 12px; }
.meter-row .k { font-size: 12px; color: var(--ink-2); }
.meter-row .v { text-align: right; font-size: 12px; }
.bar { height: 6px; background: rgba(120,150,190,.12); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--s1); border-radius: 3px; transition: width .6s ease; }
.diverge { position: relative; height: 6px; background: rgba(120,150,190,.12); border-radius: 3px; }
.diverge::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }
.diverge i { position: absolute; top: 0; bottom: 0; border-radius: 3px; transition: all .6s ease; }

/* ------------------------------------------------------------ bridge */
.g-bridge .p-organism { grid-column: span 4; }
.g-bridge .p-ekg { grid-column: span 8; }
.g-bridge .p-fractal { grid-column: span 5; }
.g-bridge .p-market { grid-column: span 7; }
.g-bridge .p-chain { grid-column: span 6; }
.g-bridge .p-summary { grid-column: span 6; }

.organism-state { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.state-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bio); box-shadow: 0 0 0 4px rgba(60,242,160,.15), 0 0 16px var(--bio); animation: breathe-dot 2.4s ease-in-out infinite; }
@keyframes breathe-dot { 50% { box-shadow: 0 0 0 8px rgba(60,242,160,.04), 0 0 22px var(--bio); } }
.state-name { font-family: var(--f-mono); font-size: 12px; color: var(--bio); letter-spacing: .06em; overflow-wrap: anywhere; }

.ekg { display: block; width: 100%; height: 170px; border-radius: 3px;
  background: linear-gradient(rgba(60,242,160,.05) 1px, transparent 1px) 0 0/ 100% 20px,
              linear-gradient(90deg, rgba(60,242,160,.05) 1px, transparent 1px) 0 0/ 20px 100%,
              rgba(2,8,8,.55);
  border: 1px solid rgba(60,242,160,.15);
}
.ekg-foot { display: flex; align-items: center; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.ekg-foot > div { display: flex; flex-direction: column; }
.ekg-foot .k { font-size: 11px; color: var(--ink-3); }
.ekg-foot .v { font-size: 18px; }
.ekg-foot .chip { margin-left: auto; }

.fractal-wrap { position: relative; border-radius: 3px; overflow: hidden; border: 1px solid var(--line-2); aspect-ratio: 16 / 10; background: #000; }
.fractal-wrap canvas { width: 100%; height: 100%; display: block; image-rendering: auto; }
.fractal-hud { position: absolute; right: 8px; top: 8px; text-align: right; padding: 5px 8px; background: rgba(2,6,14,.72); border: 1px solid rgba(94,230,255,.25); border-radius: 3px; display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #dffaff; text-shadow: 0 1px 3px #000; }
.fractal-mark { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lens { position: absolute; left: 10px; top: 10px; width: 40%; aspect-ratio: 1; border: 1px solid rgba(94,230,255,.7); border-radius: 3px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 10px 30px rgba(0,0,0,.55); }
.lens canvas, .lens svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.lens-cap { position: absolute; left: 6px; top: 5px; font-size: 9.5px; letter-spacing: .1em; color: #dffaff; text-shadow: 0 1px 2px #000; }
.probe-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 11px; color: var(--ink-2); }
.probe-legend b { color: var(--ink); font-weight: 500; }

.market-list { display: grid; gap: 2px; }
.mk-row { display: grid; grid-template-columns: 92px 1fr 150px 110px 64px; align-items: center; gap: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.mk-row:last-child { border-bottom: 0; }
.mk-sym b { display: block; font-size: 13px; letter-spacing: .06em; }
.mk-sym span { font-size: 11px; color: var(--ink-3); }
.mk-spark { height: 30px; width: 100%; }
.mk-spark svg { width: 100%; height: 100%; overflow: visible; }
.mk-price { text-align: right; font-size: 15px; }
.mk-price small { display: block; font-size: 10.5px; color: var(--ink-3); }
.mk-imb { position: relative; height: 6px; background: rgba(120,150,190,.12); border-radius: 3px; }
.mk-imb::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }
.mk-imb i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.mk-spread { text-align: right; font-size: 11px; color: var(--ink-2); }
.mk-head { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-3); border-bottom: 1px solid var(--line-2); padding-top: 0; }

.summary-list { list-style: none; margin: 0; padding: 0; display: grid; }
.summary-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.summary-list li:last-child { border-bottom: 0; }
.summary-list .k { color: var(--ink-2); font-size: 13px; }
.summary-list .v { font-family: var(--f-mono); font-size: 13px; text-align: right; }

/* ------------------------------------------------------------ cell */
.g-cell .p-neuro { grid-column: span 7; }
.g-cell .p-shanks { grid-column: span 5; }
.g-cell .p-colonies { grid-column: span 8; }
.g-cell .p-window { grid-column: span 4; }
.g-cell .p-page { grid-column: span 6; }
.g-cell .p-orbit { grid-column: span 3; }
.g-cell .p-decl { grid-column: span 3; }
.g-cell .p-covenant { grid-column: span 12; }

.neuro-count { display: flex; flex-direction: column; }
.neuro-top { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.dials { display: flex; gap: 14px; }
.dial { margin: 0; text-align: center; }
.dial svg { width: 112px; height: 112px; }
.dial figcaption { display: flex; flex-direction: column; font-size: 11px; color: var(--ink-3); }
.dial figcaption b { color: var(--ink); font-size: 13px; font-weight: 500; }
.saccade { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); }
.saccade .k { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--ink-3); margin-right: 6px; }

.shanks { display: grid; gap: 8px; }
.shank { border: 1px solid var(--line); border-left: 2px solid var(--bio); padding: 9px 10px; border-radius: 3px; background: rgba(6,12,22,.55); }
.shank.off { border-left-color: var(--ink-3); opacity: .7; }
.shank-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.shank-top b { font-weight: 600; }
.shank-meta { display: flex; gap: 14px; margin-top: 4px; font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); flex-wrap: wrap; }

.colony-wrap { display: grid; grid-template-columns: 1fr 210px; gap: 18px; align-items: start; }
.colony-grid { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 8px; }
.colony {
  position: relative; aspect-ratio: 1; border-radius: 3px; cursor: crosshair;
  border: 1px solid rgba(255,255,255,.06);
  display: grid; place-items: center; font-family: var(--f-mono); font-size: 11px; color: rgba(255,255,255,.9);
  transition: transform .15s, box-shadow .15s;
}
.colony:hover, .colony:focus-visible { transform: scale(1.06); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent); z-index: 2; }
.colony .atp { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 3px; background: rgba(0,0,0,.35); border-radius: 2px; overflow: hidden; }
.colony .atp i { display: block; height: 100%; background: rgba(255,255,255,.75); }
.colony-detail { margin-top: 12px; padding: 8px 10px; min-height: 36px; border: 1px dashed var(--line-2); border-radius: 3px; font-size: 11.5px; color: var(--ink-2); }
.legend-seq { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 11px; color: var(--ink-3); }
.legend-seq i { flex: 1; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #12334a, #11607f, #169fc4, #52c6e6, #a6ecff); }

.window-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.flag { font-family: var(--f-mono); font-size: 11px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 2px; color: var(--ink-2); }
.flag.ok { color: var(--bio); border-color: rgba(60,242,160,.4); }
.flag.warn { color: var(--warn); border-color: rgba(255,181,71,.45); }
.ring-pair { display: flex; justify-content: space-around; margin: 4px 0 12px; }
.ring-gauge { margin: 0; text-align: center; }
.ring-gauge svg { width: 110px; height: 110px; }
.ring-gauge figcaption { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; }
.mig-list { list-style: none; margin: 0; padding: 0; font-size: 11px; display: grid; gap: 5px; }
.mig-list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.mig-list li span:last-child { color: var(--ink-3); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--ink-2); margin-bottom: 6px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 2px; display: inline-block; border-radius: 1px; }
.sw.s1 { background: var(--s1); }
.sw.s2 { background: var(--s2); }
.sw.s3 { background: var(--s3); height: 10px; width: 2px; }
.chart-box { position: relative; height: 200px; margin-bottom: 12px; }
.chart-box svg { width: 100%; height: 100%; overflow: visible; }
.axis text { fill: var(--ink-3); font-family: var(--f-mono); font-size: 10px; }
.axis line, .axis path { stroke: var(--grid); }

.decl-grid { display: grid; gap: 10px; }
.decl { border: 1px dashed var(--line-2); border-radius: 3px; padding: 8px 10px; }
.decl b { display: block; font-size: 12px; letter-spacing: .06em; margin-bottom: 4px; }
.decl span { display: block; font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }

.covenant summary { cursor: pointer; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--ink-2); list-style: none; }
.covenant summary::-webkit-details-marker { display: none; }
.covenant summary::before { content: "▸"; color: var(--accent); transition: transform .2s; }
.covenant[open] summary::before { transform: rotate(90deg); }
.covenant code { font-size: 11px; color: var(--violet); overflow-wrap: anywhere; }
.covenant blockquote { margin: 12px 0 0; padding: 12px 16px; border-left: 2px solid var(--violet); background: rgba(182,156,255,.06); color: var(--ink); line-height: 1.7; font-size: 14px; white-space: pre-wrap; }

/* ------------------------------------------------------------ chat */
.g-chat .p-console { grid-column: span 8; display: flex; flex-direction: column; min-height: 620px; }
.g-chat .p-response { grid-column: span 4; }
.transcript { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 4px 12px; max-height: 60vh; min-height: 320px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 3px; border: 1px solid var(--line); background: rgba(6,12,22,.6); }
.msg .who { display: block; font-family: var(--f-mono); font-size: 10px; letter-spacing: .16em; color: var(--ink-3); margin-bottom: 4px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.msg.me { align-self: flex-end; border-color: rgba(94,230,255,.35); background: rgba(94,230,255,.07); }
.msg.me .who { color: var(--accent); }
.msg.cell { align-self: flex-start; border-color: rgba(60,242,160,.3); background: rgba(60,242,160,.05); }
.msg.cell .who { color: var(--bio); }
.msg.sys { align-self: center; max-width: 100%; border-style: dashed; color: var(--ink-2); font-size: 12.5px; }
.msg.err { align-self: center; border-color: rgba(255,93,120,.45); color: #ffc2cd; }
.msg .meta { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); }
.msg.typing p::after { content: "▍"; animation: blink 1s infinite; color: var(--bio); }
.composer { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.presets .k, .shock .k { min-width: 38px; }
.presets .k { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--ink-3); margin-right: 4px; }
.preset { height: 30px; padding: 0 11px; cursor: pointer; border-radius: 3px; border: 1px solid rgba(60,242,160,.3); background: rgba(60,242,160,.05); color: var(--ink-2); font-family: var(--f-ui); font-size: 12px; letter-spacing: .02em; transition: border-color .15s, color .15s, background .15s; }
.preset:hover { color: var(--ink); border-color: var(--bio); background: var(--bio-dim); }
.preset[disabled] { opacity: .45; cursor: progress; }
.preset-hint { margin: -4px 0 0; font-size: 11px; color: var(--ink-3); }
.shock { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.shock .k { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--ink-3); margin-right: 4px; }
.shock button { height: 28px; padding: 0 10px; cursor: pointer; border-radius: 3px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-family: var(--f-mono); font-size: 11px; }
.shock button[aria-checked="true"] { color: var(--ink); border-color: var(--accent); background: var(--accent-dim); }
.composer-row { display: flex; gap: 10px; align-items: stretch; }
.composer textarea {
  flex: 1; resize: none; min-height: 48px; max-height: 180px; padding: 12px 14px; border-radius: var(--r);
  background: rgba(6,10,20,.85); border: 1px solid var(--line-2); color: var(--ink); font-family: var(--f-ui); font-size: 14px; line-height: 1.5;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer .btn { height: auto; min-width: 96px; }
.mode-bars { display: grid; gap: 6px; margin-top: 12px; }
.mode-bar { display: grid; grid-template-columns: 96px 1fr 44px; gap: 8px; align-items: center; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-2); }
.mode-bar .bar i { background: var(--s2); }
.mode-bar.sel { color: var(--ink); }
.mode-bar.sel .bar i { background: var(--s1); }
.mode-bar span:last-child { text-align: right; }

/* ------------------------------------------------------------ infra */
.g-infra .p-cpu, .g-infra .p-mem, .g-infra .p-proc { grid-column: span 4; }
.g-infra .p-net { grid-column: span 4; }
.g-infra .p-svc { grid-column: span 8; }
.g-infra .p-nodes { grid-column: span 12; }
.load-gauge { position: relative; max-width: 260px; margin: 0 auto 8px; }
.load-gauge svg { width: 100%; height: auto; display: block; }
.load-read { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; display: flex; flex-direction: column; }
.cap { margin-bottom: 14px; }
.cap-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; gap: 12px; }
.cap-top span:first-child { color: var(--ink-2); }
.cap-top span:last-child { font-family: var(--f-mono); color: var(--ink); }
.cap .bar { height: 8px; }
.cap.hot .bar i { background: var(--warn); }
.core-map { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin-top: 14px; }
.core-map i { aspect-ratio: 1; border-radius: 1.5px; background: rgba(120,150,190,.12); }
.core-map i.on { background: var(--s1); box-shadow: 0 0 6px rgba(22,159,196,.7); }
.net-dual { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.net-dual > div { display: flex; flex-direction: column; }
.net-dual .k { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; }
.net-dual .hero-v { font-size: 28px; }
.svc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.svc-grid li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; background: rgba(6,12,22,.55); }
.svc-grid li span:first-child { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.node-block { padding: 12px 0; border-bottom: 1px solid var(--line); }
.node-block:first-of-type { padding-top: 0; }
.node-block:last-child { border-bottom: 0; padding-bottom: 0; }
.node-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.node-head b { font-size: 14px; letter-spacing: .08em; }
.node-head span { font-size: 11.5px; color: var(--ink-2); }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 22px; }
.stages li { display: grid; grid-template-columns: 138px 1fr 58px; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); }
.stages li.done { color: var(--ink); }
.stages li.done .bar i { background: var(--bio); }
.stages li.active .bar i { background: var(--s1); }
.stages li span:last-child { text-align: right; }

/* ------------------------------------------------------------ treasury */
.g-treasury .p-pnl, .g-treasury .p-wallets, .g-treasury .p-agents { grid-column: span 4; }
.g-treasury .p-opps { grid-column: span 8; }
.g-treasury .p-sim { grid-column: span 4; }
.cb { margin-top: 16px; padding: 10px 12px; border-radius: 3px; border: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cb .k { font-size: 11px; color: var(--ink-3); letter-spacing: .1em; }
.wallet { border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; margin-bottom: 10px; background: rgba(6,12,22,.55); }
.wallet-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.wallet-head .k { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; }
.addr { font-size: 11px; color: var(--accent); overflow-wrap: anywhere; }
.wallet-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; color: var(--ink-2); }
.wallet-row b { font-weight: 500; color: var(--ink); }
.wallet-row.tot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 7px; }
.agents { display: grid; gap: 8px; }
.agent { padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; background: rgba(6,12,22,.55); }
.agent-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.agent-top b { font-size: 13px; letter-spacing: .04em; }
.agent-role { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 6px; }
.agent-tag { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); border: 1px dashed var(--line-2); padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.agent-nums { display: flex; gap: 14px; font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); flex-wrap: wrap; }
.opp-chart { height: 130px; margin-bottom: 10px; }
.opp-chart svg { width: 100%; height: 100%; overflow: visible; }
.table-wrap { overflow-x: auto; max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 3px; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { position: sticky; top: 0; background: var(--panel-solid); text-align: left; font-family: var(--f-mono); font-weight: 500; font-size: 10px; letter-spacing: .12em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
table.data td.r, table.data th.r { text-align: right; font-family: var(--f-mono); }
table.data tr:hover td { background: rgba(94,230,255,.04); color: var(--ink); }
table.data td.wrap { white-space: normal; min-width: 180px; }
.sim-controls { display: grid; gap: 12px; }
.sim-controls label { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12px; color: var(--ink-2); }
.sim-controls input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--warn); }
.sim-controls output { color: var(--ink); font-size: 12px; }
.sim-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-out { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin: 16px 0 12px; padding: 12px; border: 1px dashed rgba(255,181,71,.45); border-radius: 3px; }
.sim-out > div { display: flex; flex-direction: column; }
.sim-out .k { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; }
.sim-out .hero-v { font-size: 28px; text-shadow: none; }

/* ------------------------------------------------------------ sources */
.g-sources .p-legend { grid-column: span 4; }
.g-sources .p-verify { grid-column: span 8; }
.g-sources .p-feeds { grid-column: span 12; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.legend-list li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start; }
.legend-list p { margin: 0; font-size: 12.5px; color: var(--ink-2); }

/* ------------------------------------------------------------ dialog / tip / toast */
.dialog { width: min(440px, calc(100vw - 32px)); padding: 18px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel-solid); color: var(--ink); }
.dialog::backdrop { background: rgba(2,4,8,.72); backdrop-filter: blur(3px); }
.dialog form { display: grid; gap: 12px; }
.dialog label { display: grid; gap: 6px; font-size: 12px; color: var(--ink-2); }
.dialog input { padding-right: 14px; height: 42px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tip { position: fixed; z-index: 60; pointer-events: none; max-width: 280px; padding: 8px 10px; border-radius: 3px; background: rgba(8,13,24,.96); border: 1px solid var(--line-2); font-family: var(--f-mono); font-size: 11px; line-height: 1.55; color: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.tip b { color: var(--accent); font-weight: 500; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: grid; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 3px; border: 1px solid var(--line-2); background: rgba(8,13,24,.96); font-size: 13px; animation: rise .25s ease-out; max-width: 340px; }
.toast.ok { border-color: rgba(60,242,160,.45); }
.toast.bad { border-color: rgba(255,93,120,.5); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .g-bridge .p-organism { grid-column: span 5; }
  .g-bridge .p-ekg { grid-column: span 7; }
  .g-bridge .p-fractal, .g-bridge .p-market { grid-column: span 12; }
  .g-cell .p-neuro, .g-cell .p-shanks, .g-cell .p-colonies, .g-cell .p-window, .g-cell .p-page { grid-column: span 12; }
  .g-cell .p-orbit, .g-cell .p-decl { grid-column: span 6; }
  .g-chat .p-console, .g-chat .p-response { grid-column: span 12; }
  .g-infra .p-cpu, .g-infra .p-mem, .g-infra .p-proc, .g-infra .p-net { grid-column: span 6; }
  .g-infra .p-svc { grid-column: span 12; }
  .g-treasury .p-pnl, .g-treasury .p-wallets { grid-column: span 6; }
  .g-treasury .p-agents, .g-treasury .p-opps, .g-treasury .p-sim { grid-column: span 12; }
  .g-sources .p-legend, .g-sources .p-verify { grid-column: span 12; }
}
@media (max-width: 860px) {
  :root { --rail-w: 0px; }
  .grid > .panel { grid-column: span 12 !important; }
  .main { padding: calc(var(--top-h) + 16px) 16px calc(84px + env(safe-area-inset-bottom)) 16px; }
  .railnav {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; height: calc(64px + env(safe-area-inset-bottom));
    flex-direction: row; justify-content: space-around; padding: 6px 4px env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--line);
  }
  .railnav a { flex: 1; padding: 6px 2px; font-size: 9.5px; gap: 3px; }
  .railnav a[aria-current="page"]::before { left: 20%; right: 20%; top: -6px; bottom: auto; width: auto; height: 2px; }
  .brand-sub, .hide-sm { display: none; }
  .topbar-center { gap: 14px; justify-content: flex-end; }
  .page-head h2 { font-size: 24px; }
  .hero-v { font-size: 30px; }
  .mk-row { grid-template-columns: 78px 1fr 100px; }
  .mk-row .mk-imb, .mk-row .mk-spread, .mk-head .h-imb, .mk-head .h-spr { display: none; }
  .colony-wrap { grid-template-columns: 1fr; }
  .colony-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .kv-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .meter-row { grid-template-columns: 110px 1fr 60px; }
  .msg { max-width: 100%; }
  .g-chat .p-console { min-height: 0; }
  .transcript { max-height: 55vh; }
  .legend-list li { grid-template-columns: 1fr; }
  .ph { flex-wrap: wrap; }
  .ph-meta { flex-basis: 100%; order: 5; }
}
@media (max-width: 560px) {
  .topbar-center { display: none; }
  .topbar-right { margin-left: auto; }
}
@media (max-width: 480px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-name { font-size: 14px; letter-spacing: .2em; }
  .tb-stat:nth-child(2) { display: none; }
  .dials { width: 100%; justify-content: space-around; }
  .ekg-foot .chip { margin-left: 0; }
  .vault-title { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .badge, .panel, .status::before { forced-color-adjust: auto; }
}
