/* ORDEN design system — dark mission-control theme.
   Shares its language with the ORDEN Architecture page:
   Manrope + DM Mono, deep teal-black surfaces, hard offset shadows. */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg0: #040b0a;
  --bg: #07110f;
  --surface: #0d1a17;
  --surface-2: #11211e;
  --surface-3: #162825;
  --ink: #edf7f4;
  --muted: #9db1ac;
  --faint: #6b817b;
  --line: #22382f;
  --line-strong: #3b5851;
  --teal: #53d5c4;
  --teal-dim: #2b7f75;
  --teal-soft: #123c36;
  --cyan: #60c7ea;
  --cyan-soft: #113542;
  --amber: #ffad5c;
  --amber-soft: #412b18;
  --red: #ff8780;
  --red-soft: #40211f;
  --green: #75d48f;
  --green-soft: #173823;
  --radius: 16px;
  --shadow: 5px 5px 0 rgba(0, 0, 0, .45);
  --shadow-teal: 5px 5px 0 rgba(83, 213, 196, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(1100px 420px at 50% -120px, rgba(83, 213, 196, .10), transparent 70%),
    linear-gradient(rgba(83, 213, 196, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 213, 196, .045) 1px, transparent 1px),
    var(--bg0);
  background-size: auto, 44px 44px, 44px 44px, auto;
  min-height: 100vh;
}
::selection { background: var(--teal-soft); }

/* ---------- top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  background: rgba(7, 17, 15, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -.02em;
  font-size: 17px;
}
.brand .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal);
}
.brand small {
  font: 500 11px "DM Mono", monospace;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
}
.navlinks { display: flex; gap: 4px; margin-left: 8px; }
.navlinks a {
  color: var(--muted);
  text-decoration: none;
  font: 500 12.5px "DM Mono", monospace;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.navlinks a:hover { color: var(--ink); background: var(--surface-2); }
.navlinks a.on {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: var(--line-strong);
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- page scaffold ---------- */
.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 72px; }
.hero { margin-bottom: 28px; }
.kicker {
  display: inline-flex; align-items: center; gap: 9px;
  margin-bottom: 12px;
  color: var(--teal);
  font: 500 12px/1.2 "DM Mono", monospace;
  letter-spacing: .1em; text-transform: uppercase;
}
.kicker::before { content: ""; width: 22px; height: 2px; background: currentColor; }
h1.hero-title {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.02;
  letter-spacing: -.04em;
  font-weight: 800;
}
.lede { max-width: 720px; margin: 14px 0 0; color: var(--muted); font-size: 16px; }
h2.sect {
  margin: 40px 0 4px;
  font-size: 20px; font-weight: 800; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 10px;
}
h2.sect .rule { flex: 1; height: 1px; background: var(--line); }
.sub { color: var(--faint); font-size: 13px; margin: 2px 0 14px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* module cards (cockpit) */
.mod-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  text-decoration: none; color: inherit;
}
a.mod-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 rgba(83, 213, 196, .16); border-color: var(--line-strong); }
.mod-top { display: flex; align-items: center; gap: 12px; }
.mod-icon {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  font-size: 21px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.mod-name { font-size: 18px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.mod-desc { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.mod-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.mod-open { color: var(--teal); font: 500 13px "DM Mono", monospace; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 12px 3px 9px;
  border-radius: 999px;
  font: 500 12px "DM Mono", monospace;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--green); background: var(--green-soft); border-color: #2c5c40; }
.pill.ok::before { box-shadow: 0 0 8px var(--green); }
.pill.warn { color: var(--amber); background: var(--amber-soft); border-color: #6b4423; }
.pill.warn::before { box-shadow: 0 0 8px var(--amber); }
.pill.bad { color: var(--red); background: var(--red-soft); border-color: #6e2f2b; }
.pill.bad::before { box-shadow: 0 0 8px var(--red); }
.pill.info { color: var(--cyan); background: var(--cyan-soft); border-color: #274f60; }
.pill.info::before { box-shadow: 0 0 8px var(--cyan); }
.pill.teal { color: var(--teal); background: var(--teal-soft); border-color: #2b5a54; }
.pill.teal::before { box-shadow: 0 0 8px var(--teal); }

/* ---------- stats ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 16px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .4);
}
.stat .k { font: 500 10.5px "DM Mono", monospace; color: var(--faint); text-transform: uppercase; letter-spacing: .09em; }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- tables ---------- */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-top: 14px;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; vertical-align: top; }
th {
  font: 500 11px "DM Mono", monospace;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
td { border-bottom: 1px solid var(--line); color: var(--ink); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(83, 213, 196, .04); }
td.dim, .dim { color: var(--faint); }

/* ---------- grouped minds (e.g. grok-fleet) ---------- */
tr.mind-group td {
  background: var(--surface-2);
  border-top: 1px solid var(--line-strong);
  font-weight: 600;
}
tr.mind-nested td { color: var(--muted); }
tr.mind-nested td:first-child { padding-left: 30px; }

/* ---------- routing flow chips ---------- */
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-top: 14px; }
.flow-step {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.flow-step .lbl { font: 500 11px "DM Mono", monospace; color: var(--teal); display: block; margin-bottom: 2px; }
.flow-arrow { align-self: center; color: var(--faint); font-size: 18px; }

/* ---------- tabs / filters / forms ---------- */
.tabs { display: flex; gap: 8px; margin-top: 18px; }
.tabs a {
  padding: 8px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px 10px 0 0;
  color: var(--muted);
  text-decoration: none;
  font: 500 13px "DM Mono", monospace;
  background: var(--surface);
}
.tabs a.on { color: var(--teal); background: var(--surface-2); border-bottom-color: var(--surface-2); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.filters input, .filters select {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
}
.btn {
  background: var(--teal);
  color: #04211d;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .45);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.45); }

/* ---------- misc ---------- */
a { color: var(--teal); }
code, pre {
  font-family: "DM Mono", ui-monospace, monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
code { padding: 2px 7px; font-size: .88em; }
pre { padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 22px;
  color: var(--faint);
  background: rgba(17, 33, 30, .5);
  margin-top: 14px;
  font-size: 14px;
}
.empty b { color: var(--muted); }
.note { font-size: 12.5px; color: var(--faint); margin-top: 10px; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.story { border-top: 1px solid var(--line); padding: 14px 0; }
.story:first-of-type { border-top: none; }
.story h4 { margin: 0 0 8px; font-size: 15px; letter-spacing: -.01em; }
.story p { margin: 6px 0; font-size: 14px; color: var(--muted); }
.story p b { color: var(--ink); font-weight: 600; }
ul.audit { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
ul.audit li { margin: 4px 0; }
.back { display: inline-block; margin-top: 22px; font: 500 13px "DM Mono", monospace; }
.check { color: var(--green); font-weight: 700; }
.cross { color: var(--red); font-weight: 700; }

@media (max-width: 640px) {
  .topnav { padding: 10px 16px; gap: 10px; }
  .navlinks { display: none; }
  .page { padding: 26px 0 56px; }
}
