/* ============================================================
   QUANTA OS — Company Operating System shell
   QUANTA_OS_NAVIGATION_V1
   Design language: Apple · Linear · Cursor · Vercel · Palantir Foundry
   Dark-mode-first. Soft borders, calm spacing, deliberate hierarchy.
   All classes are namespaced `qos-` to avoid colliding with morning.css.
   ============================================================ */

:root {
  --qos-sidebar-w: 220px;
  --qos-rail-w: 60px;
  --qos-topbar-h: 48px;
  --qos-radius: 14px;
  --qos-radius-sm: 9px;
  --qos-radius-xs: 6px;
  --qos-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Dark theme (default) */
  --qos-bg: #0a0b0e;
  --qos-bg-grad: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(11, 63, 228, 0.14), transparent 55%), #0a0b0e;
  --qos-honeycomb: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cg fill='none' stroke='%231EF2C5' stroke-width='0.4' stroke-opacity='0.028'%3E%3Cpolygon points='28,1 54,16 54,45 28,60 2,45 2,16'/%3E%3Cpolygon points='28,37 54,52 54,81 28,96 2,81 2,52'/%3E%3C/g%3E%3C/svg%3E");
  --qos-rail-bg: #0c0d11;
  --qos-surface: #131419;
  --qos-surface-2: #181a21;
  --qos-surface-3: #1e212a;
  --qos-border: rgba(255, 255, 255, 0.075);
  --qos-border-strong: rgba(255, 255, 255, 0.14);
  --qos-text: #e9ebf0;
  --qos-text-dim: #9aa1ad;
  --qos-text-faint: #686f7d;
  --qos-accent: #1ef2c5;
  --qos-accent-soft: rgba(30, 242, 197, 0.12);
  --qos-accent-border: rgba(30, 242, 197, 0.35);
  --qos-critical: #ff5d5d;
  --qos-critical-soft: rgba(255, 93, 93, 0.12);
  --qos-warn: #f5b14a;
  --qos-warn-soft: rgba(245, 177, 74, 0.13);
  --qos-ok: #41d196;
  --qos-ok-soft: rgba(65, 209, 150, 0.12);
  --qos-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 30px rgba(0,0,0,0.35);
  --qos-shadow-lg: 0 24px 80px rgba(0,0,0,0.55);
  --qos-font: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --qos-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --qos-context-w: 248px;
  --qos-macos-titlebar-h: 0px;
}

body[data-qos-theme="light"] {
  --qos-bg: #f6f7f9;
  --qos-bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(110,139,255,0.10), transparent 60%), #f6f7f9;
  --qos-rail-bg: #ffffff;
  --qos-surface: #ffffff;
  --qos-surface-2: #f3f4f7;
  --qos-surface-3: #eceef2;
  --qos-border: rgba(15, 23, 42, 0.09);
  --qos-border-strong: rgba(15, 23, 42, 0.16);
  --qos-text: #11151c;
  --qos-text-dim: #586173;
  --qos-text-faint: #8a93a4;
  --qos-accent: #3a5bd9;
  --qos-accent-soft: rgba(58, 91, 217, 0.10);
  --qos-accent-border: rgba(58, 91, 217, 0.35);
  --qos-shadow: 0 1px 2px rgba(15,23,42,0.06), 0 10px 30px rgba(15,23,42,0.08);
  --qos-shadow-lg: 0 24px 70px rgba(15,23,42,0.18);
}

/* ---------- Shell layout ---------- */
body.qos-active {
  margin: 0;
  background:
    var(--qos-bg-grad),
    var(--qos-honeycomb),
    var(--qos-bg);
  background-size: 100% 100%, 56px 97px, auto;
  color: var(--qos-text);
  font-family: var(--qos-font);
  padding-left: var(--qos-sidebar-w);
  padding-right: var(--qos-context-w);
  transition: padding-left 0.24s var(--qos-ease), padding-right 0.24s var(--qos-ease);
}
body.qos-active.qos-collapsed { padding-left: var(--qos-rail-w); }
body.qos-active.qos-context-collapsed { padding-right: 0; }

/* Native SwiftUI shell — hide duplicate chrome (sidebar, context, topbar). */
body.qos-active.qos-native-shell {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body.qos-native-shell #qos-sidebar,
body.qos-native-shell .qos-sidebar-resize,
body.qos-native-shell .qos-context-panel,
body.qos-native-shell .qos-context-resize {
  display: none !important;
}
body.qos-native-shell .qos-topbar {
  display: none !important;
}
body.qos-native-shell .qos-view {
  padding: 20px 24px 48px;
  max-width: none;
}
body.qos-native-shell #qos-palette-overlay {
  display: none !important;
}

/* hide the legacy infinite-scroll dashboard chrome by default */
.qos-active .topbar { display: none !important; }
.qos-active .app { display: none; }
.qos-active.qos-legacy .app {
  display: block;
  background: transparent;
  max-width: none;
}
.qos-active.qos-legacy #qos-content { display: none; }

