/* ═══════════════════════════════════════════════════════════
   SimTechCloud — Design System Tokens
   Dark theme (default) + light overrides via [data-theme="light"]
   Powered by simtech.dev
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds & surfaces — deep dark with subtle blue tint */
  --bg: #0c0e14;
  --bg-elevated: #12141c;
  --surface: rgba(255,255,255,0.035);
  --surface-hover: rgba(255,255,255,0.065);

  /* Borders — refined glass edges */
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --border-accent: rgba(190,32,46,0.3);

  /* Typography — crisper hierarchy */
  --text: #eef0f6;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* Brand */
  --brand-red: #be202e;
  --brand-red-hover: #d42a3a;
  --brand-red-glow: rgba(190,32,46,0.15);
  --brand-blue: #1863dc;

  /* Semantic colours */
  --green: #10b981;
  --green-bg: rgba(16,185,129,0.1);
  --green-border: rgba(16,185,129,0.25);
  --amber: #f59e0b;
  --amber-bg: rgba(245,158,11,0.1);
  --amber-border: rgba(245,158,11,0.25);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --red-border: rgba(239,68,68,0.25);
  --blue: #6366f1;

  /* Glass — premium depth */
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --glass-strong: rgba(255,255,255,0.06);

  /* Radii */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* Motion — premium easing */
  --transition: 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Shadows — layered depth */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
  --shadow: 0 2px 4px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.15);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.35), 0 8px 16px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 20px rgba(190,32,46,0.08);

  /* Legacy aliases */
  --panel: rgba(255, 255, 255, 0.035);
  --panel-border: rgba(255,255,255,0.07);
  --panel-soft: rgba(255,255,255,0.035);
  --panel-strong: rgba(255,255,255,0.065);
  --muted: #64748b;
  --accent: #6366f1;
  --accent-soft: rgba(99,102,241,0.12);
  --accent-hover: #818cf8;
  --accent-cool: #3b82f6;
  --ok: #10b981;
  --ok-soft: rgba(16,185,129,0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245,158,11,0.12);
  --bad: #ef4444;
  --bad-soft: rgba(239,68,68,0.12);
}

/* ── Light Theme Overrides ─────────────────────────────── */

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: rgba(255,255,255,0.92);
  --surface-hover: rgba(0,0,0,0.04);
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --green: #059669;
  --green-bg: rgba(5,150,105,0.1);
  --green-border: rgba(5,150,105,0.2);
  --amber: #d97706;
  --amber-bg: rgba(217,119,6,0.1);
  --amber-border: rgba(217,119,6,0.2);
  --red: #dc2626;
  --red-bg: rgba(220,38,38,0.1);
  --red-border: rgba(220,38,38,0.2);
  --blue: #4f46e5;
  --glass: rgba(255,255,255,0.8);
  --glass-border: rgba(0,0,0,0.08);

  /* Legacy aliases — light */
  --panel: rgba(255,255,255,0.92);
  --panel-border: #e2e8f0;
  --panel-soft: rgba(0,0,0,0.025);
  --panel-strong: rgba(255,255,255,0.98);
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-soft: rgba(79,70,229,0.08);
  --accent-hover: #4338ca;
  --ok: #059669;
  --ok-soft: rgba(5,150,105,0.1);
  --warn: #d97706;
  --warn-soft: rgba(217,119,6,0.1);
  --bad: #dc2626;
  --bad-soft: rgba(220,38,38,0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.06), 0 8px 10px -6px rgba(0,0,0,0.04);
}

/* ── Reset & Base ───────────────────────────────────────── */

* {
  box-sizing: border-box;
}

/* ── Login Screen ──────────────────────────────────────────── */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #0c0e14);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(190,32,46,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(24,99,220,0.04) 0%, transparent 50%);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 48px 40px 40px;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  backdrop-filter: blur(24px);
  box-shadow:
    0 24px 48px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-wpr-logo {
  margin: 0 auto 16px;
  display: flex;
  justify-content: center;
}

.login-wpr-logo-img {
  max-width: 220px;
  height: auto;
  object-fit: contain;
}

.login-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fff;
  margin: 0 0 6px;
}

.login-subtitle {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
  margin: 0 0 32px;
}

