/* FortrOS preview styles -- no external dependencies, no build step.
   Aesthetic: industrial specification / mission console, ca. 2026.
   Typography: IBM Plex family (Sans + Mono), OFL licensed, self-hosted.
   Palette: deep navy + granite + brass, plus semantic state colors. */

/* Fonts -- WOFF2 files in /static/fonts/.
   System fallbacks render acceptably if the files aren't deployed yet;
   run preview/static/fonts/fetch-fonts.sh to pull the real files. */

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/IBMPlexSans-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/IBMPlexSans-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/IBMPlexSans-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/IBMPlexMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/IBMPlexMono-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/IBMPlexMono-Bold.woff2') format('woff2');
}

:root {
  --navy: #0A1628;
  --navy-deep: #060F1C;
  --navy-hi: #132035;
  --steel: #2C3440;
  --granite: #3A4148;
  --granite-hi: #4A5260;
  --divider: #1E2A3C;
  --offwhite: #F5F3F0;
  --offwhite-dim: #C9C5BE;
  --mute: #8A8680;
  --mute-lo: #5A574F;
  --brass: #B08D57;
  --brass-hi: #C9A574;
  --brass-dim: #8C7044;
  --confirm: #059669;
  --confirm-hi: #10B981;
  --alert: #DC2626;
  --alert-hi: #EF4444;
  --warn: #D97706;
  --warn-hi: #F59E0B;
  --link: #6EA8E8;

  --font-ui: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Monaco, Menlo, Consolas, 'Courier New', monospace;
  --font-display: 'IBM Plex Mono', 'SF Mono', Monaco, Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 48px; --s9: 64px; --s10: 96px;

  --r1: 2px; --r2: 4px; --r3: 8px; --r4: 12px;

  --fg-primary: var(--offwhite);
  --fg-secondary: var(--offwhite-dim);
  --fg-tertiary: var(--mute);
  --bg-base: var(--navy);
  --bg-elev-1: var(--navy-hi);
  --bg-elev-2: var(--steel);
  --bg-elev-3: var(--granite);
  --border-subtle: var(--divider);
  --border-strong: var(--granite);
  --accent: var(--brass);
  --accent-hi: var(--brass-hi);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--fg-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Scrollbars -- match the industrial-spec palette.
   Firefox uses scrollbar-width / scrollbar-color; WebKit uses the
   ::-webkit-scrollbar* pseudo-elements. Both covered. */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--granite-hi) var(--navy-deep);
}
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--navy-deep);
  border-left: 1px solid var(--border-subtle);
}
::-webkit-scrollbar-thumb {
  background: var(--granite);
  border: 2px solid var(--navy-deep);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--granite-hi);
}
::-webkit-scrollbar-corner {
  background: var(--navy-deep);
}
/* Tighter scrollbars inside scrollable panels (event feed, drawer, etc.) */
.tile-body-plain::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.admin-sidebar::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar,
.guide-sidebar::-webkit-scrollbar,
.admin-content::-webkit-scrollbar {
  width: 8px;
}

body {
  background-image:
    radial-gradient(ellipse at top, rgba(176, 141, 87, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at bottom, rgba(11, 23, 40, 0.6) 0%, transparent 70%);
  background-attachment: fixed;
}

/* Hex-grid motif for screens that want it */
.hex-bg {
  position: relative;
}
.hex-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='64' viewBox='0 0 56 64'><path d='M28 0L52 16V48L28 64L4 48V16Z' fill='none' stroke='%23132035' stroke-width='1'/></svg>");
  background-size: 56px 64px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.hex-bg > * { position: relative; z-index: 1; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--brass-hi); }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--offwhite);
}
h1 { font-size: 48px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: 32px; line-height: 1.15; }
h3 { font-size: 22px; line-height: 1.25; }
h4 { font-size: 16px; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.08em; color: var(--offwhite-dim); font-weight: 600; }

p { margin: 0 0 var(--s4) 0; color: var(--fg-secondary); }

code, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  letter-spacing: 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--offwhite);
}
.wordmark .mark {
  width: 24px;
  height: 24px;
  display: inline-block;
  flex-shrink: 0;
}
.wordmark .mark svg,
.wordmark .mark img {
  display: block;
  width: 100%;
  height: 100%;
}
.wordmark .name {
  font-size: 20px;
  font-weight: 700;
}
.wordmark .name .rest { color: var(--brass); }

.wordmark-lg .mark { width: 40px; height: 40px; }
.wordmark-lg .name { font-size: 28px; }

