/* KitFire Platform — one responsive codebase, two surfaces.
   Rail mode (≤480px) = Chrome side panel. Platform mode (wide) = full screen.
   Brand: Kit = navy on light / porcelain on dark · Fire = ember #ff3d2e · Sora wordmark. */

:root {
  --ember: #ff3d2e;
  --ember-soft: rgba(255, 61, 46, 0.12);
  --ember-line: rgba(255, 61, 46, 0.35);
  --ink: #0c1220;          /* Kit navy */
  --bg: #0b0f17;
  --bg-raise: #121826;
  --bg-raise-2: #1a2233;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f6;
  --text-dim: #9aa4b5;
  --text-faint: #626d80;
  --good: #3ecf8e;
  --warn: #f5b83d;
  --font-brand: "Sora", sans-serif;
  --font-ui: "Inter", -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  grid-template-rows: 100vh;
  overflow: hidden;
  font-size: 14px;
}

.hidden { display: none !important; }

/* ============ SIDEBAR ============ */
#sidebar {
  border-right: 1px solid var(--line);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 20px;
  overflow-y: auto;
}

.brand {
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 700;
  padding: 2px 8px 10px;
  display: flex;
  align-items: center;
}
.brand-kit { color: var(--text); }
.brand-fire { color: var(--ember); }
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  margin-left: 10px;
  animation: pulse 2.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- campaign switcher (FLEET-0070, S230) ---- */
.campaign-switcher { position: relative; }
.campaign-switcher-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border-radius: 9px; text-align: left;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  color: var(--text); font: 600 13px var(--font-ui); cursor: pointer;
}
.campaign-switcher-btn:hover { background: rgba(255,255,255,0.07); }
.campaign-ico { color: var(--ember); font-size: 11px; }
.campaign-current-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-caret { color: var(--text-faint); font-size: 11px; }
.campaign-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--bg-raise); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 8px; box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.campaign-menu-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); padding: 2px 8px 6px;
}
.campaign-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-dim);
  font: 500 13px var(--font-ui); padding: 8px 8px; border-radius: 7px; cursor: pointer;
}
.campaign-row:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.campaign-row.active { background: var(--ember-soft); color: var(--text); }
.campaign-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-row-check { color: var(--ember); font-size: 12px; }
.campaign-add-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-faint);
  font: 500 13px var(--font-ui); padding: 8px 8px; border-radius: 7px; cursor: pointer;
  margin-top: 2px; border-top: 1px solid var(--line);
}
.campaign-add-row:hover { color: var(--ember); }
.campaign-menu-foot { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.campaign-menu-link {
  background: none; border: none; text-align: left; cursor: pointer;
  font: 500 11.5px var(--font-ui); color: var(--text-faint); padding: 6px 8px; border-radius: 7px;
}
.campaign-menu-link:hover { color: var(--text-dim); background: rgba(255,255,255,0.05); }
.campaign-menu-link.danger:hover { color: #ff6b5e; }

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); padding: 0 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: none; color: var(--text-dim);
  font: 500 14px var(--font-ui);
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: var(--ember-soft); color: var(--text); }
.nav-item.active .nav-ico { color: var(--ember); }
.nav-ico { width: 18px; text-align: center; font-size: 14px; color: var(--text-faint); }
.nav-add { color: var(--text-faint); font-weight: 500; }
.nav-add:hover { color: var(--ember); }

.agent-status {
  width: 7px; height: 7px; border-radius: 50%; margin-left: auto;
  background: var(--good);
}
.agent-status.paused { background: var(--text-faint); }

.badge {
  margin-left: auto;
  background: var(--ember); color: #fff;
  font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* ---- agent health strip + pause all ---- */
#healthStrip {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-dim);
  padding: 8px 10px; border-radius: 9px;
  background: rgba(255,255,255,0.03);
}
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex-shrink: 0; }
.health-dot.paused { background: var(--warn); }
.pause-btn {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 10px; padding: 3px 6px; border-radius: 6px;
}
.pause-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.pause-btn.on { color: var(--warn); }

.topbar-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ember); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; margin-left: 4px;
  cursor: pointer; /* FLEET-0069: opens Settings */
}

