:root {
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Tactical Cockpit Dark Palette */
  --bg-primary: #0a0d14;
  --bg-secondary: #111726;
  --bg-card: #151d30;
  --bg-card-hover: #1b253d;
  --bg-card-active: #19233a;
  
  --border-dim: #212c45;
  --border-focus: #3b82f6;
  --border-subtle: #192238;
  
  --text-main: #e2e8f0;
  --text-muted: #8b9bb4;
  --text-dim: #50617c;
  
  /* Status Colors */
  --status-blocked: #f59e0b;
  --status-blocked-bg: rgba(245, 158, 11, 0.15);
  --status-blocked-border: rgba(245, 158, 11, 0.4);
  
  --status-backlog: #38bdf8;
  --status-backlog-bg: rgba(56, 189, 248, 0.15);
  --status-backlog-border: rgba(56, 189, 248, 0.4);
  
  --status-future: #a78bfa;
  --status-future-bg: rgba(167, 139, 250, 0.15);
  --status-future-border: rgba(167, 139, 250, 0.4);
  
  --status-nice: #2dd4bf;
  --status-nice-bg: rgba(45, 212, 191, 0.15);
  --status-nice-border: rgba(45, 212, 191, 0.4);
  
  --status-complete: #22c55e;
  --status-complete-bg: rgba(34, 197, 94, 0.15);
  --status-complete-border: rgba(34, 197, 94, 0.4);
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --danger-red: #ef4444;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-active: 0 0 15px rgba(56, 189, 248, 0.25);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-mono);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.4;
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   Login Page Styling
   ========================================================================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.radar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  position: relative;
  margin-bottom: 12px;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.radar-logo .blip {
  width: 8px;
  height: 8px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  animation: pulseBlip 1.8s infinite;
}

@keyframes pulseBlip {
  0% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.4; }
}

.system-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-main);
}

.system-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-primary);
  border: 1px solid var(--border-dim);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #03131a;
  border-color: var(--accent-cyan);
}

.btn-primary:hover {
  background: #22d3ee;
}

.btn-block {
  width: 100%;
}

.alert-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-dim);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.indicator-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.indicator-led.connected {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-main);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  padding: 6px 10px;
  font-size: 11px;
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
}

/* Virtual Bays Filter Bar */
.virtual-bays-bar {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  padding: 4px 10px 8px 10px;
  gap: 6px;
  scrollbar-width: none;
}

.virtual-bays-bar::-webkit-scrollbar {
  display: none;
}

.bay-tab {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: all 0.15s ease;
}

.bay-tab .badge-count {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.bay-tab:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.bay-tab.active {
  background: var(--bg-card);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.bay-tab.active .badge-count {
  background: rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan);
}

/* Sub-toolbar: Search & Tag Filter */
.sub-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-dim);
}

.search-box {
  flex: 1;
  position: relative;
}

.search-box input {
  padding: 6px 10px;
  font-size: 12px;
  background: var(--bg-primary);
}

.tag-select-wrapper {
  min-width: 110px;
}

.tag-select-wrapper select {
  padding: 6px 8px;
  font-size: 12px;
}

/* ==========================================================================
   Strip Bay Container (Single Bay Stack)
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 12px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.bay-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

.active-bay-name {
  font-weight: 700;
  color: var(--accent-cyan);
}

.strip-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

/* ==========================================================================
   Flight Strip Card
   ========================================================================== */
.flight-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-left: 5px solid var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, border-color 0.15s ease;
  position: relative;
  user-select: none;
}

.flight-strip:hover {
  background: var(--bg-card-hover);
}

/* Active Focus Strip (Top of Bay) */
.flight-strip.active-focus {
  border-color: rgba(56, 189, 248, 0.7);
  border-left-color: var(--accent-cyan);
  box-shadow: var(--shadow-active);
  background: var(--bg-card-active);
}

.flight-strip.active-focus::before {
  content: '▶ ACTIVE FOCUS';
  position: absolute;
  top: -9px;
  right: 12px;
  background: var(--accent-cyan);
  color: #04141e;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 1px 6px;
  border-radius: 2px;
}

