/* ===========================================================================
   Naka — console shell
   ---------------------------------------------------------------------------
   Loaded after app.css (tokens + panels + feed/meter/diff components, all of
   which this file reuses unchanged). What is here is only the application
   chrome: the sidebar, the top bar, the view router's surfaces and the few
   dashboard-specific components that do not exist on the marketing site.

   The console is a WORKING SURFACE, not a landing page. That drives three
   decisions that differ from site.css:

     - No smooth scroll and no scroll-triggered reveals. An operator reading
       an audit trail should never have to wait for content to animate in,
       and Lenis fighting a scrollable table is actively unpleasant.
     - Denser type and tighter spacing than the marketing bands.
     - Fixed chrome: the sidebar and top bar do not scroll away, because the
       thing you need during an incident must not be somewhere else.
   =========================================================================== */

html, body { height: 100%; }
body.d-body { overflow: hidden; background: var(--page-alt); }

.d-app {
  display: grid;
  grid-template-columns: 250px 1fr;
  height: 100vh;
  height: 100dvh;
}

/* ---------------------------------------------------------------- sidebar */

.d-side {
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--peach);
  overflow: hidden;
}

.d-side-head {
  display: flex; align-items: center; gap: 10px;
  padding: var(--s4) var(--s4);
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
}
.d-side-head svg { width: 28px; height: 28px; flex-shrink: 0; }
.d-side-head b {
  font-family: var(--font-display); font-size: 21px;
  font-weight: 700; letter-spacing: -0.025em;
}
.d-side-head span {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mud); background: var(--page-alt);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  padding: 3px 7px;
}

.d-nav { flex: 1; overflow-y: auto; padding: var(--s4) var(--s3); }
.d-nav-group {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--mud);
  padding: var(--s4) var(--s3) var(--s2);
}
.d-nav-group:first-child { padding-top: 0; }

.d-nav a {
  position: relative;
  display: grid; grid-template-columns: 18px 1fr auto; gap: 11px;
  align-items: center;
  height: 38px; padding: 0 var(--s3);
  border-radius: var(--r-btn);
  font-size: var(--t-small); font-weight: 600;
  color: var(--ink-2); text-decoration: none;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.d-nav a svg { width: 17px; height: 17px; opacity: 0.75; }
.d-nav a:hover { background: var(--page-alt); color: var(--ink); }
.d-nav a[aria-current="page"] {
  background: var(--brand-tint); color: var(--ink);
  box-shadow: inset 2px 0 0 var(--brand);
}
.d-nav a[aria-current="page"] svg { opacity: 1; color: var(--brand-deep); }

/* a count badge on a nav row; hidden entirely at zero rather than showing a
   grey "0", which reads as broken rather than as quiet */
.d-nav-count {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--ink-2); background: var(--page-alt);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  padding: 2px 7px; min-width: 22px; text-align: center;
}
.d-nav-count:empty, .d-nav-count[hidden] { display: none; }

.d-side-foot {
  padding: var(--s3) var(--s4) var(--s4);
  border-top: 1px solid var(--line);
  display: grid; gap: 7px;
}
.d-health {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--t-micro); color: var(--ink-2);
}
.d-health i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3); flex-shrink: 0;
}
.d-health.is-live i { background: var(--allow); }
.d-health.is-down i { background: var(--fault); }
.d-health .mono { margin-left: auto; color: var(--mud); font-size: 10px; }

/* ----------------------------------------------------------------- topbar */

.d-main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.d-top {
  display: flex; align-items: center; gap: var(--s4);
  height: 60px; flex-shrink: 0;
  padding: 0 var(--s6);
  background: var(--panel);
  border-bottom: 1px solid var(--peach);
}
.d-crumb { display: flex; align-items: center; gap: 9px; min-width: 0; }
.d-crumb-h { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.d-crumb-sub {
  font-size: var(--t-micro); color: var(--mud);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.d-top-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }

.d-env {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  font-family: var(--font-mono); font-size: var(--t-micro);
  color: var(--ink-2); background: var(--page-alt);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
}
.d-env i { width: 6px; height: 6px; border-radius: 50%; background: var(--allow); }

.d-burger { display: none; }

/* ------------------------------------------------------------------ views */

.d-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.d-view { display: none; padding: var(--s6); max-width: 1320px; }
.d-view.is-on { display: block; }

.d-view-head { margin-bottom: var(--s5); max-width: 78ch; }
.d-view-head h1 {
  font-family: var(--font-display); font-size: 30px;
  font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px;
}
.d-view-head p { margin: 0; color: var(--ink-2); font-size: var(--t-body); line-height: 1.55; }

.d-section-h {
  display: flex; align-items: center; gap: var(--s3);
  font-size: var(--t-micro); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mud); margin: var(--s6) 0 var(--s3);
}
.d-section-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.d-section-h:first-child { margin-top: 0; }

/* ------------------------------------------------------------------- kpis */