/* Layout primitives */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--s6);
}
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s7); }
.row { display: flex; gap: var(--s4); align-items: center; }
.row-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5); }
@media (max-width: 960px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Cards + panels */
.panel {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r3);
  padding: var(--s6);
}
.panel-elev {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
}
.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r3);
  padding: var(--s5);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card-interactive:hover {
  border-color: var(--brass-dim);
  transform: translateY(-1px);
  cursor: pointer;
}
.card-interactive.is-active {
  border-color: var(--brass);
  box-shadow: 0 0 0 1px var(--brass) inset, 0 4px 16px rgba(176, 141, 87, 0.12);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 10px 20px;
  border-radius: var(--r2);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px; /* matches icon-sm height so icon + text share a baseline */
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.btn .icon,
.btn .icon-sm,
.btn svg {
  flex-shrink: 0;
  display: block;
  vertical-align: middle;
}
.btn-primary {
  background: var(--brass);
  color: var(--navy-deep);
  border-color: var(--brass);
}
.btn-primary:hover {
  background: var(--brass-hi);
  border-color: var(--brass-hi);
  color: var(--navy-deep);
}
.btn-secondary {
  background: transparent;
  color: var(--offwhite);
  border-color: var(--granite);
}
.btn-secondary:hover {
  background: var(--navy-hi);
  border-color: var(--granite-hi);
  color: var(--offwhite);
}
.btn-ghost {
  background: transparent;
  color: var(--offwhite-dim);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--offwhite); background: var(--navy-hi); }

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  font-family: var(--font-ui);
}
.pill-confirm { background: rgba(5, 150, 105, 0.14); color: var(--confirm-hi); border-color: rgba(5, 150, 105, 0.4); }
.pill-warn { background: rgba(217, 119, 6, 0.14); color: var(--warn-hi); border-color: rgba(217, 119, 6, 0.4); }
.pill-alert { background: rgba(220, 38, 38, 0.14); color: var(--alert-hi); border-color: rgba(220, 38, 38, 0.4); }
.pill-neutral { background: var(--navy-hi); color: var(--offwhite-dim); border-color: var(--border-strong); }
.pill-brass { background: rgba(176, 141, 87, 0.14); color: var(--brass-hi); border-color: rgba(176, 141, 87, 0.4); }

/* Dot indicator */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mute);
  flex-shrink: 0;
}
.dot-confirm { background: var(--confirm-hi); box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
.dot-warn { background: var(--warn-hi); box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
.dot-alert { background: var(--alert-hi); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.dot-pulse {
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Icons */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 40px; height: 40px; }

/* Divider */
.hr {
  height: 1px;
  background: var(--border-subtle);
  border: 0;
  margin: var(--s7) 0;
}

/* Nav header shared across pages */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.top-nav .inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--s4) var(--s6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-nav .links {
  display: flex;
  gap: var(--s6);
  align-items: center;
}
.top-nav .links a {
  color: var(--offwhite-dim);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.top-nav .links a:hover { color: var(--offwhite); }
.top-nav .links a.active { color: var(--brass-hi); }

/* ============================================================
   Full-screen stage pages (bootstrapper, preboot)
   ============================================================ */
.stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.stage-header {
  padding: var(--s6) var(--s7);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
.stage-header .org {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.stage-header .org .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mute);
}
.stage-header .org .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--offwhite);
}
.stage-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s8) var(--s6);
}
.stage-footer {
  padding: var(--s5) var(--s7);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
}
.stage-footer .sig {
  color: var(--offwhite-dim);
  letter-spacing: 0.02em;
}

/* Status line renderer (bootstrapper) */
.status-list {
  width: 100%;
  max-width: 680px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
}
.status-list li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
  color: var(--offwhite);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.status-list li.shown { opacity: 1; transform: translateY(0); }
.status-list li .marker {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-list li .marker svg { width: 16px; height: 16px; }
.status-list li .marker.spin svg { animation: rot 1.2s linear infinite; }
@keyframes rot { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.status-list li.ok { color: var(--offwhite); }
.status-list li.ok .marker { color: var(--confirm-hi); }
.status-list li.pending .marker { color: var(--brass-hi); }
.status-list li.fail { color: var(--alert-hi); }
.status-list li.fail .marker { color: var(--alert-hi); }
.status-list li .detail {
  color: var(--mute);
  font-size: 12px;
  margin-left: auto;
  padding-left: var(--s4);
}

/* Preboot card list */
.card-stack {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.option-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s5);
  padding: var(--s5) var(--s6);
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r3);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
  text-align: left;
  width: 100%;
  font-family: var(--font-ui);
  color: inherit;
}
.option-card:hover {
  border-color: var(--brass-dim);
  background: var(--bg-elev-2);
}
.option-card.is-active {
  border-color: var(--brass);
  background: var(--bg-elev-2);
  box-shadow: 0 0 0 1px var(--brass) inset, 0 4px 20px rgba(176, 141, 87, 0.1);
}
.option-card .opt-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r2);
  background: var(--navy-deep);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brass-hi);
  flex-shrink: 0;
}
.option-card.is-active .opt-icon { border-color: var(--brass); color: var(--brass-hi); }
.option-card .opt-icon .icon { width: 22px; height: 22px; }
.option-card .opt-body { flex: 1; }
.option-card .opt-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--offwhite);
  margin: 0 0 var(--s1) 0;
  letter-spacing: -0.005em;
}
.option-card .opt-sub {
  font-size: 13px;
  color: var(--fg-tertiary);
  line-height: 1.5;
}
.option-card .opt-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--offwhite-dim);
  margin-top: var(--s2);
}

