/* shell.css - the frame around every screen: gate card, topbar, app switcher,
   nav pills, main region, rail. */

/* ---------- Gate card ---------- */
.gate {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #12456f 0%, var(--navy-deep) 55%, #071f34 100%);
  padding: 24px;
}
.gate-card { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 400px; padding: 38px 34px; box-shadow: var(--sh-3); text-align: center; }
.gate-logo { width: 200px; max-width: 100%; display: block; margin: 0 auto 22px; }
.gate-title { font-size: 22px; }
.gate-sub { color: var(--muted); margin: 8px 0 24px; font-size: 14px; line-height: 1.5; }
.gate-card .btn { margin-bottom: 10px; }
.gate-foot { color: rgba(255,255,255,0.72); font-size: 12px; margin-top: 22px; }

/* ---------- App shell layout ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, var(--topbar-a) 0%, var(--topbar-b) 100%);
  color: #fff; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: var(--topbar-h); box-shadow: 0 1px 0 rgba(16,32,50,.06);
}
.topbar-left { flex: none; }
.topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.topbar-right { flex: none; display: flex; align-items: center; gap: 10px; }

/* App switcher */
.switcher { position: relative; flex: none; }
.switcher-btn {
  display: inline-flex; align-items: center; gap: 11px; cursor: pointer; font-family: inherit;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 6px 10px 6px 8px; color: #fff; transition: background var(--dur-2) var(--ease);
}
.switcher-btn:hover { background: var(--on-navy-fill); }
.switcher-btn .sw-mono { height: 28px; width: 28px; flex: none; display: block; }
.switcher-btn .sw-name { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; white-space: nowrap; }
.switcher-btn .sw-chev { width: 16px; height: 16px; opacity: .82; transition: transform var(--dur-2) var(--ease); }
.switcher-btn[aria-expanded="true"] .sw-chev { transform: rotate(180deg); }
.switcher .menu { top: calc(100% + 8px); left: 0; --menu-origin: top left; }
.env-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #ffd7cf; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: var(--r-pill); padding: 3px 9px; }

/* Center nav pills */
.nav { display: inline-flex; align-items: center; gap: 2px; padding: 4px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.10); border-radius: var(--r-pill); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-pill {
  position: relative; background: none; border: none; color: rgba(255,255,255,.80); font-weight: 600; font-size: 13.5px;
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer; font-family: inherit; white-space: nowrap;
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.nav-pill:hover { color: #fff; background: rgba(255,255,255,.10); }
.nav-pill.active { color: var(--navy); background: #fff; box-shadow: var(--sh-1); }
[data-theme="dark"] .nav-pill.active { color: var(--ink); background: var(--surface-2); }

/* Status light */
.status-light { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border-radius: var(--r-pill); background: var(--on-navy-fill); border: 1px solid var(--on-navy-line); font-size: 12px; font-weight: 600; color: var(--on-navy); }
.status-light::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(15,157,99,.30); }
.status-light.off::before { background: var(--faint); box-shadow: none; }
.status-light.busy::before { background: #ffd7cf; box-shadow: 0 0 0 3px rgba(240,85,63,.30); animation: pulse-dot 1.4s var(--ease) infinite; }

/* Theme cycler icon swap */
.theme-ic .ic { display: none; }
:root:not([data-theme="dark"]) .theme-ic.mode-system .ic-monitor,
:root:not([data-theme="dark"]) .theme-ic.mode-light .ic-sun,
:root:not([data-theme="dark"]) .theme-ic.mode-dark .ic-moon { display: block; }
[data-theme="dark"] .theme-ic.mode-system .ic-monitor,
[data-theme="dark"] .theme-ic.mode-light .ic-sun,
[data-theme="dark"] .theme-ic.mode-dark .ic-moon { display: block; }

/* User chip */
.userchip { display: inline-flex; align-items: center; gap: 9px; padding-left: 4px; }
.userchip-name { font-size: 13px; color: var(--on-navy); font-weight: 600; white-space: nowrap; }
.userchip .badge { background: rgba(255,255,255,.14); color: #fff; }

/* Notification bell state */
.bell.muted { opacity: .7; }

/* ---------- Main ---------- */
.main { flex: 1; }
.view { max-width: var(--content-max); margin: 0 auto; padding: 26px 24px 64px; }
.view-wide { max-width: 1320px; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head .vh-main { min-width: 0; }
.view-title { font-size: 24px; letter-spacing: -0.02em; }
.view-sub { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.5; }
.view-head .vh-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Rail + content split (Runs, Spend, Cost) ---------- */
.split { display: grid; grid-template-columns: var(--rail-w) 1fr; gap: 24px; align-items: start; }
.rail { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .topbar-center { order: 3; width: 100%; flex-basis: 100%; justify-content: flex-start; }
  .topbar-right { margin-left: auto; }
  .split { grid-template-columns: 1fr; }
  .rail { position: static; }
}
@media (max-width: 560px) {
  .switcher-btn .sw-name { font-size: 14px; }
  .userchip-name { display: none; }
  .status-light { display: none; }
  .view { padding: 18px 14px 56px; }
  .view-title { font-size: 20px; }
}