.login-form {
  text-align: left;
}

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 8px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #fff;
  font-family: 'IBM Plex Mono', 'SF Mono', monospace;
  font-size: 18px;
  letter-spacing: 6px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-input:focus {
  border-color: var(--brand-red, #be202e);
  box-shadow: 0 0 0 3px rgba(190,32,46,0.15);
}

.login-input::placeholder {
  letter-spacing: 1px;
  font-size: 14px;
  color: rgba(255,255,255,0.2);
}

.login-error {
  min-height: 20px;
  font-size: 13px;
  color: #ef4444;
  margin-top: 8px;
  text-align: center;
}

.login-btn {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--brand-red, #be202e), #d42a3a);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(190,32,46,0.3);
}

.login-btn:hover {
  box-shadow: 0 6px 24px rgba(190,32,46,0.45);
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(190,32,46,0.3);
}

.login-footer {
  margin-top: 28px;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.3px;
}

.login-footer strong {
  color: rgba(255,255,255,0.35);
}

/* ── Base ──────────────────────────────────────────────────── */

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(190,32,46,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(24,99,220,0.03) 0%, transparent 50%);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code {
  font-family: "IBM Plex Mono", "SF Mono", "Fira Code", monospace;
  font-size: 0.88em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Shell Containers ───────────────────────────────────── */

.shell,
.station-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.station-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: center;
}

/* ── Shared Card Styles ─────────────────────────────────── */

.hero,
.station-header,
.panel,
.station-card,
.dialog-card,
.help-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero,
.station-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  border-radius: 20px;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.hero h1,
.station-header h1,
.panel h2,
.dialog-card h3,
.help-card h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
}

.hero h1,
.station-header h1 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1;
}

.hero-copy,
.muted,
.block-heading p,
.session-meta,
.status-copy {
  color: var(--muted);
}

/* ── Eyebrow Labels ─────────────────────────────────────── */

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ── Layout Rows ────────────────────────────────────────── */

.hero-actions,
.button-row,
.station-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-copy-block {
  display: grid;
  gap: 8px;
}

/* ── Status Metrics Strip ───────────────────────────────── */

.status-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-chip {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .metric-chip {
  background: #fff;
  border-color: var(--border);
}

.metric-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.65rem;
  font-weight: 700;
}

.metric-chip strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* ── Dashboard Layout ───────────────────────────────────── */

.dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.dashboard-main,
.dashboard-sidebar {
  display: grid;
  gap: 16px;
}

/* ── Panels ─────────────────────────────────────────────── */

.panel,
.station-card {
  border-radius: var(--radius);
  padding: 20px;
}

.panel-heading,
.block-heading,
.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-form {
  min-height: 100%;
}

/* ── Collapsible Panels ─────────────────────────────────── */

.collapsible {
  padding: 0;
  overflow: clip;
  background: var(--bg-elevated);
}

.panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.panel-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.panel-titlegroup {
  display: grid;
  gap: 4px;
}

.panel-titlegroup .eyebrow {
  margin-bottom: 0;
}

.panel-titlegroup h2 {
  font-size: 1.6rem;
  line-height: 0.95;
}

.panel-toggle-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex-shrink: 0;
}

.panel-summary {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.panel-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 0.9rem;
  color: var(--muted);
  transform: rotate(180deg);
  transition: transform var(--transition), background var(--transition);
}

.collapsible:not(.is-open) .panel-chevron {
  transform: rotate(0deg);
}

.panel-body {
  max-height: 5000px;
  overflow: hidden;
  padding: 0 20px 20px;
  transition: max-height 220ms ease, opacity 220ms ease, padding 220ms ease;
  opacity: 1;
}

.collapsible:not(.is-open) .panel-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.panel-copy {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Forms ──────────────────────────────────────────────── */

.session-form,
.station-form,
.dialog-card {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-hover);
}