/* Desktop founder mode — no service badge bar (legacy topbar stays hidden). */
body.qos-desktop.qos-mode-founder .topbar-status,
body.qos-desktop.qos-mode-founder .topbar-pills,
body.qos-desktop.qos-mode-founder #topbar-pills { display: none !important; }

/* ---------- Sidebar ---------- */
#qos-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--qos-sidebar-w);
  background: var(--qos-rail-bg);
  border-right: 1px solid var(--qos-border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: width 0.24s var(--qos-ease);
  overflow: hidden;
}
body.qos-resizing #qos-sidebar { transition: none; }
.qos-collapsed #qos-sidebar { width: var(--qos-rail-w); }

.qos-sidebar-resize {
  position: absolute; top: 0; right: -3px; width: 6px; height: 100%;
  cursor: col-resize; z-index: 70;
}
.qos-sidebar-resize:hover { background: var(--qos-accent-soft); }
body.qos-resizing { cursor: col-resize; user-select: none; }
.qos-collapsed .qos-sidebar-resize { display: none; }

/* macOS Electron — empty drag strip clears traffic-light overlap */
.qos-macos-titlebar { display: none; }
body.qos-desktop {
  --qos-bg: #000000;
  --qos-bg-grad: #000000;
  --qos-rail-bg: #000000;
  --qos-macos-titlebar-h: 38px;
  --qos-topbar-h: 44px;
  --qos-border: rgba(255, 255, 255, 0.055);
  --qos-border-strong: rgba(255, 255, 255, 0.11);
}
body.qos-desktop .qos-macos-titlebar {
  display: block;
  flex-shrink: 0;
  height: var(--qos-macos-titlebar-h);
  min-height: var(--qos-macos-titlebar-h);
  background: #000000;
  -webkit-app-region: drag;
}
body.qos-desktop .qos-topbar {
  height: calc(var(--qos-topbar-h) + var(--qos-macos-titlebar-h));
  padding-top: var(--qos-macos-titlebar-h);
  padding-left: 16px;
  padding-right: 16px;
  gap: 8px;
  box-sizing: border-box;
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: #000000;
  backdrop-filter: none;
}
body.qos-desktop .qos-ctx-toolbar {
  height: calc(var(--qos-topbar-h) + var(--qos-macos-titlebar-h));
  padding-top: var(--qos-macos-titlebar-h);
  box-sizing: border-box;
}
body.qos-desktop .qos-side-head {
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 4px 12px 8px;
  border-bottom-color: rgba(255, 255, 255, 0.045);
  -webkit-app-region: no-drag;
}
body.qos-desktop .qos-side-head--desktop .qos-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  margin-top: 0;
  object-fit: contain;
  content: url("/assets/brand/quanta-logo-white.svg");
}
body.qos-desktop .qos-side-head--desktop .qos-side-brand {
  flex-direction: row;
  align-items: baseline;
  gap: 0;
}
body.qos-desktop .qos-side-head--desktop .qos-side-brand b {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
body.qos-desktop .qos-pin-section {
  padding: 4px 8px 2px;
  border-bottom-color: rgba(255, 255, 255, 0.045);
}
body.qos-desktop .qos-pin-rail { gap: 1px; margin-top: 2px; }
body.qos-desktop .qos-pin-item { padding: 5px 8px; font-size: 12px; }
body.qos-desktop .qos-nav { padding: 6px 8px 12px; }
body.qos-desktop .qos-nav-group { margin-top: 10px; }
body.qos-desktop .qos-nav-group:first-child { margin-top: 0; }
body.qos-desktop .qos-nav-group-label {
  font-size: 10px;
  padding: 2px 8px 4px;
  letter-spacing: 0.08em;
}
body.qos-desktop .qos-nav-item {
  gap: 9px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 7px;
}
body.qos-desktop .qos-nav-item.active::before { left: -8px; height: 16px; }
body.qos-desktop .qos-side-foot {
  padding: 6px 8px 8px;
  border-top-color: rgba(255, 255, 255, 0.045);
}
body.qos-desktop .qos-mode-toggle {
  padding: 6px 8px;
  font-size: 12px;
  border: none;
  background: transparent;
}
body.qos-desktop .qos-mode-toggle:hover { background: var(--qos-surface-2); }
body.qos-desktop .qos-crumb span { display: none; }
body.qos-desktop .qos-crumb b { font-size: 14px; font-weight: 600; }
body.qos-desktop .qos-search-trigger {
  min-width: 160px;
  height: 30px;
  font-size: 12px;
}
body.qos-desktop .qos-icon-btn { width: 30px; height: 30px; font-size: 14px; }
body.qos-desktop .qos-view {
  padding: 18px 22px 40px;
  max-width: none;
}
body.qos-desktop .qos-view-head { margin-bottom: 14px; }
body.qos-desktop .qos-view-head h1 { font-size: 22px; }
body.qos-desktop .qos-view-head p { font-size: 13px; margin-top: 3px; }
body.qos-desktop #qos-sidebar { border-right-color: rgba(255, 255, 255, 0.045); }
body.qos-desktop .qos-context-panel { border-left-color: rgba(255, 255, 255, 0.045); }

/* Top toolbar mode switch (Cursor-style segmented control) */
.qos-mode-switch--topbar {
  flex-wrap: nowrap;
  gap: 0;
  padding: 2px;
  margin-right: 4px;
  border: none;
  border-radius: 8px;
  background: var(--qos-surface-2);
  flex-shrink: 0;
}
.qos-mode-switch--topbar .qos-mode-btn {
  flex: none;
  min-width: 0;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--qos-text-faint);
  border-radius: 6px;
}
.qos-mode-switch--topbar .qos-mode-btn:hover {
  color: var(--qos-text-dim);
  border-color: transparent;
}
.qos-mode-switch--topbar .qos-mode-btn.active {
  background: var(--qos-surface-3);
  color: var(--qos-text);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.qos-side-head {
  display: flex; align-items: flex-start; gap: 11px;
  min-height: 72px;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--qos-border);
  flex-shrink: 0;
}
.qos-side-head img, .qos-side-head .qos-logo { width: 52px; height: 52px; border-radius: 0; object-fit: contain; object-position: center; flex-shrink: 0; margin-top: 1px; }
.qos-side-brand { display: flex; flex-direction: column; line-height: 1.3; overflow: hidden; gap: 2px; min-width: 0; flex: 1; }
.qos-side-brand b { font-size: 17px; letter-spacing: -0.02em; font-weight: 700; line-height: 1.15; }
.qos-side-brand span { font-size: 11px; color: var(--qos-text-faint); }
.qos-side-brand .qos-tagline { font-size: 11px; color: var(--qos-text-dim); font-weight: 550; line-height: 1.35; white-space: normal; }
.qos-side-brand .qos-tagline-sub { font-size: 11px; color: var(--qos-text-dim); font-weight: 500; line-height: 1.35; white-space: normal; }
.qos-side-brand .qos-subline { font-size: 10px; color: var(--qos-text-faint); letter-spacing: 0.01em; line-height: 1.35; margin-top: 2px; white-space: normal; }
.qos-collapsed .qos-side-head {
  justify-content: center; align-items: center;
  min-height: 52px; padding: 8px;
}
body.qos-desktop.qos-collapsed .qos-side-head { display: none; }
body.qos-desktop.qos-collapsed .qos-macos-titlebar {
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 6px;
}
body.qos-desktop.qos-collapsed .qos-macos-titlebar::after {
  content: "";
  width: 34px; height: 34px;
  border-radius: 10px;
  background: center / contain no-repeat url("/assets/brand/quanta-logo-white.svg");
  -webkit-app-region: no-drag;
}
.qos-collapsed .qos-side-head .qos-logo { width: 34px; height: 34px; margin-top: 0; object-fit: contain; }
.qos-collapsed .qos-side-brand { display: none; }