.link-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 12px;
  color: var(--offwhite-dim);
  font-family: var(--font-mono);
}

/* Wifi picker sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 15, 28, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--s6);
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--navy-hi);
  border: 1px solid var(--granite);
  border-radius: var(--r4);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.sheet-head {
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sheet-head h3 { font-size: 16px; }
.sheet-body { padding: var(--s3) 0; max-height: 340px; overflow-y: auto; }
.wifi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s3) var(--s6);
  cursor: pointer;
  transition: background 0.1s ease;
}
.wifi-row:hover { background: var(--steel); }
.wifi-row .name { font-size: 14px; color: var(--offwhite); }
.wifi-row .meta {
  display: flex;
  align-items: center;
  gap: var(--s3);
  color: var(--fg-tertiary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  padding: var(--s1);
  display: flex;
  align-items: center;
}
.btn-close:hover { color: var(--offwhite); }

/* ============================================================
   Admin webui layout
   ============================================================ */
.admin-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
@media (max-width: 820px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    height: auto;
    padding: var(--s3) var(--s4);
    gap: var(--s4);
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }
  .admin-sidebar .brand,
  .admin-sidebar .org-meta { padding: 0; flex-shrink: 0; }
  .admin-sidebar .admin-nav {
    flex-direction: row;
    padding: 0;
    gap: var(--s1);
    flex: 1;
    overflow-x: auto;
  }
  .admin-sidebar .admin-nav .section-label { display: none; }
  .admin-sidebar .admin-nav a {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .admin-sidebar .admin-nav a.active {
    border-left: 0;
    border-bottom: 2px solid var(--brass);
    padding-left: 10px;
    padding-bottom: 4px;
  }
  .admin-sidebar > div:last-child { display: none; }
  .admin-topbar .search { max-width: none; }
  .admin-topbar .session .identity,
  .admin-topbar .session .link-status { display: none; }
}
.admin-sidebar {
  background: var(--navy-deep);
  border-right: 1px solid var(--border-subtle);
  padding: var(--s5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s6);
}
.admin-sidebar .brand {
  padding: 0 var(--s5);
}
.admin-sidebar .org-meta {
  padding: 0 var(--s5);
  margin-top: var(--s3);
}
.admin-sidebar .org-meta .org-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--offwhite);
}
.admin-sidebar .org-meta .org-sub {
  font-size: 11px;
  color: var(--mute);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  padding: 0 var(--s3);
  gap: 2px;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px var(--s3);
  border-radius: var(--r2);
  color: var(--offwhite-dim);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a:hover {
  background: var(--navy-hi);
  color: var(--offwhite);
}
.admin-nav a.active {
  background: var(--navy-hi);
  color: var(--brass-hi);
  border-left: 2px solid var(--brass);
  padding-left: calc(var(--s3) - 2px);
}
.admin-nav a .icon { color: inherit; }
.admin-nav .section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mute);
  padding: var(--s3) var(--s3) var(--s2);
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-topbar {
  height: 60px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s6);
  gap: var(--s4);
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar .search {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 8px var(--s4);
  background: var(--navy-hi);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r2);
  color: var(--offwhite-dim);
  font-size: 13px;
  flex: 1;
  max-width: 420px;
  font-family: var(--font-ui);
}
.admin-topbar .search .icon { color: var(--mute); }
.admin-topbar .search input {
  background: transparent;
  border: none;
  color: inherit;
  outline: none;
  font: inherit;
  flex: 1;
}
.admin-topbar .search .shortcut {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
  padding: 2px 6px;
  background: var(--steel);
  border-radius: var(--r1);
}
.admin-topbar .session {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.admin-topbar .session .identity {
  font-size: 13px;
  text-align: right;
}
.admin-topbar .session .identity .name {
  color: var(--offwhite);
  font-weight: 600;
}
.admin-topbar .session .identity .sub {
  font-size: 11px;
  color: var(--mute);
  font-family: var(--font-mono);
}
.admin-topbar .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brass-dim), var(--brass));
  color: var(--navy-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
}

.admin-content {
  padding: var(--s7) var(--s6);
  flex: 1;
  overflow-y: auto;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--s6);
  gap: var(--s4);
}
.page-head .title h1 {
  font-size: 28px;
  letter-spacing: -0.01em;
}
.page-head .title .sub {
  color: var(--fg-tertiary);
  font-size: 14px;
  margin-top: 4px;
}
.page-head .actions { display: flex; gap: var(--s3); }

/* Dashboard grid */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--s5);
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-col { display: flex; flex-direction: column; gap: var(--s5); }