/* ---- usage meter (Anthropic-style session + weekly allotment) ---- */
.usage-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.usage-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
}
.usage-plan {
  text-transform: none; letter-spacing: 0;
  font-size: 10.5px; font-weight: 600;
  color: var(--ember); background: var(--ember-soft);
  padding: 2px 8px; border-radius: 10px;
}
.usage-row { display: flex; flex-direction: column; gap: 4px; }
.usage-labels {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--text-dim);
}
.usage-labels span:last-child { font-weight: 600; color: var(--text); }
/* Same bar language as .grad-bar/.grad-fill — one meter style platform-wide. */
.u-bar {
  height: 6px; border-radius: 3px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
}
.u-fill {
  height: 100%; border-radius: 3px;
  background: var(--ember);
  transition: width 0.6s ease;
}
.usage-reset { font-size: 10.5px; color: var(--text-faint); }
.seat-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px;
  background: rgba(255,255,255,0.04);
  cursor: pointer; /* FLEET-0069: opens Settings */
}
.seat-chip:hover { background: rgba(255,255,255,0.07); }
.seat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ember); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}
.seat-name { font-weight: 600; font-size: 13px; }
.seat-plan { font-size: 11.5px; color: var(--text-dim); }

/* ============ MAIN ============ */
#main {
  display: flex; flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

#topbar {
  display: none;
  align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}
#chipRow {
  display: flex; gap: 6px; overflow-x: auto; flex: 1;
  scrollbar-width: none;
}
#chipRow::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--line-strong); color: var(--text-dim);
  background: none; cursor: pointer;
}
.chip.active { background: var(--ember-soft); border-color: var(--ember-line); color: var(--text); }

.icon-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 17px; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.topbar-right { display: flex; }

/* ---- chat ---- */
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
#view-chat { overflow: hidden; }

#chatHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
}
.chat-agent-name { font-family: var(--font-brand); font-weight: 600; font-size: 16px; }
.chat-agent-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.chat-header-actions { display: flex; align-items: center; gap: 10px; }

.tier-chip {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 20px;
  background: var(--ember-soft); color: var(--ember);
  border: 1px solid var(--ember-line);
}

.btn-ghost {
  background: none; border: 1px solid var(--line-strong);
  color: var(--text-dim); font: 500 13px var(--font-ui);
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }

.btn-primary {
  background: var(--ember); border: none; color: #fff;
  font: 600 13.5px var(--font-ui);
  padding: 9px 18px; border-radius: 9px; cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

#thread {
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 18px;
}

.msg { max-width: 78%; line-height: 1.55; }
.msg-user {
  align-self: flex-end;
  background: var(--bg-raise-2);
  padding: 10px 16px; border-radius: 16px 16px 4px 16px;
}
.msg-agent { align-self: flex-start; }
.msg-agent-tag {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-dim); margin-bottom: 6px;
}
.msg-agent-tag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ember); display: inline-block;
}
.msg-body p { margin-bottom: 8px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 6px 0 8px 20px; }
.msg-body li { margin-bottom: 4px; }
.msg-body strong { font-weight: 600; }
.msg-body code {
  background: var(--bg-raise); padding: 1px 6px; border-radius: 5px;
  font-size: 13px;
}

.msg-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: 10px; overflow: hidden;
}
.msg-card-row { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.msg-card-row:last-child { border-bottom: none; }
.msg-card-title { font-weight: 600; font-size: 13px; }
.msg-card-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.msg-card-sub.warn { color: var(--warn); }
.msg-card-actions { display: flex; gap: 8px; margin-top: 8px; }
.mini-btn {
  font: 600 11.5px var(--font-ui);
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
  border: none;
}
.mini-btn.fire { background: var(--ember); color: #fff; }
.mini-btn.line { background: none; border: 1px solid var(--line-strong); color: var(--text-dim); }
.mini-btn.line:hover { color: var(--text); }

.msg-meta {
  align-self: flex-start;
  font-size: 11.5px; color: var(--text-faint);
  display: flex; align-items: center; gap: 6px;
}

.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint);
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,100% { opacity: 0.25; } 50% { opacity: 1; } }