/* ---------- V3 mode switcher ---------- */
.qos-mode-switch {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px 6px;
  border-bottom: 1px solid var(--qos-border); flex-shrink: 0;
}
.qos-mode-btn {
  flex: 1; min-width: 0; padding: 6px 4px; border-radius: var(--qos-radius-xs);
  border: 1px solid var(--qos-border); background: var(--qos-surface-2);
  color: var(--qos-text-faint); font-size: 10.5px; font-weight: 650;
  letter-spacing: 0.02em; cursor: pointer; transition: all 0.12s;
}
.qos-mode-btn:hover { color: var(--qos-text-dim); border-color: var(--qos-border-strong); }
.qos-mode-btn.active { background: var(--qos-accent-soft); color: var(--qos-text); border-color: var(--qos-accent-border); }
.qos-mode-hint {
  width: 100%; font-size: 10px; color: var(--qos-text-faint); padding: 4px 2px 0;
  line-height: 1.3;
}
.qos-collapsed .qos-mode-switch { display: none; }

/* ---------- Pinned rail ---------- */
.qos-pin-section {
  padding: 8px 10px 4px; border-bottom: 1px solid var(--qos-border); flex-shrink: 0;
  background: var(--qos-rail-bg); position: relative; z-index: 1;
}
.qos-pin-rail { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.qos-pin-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: var(--qos-radius-xs);
  border: none; background: var(--qos-rail-bg); color: var(--qos-text-dim);
  font-size: 12.5px; font-weight: 550; cursor: pointer; text-align: left;
  transition: background 0.12s, color 0.12s;
}
.qos-pin-item:hover { background: var(--qos-surface-2); color: var(--qos-text); }
.qos-pin-item.active { background: var(--qos-accent-soft); color: var(--qos-accent); }
.qos-pin-star { color: var(--qos-warn); font-size: 11px; flex-shrink: 0; }
.qos-pin-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qos-collapsed .qos-pin-section { display: none; }