.tile {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r3);
  overflow: hidden;
}
.tile-head {
  padding: var(--s4) var(--s5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
.tile-head h3 { font-size: 15px; letter-spacing: -0.005em; }
.tile-head .tag { font-size: 12px; color: var(--mute); font-family: var(--font-mono); }
.tile-body { padding: var(--s5); }
.tile-body-plain { padding: 0; }

/* Stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s5);
}
@media (max-width: 780px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r3);
  padding: var(--s5);
}
.stat .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mute);
}
.stat .val {
  font-size: 30px;
  font-weight: 600;
  color: var(--offwhite);
  letter-spacing: -0.02em;
  margin-top: var(--s2);
  font-family: var(--font-ui);
}
.stat .delta {
  font-size: 12px;
  margin-top: var(--s1);
  font-family: var(--font-mono);
  color: var(--confirm-hi);
}
.stat .delta.down { color: var(--alert-hi); }
.stat .delta.neutral { color: var(--mute); }

/* Event feed */
.event-row {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s5);
  border-bottom: 1px solid var(--border-subtle);
  align-items: flex-start;
}
.event-row:last-child { border-bottom: none; }
.event-row .timestamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
  flex-shrink: 0;
  padding-top: 2px;
  width: 62px;
}
.event-row .msg {
  font-size: 13px;
  color: var(--offwhite);
  flex: 1;
}
.event-row .msg .actor {
  color: var(--brass-hi);
  font-family: var(--font-mono);
  font-size: 12px;
}
.event-row .msg .target {
  color: var(--offwhite-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Nodes table */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: var(--s3) var(--s5);
  text-align: left;
  font-size: 13px;
}
.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mute);
  background: var(--navy-deep);
  border-bottom: 1px solid var(--border-subtle);
}
.table td {
  border-bottom: 1px solid var(--border-subtle);
  color: var(--offwhite);
}
.table tr:last-child td { border-bottom: none; }
.table tr.is-interactive { cursor: pointer; transition: background 0.1s ease; }
.table tr.is-interactive:hover td { background: var(--bg-elev-2); }
.table tr.is-selected td { background: var(--bg-elev-2); }
.table .mono { color: var(--offwhite-dim); }

/* Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  background: var(--bg-elev-1);
  border-left: 1px solid var(--border-strong);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s4);
}
.drawer-head h2 {
  font-size: 18px;
  letter-spacing: -0.005em;
}
.drawer-head .sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
  margin-top: 2px;
}
.drawer-body {
  padding: var(--s5) var(--s6);
  overflow-y: auto;
  flex: 1;
}
.drawer-section { margin-bottom: var(--s6); }
.drawer-section h4 {
  margin-bottom: var(--s3);
}
.kv-list {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  font-size: 13px;
}
.kv-list .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.kv-list .row:last-child { border-bottom: none; }
.kv-list .row .k { color: var(--mute); }
.kv-list .row .v { color: var(--offwhite); font-family: var(--font-mono); font-size: 12px; text-align: right; }

/* Topology SVG (dashboard) */
.topology {
  background: var(--navy-deep);
  border-radius: 0;
  position: relative;
  height: 340px;
  overflow: hidden;
}
.topology svg { width: 100%; height: 100%; display: block; }
.topology .tp-legend {
  position: absolute;
  bottom: var(--s4);
  left: var(--s5);
  display: flex;
  gap: var(--s5);
  font-size: 11px;
  color: var(--offwhite-dim);
  font-family: var(--font-mono);
  background: rgba(10, 22, 40, 0.85);
  padding: var(--s2) var(--s4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r2);
}
.topology .tp-legend .leg-item { display: inline-flex; align-items: center; gap: 6px; }

/* Login screen */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s7);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r4);
  padding: var(--s8) var(--s7);
  text-align: center;
  position: relative;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4);
}
.login-card .wordmark { justify-content: center; margin-bottom: var(--s2); }
.login-card h2 {
  font-size: 20px;
  letter-spacing: -0.005em;
  margin-bottom: var(--s2);
}
.login-card .subline {
  font-size: 13px;
  color: var(--fg-tertiary);
  margin-bottom: var(--s7);
}
.login-card .input {
  width: 100%;
  padding: 12px var(--s4);
  background: var(--navy-deep);
  border: 1px solid var(--border-strong);
  border-radius: var(--r2);
  color: var(--offwhite);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.2em;
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease;
  margin-bottom: var(--s4);
}
.login-card .input:focus { border-color: var(--brass); }
.login-card .yk-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  font-size: 12px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  margin: var(--s5) 0 var(--s4);
}
.login-card .btn { width: 100%; padding: 12px 20px; font-size: 14px; }

/* Utility */
.muted { color: var(--fg-tertiary); }
.dim { color: var(--offwhite-dim); }
.center { text-align: center; }
.sp-bottom { margin-bottom: var(--s5); }
.sp-top { margin-top: var(--s5); }
.flex-1 { flex: 1; }