.d-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.d-kpi {
  background: var(--panel);
  border: 1px solid var(--peach);
  border-radius: var(--r-card);
  padding: var(--s4) var(--s5) var(--s5);
  box-shadow: var(--shadow-m);
}
.d-kpi-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--mud); margin-bottom: 10px;
}
.d-kpi-v {
  font-size: 34px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.d-kpi-v.is-good { color: var(--allow); }
.d-kpi-v.is-warn { color: var(--rust); }
.d-kpi-v.is-fault { color: var(--fault); }
.d-kpi-note { margin-top: 9px; font-size: var(--t-micro); color: var(--ink-2); line-height: 1.5; }

/* the invariant card — the one number that must stay at zero */
.d-kpi-invariant { border-color: var(--allow); background: var(--allow-tint); }
.d-kpi-invariant.is-broken { border-color: var(--fault); background: var(--fault-tint); }

/* ----------------------------------------------------------------- planes */

.d-planes { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.d-plane {
  display: flex; flex-direction: column; gap: var(--s3);
  background: var(--panel); border: 1px solid var(--peach);
  border-radius: var(--r-card); padding: var(--s5);
  box-shadow: var(--shadow-m);
  text-decoration: none; color: var(--ink);
  transition: border-color 160ms var(--ease), transform 160ms var(--ease);
}
.d-plane:hover { border-color: var(--plane-accent, var(--rust)); transform: translateY(-2px); }
.d-plane-top { display: flex; align-items: center; gap: 10px; }
.d-plane-top svg { width: 30px; height: 30px; }
.d-plane-top strong { font-size: var(--t-body); font-weight: 700; }
.d-plane-state {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap;
}
.d-plane-state::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--ink-3); }
.d-plane-state.is-live { color: var(--allow); }
.d-plane-state.is-live::before { background: var(--allow); }
.d-plane-state.is-idle { color: var(--mud); }
.d-plane-state.is-down { color: var(--fault); }
.d-plane-state.is-down::before { background: var(--fault); }
.d-plane p { margin: 0; font-size: var(--t-small); color: var(--ink-2); line-height: 1.5; }
.d-plane-figs { display: flex; gap: var(--s5); margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); }
.d-plane-fig b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.d-plane-fig span { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mud); }

/* ------------------------------------------------------------- empty state */

/* Used wherever a surface genuinely has no data. It says which, why, and
   what to do — never a spinner that never resolves, and never a fabricated
   row to make the screen look populated. */
.d-empty {
  display: grid; gap: var(--s3); justify-items: start;
  padding: var(--s7) var(--s6);
  background: var(--page-alt);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-card);
}
.d-empty svg { width: 30px; height: 30px; color: var(--mud); }
.d-empty h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.d-empty p { margin: 0; font-size: var(--t-small); color: var(--ink-2); line-height: 1.6; max-width: 66ch; }
.d-empty code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r-mark); padding: 1px 6px;
}

/* a copyable command block */
.d-cmd {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%;
  background: var(--ink); border-radius: var(--r-btn);
  padding: 12px var(--s4);
  font-family: var(--font-mono); font-size: 12.5px; color: #f0e4d4;
  overflow-x: auto;
}
.d-cmd span { white-space: nowrap; }
.d-cmd .p { color: var(--tea); user-select: none; }
.d-cmd button {
  margin-left: auto; flex-shrink: 0;
  height: 26px; padding: 0 10px; font-size: 11px;
  background: color-mix(in oklab, #faebd6 14%, transparent); color: var(--page);
  box-shadow: none;
}
.d-cmd button:hover { background: color-mix(in oklab, #faebd6 26%, transparent); }

/* ------------------------------------------------------------------ steps */

.d-enroll { display: grid; gap: var(--s4); counter-reset: d-step; }
.d-enroll-step {
  display: grid; grid-template-columns: 26px 1fr; gap: var(--s4);
  align-items: start;
}
.d-enroll-step::before {
  counter-increment: d-step; content: counter(d-step);
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  background: var(--ink); color: var(--page);
}
.d-enroll-step h4 { margin: 3px 0 7px; font-size: var(--t-body); font-weight: 700; }
.d-enroll-step p { margin: 0 0 var(--s3); font-size: var(--t-small); color: var(--ink-2); line-height: 1.55; }

/* -------------------------------------------------------------- data table */

.d-table { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.d-table th {
  position: sticky; top: 0; z-index: 1; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--mud);
  background: var(--panel); padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--line-2);
}
.d-table td { padding: 10px var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.d-table tbody tr:last-child td { border-bottom: 0; }
.d-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ misc */

.d-row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.d-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.d-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.d-spacer { flex: 1; }

.d-note {
  font-size: var(--t-micro); color: var(--ink-2); line-height: 1.6;
  background: var(--page-alt); border-left: 3px solid var(--brand);
  border-radius: 0 var(--r-btn) var(--r-btn) 0;
  padding: 11px var(--s4); margin-top: var(--s4);
}
.d-note strong { color: var(--ink); }

/* The console does not use the marketing reveal system. Anything that got
   a .reveal class from a shared component stays visible here. */
.d-app .reveal { opacity: 1 !important; transform: none !important; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .d-kpis { grid-template-columns: 1fr 1fr; }
  .d-planes { grid-template-columns: 1fr; }
  .d-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  body.d-body { overflow: auto; }
  .d-app { grid-template-columns: 1fr; height: auto; }
  .d-side {
    position: fixed; inset: 0 auto 0 0; z-index: 90;
    width: 250px; transform: translateX(-100%);
    transition: transform 240ms var(--ease);
    box-shadow: 0 0 40px -10px rgba(20,21,26,.4);
  }
  .d-app.is-open .d-side { transform: none; }
  .d-main { height: auto; overflow: visible; }
  .d-scroll { overflow: visible; }
  .d-top { position: sticky; top: 0; z-index: 60; padding-inline: var(--s4); }
  .d-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    background: none; color: var(--ink); box-shadow: var(--ring-ink);
  }
  .d-view { padding: var(--s5) var(--s4); }
  .d-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .d-kpis { grid-template-columns: 1fr; }
  .d-crumb-sub { display: none; }
}