.qos-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 20px; }
.qos-nav::-webkit-scrollbar { width: 8px; }
.qos-nav::-webkit-scrollbar-thumb { background: var(--qos-border-strong); border-radius: 8px; }
.qos-nav-group { margin-top: 14px; }
.qos-nav-group:first-child { margin-top: 2px; }
.qos-nav-group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--qos-text-faint);
  padding: 4px 10px 6px; white-space: nowrap;
}
.qos-collapsed .qos-nav-group-label { opacity: 0; height: 10px; padding: 0; }

.qos-nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--qos-radius-sm);
  color: var(--qos-text-dim);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; background: none; text-align: left;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.qos-nav-item:hover { background: var(--qos-surface-2); color: var(--qos-text); }
.qos-nav-item.active { background: var(--qos-accent-soft); color: var(--qos-text); }
.qos-nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--qos-accent);
}
.qos-nav-ic { width: 18px; text-align: center; flex-shrink: 0; font-size: 15px; opacity: 0.9; }
.qos-nav-label { white-space: nowrap; overflow: hidden; flex: 1; }
.qos-collapsed .qos-nav-label { display: none; }
.qos-nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--qos-critical); color: #fff;
  border-radius: 999px; padding: 1px 7px; min-width: 8px; text-align: center;
}
.qos-nav-badge.muted { background: var(--qos-surface-3); color: var(--qos-text-dim); }
.qos-collapsed .qos-nav-badge { position: absolute; top: 3px; right: 4px; padding: 0 4px; font-size: 9px; }

.qos-side-foot { border-top: 1px solid var(--qos-border); padding: 10px; flex-shrink: 0; }
.qos-mode-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  padding: 9px 10px; border-radius: var(--qos-radius-sm);
  background: var(--qos-surface-2); border: 1px solid var(--qos-border);
  color: var(--qos-text-dim); cursor: pointer; font-size: 12.5px; font-weight: 500;
  transition: all 0.14s;
}
.qos-mode-toggle:hover { color: var(--qos-text); border-color: var(--qos-border-strong); }
.qos-mode-toggle .qos-mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--qos-accent); flex-shrink: 0; }
.qos-mode-toggle b { color: var(--qos-text); font-weight: 600; }
.qos-collapsed .qos-mode-toggle span.qos-mode-text { display: none; }

/* ---------- Content + topbar ---------- */
#qos-content { min-height: 100vh; }
.qos-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--qos-topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--qos-bg) 78%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--qos-border);
}
.qos-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--qos-radius-sm);
  border: 1px solid transparent; background: none; color: var(--qos-text-dim);
  cursor: pointer; font-size: 16px; transition: all 0.12s;
}
.qos-icon-btn:hover { background: var(--qos-surface-2); color: var(--qos-text); }
.qos-crumb { display: flex; flex-direction: column; line-height: 1.2; }
.qos-crumb b { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.qos-crumb span { font-size: 11.5px; color: var(--qos-text-faint); }
.qos-topbar-spacer { flex: 1; }
.qos-search-trigger {
  display: flex; align-items: center; gap: 9px;
  height: 34px; padding: 0 12px; min-width: 210px;
  border-radius: var(--qos-radius-sm);
  background: var(--qos-surface); border: 1px solid var(--qos-border);
  color: var(--qos-text-faint); cursor: pointer; font-size: 13px; transition: all 0.12s;
}
.qos-search-trigger:hover { border-color: var(--qos-border-strong); color: var(--qos-text-dim); }
.qos-search-trigger kbd {
  margin-left: auto; font-family: var(--qos-mono); font-size: 11px;
  background: var(--qos-surface-3); border: 1px solid var(--qos-border);
  border-radius: 5px; padding: 1px 6px; color: var(--qos-text-dim);
}
@media (max-width: 900px) { .qos-search-trigger { min-width: 40px; } .qos-search-trigger span, .qos-search-trigger kbd { display: none; } }

/* ---------- View canvas ---------- */
.qos-view { padding: 26px 28px 60px; max-width: 1180px; margin: 0 auto; animation: qos-fade 0.26s var(--qos-ease); }
@keyframes qos-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.qos-view-head { margin-bottom: 20px; }
.qos-view-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.qos-view-head p { color: var(--qos-text-dim); margin: 5px 0 0; font-size: 14px; }

/* ---------- Cards ---------- */
.qos-card {
  background: var(--qos-surface); border: 1px solid var(--qos-border);
  border-radius: var(--qos-radius); padding: 18px 20px; box-shadow: var(--qos-shadow);
}
.qos-card + .qos-card { margin-top: 14px; }
.qos-grid { display: grid; gap: 14px; }
.qos-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.qos-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .qos-grid.cols-2, .qos-grid.cols-3 { grid-template-columns: 1fr; } }