/* Status-specific left borders */
.flight-strip[data-effective-status="BLOCKED"] {
  border-left-color: var(--status-blocked);
}
.flight-strip[data-effective-status="BACKLOG"] {
  border-left-color: var(--status-backlog);
}
.flight-strip[data-effective-status="FUTURE"] {
  border-left-color: var(--status-future);
}
.flight-strip[data-effective-status="NICE"] {
  border-left-color: var(--status-nice);
}
.flight-strip[data-effective-status="COMPLETE"] {
  border-left-color: var(--status-complete);
  opacity: 0.75;
}

/* Strip Header Grid Row */
.strip-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.strip-id-badge {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.status-badge.status-BLOCKED {
  background: var(--status-blocked-bg);
  border: 1px solid var(--status-blocked-border);
  color: var(--status-blocked);
}

.status-badge.status-BACKLOG {
  background: var(--status-backlog-bg);
  border: 1px solid var(--status-backlog-border);
  color: var(--status-backlog);
}

.status-badge.status-FUTURE {
  background: var(--status-future-bg);
  border: 1px solid var(--status-future-border);
  color: var(--status-future);
}

.status-badge.status-NICE {
  background: var(--status-nice-bg);
  border: 1px solid var(--status-nice-border);
  color: var(--status-nice);
}

.status-badge.status-COMPLETE {
  background: var(--status-complete-bg);
  border: 1px solid var(--status-complete-border);
  color: var(--status-complete);
}

.underlying-tag {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 4px;
}

.strip-meta-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.due-date-pill {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dim);
}

.tag-pill {
  background: rgba(56, 189, 248, 0.1);
  color: #7dd3fc;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 9px;
}

/* Strip Title & Content */
.strip-body {
  cursor: pointer;
  margin-bottom: 8px;
}

.strip-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.strip-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Sub-Requirements Row */
.sub-reqs-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-dim);
}

.sub-req-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.sub-req-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 2px;
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  transition: all 0.15s ease;
}

.sub-req-chip.complete {
  color: var(--status-complete);
  border-color: var(--status-complete-border);
}

.sub-req-chip.pending {
  color: var(--status-blocked);
  border-color: var(--status-blocked-border);
}

.sub-req-chip:hover {
  transform: translateY(-1px);
}

/* Strip Bottom Actions Bar */
.strip-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}

.order-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-ctrl {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  min-width: 34px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.btn-ctrl:hover:not(:disabled) {
  background: var(--bg-primary);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-ctrl:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-done {
  background: var(--status-complete-bg);
  border: 1px solid var(--status-complete-border);
  color: var(--status-complete);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-done:hover {
  background: rgba(34, 197, 94, 0.25);
}

.btn-reopen {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--status-backlog);
  font-size: 11px;
  height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Slide-out animation when marked complete */
.flight-strip.slide-out {
  transform: translateX(100%);
  opacity: 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border-dim);
  border-radius: var(--radius-md);
  margin-top: 20px;
}

.empty-state h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ==========================================================================
   Floating Action Button
   ========================================================================== */
.fab-btn {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 90;
  background: var(--accent-cyan);
  color: #03131a;
  border: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  padding: 12px 18px;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fab-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   Bottom Sheet Modal / Drawer
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end; /* Mobile bottom sheet */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-drawer {
  background: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-drawer {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-dim);
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  font-family: var(--font-mono);
  cursor: pointer;
  padding: 4px 8px;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--border-dim);
  background: var(--bg-primary);
}

.blocked-notice {
  background: var(--status-blocked-bg);
  border: 1px solid var(--status-blocked-border);
  color: var(--status-blocked);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin-bottom: 14px;
}

/* Desktop Responsiveness */
@media (min-width: 768px) {
  .modal-overlay {
    align-items: center; /* Center on larger screens */
  }
  .modal-drawer {
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--border-dim);
    max-height: 85vh;
  }
}