/* Index landing */
.hero {
  padding: var(--s10) 0 var(--s8);
  text-align: center;
  position: relative;
}
.hero-tagline {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--brass-dim);
  border-radius: 999px;
  color: var(--brass-hi);
  margin-bottom: var(--s5);
  background: rgba(176, 141, 87, 0.08);
}
.hero h1 {
  max-width: 880px;
  margin: 0 auto var(--s5);
}
.hero h1 .accent { color: var(--brass-hi); }
.hero .lede {
  max-width: 720px;
  margin: 0 auto var(--s6);
  font-size: 18px;
  color: var(--fg-secondary);
  line-height: 1.55;
}
.hero .cta { display: inline-flex; gap: var(--s3); }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s5);
  margin: var(--s8) 0;
}
@media (max-width: 960px) { .preview-grid { grid-template-columns: 1fr; } }
.preview-card {
  display: block;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r3);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.preview-card:hover {
  border-color: var(--brass-dim);
  transform: translateY(-2px);
}
.preview-card .thumb {
  aspect-ratio: 16/10;
  background: var(--navy-deep);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-card .thumb .mini {
  transform: scale(0.55);
  transform-origin: center;
  width: 180%;
  pointer-events: none;
}
.preview-card .body {
  padding: var(--s5) var(--s5);
}
.preview-card .body h3 { font-size: 17px; }
.preview-card .body p { font-size: 13px; color: var(--fg-tertiary); margin: var(--s2) 0 0; }
.preview-card .stage-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-hi);
  font-family: var(--font-mono);
  margin-bottom: var(--s1);
}

/* Compare table */
.compare-wrap {
  overflow-x: auto;
  /* Scroll-shadow affordance: gradients only show when there is
     content-off-screen in that direction, thanks to background-attachment
     values of `local` (moves with content) and `scroll` (stays in
     viewport). Works in all modern browsers. */
  background:
    linear-gradient(to right, var(--bg-elev-1), transparent) left / 24px 100% no-repeat local,
    linear-gradient(to left, var(--bg-elev-1), transparent) right / 24px 100% no-repeat local,
    radial-gradient(ellipse at left, rgba(176, 141, 87, 0.18), transparent 70%) left / 14px 100% no-repeat scroll,
    radial-gradient(ellipse at right, rgba(176, 141, 87, 0.18), transparent 70%) right / 14px 100% no-repeat scroll,
    var(--bg-elev-1);
}
.compare {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s6) 0;
  font-size: 13px;
  min-width: 640px;
}
.compare th, .compare td {
  padding: var(--s3) var(--s4);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.compare th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
}
.compare th.is-fortros { color: var(--brass-hi); }
.compare td:first-child { color: var(--offwhite-dim); font-weight: 500; }
.compare td.yes { color: var(--confirm-hi); font-weight: 600; }
.compare td.no { color: var(--alert-hi); }
.compare td.maybe { color: var(--warn-hi); }
.compare td.na { color: var(--mute); }

/* Sections on index */
.section {
  padding: var(--s9) 0;
}
.section-dark {
  background: var(--navy-deep);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.section h2 {
  margin-bottom: var(--s3);
}
.section .section-lede {
  font-size: 16px;
  color: var(--fg-secondary);
  max-width: 720px;
  margin-bottom: var(--s6);
}

/* Footer */
.site-footer {
  padding: var(--s7) 0 var(--s6);
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--fg-tertiary);
  margin-top: var(--s7);
}
.site-footer .row { justify-content: space-between; }
.site-footer a { color: var(--fg-secondary); }
.site-footer a:hover { color: var(--brass-hi); }

/* Mark preview pages as "preview" with a tiny ribbon.
   Bottom-right so it doesn't collide with the sticky top nav. */
.preview-ribbon {
  position: fixed;
  bottom: 12px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-hi);
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--brass-dim);
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 40;
  pointer-events: none;
}

/* Hide during actual demo if needed via ?clean=1 (handled in JS) */
body.demo-clean .preview-ribbon,
body.demo-clean .top-nav { display: none; }

/* ============================================================
   INDUSTRIAL-SPEC DECORATIVE LAYER
   The elements that move the aesthetic from "tech dashboard"
   to "mission-console blueprint."
   ============================================================ */

/* Tabular numerals for all numeric contexts */
.num-tab,
.mono,
.stat .val,
.table td.num,
.event-row .timestamp,
.kv-list .row .v {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" on, "lnum" on;
}

/* Industrial section label: all-caps mono with wide tracking.
   Use above every major panel to anchor the spec-doc tone. */
.ui-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brass-hi);
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.ui-label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--brass);
  flex-shrink: 0;
}
.ui-label-dim { color: var(--mute); }
.ui-label-dim::before { background: var(--granite-hi); }