.qos-section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--qos-text-faint); margin: 26px 2px 12px;
}
.qos-section-label .qos-pip { width: 7px; height: 7px; border-radius: 50%; background: var(--qos-text-faint); }
.qos-section-label.critical { color: var(--qos-critical); }
.qos-section-label.critical .qos-pip { background: var(--qos-critical); box-shadow: 0 0 0 4px var(--qos-critical-soft); }
.qos-section-label.attention { color: var(--qos-warn); }
.qos-section-label.attention .qos-pip { background: var(--qos-warn); box-shadow: 0 0 0 4px var(--qos-warn-soft); }

/* ---------- Hero / critical card ---------- */
.qos-hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(135deg, rgba(110,139,255,0.10), transparent 55%),
    var(--qos-surface);
  border: 1px solid var(--qos-accent-border);
  border-radius: 18px; padding: 26px 28px;
}
.qos-hero.is-critical {
  background: linear-gradient(135deg, var(--qos-critical-soft), transparent 55%), var(--qos-surface);
  border-color: rgba(255, 93, 93, 0.4);
}
.qos-hero-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--qos-critical); }
.qos-hero h2 { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 6px; }
.qos-hero p { color: var(--qos-text-dim); margin: 0; font-size: 14.5px; line-height: 1.5; }
.qos-hero-meta { display: flex; flex-wrap: wrap; gap: 22px; margin: 18px 0 4px; }
.qos-metric { display: flex; flex-direction: column; gap: 2px; }
.qos-metric b { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.qos-metric span { font-size: 11.5px; color: var(--qos-text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.qos-metric.crit b { color: var(--qos-critical); }
.qos-progress { height: 6px; border-radius: 999px; background: var(--qos-surface-3); overflow: hidden; margin-top: 8px; width: 140px; }
.qos-progress > i { display: block; height: 100%; background: var(--qos-warn); border-radius: 999px; }
.qos-hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.qos-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--qos-radius-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--qos-border-strong); background: var(--qos-surface-2); color: var(--qos-text);
  transition: all 0.13s var(--qos-ease);
}
.qos-btn:hover { border-color: var(--qos-border-strong); transform: translateY(-1px); }
.qos-btn.primary { background: var(--qos-accent); border-color: transparent; color: #fff; }
.qos-btn.primary:hover { box-shadow: 0 6px 22px rgba(110,139,255,0.35); }
.qos-btn.danger { color: var(--qos-critical); border-color: rgba(255,93,93,0.3); background: var(--qos-critical-soft); }
.qos-btn.ghost { background: none; border-color: transparent; color: var(--qos-text-dim); }
.qos-btn.ghost:hover { background: var(--qos-surface-2); color: var(--qos-text); }
.qos-btn.small { padding: 6px 11px; font-size: 12.5px; }
.qos-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Inputs / selects / badges (Account, Team, API Keys) ---------- */
.qos-input {
  padding: 9px 12px; border-radius: var(--qos-radius-sm);
  border: 1px solid var(--qos-border); background: var(--qos-surface-2);
  color: var(--qos-text); font-size: 13px; font-family: inherit; outline: none;
}
.qos-input:focus { border-color: var(--qos-accent-border); box-shadow: 0 0 0 3px var(--qos-accent-soft); }
.qos-input.small { padding: 6px 9px; font-size: 12.5px; }
select.qos-input { cursor: pointer; }
.qos-badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--qos-border-strong); color: var(--qos-text-dim);
}
.qos-badge.ok { color: #34d399; border-color: rgba(52,211,153,0.4); background: rgba(52,211,153,0.10); }

/* ---------- Action engine list ---------- */
.qos-action-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--qos-radius-sm);
  background: var(--qos-surface); border: 1px solid var(--qos-border);
  transition: border-color 0.13s, transform 0.13s;
}
.qos-action-row + .qos-action-row { margin-top: 9px; }
.qos-action-row:hover { border-color: var(--qos-border-strong); transform: translateX(2px); }
.qos-rank {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--qos-surface-3); color: var(--qos-text-dim); font-weight: 700; font-size: 14px;
}
.qos-action-row:nth-child(1) .qos-rank { background: var(--qos-accent); color: #fff; }
.qos-action-body { flex: 1; min-width: 0; }
.qos-action-body b { font-size: 14.5px; font-weight: 600; display: block; }
.qos-action-body span { font-size: 13px; color: var(--qos-text-dim); }
.qos-action-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.qos-score { font-family: var(--qos-mono); font-size: 12px; color: var(--qos-text-faint); }

/* ---------- Chips / badges ---------- */
.qos-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--qos-surface-3); color: var(--qos-text-dim); border: 1px solid var(--qos-border);
}
.qos-chip.ok { background: var(--qos-ok-soft); color: var(--qos-ok); border-color: transparent; }
.qos-chip.warn { background: var(--qos-warn-soft); color: var(--qos-warn); border-color: transparent; }
.qos-chip.crit { background: var(--qos-critical-soft); color: var(--qos-critical); border-color: transparent; }
.qos-chip.accent { background: var(--qos-accent-soft); color: var(--qos-accent); border-color: transparent; }