#composerWrap { padding: 14px 28px 18px; border-top: 1px solid var(--line); }
#composer {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px 10px 10px 18px;
  transition: border-color 0.15s;
}
#composer:focus-within { border-color: var(--ember-line); }
#composerInput {
  flex: 1; resize: none; background: none; border: none; outline: none;
  color: var(--text); font: 400 14px/1.5 var(--font-ui);
  max-height: 140px;
}
#composerInput::placeholder { color: var(--text-faint); }
#sendBtn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ember); color: #fff; border: none;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  transition: transform 0.1s, filter 0.15s;
}
#sendBtn:hover { filter: brightness(1.08); }
#sendBtn:active { transform: scale(0.92); }
/* Voice input (S225): one mic on the shared composer serves every agent;
   a second one rides the spawn wizard. Ember pulse = listening. */
.mic-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; color: var(--text-dim);
  border: 1px solid var(--line-strong);
  cursor: pointer; flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}
.mic-btn:hover { color: var(--ember); border-color: var(--ember-line); }
.mic-btn:active { transform: scale(0.92); }
.mic-btn.listening {
  color: #fff; background: var(--ember); border-color: var(--ember);
  animation: micPulse 1.6s ease-out infinite;
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 var(--ember-soft); }
  70% { box-shadow: 0 0 0 12px rgba(0, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}
.spawn-actions .mic-btn { margin-right: auto; }
.composer-hint {
  font-size: 11px; color: var(--text-faint);
  text-align: center; margin-top: 8px;
}

/* ---- generic views ---- */
.view-head { padding: 28px 28px 8px; }
.view-head h1 { font-family: var(--font-brand); font-size: 22px; font-weight: 600; }
.view-head p { color: var(--text-dim); margin-top: 6px; max-width: 560px; line-height: 1.5; }

/* ---- pricing band (two tiers + annual prepay) ---- */
#pricingBand { padding: 18px 28px 6px; }
.billing-toggle {
  display: inline-flex; gap: 4px;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; margin-bottom: 16px;
}
.bill-opt {
  border: none; background: none; cursor: pointer;
  font: 500 12.5px var(--font-ui); color: var(--text-dim);
  padding: 7px 14px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 7px;
}
.bill-opt.active { background: var(--bg-raise-2); color: var(--text); }
.bill-save {
  font-size: 10px; font-weight: 600;
  color: var(--good); background: rgba(62,207,142,0.12);
  padding: 2px 7px; border-radius: 9px;
}
.price-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px; max-width: 640px;
}
.price-card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
}
.price-card.featured { border-color: var(--ember-line); cursor: pointer; transition: box-shadow 0.2s, border-color 0.2s; }
.price-card.featured:hover { border-color: var(--ember); }
.price-card.featured.selected {
  border-color: var(--good);
  box-shadow: 0 0 0 1px var(--good), 0 10px 34px rgba(62, 207, 142, 0.2);
}
.price-flag {
  position: absolute; top: -9px; left: 18px;
  font-size: 10.5px; font-weight: 600;
  color: #fff; background: var(--ember);
  padding: 3px 10px; border-radius: 10px;
}
.price-tier { font-family: var(--font-brand); font-weight: 600; font-size: 15px; }
.price-amount { font-family: var(--font-brand); font-size: 30px; font-weight: 700; }
.price-per { font-size: 13px; font-weight: 400; color: var(--text-dim); margin-left: 3px; }
.price-note { font-size: 11.5px; color: var(--text-faint); }
.price-feats { margin: 8px 0 4px 18px; font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }
.price-feats li::marker { color: var(--ember); }
.price-cta-row { margin-top: auto; padding-top: 8px; }
.price-current-tag { font-size: 12.5px; font-weight: 600; color: var(--good); }
.price-foot { font-size: 11px; color: var(--text-faint); margin-top: 14px; max-width: 640px; line-height: 1.5; }

