/* =================================================================
   SACRED STUDIOS — Command Center · FLEET COCKPIT REFACE (2026-06-27)
   -----------------------------------------------------------------
   Global look-and-feel upgrade. Lifts the approved "premium dark
   cockpit" design system from the reface prototype and applies it to
   the LIVE app shell + every existing view.

   Strategy: this file loads LAST (after theme/app/views/.../polish),
   so it WINS the cascade. It re-points the shared design tokens
   (--bg-*, --text-*, --border, --accent, fonts, radii) to the cockpit
   palette, so the hundreds of existing components that read those
   tokens inherit the new look automatically — no per-view rewrite.
   Then it restyles the load-bearing chrome (rail, topbar, nav, cards,
   buttons) and adds the new rail components (teammate roster, $50k
   goal bar). Nothing here changes behavior or markup contracts.
   ================================================================= */

:root {
  /* ---- Cockpit surfaces (override theme.css Midnight) ---- */
  --bg-0: #0a0b0f;
  --bg-1: #111319;
  --bg-2: #161922;
  --bg-3: #1c2029;
  --bg-glass: rgba(10, 11, 15, 0.70);
  --bg-glass-strong: rgba(22, 25, 34, 0.92);

  --line: #23262f;
  --line-soft: #1a1d25;
  --border: #23262f;
  --border-strong: #2d313c;

  /* ---- Cockpit text ---- */
  --text-0: #ffffff;
  --text-1: #eef1f6;
  --text-2: #8b93a3;
  --text-3: #5b6371;
  --text-dim: #454c58;
  --mut: #8b93a3;
  --dim: #5b6371;

  /* ---- Cockpit accent (the fleet red) ---- */
  --accent: #ff3b4e;
  --accent-2: #ff6473;
  --accent-3: #c41230;
  --accent-glow: rgba(255, 59, 78, 0.40);
  --brand: #ff3b4e;
  --good: #22c55e;

  /* internal-build signal tracks the new accent so the top hairline
     stays on-brand for the reface */
  --internal: #ff3b4e;
  --internal-2: #ff6473;
  --internal-ink: #ffffff;
  --internal-glow: rgba(255, 59, 78, 0.40);
  --internal-wash: rgba(255, 59, 78, 0.12);

  --grad-sacred: linear-gradient(135deg, #ff6473 0%, #ff3b4e 55%, #c41230 110%);
  --grad-soft: linear-gradient(135deg, rgba(255, 59, 78, 0.16), rgba(255, 122, 82, 0.08));
  --grad-internal: linear-gradient(180deg, var(--internal), var(--internal-2));

  /* ---- Radii to match the prototype's 14px language ---- */
  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius: 13px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* ---- Fonts: Inter is the cockpit typeface ---- */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --sidebar-w: 264px;
  --topbar-h: 54px;
}

body {
  /* drop the crimson ambient wash for the flat cockpit black */
  background: var(--bg-0);
}
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ===================================================================
   RAIL  (re-theme the existing .sidebar into the teammate roster rail)
   =================================================================== */
.sidebar {
  background: linear-gradient(180deg, #0c0d12 0%, #0a0b0f 100%);
  border-right: 1px solid var(--line);
  backdrop-filter: none;
  padding: 16px 14px 0;
}
.brand { padding: 6px 8px 14px; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: radial-gradient(circle at 30% 30%, #ff6473, var(--brand));
  box-shadow: 0 0 16px rgba(255, 59, 78, 0.45);
  color: #fff; filter: none; padding: 5px;
}
.brand-name {
  font-weight: 700; letter-spacing: 0.14em; font-size: 13px; color: #fff;
}
.brand-sub { font-family: var(--font); letter-spacing: 0.1em; font-size: 11px; color: var(--dim); }
.brand-tag { display: none; }

/* --- $50k goal bar (rendered by app.js into #railGoal) --- */
.rail-goal {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; margin: 0 4px 18px;
}
.rail-goal-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.rail-goal-now { font-size: 18px; font-weight: 700; color: var(--text-1); }
.rail-goal-now small { color: var(--mut); font-weight: 500; font-size: 12px; }
.rail-goal-pct { font-size: 11px; color: var(--brand); font-weight: 600; }
.rail-goal-bar { height: 7px; border-radius: 6px; background: #1d2029; overflow: hidden; }
.rail-goal-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #ff3b4e, #ff7a52);
  box-shadow: 0 0 12px rgba(255, 59, 78, 0.5);
  transition: width 1.2s var(--ease);
}
.rail-goal-foot { display: flex; justify-content: space-between; margin-top: 8px; color: var(--dim); font-size: 11px; }

/* --- section labels --- */
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 0; }
.nav-group-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em; color: var(--dim);
  text-transform: uppercase; padding: 0 8px 8px; font-family: var(--font);
}
.nav-group-label:hover { background: transparent; color: var(--dim); }
.ngl-caret { display: none; }
.nav-group.collapsed .nav-group-items { display: flex; } /* fleet rail never collapses */
.nav-group-items { gap: 2px; }

/* --- Mission Control + generic nav row (home style) --- */
.nav-item {
  gap: 11px; padding: 10px 12px; border-radius: 11px;
  color: var(--mut); font-weight: 500; font-size: 13px;
}
.nav-item .nv-ico { width: 18px; font-size: 15px; opacity: 1; color: var(--mut); }
.nav-item:hover { background: var(--bg-1); color: var(--text-1); }
.nav-item:hover .nv-ico { color: var(--text-1); }
.nav-item.active { background: linear-gradient(90deg, rgba(255, 59, 78, 0.13), rgba(255, 59, 78, 0.03)); color: var(--text-1); }
.nav-item.active .nv-ico { color: var(--text-1); }
.nav-item.active::before {
  top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
  background: var(--brand); box-shadow: 0 0 10px var(--brand);
}

/* --- WORKSPACE rows: secondary, smaller --- */
.nav-group.ws .nav-item { padding: 8px 12px; border-radius: 9px; font-size: 13px; }
.nav-group.ws .nav-item.active { background: var(--bg-1); }
.nav-group.ws .nav-item.active::before { display: none; }

/* --- FLEET teammate rows (rich avatar + role + status + needs pill) --- */
.fleet-row {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px 7px 11px; border-radius: 11px; position: relative;
  min-height: 52px; cursor: pointer; color: inherit;
  transition: background .16s var(--ease);
}
.fleet-row::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 3px; background: var(--ag, #fff); opacity: 0; transition: opacity .18s var(--ease);
}
.fleet-row:hover { background: var(--bg-1); }
.fleet-row.active { background: var(--bg-2); }
.fleet-row.active::before { opacity: 1; box-shadow: 0 0 9px var(--ag); }
.fleet-av {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: color-mix(in srgb, var(--ag) 17%, #13151c);
  border: 1px solid color-mix(in srgb, var(--ag) 34%, transparent);
}
.fleet-meta { flex: 1; min-width: 0; }
.fleet-meta .nm { font-weight: 600; font-size: 13px; color: var(--text-1); line-height: 1.25; }
.fleet-meta .rl { font-size: 11px; color: var(--dim); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fleet-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.fleet-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.fleet-dot.on { background: var(--good); box-shadow: 0 0 7px rgba(34, 197, 94, 0.7); }
.fleet-dot.idle { background: #3a3f4a; }
.fleet-dot.busy { background: #f5a623; box-shadow: 0 0 7px rgba(245, 166, 35, 0.6); }
.fleet-need {
  font-size: 10px; font-weight: 700; color: #fff; background: var(--brand);
  min-width: 17px; height: 17px; border-radius: 9px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 6px rgba(255, 59, 78, 0.5);
}
/* tiny workspace badge */
.nav-group.ws .nav-badge {
  background: #181b22; color: var(--dim); box-shadow: none;
  font-weight: 600; font-size: 10px;
}

/* --- rail footer / account chip --- */
.sidebar-foot {
  border-top: 1px solid var(--line); padding: 11px 8px;
  margin: 8px -14px 0; background: #0a0b0f;
}
.nav-foot { border-top: none; padding-top: 0; }
.nav-foot .nav-foot-item { border-radius: 9px; }
.user-chip { background: transparent; border: none; padding: 8px; }
.avatar { border-radius: 9px; background: linear-gradient(135deg, #2a2e38, #1a1d25); border: 1px solid var(--line); }

/* ===================================================================
   TOPBAR
   =================================================================== */
.topbar {
  height: var(--topbar-h); padding: 0 26px; gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 11, 15, 0.7); backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 14px; font-weight: 600; color: var(--text-1); }
.topbar .crumb { color: var(--dim); font-size: 12px; }
.menu-toggle { color: var(--mut); }

.sage-btn {
  padding: 7px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(90deg, rgba(255, 59, 78, 0.16), rgba(255, 59, 78, 0.06));
  border: 1px solid rgba(255, 59, 78, 0.32); color: #ffd2d6; box-shadow: none;
}
.sage-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255, 59, 78, 0.22); filter: none; }
.sage-btn kbd { background: rgba(0, 0, 0, 0.28); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-1); color: var(--mut);
}
.icon-btn:hover { background: var(--bg-2); color: var(--text-1); border-color: var(--line); }

.view-scroll { padding: 26px 30px 60px; }

/* ===================================================================
   SHARED COMPONENTS — re-skin to the cockpit
   =================================================================== */
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); }
.card.hover:hover, .card:hover { border-color: var(--border-strong); }

.btn {
  border-radius: 9px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); color: var(--text-2); background: var(--bg-2);
}
.btn:hover { color: var(--text-1); border-color: var(--border-strong); background: var(--bg-3); }
.btn.primary {
  background: linear-gradient(90deg, #1c7a44, #22c55e); color: #fff; border: none;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.22);
}
.btn.primary:hover { box-shadow: 0 4px 16px rgba(34, 197, 94, 0.34); filter: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text-1); }

.section-head h2 { color: var(--text-1); font-weight: 700; }

/* focus / stat / pill cards pick up the new tokens automatically; nudge a few */
.stat { background: var(--bg-1); border: 1px solid var(--line); }
.stat::after { opacity: .35; }
.pill { background: var(--bg-3); color: var(--text-1); }

/* Sage drawer + toast pick up the tokens; just align the orb */
.sage-orb { background: var(--grad-sacred); }

/* ===================================================================
   MOBILE — rail collapses; bottom nav re-skins via tokens
   =================================================================== */
@media (max-width: 768px) {
  .sidebar { width: 84vw; max-width: 300px; }
  .sidebar-foot { margin-left: 0; margin-right: 0; }
}