/* ---------- List items (generic views) ---------- */
.qos-list-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid var(--qos-border);
}
.qos-list-item:last-child { border-bottom: none; }
.qos-li-body { flex: 1; min-width: 0; }
.qos-li-body b { font-size: 14px; font-weight: 600; }
.qos-li-body p { margin: 3px 0 0; font-size: 13px; color: var(--qos-text-dim); }
.qos-li-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- Approval groups ---------- */
.qos-approval-group { margin-bottom: 16px; }
.qos-approval-group-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.qos-approval-group-head h3 { font-size: 14px; font-weight: 650; margin: 0; }
.qos-approval-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-radius: var(--qos-radius-sm);
  background: var(--qos-surface); border: 1px solid var(--qos-border); margin-bottom: 8px;
}
.qos-approval-item label.qos-check { display: flex; align-items: center; cursor: pointer; }
.qos-approval-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--qos-accent); cursor: pointer; }
.qos-approval-item .qos-li-body b { display: block; }
.qos-approval-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-top: 8px;
  background: color-mix(in srgb, var(--qos-bg) 86%, transparent);
  backdrop-filter: blur(12px); border: 1px solid var(--qos-border); border-radius: var(--qos-radius);
}
.qos-approval-bar .qos-count { font-size: 13px; color: var(--qos-text-dim); }
.qos-approval-bar .qos-count b { color: var(--qos-text); }

/* ---------- Approval Center V2 (outcome-centric) ---------- */
.qos-approval-v2-wrap { align-items: flex-start; flex-wrap: wrap; }
.qos-approval-v2-wrap.is-focus { border-color: var(--qos-accent-border); box-shadow: 0 0 0 1px var(--qos-accent-soft); }
.qos-appr-title { font-size: 16px; font-weight: 650; margin: 0 0 10px; letter-spacing: -0.01em; }
.qos-appr-field { margin-bottom: 10px; }
.qos-appr-label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--qos-text-faint); margin-bottom: 3px;
}
.qos-appr-field p { margin: 0; font-size: 13.5px; color: var(--qos-text-dim); line-height: 1.45; }
.qos-appr-details { margin-top: 12px; font-size: 13px; }
.qos-appr-details summary { cursor: pointer; color: var(--qos-accent); font-weight: 600; }
.qos-appr-body {
  white-space: pre-wrap; font-size: 12px; color: var(--qos-text-dim);
  margin-top: 8px; max-height: 200px; overflow: auto;
  background: var(--qos-surface-3); padding: 10px; border-radius: var(--qos-radius-xs);
}
.qos-appr-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.qos-appr-actions { align-self: flex-start; padding-top: 4px; }
.qos-dev-id { font-family: var(--qos-mono); font-size: 10px; color: var(--qos-text-faint); margin-top: 8px; }
body.qos-mode-founder .qos-dev-id { display: none; }
.qos-dev-pre { font-family: var(--qos-mono); }