/* ---- catalog ---- */
#catalogGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 20px 28px 40px;
}
.cat-card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.cat-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.cat-card.owned { border-color: var(--ember-line); }
.cat-top { display: flex; align-items: center; justify-content: space-between; }
.cat-dept {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint);
}
.cat-lock { font-size: 13px; color: var(--text-faint); }
.cat-unlock-tag {
  display: none; font-size: 11px; font-weight: 600; color: var(--good);
  animation: tagIn 0.25s ease;
}
@keyframes tagIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Upgrade preview (Chris ruling S219: GREEN = unlocked/go, ember stays the
   brand/progress color): hovering/selecting the Full Workforce card shows
   every locked pad flipping open with a green outline — "this becomes yours." */
.cat-card.would-unlock {
  border-color: var(--good);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(62, 207, 142, 0.14);
}
.cat-card.would-unlock .cat-lock { display: none; }
.cat-card.would-unlock .cat-unlock-tag { display: inline; }
.cat-card.would-unlock .cat-price { color: var(--good); font-weight: 600; }
.cat-name { font-family: var(--font-brand); font-weight: 600; font-size: 15.5px; }
.cat-pitch { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; flex: 1; }
.cat-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.cat-price { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.cat-owned-tag { font-size: 11.5px; font-weight: 600; color: var(--good); }

/* ---- approvals ---- */
#approvalList { padding: 20px 28px 40px; display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.appr-card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.appr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.appr-agent { font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.appr-agent::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ember); display: inline-block;
}
.appr-time { font-size: 11.5px; color: var(--text-faint); }
.appr-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.appr-preview {
  font-size: 13px; color: var(--text-dim); line-height: 1.55;
  background: rgba(255,255,255,0.03);
  border-left: 2px solid var(--ember-line);
  padding: 10px 14px; margin: 10px 0; border-radius: 0 8px 8px 0;
}
.appr-actions { display: flex; gap: 8px; }

.empty-note { color: var(--text-faint); padding: 30px 28px; font-size: 13.5px; }