[data-theme="light"] input:hover,
[data-theme="light"] textarea:hover,
[data-theme="light"] select:hover {
  border-color: rgba(0,0,0,0.18);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ── Buttons ────────────────────────────────────────────── */

.button,
.icon-button {
  border: none;
  border-radius: var(--radius-xs);
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.button:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button-secondary,
.icon-button {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.button-secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: var(--surface-hover);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  border-color: var(--border-hover);
}

[data-theme="light"] .button-secondary,
[data-theme="light"] .icon-button {
  background: var(--panel-soft);
  border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .button-secondary:hover:not(:disabled),
[data-theme="light"] .icon-button:hover:not(:disabled) {
  background: rgba(0,0,0,0.04);
}

.button-small {
  padding: 7px 14px;
  font-size: 0.78rem;
}

.button.active {
  background: var(--accent);
  color: #fff;
}

.button-large {
  font-size: 1.1rem;
  padding: 14px 28px;
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Form Blocks ────────────────────────────────────────── */

.form-block {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

[data-theme="light"] .form-block {
  background: var(--panel-soft);
  border-color: rgba(0,0,0,0.04);
}

/* ── Activity Monitor ───────────────────────────────────── */

.activity-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.activity-stat {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  gap: 4px;
}

[data-theme="light"] .activity-stat {
  background: var(--panel-soft);
  border-color: rgba(0,0,0,0.04);
}

.activity-stat strong {
  font-size: 1.3rem;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.03em;
  color: var(--text);
}

.activity-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* ── Logs ───────────────────────────────────────────────── */

.logs-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.log-entry {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

[data-theme="light"] .log-entry {
  background: #fff;
  border-color: rgba(0,0,0,0.05);
}

/* ── Checkboxes & Grid Items ────────────────────────────── */

.station-checkboxes,
.server-checklist,
.stations-grid {
  display: grid;
  gap: 10px;
}

.station-checkboxes,
.server-checklist {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}

[data-theme="light"] .checkbox-card {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
}

.checkbox-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.inline-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-checkbox input {
  width: auto;
}

/* ── Session & Station Lists ────────────────────────────── */

.session-list,
.logs-list {
  display: grid;
  gap: 12px;
}

.session-card,
.station-tile {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

[data-theme="light"] .session-card,
[data-theme="light"] .station-tile {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
}

.session-card:hover,
.station-tile:hover {
  box-shadow: var(--shadow-md);
}

.session-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.station-tile {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.stations-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.station-tile.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Status Pills ───────────────────────────────────────── */

.status-pill,
.status-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  background: var(--panel-soft);
  width: fit-content;
}

.status-banner {
  margin-bottom: 16px;
}

.status-offline,
.status-failed {
  background: var(--bad-soft);
  color: var(--bad);
}

.status-waiting_for_input {
  background: var(--warn-soft);
  color: #b45309;
}

.status-queued,
.status-sent,
.status-partially_succeeded,
.status-published {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
}

.status-ready,
.status-ready_to_launch,
.status-joined,
.status-joined_remote,
.status-joined_local {
  background: var(--ok-soft);
  color: #059669;
}

.status-launching,
.status-awaiting_remote_confirmation {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
}

.status-not_found_remote,
.status-remote_check_failed,
.status-failed_local {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ── Tile Layouts ───────────────────────────────────────── */

.tile-top,
.tile-actions,
.session-actions,
.dispatch-summary-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.tile-actions,
.session-actions {
  margin-top: 12px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tile-meta,
.session-meta {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.88rem;
}

.capability-row,
.control-actions-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.capability-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.capability-chip.supported {
  background: var(--ok-soft);
  color: #059669;
}

.capability-chip.unsupported {
  background: var(--panel-soft);
  color: var(--muted);
}

/* ── Station Page Card ──────────────────────────────────── */

.station-card {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* ── Dialog ─────────────────────────────────────────────── */

.dialog {
  border: none;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.dialog-card {
  width: min(480px, calc(100vw - 32px));
  border-radius: var(--radius);
  padding: 24px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.1rem;
}

/* ── Help Card ──────────────────────────────────────────── */

.help-card {
  margin-top: 16px;
  border-radius: var(--radius-sm);
  padding: 18px;
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.1);
}

/* ── Empty State ────────────────────────────────────────── */

.empty-state {
  padding: 24px 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

[data-theme="light"] .empty-state {
  border-color: rgba(0,0,0,0.12);
}

/* ── Dispatch ───────────────────────────────────────────── */

.dispatch-controls {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.compact-form {
  margin-bottom: 16px;
}

.hidden {
  display: none;
}


/* ═══════════════════════════════════════════════════════════
   STATION VIEW — body[data-view="station"]
   ═══════════════════════════════════════════════════════════ */

body[data-view="station"] {
  --bg: #090c12;
  --panel: #121821;
  --panel-border: rgba(0, 212, 170, 0.16);
  --panel-soft: rgba(242, 239, 230, 0.05);
  --panel-strong: #1a212c;
  --text: #f2efe6;
  --text-secondary: #d2c7b4;
  --muted: #94a2b6;
  --accent: #00d4aa;
  --accent-soft: rgba(0, 212, 170, 0.14);
  --accent-hover: #00e8bb;
  --accent-cool: #4f6b8c;
  --ok-soft: rgba(71, 186, 141, 0.14);
  --warn-soft: rgba(238, 174, 73, 0.14);
  --bad-soft: rgba(255, 107, 74, 0.14);
  --shadow-sm: 0 12px 24px rgba(0, 0, 0, 0.22);
  --shadow: 0 20px 44px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 24px 52px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 32px 72px rgba(0, 0, 0, 0.34);
  background:
    radial-gradient(circle at top left, rgba(79, 107, 140, 0.22), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(0, 212, 170, 0.14), transparent 22%),
    linear-gradient(180deg, #111722 0%, #090c12 58%, #06080d 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

body[data-view="station"] .station-shell {
  width: min(1320px, calc(100% - 40px));
  display: grid;
  align-content: center;
  gap: 20px;
  padding: 24px 0 32px;
}

body[data-view="station"] .station-header,
body[data-view="station"] .station-card,
body[data-view="station"] .help-card {
  background: linear-gradient(180deg, rgba(17, 24, 33, 0.98), rgba(10, 14, 20, 0.98));
  border: 1px solid rgba(0, 212, 170, 0.16);
  box-shadow: var(--shadow);
}

body[data-view="station"] .station-header {
  margin-bottom: 0;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}

body[data-view="station"] .station-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(0, 212, 170, 0.08), var(--accent), rgba(255, 107, 74, 0.72));
}

body[data-view="station"] .station-header-main {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
  gap: 18px;
  align-items: end;
}

body[data-view="station"] .station-header-copy {
  display: grid;
  gap: 8px;
}

body[data-view="station"] .station-header h1,
body[data-view="station"] .help-card h2 {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.04em;
}

body[data-view="station"] .station-header h1 {
  font-size: clamp(2.8rem, 5vw, 4.8rem);
  line-height: 0.9;
}

body[data-view="station"] .station-telemetry-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body[data-view="station"] .station-telemetry-card {
  display: grid;
  gap: 8px;
  min-height: 92px;
  align-content: end;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 32, 44, 0.98), rgba(10, 14, 20, 0.98));
  border: 1px solid rgba(0, 212, 170, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body[data-view="station"] .station-telemetry-card strong {
  font-family: "Oswald", sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-view="station"] .station-card {
  max-width: none;
  margin: 0;
  padding: 24px;
}

body[data-view="station"] .station-console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.68fr);
  gap: 18px;
  align-items: start;
}

body[data-view="station"] .station-console-main,
body[data-view="station"] .station-console-sidebar {
  display: grid;
  gap: 16px;
}

body[data-view="station"] .station-status-well {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(0, 212, 170, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(24, 32, 44, 0.98), rgba(10, 14, 20, 0.98));
  border: 1px solid rgba(0, 212, 170, 0.16);
}

body[data-view="station"] .station-status-copy {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

body[data-view="station"] .station-form {
  gap: 18px;
}

body[data-view="station"] .station-form-block,
body[data-view="station"] .station-briefing-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(19, 27, 37, 0.94), rgba(12, 17, 24, 0.96));
  border: 1px solid rgba(0, 212, 170, 0.08);
}

body[data-view="station"] label {
  color: var(--text-secondary);
}

body[data-view="station"] input,
body[data-view="station"] textarea,
body[data-view="station"] select {
  border-color: rgba(0, 212, 170, 0.12);
  background: linear-gradient(180deg, rgba(8, 12, 17, 0.92), rgba(17, 22, 30, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  color: var(--text);
}

body[data-view="station"] input:hover,
body[data-view="station"] textarea:hover,
body[data-view="station"] select:hover {
  border-color: rgba(0, 212, 170, 0.24);
}

body[data-view="station"] input:focus,
body[data-view="station"] textarea:focus,
body[data-view="station"] select:focus {
  box-shadow: 0 0 0 3px var(--accent-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body[data-view="station"] .button,
body[data-view="station"] .icon-button {
  min-height: 44px;
  background: linear-gradient(180deg, #00d4aa, #00a88a);
  color: #090c12;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-view="station"] .button:hover:not(:disabled),
body[data-view="station"] .icon-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #00e8bb, #00d4aa);
  box-shadow: var(--shadow-md);
}

body[data-view="station"] .button-secondary,
body[data-view="station"] .icon-button {
  background: linear-gradient(180deg, rgba(27, 35, 47, 0.98), rgba(18, 25, 34, 0.98));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 212, 170, 0.14);
}

body[data-view="station"] .button-secondary:hover:not(:disabled),
body[data-view="station"] .icon-button:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(33, 42, 56, 0.98), rgba(22, 28, 38, 0.98));
  box-shadow: var(--shadow-sm);
}

body[data-view="station"] .button-large {
  font-size: 0.9rem;
  padding: 16px 28px;
}

body[data-view="station"] .station-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
}

body[data-view="station"] .status-banner {
  margin-bottom: 0;
}

body[data-view="station"] .status-ready,
body[data-view="station"] .status-joined,
body[data-view="station"] .status-ready_to_launch,
body[data-view="station"] .status-joined_remote,
body[data-view="station"] .status-joined_local {
  color: #8ce0b1;
}

body[data-view="station"] .status-waiting_for_input {
  color: #f0be63;
}

body[data-view="station"] .status-offline,
body[data-view="station"] .status-failed {
  color: #ff8f78;
}

body[data-view="station"] :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}



/* ═══════════════════════════════════════════════════════════
   DASHBOARD VIEW — body[data-view="dashboard"]
   Glassmorphism design system with nav rail layout
   ═══════════════════════════════════════════════════════════ */

body[data-view="dashboard"] {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Navigation Rail ─── */

.nav-rail {
  width: 64px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

[data-theme="light"] .nav-rail {
  background: rgba(255,255,255,0.95);
  border-right-color: var(--border);
}

.nav-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  overflow: hidden;
}

.nav-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-item,
.nav-rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  border: none;
  background: none;
  font-size: 18px;
}

.nav-item:hover,
.nav-rail-btn:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.nav-item.active,
.nav-rail-btn.active {
  background: rgba(190,32,46,0.14);
  color: var(--brand-red-hover);
  box-shadow: 0 0 12px rgba(190,32,46,0.1);
}

[data-theme="light"] .nav-item.active,
[data-theme="light"] .nav-rail-btn.active {
  background: rgba(190,32,46,0.08);
}

.nav-item.active::before,
.nav-rail-btn.active::before {
  content: '';
  position: absolute;
  left: -10px;
  width: 3px;
  height: 20px;
  background: var(--brand-red);
  border-radius: 0 3px 3px 0;
}

.nav-tooltip {
  position: absolute;
  left: 56px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms;
  z-index: 200;
}

[data-theme="light"] .nav-tooltip {
  background: #1e293b;
  color: #e2e8f0;
}

.nav-item:hover .nav-tooltip {
  opacity: 1;
}

.nav-spacer,
.nav-rail-spacer { flex: 1; }

.nav-theme {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
}

.nav-theme:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

/* ─── App Frame & Module Layout ─── */

.app-frame {
  display: flex;
  min-height: 100vh;
}

.product-stage {
  margin-left: 64px;
  flex: 1;
  padding: 20px 24px;
  max-width: 1400px;
  min-width: 0;
}

.module-workspace {
  display: none;
}

.module-workspace.is-active {
  display: block;
}

/* ─── Main Content (legacy) ─── */

body[data-view="dashboard"] .main {
  margin-left: 64px;
  flex: 1;
  padding: 20px 24px;
  max-width: 1400px;
}

/* ─── Top Bar ─── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-live {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand-red-hover);
  background: rgba(190,32,46,0.12);
  padding: 3px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .topbar-live {
  background: rgba(190,32,46,0.08);
}

.topbar-live::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--brand-red);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-sse {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.sse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(16,185,129,0.5);
  animation: pulse-glow 2s ease-in-out infinite;
}

.sse-dot[aria-label*="offline"] {
  background: rgba(239,68,68,0.5);
  box-shadow: 0 0 6px rgba(239,68,68,0.2);
  animation: none;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 14px rgba(16,185,129,0.7); }
}

.topbar-clock {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ─── Critical Alert Banner ─── */

.critical-banner {
  background: linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04));
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #fca5a5;
  animation: bannerPulse 3s infinite;
}

[data-theme="light"] .critical-banner {
  background: linear-gradient(90deg, rgba(220,38,38,0.08), rgba(220,38,38,0.02));
  color: var(--red);
  border-color: rgba(220,38,38,0.2);
}

@keyframes bannerPulse {
  0%, 100% { border-color: rgba(239,68,68,0.2); }
  50% { border-color: rgba(239,68,68,0.4); }
}

.banner-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}

/* ─── Session Banner with Countdown ─── */

.session-banner {
  background: linear-gradient(135deg, rgba(190,32,46,0.1), rgba(190,32,46,0.03));
  border: 1px solid rgba(190,32,46,0.18);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
}

[data-theme="light"] .session-banner {
  background: linear-gradient(135deg, rgba(190,32,46,0.06), rgba(190,32,46,0.02));
  border-color: rgba(190,32,46,0.15);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #f87171;
  font-weight: 600;
}

[data-theme="light"] .session-label {
  color: var(--brand-red);
}

.session-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.session-countdown {
  text-align: center;
}

.countdown-value {
  font-size: 32px;
  font-weight: 800;
  color: #f87171;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1;
}

[data-theme="light"] .countdown-value {
  color: var(--brand-red);
}

.countdown-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 2px;
}

@keyframes countdownPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.countdown-pulse {
  animation: countdownPulse 1s infinite;
}

.session-actions {
  display: flex;
  gap: 8px;
}

/* ─── Buttons ─── */

.btn-primary {
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-hover));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(190,32,46,0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(190,32,46,0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  padding: 8px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

/* ─── Metrics Strip ─── */

.metrics,
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(16px);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-red), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.metric-card:hover {
  border-color: var(--border-hover);
  background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.03) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.metric-card:hover::before {
  opacity: 1;
}

body[data-view="dashboard"] .metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}

.metric-value.green { color: var(--green); }
.metric-value.amber { color: var(--amber); }
.metric-value.red { color: var(--red); }
.metric-value.text { color: var(--text); }

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.metric-sub .trend-up { color: var(--green); }

/* ─── Rig Grid ─── */

.rig-grid-container {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
}

.rig-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.rig-grid-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.rig-grid-count {
  font-size: 11px;
  color: var(--text-dim);
}

.rig-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.rig-tile {
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.rig-tile:hover {
  transform: translateY(-2px);
}

.rig-tile.racing {
  background: linear-gradient(135deg, var(--green-bg), rgba(16,185,129,0.04));
  border: 1px solid var(--green-border);
}

.rig-tile.racing:hover {
  border-color: rgba(16,185,129,0.4);
  box-shadow: 0 4px 16px rgba(16,185,129,0.15);
}

.rig-tile.idle {
  background: linear-gradient(135deg, var(--amber-bg), rgba(245,158,11,0.04));
  border: 1px solid var(--amber-border);
}

.rig-tile.idle:hover {
  border-color: rgba(245,158,11,0.4);
  box-shadow: 0 4px 16px rgba(245,158,11,0.15);
}

.rig-tile.error {
  background: linear-gradient(135deg, var(--red-bg), rgba(239,68,68,0.04));
  border: 1px solid var(--red-border);
}

.rig-tile.error:hover {
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 4px 16px rgba(239,68,68,0.15);
}

.rig-tile.offline {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  opacity: 0.5;
}

[data-theme="light"] .rig-tile.offline {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}

.rig-tile.selected {
  outline: 2px solid var(--brand-red);
  outline-offset: 1px;
}

.rig-number {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.rig-tile.racing .rig-number { color: var(--green); }
.rig-tile.idle .rig-number { color: var(--amber); }
.rig-tile.error .rig-number { color: var(--red); }
.rig-tile.offline .rig-number { color: var(--text-dim); }

.rig-driver {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rig-car {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rig-status {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 6px;
}

.rig-tile.racing .rig-status { color: var(--green); }
.rig-tile.idle .rig-status { color: var(--amber); }
.rig-tile.error .rig-status { color: var(--red); }

.rig-alert-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(239,68,68,0.6);
  animation: pulse 1.5s infinite;
}

/* ─── Bottom Row: Actions + Activity + Upcoming ─── */

.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
}

body[data-view="dashboard"] .panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(12px);
  box-shadow: none;
}

body[data-view="dashboard"] .panel-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Quick Actions */

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-btn {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  width: 100%;
  text-align: left;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-hover));
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(190,32,46,0.25);
}

.action-btn.primary:hover {
  box-shadow: 0 4px 16px rgba(190,32,46,0.35);
  transform: translateY(-1px);
}

.action-btn.secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.action-btn.secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.action-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

/* Activity Feed */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.feed-dot.green { background: var(--green); }
.feed-dot.red { background: var(--red); }
.feed-dot.blue { background: var(--blue); }
.feed-dot.amber { background: var(--amber); }

.feed-text {
  color: var(--text-secondary);
  flex: 1;
}

.feed-time {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}

/* Upcoming Bookings */

.booking-list {
  display: flex;
  flex-direction: column;
}

.booking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.booking-item:last-child {
  border-bottom: none;
}

.booking-time {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
}

.booking-detail {
  flex: 1;
}

.booking-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.booking-drivers {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
}

.booking-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
}

.booking-badge.confirmed {
  background: var(--green-bg);
  color: var(--green);
}

.booking-badge.pending {
  background: var(--amber-bg);
  color: var(--amber);
}

/* ─── Utilization Mini-Chart ─── */

.util-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.util-bar-label {
  font-size: 10px;
  color: var(--text-dim);
  min-width: 52px;
}

.util-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

[data-theme="light"] .util-bar-track {
  background: rgba(0,0,0,0.06);
}

.util-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 500ms ease;
}

.util-bar-pct {
  font-size: 10px;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
  color: var(--text-secondary);
}

/* ─── Slide-out Panel ─── */

.slideout {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: #12141c;
  border-left: 1px solid var(--border);
  padding: 24px;
  z-index: 200;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .slideout {
  background: #ffffff;
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
}

.slideout.open,
[data-slideout-open] .slideout {
  transform: translateX(0);
}

.slideout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.slideout-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.slideout-status {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.slideout-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}

.slideout-close:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.slideout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.slideout-field {
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.slideout-field-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.slideout-field-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.slideout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.slideout-btn {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: center;
}

.slideout-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.slideout-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin: 16px 0 10px;
  font-weight: 600;
}

.slideout-history-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.slideout-history-item:last-child {
  border-bottom: none;
}

/* Toast stack shifts when slideout is open */
[data-slideout-open] .toast-stack {
  right: 400px;
}

/* ─── Toast Notifications ─── */

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  transition: right 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.toast {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  min-width: 280px;
  animation: slideIn 300ms ease;
}

[data-theme="light"] .toast {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-secondary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ─── Dashboard-specific overrides for shared selectors ─── */

body[data-view="dashboard"] .shell {
  position: relative;
  z-index: 1;
  width: auto;
  padding: 0;
  margin: 0;
}

body[data-view="dashboard"] .hero,
body[data-view="dashboard"] .station-header {
  background: var(--glass);
  border-color: var(--glass-border);
  box-shadow: none;
}

body[data-view="dashboard"] .station-card,
body[data-view="dashboard"] .dialog-card {
  background: var(--glass);
  border-color: var(--glass-border);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

body[data-view="dashboard"] h1,
body[data-view="dashboard"] h2,
body[data-view="dashboard"] h3 {
  color: var(--text);
}

body[data-view="dashboard"] .muted,
body[data-view="dashboard"] .hero-copy,
body[data-view="dashboard"] .session-meta,
body[data-view="dashboard"] .status-copy {
  color: var(--text-muted);
}

body[data-view="dashboard"] .eyebrow {
  color: var(--brand-red);
}

body[data-view="dashboard"] .metric-chip {
  background: var(--glass);
  border-color: var(--glass-border);
}

body[data-view="dashboard"] .metric-chip strong {
  color: var(--text);
}

body[data-view="dashboard"] .collapsible {
  background: var(--glass);
  border-color: var(--glass-border);
}

body[data-view="dashboard"] .panel-toggle:hover {
  background: var(--surface-hover);
}

body[data-view="dashboard"] .station-tile,
body[data-view="dashboard"] .session-card,
body[data-view="dashboard"] .log-entry {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

body[data-view="dashboard"] .station-tile:hover,
body[data-view="dashboard"] .session-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

body[data-view="dashboard"] .checkbox-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

body[data-view="dashboard"] .checkbox-card:hover {
  border-color: var(--brand-red);
  background: rgba(190,32,46,0.06);
}

body[data-view="dashboard"] input,
body[data-view="dashboard"] textarea,
body[data-view="dashboard"] select {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

body[data-view="dashboard"] input:hover,
body[data-view="dashboard"] textarea:hover,
body[data-view="dashboard"] select:hover {
  border-color: var(--border-hover);
}

body[data-view="dashboard"] input:focus,
body[data-view="dashboard"] textarea:focus,
body[data-view="dashboard"] select:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(190,32,46,0.15);
}

body[data-view="dashboard"] input::placeholder,
body[data-view="dashboard"] textarea::placeholder {
  color: var(--text-dim);
}

body[data-view="dashboard"] .button {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-hover));
  color: #fff;
  box-shadow: 0 2px 8px rgba(190,32,46,0.25);
}

body[data-view="dashboard"] .button:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(190,32,46,0.35);
  transform: translateY(-1px);
}

body[data-view="dashboard"] .button-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

body[data-view="dashboard"] .button-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

body[data-view="dashboard"] .form-block {
  background: var(--surface);
  border-color: var(--border);
}

body[data-view="dashboard"] .status-pill,
body[data-view="dashboard"] .status-banner {
  background: var(--surface);
}

body[data-view="dashboard"] .status-ready,
body[data-view="dashboard"] .status-joined,
body[data-view="dashboard"] .status-ready_to_launch,
body[data-view="dashboard"] .status-joined_remote,
body[data-view="dashboard"] .status-joined_local {
  background: var(--green-bg);
  color: var(--green);
}

body[data-view="dashboard"] .status-offline,
body[data-view="dashboard"] .status-failed {
  background: var(--red-bg);
  color: var(--red);
}

body[data-view="dashboard"] .status-waiting_for_input {
  background: var(--amber-bg);
  color: var(--amber);
}

body[data-view="dashboard"] .logs-list {
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

[data-theme="light"] body[data-view="dashboard"] .logs-list,
body[data-view="dashboard"][data-theme="light"] .logs-list {
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

body[data-view="dashboard"] .dialog-card {
  border-radius: var(--radius);
}

body[data-view="dashboard"] .dialog::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
}

body[data-view="dashboard"] .empty-state {
  border-color: var(--border);
  color: var(--text-muted);
}

body[data-view="dashboard"] .help-card {
  background: var(--surface);
  border-color: var(--border);
}

body[data-view="dashboard"] code {
  color: var(--blue);
  background: rgba(99,102,241,0.12);
}

body[data-view="dashboard"] .activity-stat {
  background: var(--surface);
  border-color: var(--border);
}

body[data-view="dashboard"] .activity-stat strong {
  color: var(--text);
}

body[data-view="dashboard"] .panel-chevron {
  background: var(--surface);
  color: var(--text-muted);
}

body[data-view="dashboard"] .panel-copy {
  color: var(--text-muted);
}

body[data-view="dashboard"] .capability-chip.supported {
  background: var(--green-bg);
  color: var(--green);
}

body[data-view="dashboard"] .capability-chip.unsupported {
  background: var(--surface);
  color: var(--text-dim);
}

body[data-view="dashboard"] label {
  color: var(--text-secondary);
}

body[data-view="dashboard"] .panel-summary {
  color: var(--text-muted);
}

body[data-view="dashboard"] :focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

/* ─── Overview Bottom Row ─── */

.overview-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
  margin-top: 0;
}

.overview-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.overview-panel:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

[data-theme="light"] .overview-panel {
  background: rgba(255,255,255,0.85);
  border-color: var(--border);
}

/* ─── Section Headings (Quick Actions / Activity Feed / Upcoming Bookings) ─── */

.overview-panel h3 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  padding-left: 10px;
  border-left: 3px solid var(--brand-red);
  line-height: 1;
}

/* Also apply to module section h3 headings in the dashboard */
body[data-view="dashboard"] .module-workspace h3:not(.dialog-card h3):not([class]) {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding-left: 10px;
  border-left: 3px solid var(--brand-red);
  line-height: 1;
}

/* ─── Quick Actions Grid ─── */

.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ─── Activity Feed List ─── */

.activity-feed-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

/* ─── Upcoming List ─── */

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

/* ─── Rig Grid Empty State ─── */

.rig-grid-empty {
  grid-column: 1 / -1;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border: 1px dashed rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
}

[data-theme="light"] .rig-grid-empty {
  border-color: rgba(0,0,0,0.1);
}

/* ─── Custom Scrollbars (Dashboard) ─── */

body[data-view="dashboard"] ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

body[data-view="dashboard"] ::-webkit-scrollbar-track {
  background: transparent;
}

body[data-view="dashboard"] ::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

body[data-view="dashboard"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

[data-theme="light"] body[data-view="dashboard"] ::-webkit-scrollbar-thumb,
body[data-view="dashboard"][data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
}

[data-theme="light"] body[data-view="dashboard"] ::-webkit-scrollbar-thumb:hover,
body[data-view="dashboard"][data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.2);
}

/* ── Check-in overlay (station.html) ─────────────────────────────────────── */
.checkin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.checkin-overlay-hidden {
  display: none;
}

.checkin-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
  color: #fff;
}