/* ---------- Build Home engineering cockpit ---------- */
.qos-build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.qos-metric-card {
  background: var(--qos-surface);
  border: 1px solid var(--qos-border);
  border-radius: var(--qos-radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.16s var(--qos-ease), background 0.16s var(--qos-ease);
}
.qos-metric-card:hover { border-color: var(--qos-border-strong); background: var(--qos-surface-2); }
.qos-metric-card.is-ok { border-color: rgba(65, 209, 150, 0.25); }
.qos-metric-card.is-warn { border-color: rgba(245, 177, 74, 0.25); }
.qos-metric-card.is-crit { border-color: rgba(255, 93, 93, 0.25); }
.qos-metric-card.is-accent { border-color: var(--qos-accent-border); }
.qos-metric-label { display: block; font-size: 11px; color: var(--qos-text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.qos-metric-value { display: block; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; font-family: var(--qos-mono); line-height: 1.2; }
.qos-metric-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--qos-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Activity timeline ---------- */
.qos-activity-feed { padding: 4px 0; }
.qos-activity-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 14px; border-bottom: 1px solid var(--qos-border);
  cursor: pointer; transition: background 0.12s;
}
.qos-activity-row:last-child { border-bottom: none; }
.qos-activity-row:hover { background: var(--qos-surface-2); }
.qos-activity-time { font-size: 11px; font-family: var(--qos-mono); color: var(--qos-text-faint); min-width: 44px; padding-top: 1px; }
.qos-activity-text { font-size: 13.5px; color: var(--qos-text); line-height: 1.35; }

/* ---------- Developer Console v2 ---------- */
.qos-dev-explorer { display: flex; flex-direction: column; gap: 10px; }
.qos-dev-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qos-dev-select, .qos-dev-method, .qos-dev-body {
  font-family: var(--qos-mono); font-size: 12px;
  background: var(--qos-surface-2); color: var(--qos-text);
  border: 1px solid var(--qos-border); border-radius: var(--qos-radius-xs);
  padding: 8px 10px;
}
.qos-dev-select { flex: 1; min-width: 200px; }
.qos-dev-method { width: 88px; }
.qos-dev-body { width: 100%; resize: vertical; min-height: 56px; }
.qos-dev-status { font-size: 12px; color: var(--qos-text-dim); font-family: var(--qos-mono); }
.qos-json-viewer {
  max-height: 52vh; overflow: auto; font-size: 11.5px; line-height: 1.45;
  background: var(--qos-surface-3); padding: 14px; border-radius: var(--qos-radius-sm);
  border: 1px solid var(--qos-border);
}
.qos-json-key { color: #7aa2f7; }
.qos-json-str { color: #9ece6a; }
.qos-json-num { color: #ff9e64; }
.qos-json-bool { color: #bb9af7; }
.qos-json-null { color: var(--qos-text-faint); }

.qos-section-label.completed { color: var(--qos-ok); }
.qos-section-label.completed .qos-pip { background: var(--qos-ok); box-shadow: 0 0 0 4px var(--qos-ok-soft); }

/* ---------- Empty + error states ---------- */
.qos-empty {
  text-align: center; padding: 56px 24px; color: var(--qos-text-faint);
  border: 1px dashed var(--qos-border-strong); border-radius: var(--qos-radius);
  background: var(--qos-surface);
}
.qos-empty .qos-empty-ic { font-size: 30px; opacity: 0.5; }
.qos-empty h3 { font-size: 15px; font-weight: 600; color: var(--qos-text-dim); margin: 12px 0 4px; }
.qos-empty p { font-size: 13px; margin: 0; }
.qos-skeleton { height: 80px; border-radius: var(--qos-radius); background: linear-gradient(90deg, var(--qos-surface), var(--qos-surface-2), var(--qos-surface)); background-size: 200% 100%; animation: qos-shimmer 1.3s infinite; }
@keyframes qos-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.qos-health-line { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.qos-health-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.qos-health-dot.ok { background: var(--qos-ok); box-shadow: 0 0 0 4px var(--qos-ok-soft); }
.qos-health-dot.warn { background: var(--qos-warn); box-shadow: 0 0 0 4px var(--qos-warn-soft); }
.qos-health-dot.crit { background: var(--qos-critical); box-shadow: 0 0 0 4px var(--qos-critical-soft); }

/* ---------- Command palette (Cmd+K) ---------- */
.qos-palette-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(3,4,7,0.55); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center; padding-top: 14vh;
}
.qos-palette-overlay.open { display: flex; animation: qos-fade 0.16s var(--qos-ease); }
.qos-palette {
  width: min(620px, 92vw); background: var(--qos-surface);
  border: 1px solid var(--qos-border-strong); border-radius: 16px;
  box-shadow: var(--qos-shadow-lg); overflow: hidden;
}
.qos-palette input {
  width: 100%; box-sizing: border-box; border: none; outline: none;
  background: none; color: var(--qos-text); font-size: 16px; font-family: var(--qos-font);
  padding: 18px 20px; border-bottom: 1px solid var(--qos-border);
}
.qos-palette input::placeholder { color: var(--qos-text-faint); }
.qos-palette-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.qos-palette-result {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--qos-radius-sm); cursor: pointer; color: var(--qos-text-dim);
}
.qos-palette-result .qos-nav-ic { font-size: 16px; }
.qos-palette-result b { color: var(--qos-text); font-weight: 500; font-size: 14px; }
.qos-palette-result .qos-pr-group { margin-left: auto; font-size: 11px; color: var(--qos-text-faint); }
.qos-palette-result.active, .qos-palette-result:hover { background: var(--qos-accent-soft); color: var(--qos-text); }
.qos-palette-empty { padding: 28px; text-align: center; color: var(--qos-text-faint); font-size: 13px; }
.qos-palette-group {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--qos-text-faint); padding: 10px 12px 4px;
}
.qos-palette-result { justify-content: space-between; }
.qos-palette-action { margin-left: auto; flex-shrink: 0; }

/* ---------- Context panel (right dock) ---------- */
.qos-context-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: var(--qos-context-w);
  background: var(--qos-rail-bg);
  border-left: 1px solid var(--qos-border);
  display: flex; flex-direction: column;
  z-index: 55;
  transition: transform 0.24s var(--qos-ease), width 0.24s var(--qos-ease);
}
body.qos-context-collapsed .qos-context-panel { transform: translateX(100%); }
.qos-ctx-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--qos-topbar-h); padding: 0 14px;
  border-bottom: 1px solid var(--qos-border);
  font-size: 12px; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--qos-text-faint);
}
.qos-context-body { flex: 1; overflow-y: auto; padding: 14px; }
.qos-ctx-head { margin-bottom: 14px; }
.qos-ctx-head b { display: block; font-size: 15px; }
.qos-ctx-head span { font-size: 12px; color: var(--qos-text-faint); }
.qos-ctx-block {
  padding: 12px; margin-bottom: 10px;
  background: var(--qos-surface); border: 1px solid var(--qos-border);
  border-radius: var(--qos-radius-sm);
}
.qos-ctx-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--qos-text-faint); }
.qos-ctx-dim { font-size: 12.5px; color: var(--qos-text-dim); margin: 6px 0 0; }
.qos-context-resize {
  position: absolute; top: 0; left: -3px; width: 6px; height: 100%;
  cursor: col-resize; z-index: 70;
}
.qos-context-resize:hover { background: var(--qos-accent-soft); }
body.qos-context-collapsed .qos-context-resize { display: none; }