/* ---- activity ---- */
#activityList { padding: 20px 28px 40px; max-width: 720px; }
.act-row {
  display: flex; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.act-time { color: var(--text-faint); white-space: nowrap; font-size: 12px; padding-top: 1px; min-width: 74px; }
.act-body { color: var(--text-dim); line-height: 1.5; }
.act-body b { color: var(--text); font-weight: 600; }

/* ---- spawn ---- */
.spawn-card {
  margin: 20px 28px 40px;
  max-width: 640px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.spawn-label { display: block; font-weight: 600; margin-bottom: 10px; }
#spawnGoal {
  width: 100%; resize: vertical;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 12px 14px;
  color: var(--text); font: 400 14px/1.55 var(--font-ui);
  outline: none;
}
#spawnGoal:focus { border-color: var(--ember-line); }
.spawn-actions { display: flex; gap: 10px; margin-top: 16px; }
.spawn-plan-head {
  font-family: var(--font-brand); font-weight: 600; font-size: 15px;
  margin: 22px 0 10px; padding-top: 18px; border-top: 1px solid var(--line);
}
#spawnPlan { margin: 0 0 14px 20px; color: var(--text-dim); line-height: 1.7; }
#spawnPlan li::marker { color: var(--ember); }
.spawn-note {
  font-size: 12.5px; color: var(--text-dim); line-height: 1.55;
  background: var(--ember-soft); border-radius: 9px; padding: 10px 14px;
}

/* ============ RIGHT DETAIL RAIL ============ */
#detailRail {
  border-left: 1px solid var(--line);
  background: var(--ink);
  overflow-y: auto;
  padding: 22px 18px;
  display: flex; flex-direction: column; gap: 22px;
}
.detail-name { font-family: var(--font-brand); font-weight: 600; font-size: 16px; }
.detail-dept { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 3px; }
.detail-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); margin-bottom: 10px;
}
.detail-mission { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.ladder-action { padding: 9px 0; border-bottom: 1px solid var(--line); }
.ladder-action:last-child { border-bottom: none; }
.ladder-row { display: flex; align-items: center; justify-content: space-between; }
.ladder-name { font-size: 13px; font-weight: 500; }
.ladder-state { font-size: 11.5px; font-weight: 600; cursor: pointer; border: none; background: none; padding: 4px 10px; border-radius: 14px; }
.ladder-state.auto { color: var(--good); background: rgba(62,207,142,0.1); }
.ladder-state.ask { color: var(--ember); background: var(--ember-soft); }

.floor-row {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 11.5px; color: var(--text-faint); line-height: 1.5;
  margin-top: 12px; padding: 10px 12px;
  background: rgba(255,255,255,0.03); border-radius: 9px;
}
.floor-ico { font-size: 12px; }

.grad-body { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.grad-bar {
  height: 6px; border-radius: 3px; background: rgba(255,255,255,0.07);
  margin: 10px 0 6px; overflow: hidden;
}
.grad-fill { height: 100%; background: var(--ember); border-radius: 3px; transition: width 0.6s ease; }
.grad-count { font-size: 11.5px; color: var(--text-faint); }

.run-row { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.run-row:last-child { border-bottom: none; }
.run-when { color: var(--text-faint); font-size: 11px; }
.run-what { color: var(--text-dim); margin-top: 2px; line-height: 1.45; }

/* ---- team roster (S232/FLEET-0073) ---- */
.roster-row { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.roster-row:last-child { border-bottom: none; }
.roster-row-head { display: flex; flex-direction: column; gap: 2px; }
.roster-name { font-weight: 600; color: var(--text); }
.roster-meta { color: var(--text-faint); font-size: 11px; line-height: 1.5; }
.roster-row-actions { display: flex; gap: 6px; margin-top: 6px; }
.roster-btn { padding: 4px 10px; font-size: 11px; }

/* ---- run automatically (FLEET-0074, S232) ---- */
.schedule-controls { display: flex; gap: 8px; margin: 10px 0 2px; }
.schedule-select {
  flex: 1; min-width: 0;
  background: var(--bg-raise); border: 1px solid var(--line-strong);
  color: var(--text); font: 500 12.5px var(--font-ui);
  padding: 6px 8px; border-radius: 7px; cursor: pointer;
}
.schedule-status { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; margin-top: 8px; }

/* ---- chat canvas greeting ---- */
.greeting {
  font-family: var(--font-brand); font-size: 17px; font-weight: 600;
  padding: 4px 0 2px;
}
.greeting-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; font-family: var(--font-ui); font-weight: 400; }

/* ---- connections ---- */
#connGrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px; padding: 20px 28px 8px;
}
.conn-card {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.conn-ico { font-size: 20px; }
.conn-img { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; }
.conn-name { font-weight: 600; font-size: 14px; }
.conn-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; flex: 1; }
.conn-status { font-size: 11.5px; font-weight: 600; }
.conn-status.on { color: var(--good); }
.conn-status.off { color: var(--text-faint); }
.conn-foot { font-size: 11.5px; color: var(--text-faint); padding: 14px 28px 40px; max-width: 620px; line-height: 1.55; }
.conn-search-row { padding: 14px 28px 0; }
#connSearch {
  width: 100%; max-width: 380px;
  background: var(--bg-raise); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 9px 14px;
  color: var(--text); font: 400 13.5px var(--font-ui); outline: none;
}
#connSearch:focus { border-color: var(--ember-line); }
.conn-cat-label {
  grid-column: 1 / -1;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); padding-top: 10px;
}
.conn-cat-label:first-child { padding-top: 0; }
.conn-status.soon { color: var(--warn); }
.conn-card.request { border-style: dashed; align-items: flex-start; }

