/* kv2-launchpad — App-specific styles. Tokens from kapable-theme.css.
   v4 "engineering paper" grammar (IMP-2073, BRAND.md layout grammar):
   structure is drawn in rules, not wrapped in boxes; the accent is the
   drawing ink; corners are machined (3px). Ratified direction:
   https://kapable.kapable.ai/artifacts/launchpad-redesign (v4). */

html, body { height: 100%; }
* { margin: 0; padding: 0; }

body {
  background: var(--kp-bg); color: var(--kp-text);
  display: flex; flex-direction: column;
  min-height: 100vh; /* fallback for browsers without dvh */
  min-height: 100dvh;
}

main#app { flex: 1; width: 100%; }

main#app { padding: 40px 24px; max-width: 1180px; margin: 0 auto; }
.loading { color: var(--kp-text-dim); text-align: center; padding: 60px 0; }
.muted { color: var(--kp-text-muted); font-size: 13px; }

/* Hydrated content arrives with one quiet rise from the skeleton — a single
   220ms settle, not an orchestrated sequence. Dies under reduced-motion. */
.lp-enter { animation: kp-enter 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes kp-enter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Footer shortcut hint — only meaningful with a hardware keyboard, so it
   stays hidden on touch; revealed by app.js once the switcher has tiles. */
.footer-hint { display: none; }
@media (hover: hover) and (pointer: fine) {
  .kp-footer.has-cmdk .footer-hint { display: inline-flex; align-items: center; gap: 5px; }
}

/* Boot skeleton — the shell renders instantly, sections hydrate as data lands.
   The pulse dies under the global prefers-reduced-motion guard (static blocks). */
.skeleton-block {
  background: var(--kp-surface-hi);
  border-radius: 3px;
  animation: kp-skeleton 1.1s ease-in-out infinite alternate;
}
.skeleton-glyph { width: 24px; height: 24px; border-radius: 2px; flex-shrink: 0; }
.skeleton-line { height: 12px; }
@keyframes kp-skeleton {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

/* ── Masthead — the arrival moment ─────────────────────────────────────────
   Human register over machine register: the display-serif greeting sits on a
   mono readout of real facts, closed by the drafting double-rule. The person
   owns the moment; the org lives in the readout (no org-mark chip). */
.masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.masthead-main { min-width: 0; }
.masthead h1 {
  font-family: var(--kp-font-display);
  font-optical-sizing: auto;
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.14;
  color: var(--kp-text);
}
.masthead-readout {
  margin-top: 8px;
  font-family: var(--kp-font-mono); font-size: 11.5px; letter-spacing: 0.01em;
  color: var(--kp-text-dim); text-transform: lowercase;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
/* The page's one graphic: a quiet instrument trace of real org activity.
   Data, not decoration — hidden when there aren't ≥2 days to draw. */
.masthead-spark { flex-shrink: 0; margin: 0 0 2px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.masthead-spark svg { display: block; }
.masthead-spark figcaption {
  font-family: var(--kp-font-mono); font-size: 9.5px; letter-spacing: 0.02em;
  text-transform: lowercase; color: var(--kp-text-dim);
  font-variant-numeric: tabular-nums;
}
.masthead-readout .sep { color: var(--kp-border-strong); }
.masthead-rule {
  margin: 18px 0 32px;
  border-top: 2px solid var(--kp-accent);
  position: relative;
}
.masthead-rule::after {
  content: ""; position: absolute; left: 0; right: 0; top: 2px;
  border-top: 1px solid var(--kp-accent-bg);
}

/* ── Platform atlas ─────────────────────────────────────────────────────────
   The directory is the graphic: one editorial arrival panel beside a precise
   product index. It keeps the launchpad task-first while giving the front door
   a composition that belongs to Kapable rather than a dashboard template. */
.atlas-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(0, 1.7fr);
  gap: 64px;
  align-items: start;
}
.atlas-intro {
  position: sticky;
  top: 24px;
  min-width: 0;
  padding-top: 18px;
  border-top: 2px solid var(--kp-accent);
}
.atlas-kicker {
  font-family: var(--kp-font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--kp-accent);
}
.atlas-intro h1 {
  margin: 20px 0 0;
  max-width: 8ch;
  font-family: var(--kp-font-display);
  font-optical-sizing: auto;
  font-size: 52px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--kp-text);
}
.atlas-summary {
  max-width: 34ch;
  margin: 22px 0 0;
  color: var(--kp-text-dim);
  font-size: 13px;
  line-height: 1.6;
}
.atlas-intro .masthead-readout { margin-top: 11px; }
.atlas-intro .masthead-spark {
  width: 100%;
  max-width: 280px;
  align-items: flex-start;
  gap: 7px;
  margin: 30px 0 0;
  padding: 12px 0 10px;
  border-top: 1px solid var(--kp-border);
  border-bottom: 1px solid var(--kp-border);
}
.atlas-intro .masthead-spark svg { width: 100%; height: auto; }
.atlas-intro .masthead-spark figcaption { text-align: left; }
.atlas-command {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding: 11px 0;
  border: 0;
  border-top: 1px solid var(--kp-border);
  border-bottom: 1px solid var(--kp-border);
  border-radius: 0;
  background: transparent;
  color: var(--kp-text-dim);
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.atlas-command:hover,
.atlas-command:focus-visible {
  color: var(--kp-text);
  background: var(--kp-accent-bg);
}
.atlas-command:focus-visible { outline: 2px solid var(--kp-accent); outline-offset: 2px; }
.atlas-command:disabled { cursor: default; opacity: 0.55; }
.atlas-command-prompt {
  font-family: var(--kp-font-mono);
  font-weight: 650;
  color: var(--kp-accent);
}
.atlas-command-label { font-size: 12.5px; }
.atlas-command .kp-kbd { font-size: 9.5px; }

.atlas-main { position: relative; min-width: 0; }
.atlas-main::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -32px;
  width: 1px;
  background: var(--kp-border-subtle);
}
.atlas-main > .onboarding-card { margin: 0 0 30px; }
.atlas-section + .atlas-section,
.atlas-main > .activity-section { margin-top: 38px; }
.atlas-section .section-heading,
.atlas-main > .activity-section h2 { margin-top: 0; }
.atlas-section .section-heading .sh-n {
  font-variant-numeric: tabular-nums;
  color: var(--kp-text-dim);
}
.atlas-directory {
  border-top: 1px solid var(--kp-border);
}
.atlas-directory-head,
.atlas-directory-row {
  display: grid;
  grid-template-columns: 42px minmax(130px, 0.82fr) minmax(180px, 1.25fr) 96px;
  gap: 12px;
  align-items: center;
}
.atlas-directory-head {
  min-height: 34px;
  color: var(--kp-text-dim);
  font-family: var(--kp-font-mono);
  font-size: 9px;
  text-transform: lowercase;
}
.atlas-directory-row {
  min-height: 54px;
  border-top: 1px solid var(--kp-border-subtle);
  color: var(--kp-text);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.atlas-directory-row:hover,
.atlas-directory-row:focus-visible {
  color: var(--kp-accent);
  background: var(--kp-accent-bg);
  text-decoration: none;
}
.atlas-directory-row:focus-visible { outline: 2px solid var(--kp-accent); outline-offset: -2px; }
.atlas-directory-row:focus:not(:focus-visible) { outline: none; }
.atlas-directory-row[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.atlas-directory-row[data-group="build"],
.atlas-chapter[data-group="build"] { --atlas-hue: var(--kp-accent); }
.atlas-directory-row[data-group="collaborate"],
.atlas-chapter[data-group="collaborate"] { --atlas-hue: var(--kp-icon-teal); }
.atlas-directory-row[data-group="operate"],
.atlas-chapter[data-group="operate"] { --atlas-hue: var(--kp-icon-indigo); }
.atlas-directory-row[data-group="more"],
.atlas-chapter[data-group="more"] { --atlas-hue: var(--kp-icon-violet); }
.atlas-ref {
  position: relative;
  justify-self: start;
  font-family: var(--kp-font-mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: var(--atlas-hue, var(--kp-accent));
}
.atlas-ref::before,
.atlas-ref::after {
  position: absolute;
  opacity: 0;
  transition: opacity 0.15s;
}
.atlas-ref::before { content: "["; left: -7px; }
.atlas-ref::after { content: "]"; right: -7px; }
.atlas-directory-row:hover .atlas-ref::before,
.atlas-directory-row:hover .atlas-ref::after,
.atlas-directory-row:focus-visible .atlas-ref::before,
.atlas-directory-row:focus-visible .atlas-ref::after { opacity: 1; }
.atlas-tool {
  font-family: var(--kp-font-display);
  font-optical-sizing: auto;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.atlas-purpose {
  min-width: 0;
  overflow: hidden;
  color: var(--kp-text-dim);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform 0.15s;
}
.atlas-directory-row:hover .atlas-purpose,
.atlas-directory-row:focus-visible .atlas-purpose { transform: translateX(3px); }
/* Host fallback for customer rows without an owner-set description. */
.atlas-purpose-host {
  font-family: var(--kp-font-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
}
.atlas-group {
  position: relative;
  min-height: 14px;
  color: var(--kp-text-dim);
  font-family: var(--kp-font-mono);
  font-size: 9px;
  text-align: right;
  text-transform: lowercase;
}
.atlas-group-rest,
.atlas-group-open {
  position: absolute;
  inset: 0 0 auto auto;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.atlas-group-open { opacity: 0; color: var(--kp-accent); }
.atlas-directory-row:hover .atlas-group-rest,
.atlas-directory-row:focus-visible .atlas-group-rest { opacity: 0; }
.atlas-directory-row:hover .atlas-group-open,
.atlas-directory-row:focus-visible .atlas-group-open { opacity: 1; }
.atlas-chapter {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  border-top: 1px solid var(--kp-border);
  color: var(--kp-text-dim);
  font-family: var(--kp-font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.atlas-chapter-ref {
  color: var(--atlas-hue, var(--kp-accent));
  font-variant-numeric: tabular-nums;
}
.atlas-chapter-name { color: var(--kp-text-dim); }
.atlas-chapter::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--kp-border-subtle);
}
.atlas-chapter-count {
  order: 3;
  font-variant-numeric: tabular-nums;
}
.atlas-directory-head + .atlas-chapter { border-top: 0; }
.atlas-customer-directory .atlas-ref { color: var(--kp-success); }
.atlas-customer-directory .atlas-group-rest { color: var(--kp-success); }

.atlas-empty-apps {
  border-bottom: 1px solid var(--kp-border);
}
.atlas-ghost-row { border-top: 0; }
.atlas-ghost-row .atlas-ref { color: var(--kp-text-muted); }
.atlas-ghost-row .atlas-tool { color: var(--kp-text-dim); }
.atlas-ghost-row:hover { color: var(--kp-text); background: transparent; }
.atlas-ghost-row:hover .atlas-ref::before,
.atlas-ghost-row:hover .atlas-ref::after { opacity: 0; }
.atlas-ghost-row:hover .atlas-purpose { transform: none; }
.atlas-empty-action {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--kp-accent);
  border-radius: 3px;
  color: var(--kp-accent);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.atlas-empty-action:hover,
.atlas-empty-action:focus-visible {
  background: var(--kp-accent);
  color: var(--kp-bg);
  text-decoration: none;
}

/* ── Section labels — the machine speaks on a drafting rule ──
   --kp-text-dim (not muted): 11px mono must hold WCAG AA on the petrol
   papers; v0.7.0's muted lands ~3.5:1 at this size (audit P1). */
.section-heading,
.activity-section h2 {
  margin: 0 0 12px;
  font-family: var(--kp-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--kp-text-dim);
  display: flex; align-items: center; gap: 12px;
}
.section-heading::after,
.activity-section h2::after {
  content: ""; flex: 1; height: 1px; background: var(--kp-border);
}
.section-heading { margin-top: 34px; }
.sh-n { color: var(--kp-text-dim); }

/* ── The org's apps — a ruled index drawn on the paper, no card container ── */
.app-index {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px;
  margin-bottom: 10px;
}
.app-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; min-width: 0;
  border-bottom: 1px solid var(--kp-border-subtle);
  text-decoration: none; color: var(--kp-text);
  transition: background 0.15s, color 0.15s;
}
.app-row:hover, .app-row:focus-visible {
  background: var(--kp-accent-bg);
  text-decoration: none;
}
.app-row:hover .app-row-name, .app-row:focus-visible .app-row-name { color: var(--kp-accent); }
.app-row:focus-visible { outline: 2px solid var(--kp-accent); outline-offset: -2px; }
.app-row:focus:not(:focus-visible) { outline: none; }
.app-glyph {
  width: 24px; height: 24px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--kp-font-mono); font-weight: 650; font-size: 12px;
  color: var(--app-hue, var(--kp-accent));
  background: var(--kp-surface);
  border: 1px solid var(--kp-border); border-radius: 2px;
  user-select: none;
}
.app-row-name { font-size: 13.5px; font-weight: 600; flex-shrink: 0; transition: color 0.15s; }
.app-row-desc {
  font-size: 12.5px; color: var(--kp-text-dim); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Platform dock — grouped chips, not a tile wall ── */
.dock {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 48px;
  margin-bottom: 10px;
}
.dock-group h3 {
  font-family: var(--kp-font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: lowercase; letter-spacing: 0.02em; color: var(--kp-text-dim);
  padding: 6px 0 10px; border-bottom: 1px solid var(--kp-border-subtle);
  margin-bottom: 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--kp-border); border-radius: 3px;
  padding: 6px 11px; font-size: 12.5px; font-weight: 550;
  color: var(--kp-text); background: var(--kp-surface);
  text-decoration: none; cursor: pointer; font-family: var(--kp-font);
  transition: border-color 0.15s, color 0.15s;
}
.chip svg { color: var(--kp-text-dim); flex-shrink: 0; transition: color 0.15s; }
.chip:hover, .chip:focus-visible {
  border-color: var(--kp-accent); color: var(--kp-accent);
  text-decoration: none;
}
.chip:hover svg, .chip:focus-visible svg { color: var(--kp-accent); }
.chip:focus:not(:focus-visible) { outline: none; }
.chip[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }

/* ── Onboarding — one calm ruled line, the page's only surviving panel
   (an interruption earns a container); full checklist expands on demand. ── */
.onboarding-card {
  background: var(--kp-surface);
  border: 1px solid var(--kp-border);
  border-radius: 3px;
  padding: 12px 16px;
  margin-bottom: 6px;
}
.setup-rail { display: flex; align-items: center; gap: 14px; min-height: 32px; }
.setup-segs { display: flex; gap: 4px; flex-shrink: 0; }
.setup-segs i { width: 20px; height: 3px; background: var(--kp-surface-hi); }
.setup-segs i.done { background: var(--kp-accent); }
.setup-count { font-family: var(--kp-font-mono); font-size: 11px; color: var(--kp-text-dim); flex-shrink: 0; }
.setup-next {
  font-size: 13.5px; color: var(--kp-text); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.setup-next b { font-weight: 600; }
.setup-go {
  margin-left: auto; flex-shrink: 0;
  background: var(--kp-accent); color: var(--kp-surface);
  border: none; border-radius: 3px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: var(--kp-font); text-decoration: none;
  display: inline-flex; align-items: center;
  transition: filter 0.15s;
}
[data-theme="dark"] .setup-go { color: var(--kp-bg); }
.setup-go:hover { filter: brightness(1.08); text-decoration: none; }
.setup-all {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  font-size: 12.5px; color: var(--kp-text-dim); font-family: var(--kp-font);
  padding: 7px 6px; border-radius: 3px;
  transition: color 0.15s;
}
.setup-all:hover { color: var(--kp-accent); }
/* When the rail has no Continue button (up-next step has no URL), the ghost
   button anchors the right edge instead. */
.setup-rail .setup-all:first-of-type { margin-left: auto; }
.setup-rail .setup-go + .setup-all { margin-left: 0; }
.onboarding-dismiss {
  flex-shrink: 0;
  background: transparent; border: none; color: var(--kp-text-muted);
  font-size: 20px; line-height: 1; cursor: pointer;
  border-radius: 3px;
  width: 32px; height: 32px; margin: -4px -6px -4px -2px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.onboarding-dismiss:hover { color: var(--kp-text); background: var(--kp-surface-hi); }

.onboarding-steps {
  list-style: none; padding: 10px 0 2px; margin: 10px 0 0;
  border-top: 1px solid var(--kp-border-subtle);
  display: none; flex-direction: column; gap: 6px;
}
.onboarding-card.expanded .onboarding-steps { display: flex; }
.onboarding-step {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 13.5px;
}
.onboarding-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--kp-border); color: transparent;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.onboarding-marker.done {
  background: var(--kp-success);
  border-color: var(--kp-success);
  color: #fff;
}
.onboarding-label { flex: 1; color: var(--kp-text); }
.onboarding-label.done { color: var(--kp-text-dim); opacity: 0.6; }
.onboarding-action {
  font-size: 13px; font-weight: 500; color: var(--kp-accent);
  text-decoration: none;
  padding: 6px 12px; margin: -6px -12px;
  border-radius: 3px;
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center;
}
.onboarding-action:hover { text-decoration: none; background: var(--kp-accent-bg); }
.onboarding-step.up-next .onboarding-marker {
  border-color: var(--kp-accent);
  box-shadow: 0 0 0 3px var(--kp-accent-bg);
}
.onboarding-step.up-next .onboarding-label { font-weight: 500; }

/* Onboarding completion payoff — quiet acknowledgement, one dismiss from gone.
   The check draws itself once (450ms): motion in service of the state change. */
.onboarding-complete { padding: 16px 18px; }
.onboarding-complete-row { display: flex; align-items: center; gap: 14px; }
.onboarding-complete-mark { width: 26px; height: 26px; font-size: 14px; }
.onboarding-complete-mark svg { width: 14px; height: 14px; }
.onboarding-complete-mark svg path {
  stroke-dasharray: 24; stroke-dashoffset: 24;
  animation: kp-check-draw 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}
@keyframes kp-check-draw { to { stroke-dashoffset: 0; } }
.onboarding-complete-text { flex: 1; min-width: 0; }
.onboarding-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--kp-text); }
.onboarding-sub { font-size: 12px; margin: 4px 0 0; color: var(--kp-text-dim); }
.onboarding-complete .onboarding-title {
  font-family: var(--kp-font-display);
  font-optical-sizing: auto;
  font-size: 17px; font-weight: 600;
}

/* ── Activity — ruled receipt rows, no box ── */
.activity-section { margin-top: 34px; }
.activity-timeline { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--kp-border-subtle);
  text-decoration: none; color: var(--kp-text);
  transition: background 0.15s ease;
}
.activity-glyph {
  font-family: var(--kp-font-mono); font-size: 11.5px; font-weight: 600;
  color: var(--kp-accent); width: 14px; text-align: center; flex-shrink: 0;
  user-select: none;
}
a.activity-item:hover { background: var(--kp-accent-bg); text-decoration: none; }
a.activity-item:hover .activity-time { color: var(--kp-text-dim); }
/* Ambient rows (sign-ins): present but visually behind real events. */
.activity-item-ambient { opacity: 0.55; }
.activity-item-ambient .activity-glyph { color: var(--kp-text-muted); }
a.activity-item-ambient:hover, .activity-item-ambient:hover { opacity: 1; }
a.activity-item:focus-visible { background: var(--kp-accent-bg); outline: 2px solid var(--kp-accent); outline-offset: -2px; }
a.activity-item:focus:not(:focus-visible) { outline: none; }
.activity-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.activity-title { font-size: 13px; font-weight: 500; color: var(--kp-text); }
.activity-count {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  font-size: 10px; font-weight: 600; line-height: 16px;
  font-family: var(--kp-font-mono, ui-monospace, monospace);
  color: var(--kp-text-dim); background: var(--kp-surface);
  border: 1px solid var(--kp-border); border-radius: 2px;
  vertical-align: 1px;
}
.activity-detail { font-size: 12px; color: var(--kp-text-dim); }
/* Timestamps speak in the machine register: mono, tabular, quiet —
   dim, not muted: 10.5px must hold AA (audit P1). */
.activity-time {
  font-family: var(--kp-font-mono); font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--kp-text-dim); white-space: nowrap; flex-shrink: 0;
}

/* Quick actions empty state — machined chips, not cards */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-action {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--kp-surface); border: 1px solid var(--kp-border);
  border-radius: 3px;
  text-decoration: none; color: var(--kp-text);
  transition: border-color 0.15s, color 0.15s;
}
.quick-action:hover, .quick-action:focus-visible {
  border-color: var(--kp-accent); color: var(--kp-accent);
  text-decoration: none;
}
.quick-action:focus:not(:focus-visible) { outline: none; }
.quick-action-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--kp-text-dim); flex-shrink: 0;
}
.quick-action:hover .quick-action-icon { color: var(--kp-accent); }
.quick-action-info { display: flex; flex-direction: column; min-width: 0; }
.quick-action-name { font-weight: 600; font-size: 12.5px; }
.quick-action-desc { font-size: 11px; color: var(--kp-text-dim); }

/* ── Org picker — the doorway: a genuine interruption, so it keeps its
   containers; corners machined to match the grammar. ── */
.org-picker { max-width: 560px; margin: clamp(40px, 14vh, 120px) auto 0; }
.org-picker h1 {
  font-family: var(--kp-font-display);
  font-optical-sizing: auto;
  font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px;
}
.org-picker > .muted { margin-bottom: 28px; display: block; }

.org-grid { display: flex; flex-direction: column; gap: 10px; }

.org-avatar {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--kp-accent-bg); color: var(--app-hue, var(--kp-accent));
  font-weight: 700; font-size: 16px; user-select: none;
}
@supports (background: color-mix(in oklab, red 10%, blue)) {
  .org-avatar {
    background: color-mix(in oklab, var(--app-hue, var(--kp-accent)) 11%, var(--kp-surface));
  }
}
.org-card-main { display: flex; align-items: center; gap: 14px; min-width: 0; }