/* ---------- Workspace home grid ---------- */
.qos-workspace-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;
}
.qos-ws-tile {
  background: var(--qos-surface); border: 1px solid var(--qos-border);
  border-radius: var(--qos-radius-sm); padding: 14px 16px;
}
.qos-ws-tile.is-attention { border-color: rgba(255, 93, 93, 0.35); }
.qos-ws-tile.is-accent { border-color: var(--qos-accent-border); }
.qos-ws-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--qos-text-faint); margin-bottom: 6px; }
.qos-ws-tile b { font-size: 18px; display: block; margin-bottom: 4px; }
.qos-ws-tile p { font-size: 13px; color: var(--qos-text-dim); margin: 0 0 10px; min-height: 2.5em; }

/* ---------- Activity feed v2 ---------- */
.qos-activity-v2-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start;
  padding: 11px 14px; border-bottom: 1px solid var(--qos-border);
  cursor: pointer; transition: background 0.12s;
}
.qos-activity-v2-row:last-child { border-bottom: none; }
.qos-activity-v2-row:hover { background: var(--qos-surface-2); }
.qos-activity-v2-body b { display: block; font-size: 13.5px; font-weight: 600; }
.qos-activity-impact { font-size: 12px; color: var(--qos-text-dim); }
.qos-action-scores { display: block; font-size: 11px; color: var(--qos-text-faint); margin-top: 4px; }

/* ---------- Founder / hybrid workspace ---------- */
.qos-founder-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.qos-founder-nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-radius: var(--qos-radius-sm);
  border: 1px solid var(--qos-border); background: var(--qos-surface-2);
  color: var(--qos-text); cursor: pointer; text-align: left;
}
.qos-founder-nav-item:hover { border-color: var(--qos-border-strong); }
.qos-hybrid-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

/* ---------- Toast ---------- */
.qos-toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.qos-toast {
  background: var(--qos-surface-3); border: 1px solid var(--qos-border-strong);
  border-radius: var(--qos-radius-sm); padding: 12px 16px; font-size: 13.5px;
  box-shadow: var(--qos-shadow-lg); min-width: 240px; max-width: 380px;
  animation: qos-toast-in 0.22s var(--qos-ease);
}
.qos-toast.ok { border-left: 3px solid var(--qos-ok); }
.qos-toast.err { border-left: 3px solid var(--qos-critical); }
@keyframes qos-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile ---------- */
.qos-mobile-toggle { display: none; }
.qos-touch { min-height: 44px; min-width: 44px; }
@media (max-width: 720px) {
  body.qos-active { padding-left: 0; padding-right: 0; }
  #qos-sidebar { transform: translateX(-100%); box-shadow: var(--qos-shadow-lg); width: min(88vw, 320px); }
  body.qos-sidebar-open #qos-sidebar { transform: none; }
  body.qos-sidebar-open::before {
    content: ""; position: fixed; inset: 0; background: rgba(3,4,7,0.45); z-index: 55;
  }
  .qos-mobile-toggle { display: inline-flex; min-width: 44px; min-height: 44px; }
  .qos-view { padding: 18px 14px 80px; }
  .qos-topbar { padding: 0 12px; gap: 8px; }
  .qos-btn, .qos-icon-btn { min-height: 44px; }
  .qos-btn.small { min-height: 40px; padding: 10px 14px; }
  .qos-approval-bar {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
    flex-wrap: wrap; gap: 8px;
  }
  .qos-approval-item { flex-direction: column; align-items: stretch; }
  .qos-appr-actions { width: 100%; }
  .qos-appr-actions .qos-btn { width: 100%; justify-content: center; }
  .qos-list-item { flex-direction: column; gap: 10px; }
  .qos-li-side { width: 100%; justify-content: flex-end; }
  .qos-action-row { flex-wrap: wrap; }
  .qos-palette-overlay { padding-top: 8vh; }
  .qos-palette { width: 96vw; }
  .qos-palette-result { min-height: 48px; }
  .qos-context-panel { display: none; }
}