/* ---- billing / refer ---- */
.billing-wrap, .refer-wrap {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px; padding: 20px 28px 40px; max-width: 900px;
}
.bill-card {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.bill-card-title { font-family: var(--font-brand); font-weight: 600; font-size: 14.5px; }
.bill-hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }
.plan-line { font-size: 13px; color: var(--text-dim); display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); }
.plan-line:last-of-type { border-bottom: none; }
.plan-line b { color: var(--text); }
.seat-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.seat-row:last-of-type { border-bottom: none; }
.seat-mini-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--bg-raise-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-dim); flex-shrink: 0;
}
.seat-role-tag { margin-left: auto; font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.inv-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); padding: 6px 0; border-bottom: 1px solid var(--line); }
.inv-row:last-of-type { border-bottom: none; }
.inv-row b { color: var(--good); font-weight: 600; }
.trust-card { border-color: var(--ember-line); }
.trust-list { list-style: none; margin: 0; padding: 0; }
.trust-list li { font-size: 12.5px; color: var(--text-dim); padding: 6px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.trust-list li:last-child { border-bottom: none; }
.role-hint { color: var(--text-faint); }

.refer-link-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 10px 12px;
}
.refer-link-row code { font-size: 12.5px; color: var(--text); overflow-x: auto; white-space: nowrap; flex: 1; }
.refer-steps { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.refer-step { font-size: 12.5px; color: var(--text-dim); }
.refer-step b { color: var(--ember); margin-right: 4px; }
.refer-earnings { font-family: var(--font-brand); font-size: 32px; font-weight: 700; }
.refer-example { font-size: 12px; color: var(--text-dim); background: var(--ember-soft); border-radius: 8px; padding: 9px 12px; line-height: 1.55; }

/* TecHive skin (S221): brand-gated blocks + the MarketHive link field */
html:not([data-brand="techive"]) .techive-only { display: none; }
#mhLinkInput {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  padding: 8px 10px; border: 1px solid var(--line, #d8d4cc);
  border-radius: 8px; background: transparent; color: var(--text);
}
#mhLinkInput:focus { outline: none; border-color: var(--ember-line); }