/* Display typography -- Plex Mono at large sizes.
   Anchor the "operator console" tone. */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.04;
}
.display-xl {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.display-md {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

/* Horizontal rule with a tick mark in the middle.
   Use between major sections on dashboards + the index. */
.tick-rule {
  border: 0;
  height: 1px;
  background: var(--border-subtle);
  position: relative;
  margin: var(--s7) 0;
}
.tick-rule::before {
  content: "+";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-base);
  padding: 0 var(--s3);
  color: var(--brass);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
}
.tick-rule-left::before { left: 24px; transform: translate(0, -50%); }

/* Corner brackets: adds four L-shaped marks at corners of the parent.
   Parent must be position: relative or use .bracketed which does it. */
.bracketed {
  position: relative;
}
.bracketed::before,
.bracketed::after,
.bracketed > .bkt-tl,
.bracketed > .bkt-br {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--brass);
  pointer-events: none;
  z-index: 2;
}
.bracketed::before {
  top: -1px; left: -1px;
  border-right: 0;
  border-bottom: 0;
}
.bracketed::after {
  top: -1px; right: -1px;
  border-left: 0;
  border-bottom: 0;
}
.bracketed > .bkt-tl {
  bottom: -1px; left: -1px;
  border-right: 0;
  border-top: 0;
}
.bracketed > .bkt-br {
  bottom: -1px; right: -1px;
  border-left: 0;
  border-top: 0;
}
.bracketed-dim::before,
.bracketed-dim::after,
.bracketed-dim > .bkt-tl,
.bracketed-dim > .bkt-br {
  border-color: var(--granite-hi);
}

/* Station identifier -- tiny mono label positioned top-right of a page
   or panel, like aircraft panel markings. */
.station-tag {
  position: absolute;
  top: 16px;
  right: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mute);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--s2);
  z-index: 4;
}
.station-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--confirm-hi);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  animation: pulse 2s ease-in-out infinite;
}
.station-tag.warn::before { background: var(--warn-hi); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.station-tag.alert::before { background: var(--alert-hi); box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }

/* Coordinate hint -- small mono label in monospace used in panel corners
   or inline. Use for node IDs, zone IDs, etc. */
.coord {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mute);
  text-transform: uppercase;
}

/* Cross-crosshair decorative element for the center of panels */
.crosshair {
  position: relative;
}
.crosshair::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), var(--brass-dim) calc(50% - 0.5px), var(--brass-dim) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--brass-dim) calc(50% - 0.5px), var(--brass-dim) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  opacity: 0.6;
  pointer-events: none;
}

/* Page-load stagger -- immediate children fade + slide up with
   incremental delay. Use on hero sections. */
@keyframes stagger-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.stagger > * {
  opacity: 0;
  animation: stagger-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.08s; }
.stagger > *:nth-child(2) { animation-delay: 0.18s; }
.stagger > *:nth-child(3) { animation-delay: 0.28s; }
.stagger > *:nth-child(4) { animation-delay: 0.38s; }
.stagger > *:nth-child(5) { animation-delay: 0.48s; }
.stagger > *:nth-child(6) { animation-delay: 0.58s; }
.stagger > *:nth-child(7) { animation-delay: 0.68s; }
.stagger > *:nth-child(8) { animation-delay: 0.78s; }

/* Scanline overlay -- very faint horizontal lines for CRT feel.
   Apply to a page wrapper. */
.scanlines {
  position: relative;
}
.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 2px,
    rgba(255, 255, 255, 0.012) 2px,
    rgba(255, 255, 255, 0.012) 3px
  );
  pointer-events: none;
  z-index: 30;
}

/* Grain texture overlay for subtle depth */
.grain {
  position: relative;
}
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.35'/></svg>");
  background-size: 200px 200px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

/* Vertical rule with tick, used to separate sidebar nav sections */
.v-tick {
  display: block;
  width: 1px;
  height: 16px;
  background: var(--granite-hi);
  margin: var(--s3) auto;
  position: relative;
}
.v-tick::before, .v-tick::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 1px;
  background: var(--granite-hi);
  left: -2px;
}
.v-tick::before { top: 0; }
.v-tick::after { bottom: 0; }

/* Terminal-style typing animation for boot status */
@keyframes fade-reveal {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}
.reveal-on {
  animation: fade-reveal 0.25s ease-out forwards;
}