.org-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--kp-surface);
  border: 1px solid var(--kp-border);
  border-radius: 3px;
  text-decoration: none; color: var(--kp-text);
  transition: border-color 0.15s, background 0.15s;
}
.org-card:hover { border-color: var(--kp-accent); background: var(--kp-surface-hi); text-decoration: none; }
.org-card:focus-visible { border-color: var(--kp-accent); background: var(--kp-surface-hi); outline: 2px solid var(--kp-accent); outline-offset: 2px; }
.org-card:focus:not(:focus-visible) { outline: none; }
.org-card-name { font-weight: 600; font-size: 16px; }
.org-card-meta { display: flex; gap: 12px; align-items: center; }
.org-slug { color: var(--kp-text-dim); font-size: 12px; font-family: var(--kp-font-mono); }
.org-plan {
  color: var(--kp-accent); font-size: 10.5px; font-weight: 600;
  text-transform: lowercase; letter-spacing: 0.03em;
  font-family: var(--kp-font-mono);
  background: var(--kp-accent-bg);
  padding: 2px 8px; border-radius: 2px;
}
.org-role { color: var(--kp-text-dim); font-size: 12px; }

/* ── Cmd+K quick switcher ── */
.kp-cmdk-overlay {
  position: fixed; inset: 0; z-index: 1500; /* below toasts (2000) */
  background: rgba(3, 14, 13, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 18vh 16px 0;
}
.kp-cmdk {
  width: min(520px, 100%);
  background: var(--kp-surface); border: 1px solid var(--kp-border);
  border-radius: 4px; box-shadow: var(--kp-shadow-lg);
  overflow: hidden;
}
.kp-cmdk-input {
  width: 100%; border: 0; background: transparent;
  color: var(--kp-text); font-size: 15px; font-family: var(--kp-font);
  padding: 14px 16px; border-bottom: 1px solid var(--kp-border);
}
/* Focus indicator is the accent underline (an outline ring inside the panel
   double-borders); the caret + underline keep focus visible. */
.kp-cmdk-input:focus-visible { outline: none; border-bottom-color: var(--kp-accent); }
.kp-cmdk-input::placeholder { color: var(--kp-text-muted); }
.kp-cmdk-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.kp-cmdk-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 10px; border-radius: 3px;
  cursor: pointer;
}
.kp-cmdk-item.selected { background: var(--kp-accent-bg); }
.kp-cmdk-name { font-weight: 600; font-size: 14px; color: var(--kp-text); flex-shrink: 0; }
.kp-cmdk-desc {
  font-size: 12px; color: var(--kp-text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.kp-cmdk-empty { padding: 14px; text-align: center; }
.kp-cmdk-hint {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-top: 1px solid var(--kp-border-subtle);
  font-family: var(--kp-font-mono); font-size: 10.5px; color: var(--kp-text-dim);
}
.kp-cmdk-hint .kp-kbd { margin-left: 7px; }
.kp-cmdk-hint .kp-kbd:first-child { margin-left: 0; }

/* Terminal view styles live in terminal.html (its own document); the shared
   pieces it takes from here are the tokens, fonts, and .kp-* primitives. */
.terminal-connecting, .terminal-error, .terminal-msg {
  padding: 24px; color: var(--kp-text-dim); font-size: 14px;
}
.terminal-error { color: var(--kp-danger); }

/* ── /apps — the fleet ledger ─────────────────────────────────────────────
   Environment lanes drawn as ruled chapters; each app is a ledger entry with
   that lane's real runtime state. Same paper, same ink: rules not boxes. */
.fleet-search { margin-top: 26px; width: 100%; }
.fleet-intro-actions {
  margin-top: 18px;
  display: flex; align-items: center; gap: 16px;
}
.fleet-console-link {
  font-family: var(--kp-font-mono); font-size: 10.5px;
  text-transform: lowercase; letter-spacing: 0.02em;
  color: var(--kp-text-dim); text-decoration: none;
  transition: color 0.15s;
}
.fleet-console-link:hover, .fleet-console-link:focus-visible {
  color: var(--kp-accent); text-decoration: none;
}

.fleet-lane-head[data-env="production"] { --atlas-hue: var(--kp-accent); }
.fleet-lane-head[data-env="internal"] { --atlas-hue: var(--kp-icon-violet); }
.fleet-lane { margin-bottom: 26px; }
.fleet-env-badge {
  order: 2;
  font-family: var(--kp-font-mono); font-size: 9px;
  padding: 1px 7px; border-radius: 2px;
  border: 1px solid var(--kp-border);
  color: var(--kp-text-muted);
}
.fleet-env-badge.routed {
  border-color: transparent;
  background: var(--kp-success-bg);
  color: var(--kp-success);
}

.fleet-row {
  display: grid;
  grid-template-columns: 28px minmax(150px, 0.9fr) minmax(170px, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 60px;
  padding: 8px 4px;
  border-top: 1px solid var(--kp-border-subtle);
  transition: background 0.15s;
}
.fleet-lane .fleet-row:first-child { border-top: 0; }
.fleet-row:hover { background: var(--kp-accent-bg); }
.fleet-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fleet-name {
  font-family: var(--kp-font-display);
  font-optical-sizing: auto;
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15;
  color: var(--kp-text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color 0.15s;
}
.fleet-name:hover, .fleet-name:focus-visible { color: var(--kp-accent); text-decoration: none; }
.fleet-host {
  font-family: var(--kp-font-mono); font-size: 10.5px;
  color: var(--kp-text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fleet-status { min-width: 0; }
.fleet-status-grid {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  column-gap: 7px;
  row-gap: 3px;
  align-items: center;
}
.fleet-status-line { display: contents; }
.fleet-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--kp-text-muted);
}
.fleet-dot.live { background: var(--kp-success); }
.fleet-dot.warn { background: var(--kp-warn); }
.fleet-dot.err { background: var(--kp-danger); }
.fleet-dot.paused, .fleet-dot.idle { background: var(--kp-text-muted); }
.fleet-dot.busy {
  background: var(--kp-accent);
  animation: fleet-pulse 1.2s ease-in-out infinite;
}
@keyframes fleet-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.fleet-status-label {
  font-family: var(--kp-font-mono); font-size: 11px;
  text-transform: lowercase; letter-spacing: 0.01em;
  color: var(--kp-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fleet-row[data-status="idle"] .fleet-status-label,
.fleet-row[data-status="paused"] .fleet-status-label { color: var(--kp-text-dim); }
.fleet-meta {
  grid-column: 2;
  font-family: var(--kp-font-mono); font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--kp-text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fleet-meta.err { color: var(--kp-danger); }
.fleet-meta.warn { color: var(--kp-warn); }
/* Failure reasons expand on click — errors are instructions, they must be readable. */
button.fleet-meta-expandable {
  background: none; border: 0; padding: 0; margin: 0;
  text-align: left; cursor: pointer; display: block; width: 100%;
}
button.fleet-meta-expandable:hover { text-decoration: underline dotted; text-underline-offset: 2px; }
button.fleet-meta-expandable:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; border-radius: 2px; }
button.fleet-meta-expandable.expanded {
  white-space: normal; overflow: visible; text-overflow: clip;
  overflow-wrap: anywhere; line-height: 1.5; user-select: text;
}
.fleet-progress {
  grid-column: 2;
  display: block; width: min(180px, 100%); height: 2px;
  background: var(--kp-surface-hi); border-radius: 1px; overflow: hidden;
}
.fleet-progress i {
  display: block; height: 100%; background: var(--kp-accent);
  transition: width 0.6s ease;
}
.fleet-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  justify-content: flex-end;
}
.fleet-action {
  font-family: var(--kp-font-mono); font-size: 10.5px;
  text-transform: lowercase; letter-spacing: 0.02em;
  color: var(--kp-text-dim);
  background: transparent; border: 1px solid var(--kp-border); border-radius: 3px;
  padding: 5px 10px; cursor: pointer; text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.fleet-action:hover, .fleet-action:focus-visible {
  color: var(--kp-accent); border-color: var(--kp-accent); text-decoration: none;
}
.fleet-action:disabled { opacity: 0.55; cursor: default; }
.fleet-action:disabled:hover { color: var(--kp-text-dim); border-color: var(--kp-border); }
.fleet-lanes { display: inline-flex; gap: 4px; margin-right: 4px; }
.fleet-lane-chip {
  font-family: var(--kp-font-mono); font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 2px;
  border: 1px solid var(--kp-border);
  color: var(--kp-text-dim);
}
.fleet-lane-chip.busy { color: var(--kp-accent); border-color: var(--kp-accent); }
.fleet-lane-chip.warn { color: var(--kp-warn); }
.fleet-lane-chip.err { color: var(--kp-danger); border-color: var(--kp-danger); }
.fleet-none { padding: 18px 4px; }

@media (max-width: 720px) {
  .fleet-row {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-auto-rows: auto;
    row-gap: 6px;
    min-height: 0;
    padding: 12px 4px;
  }
  .fleet-status { grid-column: 2; }
  .fleet-actions { grid-column: 2; justify-content: flex-start; }
}

/* ── Mobile ── */
@media (max-width: 900px) {
  .atlas-layout { grid-template-columns: 1fr; gap: 40px; }
  .atlas-intro { position: static; }
  .atlas-main::before { display: none; }
  .atlas-intro h1 { max-width: 12ch; font-size: 44px; }
  .atlas-summary { max-width: 56ch; }
  .atlas-intro .masthead-spark { margin-top: 24px; }
  .atlas-command { max-width: 420px; }
}
@media (max-width: 720px) {
  .app-index { grid-template-columns: 1fr; }
  .dock { grid-template-columns: 1fr; gap: 16px; }
  main#app { padding: 24px 16px; }
  .org-picker { margin-top: 32px; }
  .masthead h1 { font-size: 25px; }
  .masthead-rule { margin: 14px 0 26px; }
  .setup-rail { flex-wrap: wrap; }
  .setup-next { flex-basis: 100%; order: 5; white-space: normal; }
}
@media (max-width: 600px) {
  .masthead-spark { display: none; }
  .atlas-layout { gap: 32px; }
  .atlas-intro { padding-top: 14px; }
  .atlas-intro h1 { max-width: 9ch; margin-top: 17px; font-size: 38px; }
  .atlas-summary { margin-top: 16px; }
  .atlas-intro .masthead-spark {
    display: flex;
    max-width: 100%;
    margin-top: 22px;
  }
  .atlas-command { margin-top: 22px; }
  .atlas-directory-head { display: none; }
  .atlas-directory-row {
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 50px;
  }
  .atlas-purpose { display: none; }
  .atlas-tool { font-size: 17px; }
  .atlas-group { display: none; }
  .atlas-ghost-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .atlas-empty-action { justify-self: end; }
  .atlas-main > .activity-section { margin-top: 34px; }
  .atlas-main .setup-rail {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 10px;
  }
  .atlas-main .setup-segs { grid-column: 1; grid-row: 1; }
  .atlas-main .setup-count { grid-column: 2; grid-row: 1; }
  .atlas-main .onboarding-dismiss {
    grid-column: 4;
    grid-row: 1;
    margin: -6px -6px -6px 0;
  }
  .atlas-main .setup-next {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    width: 100%;
  }
  .atlas-main .setup-go { grid-column: 1 / 3; grid-row: 3; justify-self: start; }
  .atlas-main .setup-all {
    grid-column: 3 / 5;
    grid-row: 3;
    justify-self: start;
    margin-left: 0 !important;
  }
  .kpc-fab {
    position: absolute !important;
    top: 105px !important;
    right: 16px !important;
    bottom: auto !important;
    width: 44px !important;
    height: 44px !important;
  }
}