.checkin-panel-hidden {
  display: none;
}

.checkin-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin: 0;
}

.checkin-qr-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 0 60px rgba(190, 32, 46, 0.35);
}

.checkin-qr-box canvas,
.checkin-qr-box img {
  display: block;
}

.checkin-heading {
  font-family: 'Oswald', sans-serif;
  font-size: 2.2rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.04em;
}

.checkin-sub {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 1rem;
  color: rgba(255,255,255,0.55);
  margin: 0;
}

.checkin-overlay-logo img {
  height: 40px;
  width: auto;
  display: block;
}

.checkin-overlay-footer {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.04em;
  font-family: 'IBM Plex Sans', sans-serif;
}

.checkin-overlay-footer a {
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
}

.checkin-welcome-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #be202e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #fff;
  box-shadow: 0 0 48px rgba(190, 32, 46, 0.5);
}

.checkin-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  margin: 0;
}

/* ── Check-in review panel ─────────────────────────────────── */
.checkin-star-row {
  display: flex;
  gap: 12px;
  margin: 4px 0;
}
.checkin-star {
  font-size: 48px;
  color: #2a2a3a;
  cursor: pointer;
  user-select: none;
  transition: color 0.12s, transform 0.1s;
  line-height: 1;
}
.checkin-star.active { color: #f59e0b; }
.checkin-star:hover  { transform: scale(1.15); }

.checkin-review-field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.checkin-review-label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.checkin-review-input {
  width: 100%;
  background: #13131A;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.checkin-review-input:focus  { border-color: #1863DC; }
.checkin-review-input.error  { border-color: #BE202E; }
.checkin-review-textarea     { resize: none; height: 90px; }

.checkin-review-error {
  font-size: 12px;
  color: #BE202E;
}
.checkin-review-error-hidden { display: none; }

.checkin-review-btns {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}
.checkin-review-btn {
  flex: 1;
  padding: 16px;
  border-radius: 8px;
  font-family: 'Barlow Condensed', 'Oswald', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
}
.checkin-review-btn-submit { background: #BE202E; color: #fff; }
.checkin-review-btn-skip   { background: #1c1c28; color: #666; border: 1px solid #2a2a3a; }

.checkin-review-thankyou { width: 100%; text-align: center; }