/* Cursor blink for terminal aesthetic */
.cursor-blink::after {
  content: "_";
  display: inline-block;
  margin-left: 2px;
  font-family: var(--font-mono);
  color: var(--brass);
  animation: blink 1s steps(2, end) infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Decorative "readout" pair: label + value in horizontal strip */
.readout-row {
  display: flex;
  gap: var(--s6);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mute);
  text-transform: uppercase;
  padding: var(--s3) 0;
}
.readout-row .group {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.readout-row .group .v {
  color: var(--offwhite);
  letter-spacing: 0.06em;
}
.readout-row .group .v.brass { color: var(--brass-hi); }

/* Marquee-lite -- single-line status ribbon scrolling slow */
.ribbon {
  overflow: hidden;
  background: var(--navy-deep);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--s3) 0;
}
.ribbon-track {
  display: inline-flex;
  gap: var(--s8);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--offwhite-dim);
  animation: ribbon-drift 80s linear infinite;
  padding-left: 100%;
}
.ribbon-track .spacer { color: var(--brass); }
@keyframes ribbon-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* Hero-specific extras */
.hero-brackets {
  position: relative;
  padding: var(--s10) var(--s7);
}
.hero-brackets::before,
.hero-brackets::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1px solid var(--brass);
}
.hero-brackets::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.hero-brackets::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* Emphasize that this is a preview */
.ribbon .ribbon-track strong { color: var(--brass-hi); }

/* Headline specific for display mono */
h1.display-xl, h2.display-md {
  margin: 0;
}

/* Tight top-nav variant that fits the industrial feel */
.top-nav {
  background: var(--navy);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.top-nav .links a {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 500;
}

/* Base panel elevation -- harder edges, flatter surface */
.panel, .tile, .card {
  border-radius: 2px;
}
.option-card, .preview-card {
  border-radius: 2px;
}

/* Keep some roundness for small interactive elements */
.pill, .btn, .admin-nav a, .admin-topbar .search, .login-card, .sheet {
  border-radius: 2px;
}
.login-card { border-radius: 3px; }
.sheet { border-radius: 3px; }

/* Override avatar rounding kept circle */
.admin-topbar .avatar, .dot, .station-tag::before, .ui-label::before {
  border-radius: 50%;
}
.ui-label::before { border-radius: 0; }

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   GUIDE LAYOUT -- rendered markdown pages (preview/guide/*.html)
   Sidebar TOC + main content, prose typography.
   Arch-Wiki dense-reference feel with the industrial chrome.
   ============================================================ */

.guide-body {
  background: var(--navy);
  color: var(--offwhite);
}

.guide-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}
@media (max-width: 860px) {
  .guide-shell { grid-template-columns: 1fr; }
  .guide-sidebar { position: static !important; height: auto !important; border-right: 0 !important; border-bottom: 1px solid var(--border-subtle); }
}

.guide-sidebar {
  background: var(--navy-deep);
  border-right: 1px solid var(--border-subtle);
  padding: var(--s5) 0 var(--s6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}
.guide-brand {
  padding: 0 var(--s5);
}
.guide-brand .wordmark { margin-bottom: var(--s1); }
.guide-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-hi);
}

.guide-nav {
  padding: 0 var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  flex: 1;
  font-size: 13px;
}
.guide-section { display: flex; flex-direction: column; gap: 2px; }
.guide-section .section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  padding: var(--s3) var(--s3) var(--s1);
}
.guide-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.guide-section li {
  margin: 0;
}
.guide-section a {
  display: block;
  padding: 6px var(--s3);
  color: var(--offwhite-dim);
  text-decoration: none;
  border-radius: 2px;
  font-size: 13px;
  line-height: 1.4;
  transition: background 0.1s ease, color 0.1s ease;
}
.guide-section a:hover {
  background: var(--navy-hi);
  color: var(--offwhite);
}
.guide-section a.active {
  background: var(--navy-hi);
  color: var(--brass-hi);
  border-left: 2px solid var(--brass);
  padding-left: calc(var(--s3) - 2px);
}

.guide-sidebar-footer {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--offwhite-dim);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.guide-sidebar-footer a { color: var(--offwhite-dim); }
.guide-sidebar-footer a:hover { color: var(--brass-hi); }

.guide-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
}

.guide-topbar {
  padding: var(--s5) var(--s7);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s4);
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--offwhite-dim);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--brass-hi); }
.breadcrumb .sep { color: var(--granite-hi); }
.breadcrumb .current { color: var(--offwhite); }
.guide-topbar-meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; }
.guide-topbar-meta a { color: var(--mute); text-transform: uppercase; }
.guide-topbar-meta a:hover { color: var(--brass-hi); }

.guide-article {
  max-width: 840px;
  margin: var(--s7) auto var(--s9);
  padding: var(--s8) var(--s8) var(--s8);
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  position: relative;
}
@media (max-width: 760px) {
  .guide-article { margin: var(--s4); padding: var(--s6) var(--s5); max-width: none; }
}
.guide-meta {
  margin-bottom: var(--s5);
}