/* ---- settings (FLEET-0069, S230) ---- */
#settingsNameInput {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  padding: 8px 10px; border: 1px solid var(--line, #d8d4cc);
  border-radius: 8px; background: transparent; color: var(--text);
}
#settingsNameInput:focus { outline: none; border-color: var(--ember-line); }
.settings-note {
  margin: 0 28px 10px; padding: 9px 14px; border-radius: 9px; font-size: 12.5px;
  background: var(--ember-soft); border: 1px solid var(--ember-line); color: var(--ember);
}
#settingsNotLive.settings-note {
  background: rgba(154,164,181,0.12); border-color: var(--line-strong); color: var(--text-dim);
}
/* ---- notification pref + A2HS hint (FLEET-0071, S230) ---- */
.pref-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.pref-row input[type="checkbox"] {
  width: 17px; height: 17px; accent-color: var(--ember); cursor: pointer; flex-shrink: 0;
}
.org-card { grid-column: 1 / -1; }
.org-level { margin-bottom: 14px; }
.org-level-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.org-level-rate { color: var(--ember); font-weight: 700; }
.org-level-sum { margin-left: auto; font-size: 12px; color: var(--text-dim); }
.org-member {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; font-size: 13px;
}
.org-member:nth-child(odd) { background: var(--ember-soft); }
.org-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fae5a; flex: none; }
.org-member.inactive .org-dot { background: #b9b3a8; }
.org-member.inactive { color: var(--text-dim); }
.org-meta { margin-left: auto; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.org-empty { font-size: 12px; color: var(--text-dim); padding: 6px 10px; }

/* S221: organization chart — avatar tree (Chris's reference image):
   person icons, small-caps names beneath, soft connectors, gold
   starburst = MarketHive Entrepreneur One, color = active / gray =
   position held. Toggles with the sheet below. */
.org-toggle { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.org-mode {
  font: inherit; font-size: 12px; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--ember-line); background: transparent;
  color: var(--text-dim); cursor: pointer;
}
.org-mode.active { background: var(--ember); border-color: var(--ember); color: #fff; }
.org-legend { margin-left: auto; font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.org-legend-seal { width: 12px; height: 12px; border-radius: 50%; background: #e9c46a; display: inline-block; }
#orgCanvas { overflow-x: auto; padding: 12px 4px 18px; }
.tree-people ul::before { border-color: rgba(130, 120, 105, 0.4); }
.tree-people li::before, .tree-people li::after { border-color: rgba(130, 120, 105, 0.4); }
.org-person { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 2px 10px; }
.org-person.inactive { opacity: 0.45; filter: grayscale(1); }
.org-avatar { position: relative; width: 46px; height: 46px; display: inline-block; }
.org-avatar svg:not(.org-seal) { position: relative; width: 46px; height: 46px; z-index: 1; }
.org-seal {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px;
  transform: translate(-50%, -50%); z-index: 0;
}
.org-name {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: #8a857c; white-space: nowrap;
}

/* S221: the org sheet — spreadsheet layout (Chris ruling, replaced the tree) */
#orgTable { overflow-x: auto; }
.org-sheet { width: 100%; border-collapse: collapse; font-size: 13px; }
.org-sheet th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); padding: 8px 10px; border-bottom: 2px solid var(--ember-line);
}
.org-sheet td { padding: 8px 10px; border-bottom: 1px solid var(--ember-soft); }
.org-sheet .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.org-sheet tbody tr:nth-child(odd):not(.org-row-subtotal):not(.org-row-total) { background: var(--ember-soft); }
.org-row-inactive td { color: var(--text-dim); }
.org-row-empty td { color: var(--text-dim); font-style: italic; }
.org-row-subtotal td { font-size: 12px; color: var(--text-dim); border-bottom: 1.5px solid var(--ember-line); }
.org-row-subtotal .num { font-weight: 600; color: var(--text); }
.org-row-total td { font-weight: 700; border-bottom: none; border-top: 2px solid var(--ember); padding-top: 10px; }

/* (legacy tree styles below — unused since the spreadsheet ruling) */
.org-totals { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.org-total-chip { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--ember-soft); color: var(--text-dim); }
.org-total-chip.strong { color: var(--text); font-weight: 600; }
#orgTree { overflow-x: auto; padding: 6px 2px 12px; }
.tree, .tree ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0; }
.tree ul { padding-top: 18px; position: relative; }
.tree ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 18px; border-left: 1.5px solid var(--ember-line); }
.tree li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 18px 8px 0; }
.tree > li { padding-top: 0; }
.tree li::before { content: ''; position: absolute; top: 0; left: 0; right: 50%; height: 18px; border-top: 1.5px solid var(--ember-line); border-right: 1.5px solid var(--ember-line); }
.tree li::after { content: ''; position: absolute; top: 0; left: 50%; right: 0; height: 18px; border-top: 1.5px solid var(--ember-line); }
.tree li:first-child::before { border-top: none; }
.tree li:last-child::after { display: none; }
.tree > li::before, .tree > li::after { display: none; }
.org-node { border: 1px solid var(--ember-line); background: var(--ember-soft); border-radius: 10px; padding: 7px 12px; font-size: 12.5px; text-align: center; white-space: nowrap; }
.org-node.me { background: var(--ember); border-color: var(--ember); color: #fff; }
.org-node.inactive { opacity: 0.55; border-style: dashed; background: transparent; }
.org-node-name { font-weight: 600; }
.org-node-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.org-node.me .org-node-sub { color: rgba(255, 255, 255, 0.85); }

/* ---- approval coordination ---- */
.appr-claim { font-size: 11px; color: var(--text-faint); margin-top: 8px; }
.detail-pause-btn { margin-left: auto; }

#scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40;
}

/* ============ RESPONSIVE ============ */

/* Mid width: drop the detail rail */
@media (max-width: 1080px) {
  body { grid-template-columns: 240px 1fr; }
  #detailRail { display: none; }
}

/* Rail mode: the Chrome side panel */
@media (max-width: 640px) {
  body { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; inset: 0 25% 0 0; z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  #sidebar.open { transform: translateX(0); }
  #topbar { display: flex; }
  #chatHeader { padding: 12px 16px; }
  #thread { padding: 16px; }
  #composerWrap { padding: 10px 12px 12px; }
  .msg { max-width: 92%; }
  .view-head { padding: 20px 16px 4px; }
  #catalogGrid, #approvalList, #activityList, #connGrid { padding: 16px; }
  .billing-wrap, .refer-wrap { padding: 16px; }
  .conn-foot { padding: 4px 16px 30px; }
  .spawn-card { margin: 16px; padding: 18px; }
  .chat-header-actions .btn-ghost { display: none; }
}