/* Prose */
.prose {
  font-size: 15px;
  line-height: 1.72;
  color: var(--offwhite);
}
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: var(--offwhite);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.prose h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s4);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--border-subtle);
}
.prose h2 {
  font-size: 22px;
  font-weight: 600;
  margin: var(--s8) 0 var(--s4);
  padding-top: var(--s5);
  border-top: 1px solid var(--border-subtle);
  position: relative;
}
.prose h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 32px;
  height: 1px;
  background: var(--brass);
}
.prose h3 {
  font-size: 17px;
  font-weight: 600;
  margin: var(--s6) 0 var(--s3);
  color: var(--brass-hi);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.prose h4 {
  font-size: 14px;
  font-weight: 600;
  margin: var(--s5) 0 var(--s3);
  color: var(--offwhite);
  text-transform: none;
  letter-spacing: 0;
}
.prose p {
  margin: 0 0 var(--s4);
  color: var(--offwhite);
}
.prose p + p { margin-top: 0; }
.prose strong {
  color: var(--offwhite);
  font-weight: 600;
}
.prose em {
  color: var(--offwhite);
  font-style: italic;
}
.prose a {
  color: var(--brass-hi);
  text-decoration: underline;
  text-decoration-color: rgba(176, 141, 87, 0.35);
  text-underline-offset: 2px;
  transition: color 0.1s ease, text-decoration-color 0.1s ease;
}
.prose a:hover {
  color: var(--brass-hi);
  text-decoration-color: var(--brass-hi);
}
.prose ul, .prose ol {
  margin: 0 0 var(--s4);
  padding-left: var(--s6);
}
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--brass); }
.prose blockquote {
  margin: var(--s4) 0;
  padding: var(--s3) var(--s5);
  border-left: 2px solid var(--brass);
  background: var(--navy-deep);
  color: var(--offwhite-dim);
  font-style: italic;
}
.prose blockquote p { margin: 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--navy-deep);
  color: var(--brass-hi);
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--border-subtle);
  letter-spacing: 0;
}
.prose pre {
  background: var(--navy-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  padding: var(--s4) var(--s5);
  overflow-x: auto;
  margin: var(--s4) 0;
  font-size: 13px;
  line-height: 1.55;
  position: relative;
}
.prose pre::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 28px;
  height: 2px;
  background: var(--brass);
}
.prose pre code {
  background: transparent;
  color: var(--offwhite-dim);
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 13px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s5) 0;
  font-size: 13.5px;
  border: 1px solid var(--border-subtle);
}
.prose th, .prose td {
  padding: var(--s3) var(--s4);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.prose th {
  background: var(--navy-deep);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brass-hi);
  border-bottom: 1px solid var(--brass-dim);
}
.prose tr:last-child td { border-bottom: 0; }
.prose tr:nth-child(even) td { background: rgba(19, 32, 53, 0.35); }

.prose hr {
  border: 0;
  height: 1px;
  background: var(--border-subtle);
  margin: var(--s7) 0;
  position: relative;
}
.prose hr::after {
  content: "+";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elev-1);
  padding: 0 var(--s3);
  color: var(--brass);
  font-family: var(--font-mono);
}

/* Unresolved wiki-links -- dim yellow, not a hard link */
.wiki-unresolved {
  color: var(--warn-hi);
  border-bottom: 1px dashed var(--warn-hi);
  cursor: help;
}

/* Task list (github-flavored) */
.prose ul li input[type="checkbox"] {
  margin-right: var(--s2);
  accent-color: var(--brass);
}

/* Inline images (rare in guide but possible) */
.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  margin: var(--s4) 0;
}

/* Small footnote list at page end */
.prose .footnote, .prose .footnotes {
  font-size: 12px;
  color: var(--fg-tertiary);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--s4);
  margin-top: var(--s7);
}

/* Featured reading grid -- injected at top of guide home */
.featured-reading {
  margin-bottom: var(--s7);
  padding-bottom: var(--s6);
  border-bottom: 1px solid var(--border-subtle);
}
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s4);
  margin-top: var(--s4);
}
@media (max-width: 760px) { .featured-grid { grid-template-columns: 1fr; } }
.featured-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) var(--s5);
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.featured-card:hover {
  border-color: var(--brass-dim);
  background: var(--navy-hi);
  transform: translateY(-1px);
}
.featured-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.featured-headline {
  font-size: 15px;
  font-weight: 600;
  color: var(--offwhite);
  line-height: 1.35;
}
.featured-teaser {
  font-size: 13px;
  color: var(--fg-tertiary);
  line-height: 1.5;
}
.featured-arrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-hi);
  margin-top: var(--s2);
}

/* Chapter prev/next nav at foot of chapters/* pages */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  margin-top: var(--s8);
  padding-top: var(--s5);
  border-top: 1px solid var(--border-subtle);
}
.cn-link {
  display: flex;
  flex-direction: column;
  padding: var(--s4) var(--s5);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  gap: var(--s1);
  background: var(--bg-elev-1);
}
.cn-link:hover {
  border-color: var(--brass-dim);
  background: var(--navy-hi);
  transform: translateY(-1px);
}
.cn-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.cn-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--offwhite);
  line-height: 1.3;
}
.cn-next { text-align: right; }
.cn-spacer {}
@media (max-width: 640px) {
  .chapter-nav { grid-template-columns: 1fr; }
}
