/**
 * Project 367B - Mars Logistics & Mining Executive Interface
 * Futuristic Sci-Fi Command Deck & Operations Center
 */

:root {
  /* Futuristic Palette */
  --bg-deep: #06090e;
  --bg-surface: #0b1118;
  --bg-surface-elevated: #111a24;
  --bg-card: rgba(14, 21, 30, 0.94);
  --bg-card-hover: rgba(20, 31, 45, 0.95);
  --bg-card-inset: rgba(7, 12, 18, 0.85);

  --border-muted: rgba(0, 229, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #00e5ff;
  --border-highlight: #00f5d4;

  /* Accent Signatures */
  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.35);
  --accent-amber: #ff9f1c;
  --accent-amber-glow: rgba(255, 159, 28, 0.35);
  --accent-teal: #00b4d8;
  --accent-emerald: #00f5d4;
  --accent-danger: #ff3366;
  --accent-danger-glow: rgba(255, 51, 102, 0.35);

  /* Legacy Pip-Boy Compat (Required by Test Specs) */
  --pip-green: #00f5d4;
  --pip-green-glow: rgba(0, 245, 212, 0.3);
  --pip-dim-green: #0d4a3e;
  --pip-amber: #ff9f1c;
  --pip-amber-glow: rgba(255, 159, 28, 0.3);
  --pip-font: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;

  /* Typography */
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;

  --text-main: #e6f1f8;
  --text-muted: #849cb0;
  --text-dim: #4d6477;
  --text-bright: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 180, 216, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #070b10 0%, #05080c 100%);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Tactical Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 11, 16, 0.9);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.25);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.5);
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  background: transparent;
}

/* ================= 1. TOP HEADER & TELEMETRY ================= */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(11, 17, 24, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 50;
  gap: 12px;
  flex-wrap: wrap;
}

.header-branding {
  display: flex;
  flex-direction: column;
}

.corp-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-amber);
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.game-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.version-pill {
  font-size: 0.62rem;
  padding: 1px 6px;
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 3px;
  font-weight: 600;
}

.header-telemetry {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.telemetry-pill {
  display: flex;
  flex-direction: column;
  background: rgba(17, 26, 36, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 4px;
  padding: 3px 8px;
  min-width: 95px;
}

.telemetry-pill .pill-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.telemetry-pill .pill-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.telemetry-pill .pill-sub {
  font-size: 0.68rem;
  color: var(--accent-cyan);
}

.status-online {
  color: var(--accent-emerald) !important;
}

.mini-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1px;
  margin-top: 3px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  background: var(--accent-emerald);
  transition: width 0.3s ease;
}

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ================= 2. EVENLY DISTRIBUTED RESOURCE HUD ================= */
.resource-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 8px 16px;
  background: rgba(9, 14, 20, 0.92);
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
  backdrop-filter: blur(8px);
  width: 100%;
}

@media (max-width: 960px) {
  .resource-hud {
    grid-template-columns: 1fr;
  }
}

.hud-item {
  background: rgba(14, 22, 32, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.14);
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hud-group-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.hud-values-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.hud-values-row span strong {
  color: #fff;
}

/* ================= 3. TABS COMPLETELY HIDDEN ================= */
.pip-tabs {
  display: none !important;
}

/* ================= 4. MAIN WORKSPACE & LEFT ICON NAV ================= */
.app-content {
  flex: 1;
  padding: 10px 14px;
  position: relative;
  width: 100%;
}

.workspace-layout {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: flex-start;
}

/* Small Left-Nav Icon Toolbar */
.deck-icon-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(11, 17, 24, 0.96);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 6px 4px;
  position: sticky;
  top: 8px;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.icon-nav-header {
  text-align: center;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 2px;
}

.icon-nav-badge {
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.icon-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  background: rgba(16, 25, 36, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.2);
  color: #fff;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.icon-nav-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
  transform: scale(1.08);
}

.icon-nav-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: inset 0 0 6px rgba(0, 229, 255, 0.25);
}

.icon-nav-btn.inactive {
  opacity: 0.3;
  filter: grayscale(1);
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(7, 10, 15, 0.6);
}

.icon-nav-btn.util-btn {
  border-color: rgba(255, 159, 28, 0.3);
  font-size: 0.85rem;
}

.icon-nav-btn.util-btn:hover {
  border-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber-glow);
}

/* Custom Floating High-Tech Tooltip on Left Nav */
.icon-nav-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #090e17;
  color: #d8e8f5;
  border: 1px solid var(--accent-cyan);
  padding: 5px 9px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 229, 255, 0.3);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1000;
}

.icon-nav-btn[data-tooltip]::before {
  content: '';
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  border-width: 4px 6px 4px 0;
  border-style: solid;
  border-color: transparent var(--accent-cyan) transparent transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1000;
}

.icon-nav-btn[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(2px);
}

.icon-nav-btn[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

.icon-nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 3px 2px;
}

/* ================= 5. DRAG-AND-DROP 3-COLUMN GRID ================= */
.command-deck-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  flex: 1;
  min-width: 0;
}

@media (max-width: 1200px) {
  .command-deck-grid {
    grid-template-columns: 1fr 1fr;
  }
  .col-3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 800px) {
  .command-deck-grid {
    grid-template-columns: 1fr;
  }
}

.deck-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
  min-height: 200px;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.deck-column.drag-over {
  background: rgba(0, 229, 255, 0.04);
  outline: 2px dashed rgba(0, 229, 255, 0.4);
  border-radius: 4px;
}

/* ================= 6. REARRANGEABLE & COLLAPSIBLE CARDS ================= */
.deck-card {
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: border-color 0.2s ease, opacity 0.15s ease;
  width: 100%;
  user-select: none;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 48px;
  resize: vertical;
}

.deck-card:hover {
  border-color: rgba(0, 229, 255, 0.25);
}

.deck-card.is-dragging {
  opacity: 0.4;
  outline: 2px dashed var(--accent-cyan);
  transform: scale(0.98);
}

.deck-card.collapsed {
  resize: none !important;
  height: auto !important;
}

.deck-card.collapsed .deck-card-body,
.deck-card.collapsed .card-resize-handle {
  display: none !important;
}

.deck-card.collapsed .collapse-toggle-btn {
  transform: rotate(180deg);
}

.card-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 6px;
}

.card-close-btn:hover {
  background: rgba(255, 71, 87, 0.25);
  border-color: var(--accent-danger);
  color: #ff6b81;
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.4);
}

.deck-card-header {
  padding: 6px 10px;
  background: rgba(0, 229, 255, 0.04);
  border-bottom: 1px solid rgba(0, 229, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.deck-card-header:hover {
  background: rgba(0, 229, 255, 0.08);
}

.deck-card-header:active {
  cursor: pointer;
}

.header-drag-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.drag-handle {
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: -1px;
  line-height: 1;
  cursor: grab;
  padding: 0 2px;
}

.drag-handle:hover {
  color: var(--accent-cyan);
}

.deck-card-header h3 {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #d8e8f5;
  text-transform: uppercase;
  margin: 0;
}

.header-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.collapse-toggle-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  color: var(--text-muted);
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.collapse-toggle-btn:hover {
  color: #fff;
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.15);
}

.deck-card-body {
  padding: 8px 10px;
  user-select: text;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Container Length/Height Resize Handle */
.card-resize-handle {
  height: 8px;
  width: 100%;
  cursor: ns-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  user-select: none;
}

.card-resize-handle::after {
  content: '';
  width: 28px;
  height: 2px;
  border-radius: 1px;
  background: rgba(0, 229, 255, 0.25);
  transition: all 0.15s ease;
}

.card-resize-handle:hover::after,
.card-resize-handle.is-resizing::after {
  background: var(--accent-cyan);
  width: 48px;
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* Dynamic space utilization: inner elements expand to fill resized container */
.scrollable-card-sm {
  min-height: 120px;
  max-height: none;
  overflow-y: auto;
  flex: 1 1 auto;
}

.scrollable-card-md {
  min-height: 180px;
  max-height: none;
  overflow-y: auto;
  flex: 1 1 auto;
}

.deck-card .scrollable-card-sm,
.deck-card .scrollable-card-md,
.deck-card-body.scrollable-card-sm,
.deck-card-body.scrollable-card-md {
  max-height: none !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Internal content grids and lists stretch to occupy all vertical space */
.deck-card #craftingCatalog,
.deck-card #buildOptionsGrid,
.deck-card #vehicleOptionsGrid,
.deck-card #techNodesGrid,
.deck-card #dailyQuestsGrid,
.deck-card #bountyQuestsGrid,
.deck-card #dashVehiclesList,
.deck-card #dashFacilitiesList,
.deck-card #smeltingRecipesList,
.deck-card #refinersContainer,
.deck-card #manufacturersContainer,
.deck-card .skills-grid-compact,
.deck-card .routes-container,
.deck-card .catalog-grid {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto;
}

/* Hauling routes container expansion */
#card-hauling .deck-card-body {
  display: flex;
  flex-direction: column;
}

#card-hauling .active-routes-box {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#card-hauling .routes-container {
  flex: 1 1 auto;
  min-height: 80px;
  max-height: none !important;
  overflow-y: auto;
}

/* Planetary map dynamic canvas scaling */
.deck-card.map-card .deck-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.deck-card.map-card .map-canvas-wrapper {
  flex: 1 1 auto;
  min-height: 300px;
  max-height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.deck-card.map-card #mapCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
}

/* Micro Headers & Labels */
.micro-header {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.micro-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.panel-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Badge System */
.badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 2px;
  background: rgba(0, 245, 212, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 245, 212, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.amber {
  background: rgba(255, 159, 28, 0.15);
  color: var(--accent-amber);
  border-color: rgba(255, 159, 28, 0.35);
}

.badge.danger {
  background: rgba(255, 51, 102, 0.15);
  color: var(--accent-danger);
  border-color: rgba(255, 51, 102, 0.35);
}

/* ================= 7. COMPACT BUTTONS & FORMS ================= */
.site-btn {
  background: rgba(18, 28, 38, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #dff0fc;
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.site-btn:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.site-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.site-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
}

.site-btn.sm {
  padding: 2px 7px;
  font-size: 0.68rem;
  border-radius: 2px;
}

.site-btn.primary {
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.4) 0%, rgba(0, 119, 182, 0.6) 100%);
  border-color: var(--accent-cyan);
  color: #fff;
  font-weight: 700;
}

.site-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.6) 0%, rgba(0, 150, 199, 0.8) 100%);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.site-btn.secondary {
  background: rgba(255, 159, 28, 0.15);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.site-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 159, 28, 0.25);
  box-shadow: 0 0 8px var(--accent-amber-glow);
}

.site-btn.danger {
  background: rgba(255, 51, 102, 0.15);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.site-btn.prospect-btn {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

/* Forms & Selects */
.form-select, .form-input {
  width: 100%;
  padding: 4px 8px;
  background: rgba(8, 14, 20, 0.95);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 3px;
  color: #e6f1f8;
  font-family: var(--font-main);
  font-size: 0.74rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan-glow);
}

.input-label {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
}

.form-row-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-group-row {
  display: flex;
  gap: 6px;
}

.checkbox-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* Empty State */
.empty-state {
  padding: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.76rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.empty-state.sm {
  padding: 8px;
  font-size: 0.72rem;
}

/* Progress Bars (Smooth Continuous 1s Transitions) */
.progress-bar-container {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill,
.mini-progress-fill,
.skill-xp-fill {
  height: 100%;
  background: var(--accent-cyan);
  transition: width 1s linear;
  will-change: width;
}

.progress-bar-fill.no-transition,
.mini-progress-fill.no-transition,
.skill-xp-fill.no-transition,
.no-transition {
  transition: none !important;
}

/* ================= 8. MAP & LOGISTICS CARDS ================= */
.map-canvas-wrapper {
  background: #04070a;
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 3px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  width: 100%;
}

#mapCanvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  cursor: crosshair;
}

.map-zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zoom-btn {
  background: rgba(10, 20, 16, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: bold;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: all 0.15s ease;
  min-width: 26px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.zoom-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.zoom-btn.zoom-reset-btn {
  font-size: 0.65rem;
  padding: 2px 4px;
  color: var(--pip-green);
  border-color: rgba(51, 255, 51, 0.3);
}

.zoom-btn.zoom-reset-btn:hover {
  border-color: var(--pip-green);
  color: #fff;
}

.map-legend {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px 0 2px;
  font-size: 0.65rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Legend marks mirror the canvas silhouettes: hexagon = structure,
   diamond = deposit, chevron = transport, spike = hostile. */
.legend-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  flex: 0 0 9px;
}

.dot-base { background: var(--map-base, #00f5d4); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.dot-rival { background: var(--map-rival, #7f8fa6); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.dot-deposit { background: var(--map-deposit, #00e5ff); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.dot-vehicle { background: var(--map-vehicle, #ff9f1c); clip-path: polygon(100% 50%, 55% 100%, 0 85%, 25% 50%, 0 15%, 55% 0); }
.dot-xeno { background: var(--map-xeno, #ff3366); clip-path: polygon(50% 0, 100% 80%, 50% 55%, 0 80%); }
.dot-barrier { background: var(--map-barrier, #334455); clip-path: polygon(50% 10%, 100% 100%, 0 100%); }
.dot-alert { background: var(--map-stalled, #ff3366); border-radius: 50%; }

.map-help {
  margin: 5px 0 0;
  font-size: 0.62rem;
  line-height: 1.4;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Hover/keyboard contact readout mirrored from the canvas tooltip */
.map-inspector {
  margin-top: 6px;
  min-height: 42px;
  padding: 5px 8px;
  background: var(--bg-card-inset);
  border: 1px solid rgba(0, 229, 255, 0.14);
  border-radius: 3px;
  font-size: 0.7rem;
  line-height: 1.35;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* Illustrated art lives here, not on the tactical canvas. */
.map-inspector-thumb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: cover;
  border: 1px solid rgba(0, 245, 212, 0.3);
  border-radius: 3px;
  image-rendering: auto;
}

.map-inspector-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.map-inspector-idle { color: var(--text-dim); font-style: italic; }
.map-inspector-title { color: var(--pip-green); font-weight: bold; }
.map-inspector-title em { color: var(--pip-amber); font-style: normal; }
.map-inspector-lines { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.66rem; }

.zoom-btn.active {
  background: rgba(0, 245, 212, 0.25);
  border-color: var(--pip-green);
  color: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.telemetry-readout {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 5px 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-readout strong {
  color: #fff;
}

.active-routes-box {
  margin-top: 8px;
  border-top: 1px solid var(--border-muted);
  padding-top: 6px;
}

.routes-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 120px;
  overflow-y: auto;
}

/* ================= 9. REFINING & ASSEMBLY ================= */
.refiner-box, .manufacturer-box {
  background: var(--bg-card-inset);
  border: 1px solid rgba(0, 229, 255, 0.14);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.refiner-box h4, .manufacturer-box h4 {
  font-size: 0.76rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Rapid Blueprint Workshop Cards */
.catalog-category-header {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 0 2px 0;
  border-bottom: 1px solid rgba(255, 159, 28, 0.2);
  margin: 6px 0 4px 0;
}

/* ================= 10. EXPANSION & OPERATIONS ================= */
.build-grid-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 500px) {
  .build-grid-compact {
    grid-template-columns: 1fr;
  }
}

.build-card {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.build-card-header-with-img {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.build-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(0, 245, 212, 0.35);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.quest-header-with-img {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.quest-thumbnail {
  width: 42px;
  height: 42px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(255, 159, 28, 0.35);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.directives-hero-banner {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0, 245, 212, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.directives-banner-img {
  width: 100%;
  height: auto;
  max-height: 180px;
  display: block;
  object-fit: cover;
}

.build-card h4 {
  font-size: 0.74rem;
  color: #fff;
  font-weight: 700;
}

.build-card p {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin: 2px 0;
}

.build-cost-list {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Scientific Tech Nodes */
.active-research-box {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 159, 28, 0.3);
  border-radius: 3px;
  padding: 6px 8px;
}

.tech-nodes-compact {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 160px;
  overflow-y: auto;
}

.tech-node-card {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 5px 8px;
}

.tech-node-card.unlocked {
  border-color: rgba(0, 245, 212, 0.3);
  background: rgba(0, 245, 212, 0.04);
}

.tech-node-card.active-research {
  border-color: rgba(255, 159, 28, 0.4);
  background: rgba(255, 159, 28, 0.04);
}

/* Quests & Contracts */
.quests-grid-compact {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quest-card {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 5px 8px;
}

.quest-card.completed {
  border-color: rgba(0, 245, 212, 0.3);
}

.quest-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.quest-reward {
  font-size: 0.65rem;
  color: var(--accent-cyan);
  margin-top: 3px;
}

/* Skills Grid */
.skills-grid-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.skill-card {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 4px 6px;
}

.skill-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
}

.skill-name { color: #fff; }
.skill-lvl { color: var(--accent-cyan); }
.skill-desc { font-size: 0.62rem; color: var(--text-dim); margin: 1px 0 3px 0; }
.skill-xp-bar { height: 3px; background: rgba(255,255,255,0.08); border-radius: 1px; overflow: hidden; }
.skill-xp-fill { height: 100%; background: var(--accent-cyan); }
.skill-xp-text { font-size: 0.58rem; color: var(--text-dim); text-align: right; margin-top: 1px; font-family: var(--font-mono); }

/* Facility Item */
.facility-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  padding: 4px 8px;
  margin-bottom: 4px;
}

.facility-item-card {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
  transition: border-color 0.15s ease;
}

.facility-item-card:hover {
  border-color: rgba(0, 229, 255, 0.25);
}

.facility-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.facility-meta {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ================= 11. DOCKED GLOBAL COMMS ================= */
.docked-comms-bar {
  position: sticky;
  bottom: 0;
  background: rgba(10, 16, 23, 0.98);
  border-top: 1px solid var(--border-muted);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6);
  z-index: 40;
}

.comms-header-bar {
  padding: 5px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: rgba(0, 229, 255, 0.04);
}

.comms-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
}

.comms-toggle-hint {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.comms-body {
  padding: 6px 16px 8px 16px;
  background: rgba(7, 11, 16, 0.95);
}

.chat-log {
  height: 80px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 6px;
  background: rgba(4, 7, 10, 0.8);
  margin-bottom: 6px;
  font-size: 0.74rem;
}

.chat-message {
  margin-bottom: 3px;
}

.chat-message .sender {
  color: var(--accent-cyan);
  font-weight: 700;
  font-family: var(--font-mono);
}

.chat-input-row {
  display: flex;
  gap: 6px;
}

.chat-input-row input {
  flex: 1;
  background: rgba(14, 22, 30, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 3px;
  padding: 4px 8px;
  color: #fff;
  font-size: 0.74rem;
  outline: none;
}

/* ================= 12. SLIDE-OVER DIRECTIVES DRAWER ================= */
.slideover-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: rgba(11, 17, 24, 0.98);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--accent-cyan);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.8);
  z-index: 100;
  transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.slideover-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
}

.drawer-close-btn:hover {
  color: #fff;
}

.drawer-body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

/* Starter Guide Card & Steps */
.starter-guide-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.starter-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 1px;
}

.starter-phases {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phase-column {
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 8px 10px;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
}

.phase-num {
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  padding: 1px 4px;
  border-radius: 2px;
}

.phase-header h4 {
  font-size: 0.72rem;
  color: #fff;
  letter-spacing: 0.5px;
}

.phase-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-step {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.72rem;
}

.guide-step.completed {
  opacity: 0.7;
}

.step-status {
  font-size: 0.78rem;
  min-width: 16px;
}

.step-content strong {
  display: block;
  color: #fff;
}

.step-content p {
  color: var(--text-dim);
  font-size: 0.68rem;
  margin: 1px 0 3px 0;
}

.step-btn {
  background: transparent;
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 2px;
  cursor: pointer;
}

.step-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  color: #fff;
}

/* ================= 13. DEDICATED OVERSEER ADMINISTRATIVE OPERATIONS DECK ================= */
.overseer-workspace-layout {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}

.overseer-hero-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(22, 14, 6, 0.95);
  border: 1px solid var(--accent-amber);
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(255, 159, 28, 0.25);
  flex-wrap: wrap;
  gap: 10px;
}

.hero-title-group {
  display: flex;
  flex-direction: column;
}

.overseer-badge-pulse {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--accent-amber);
  letter-spacing: 1.2px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 0 8px rgba(255, 159, 28, 0.5);
}

.overseer-sub-telemetry {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.6px;
  margin-top: 3px;
}

.overseer-deck-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .overseer-deck-grid {
    grid-template-columns: 1fr;
  }
}

.overseer-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.overseer-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 159, 28, 0.25);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.overseer-card-header {
  padding: 8px 12px;
  background: rgba(255, 159, 28, 0.08);
  border-bottom: 1px solid rgba(255, 159, 28, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.overseer-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.overseer-card-body {
  padding: 12px;
}

.overseer-table-container {
  overflow-y: auto;
  border-radius: 3px;
  background: rgba(5, 8, 12, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.overseer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.overseer-table th {
  background: rgba(255, 159, 28, 0.12);
  color: var(--accent-amber);
  text-align: left;
  padding: 6px 10px;
  font-size: 0.7rem;
  letter-spacing: 0.6px;
  border-bottom: 1px solid rgba(255, 159, 28, 0.2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.overseer-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.overseer-table tr:hover td {
  background: rgba(255, 159, 28, 0.05);
}

.target-inv-telemetry {
  background: rgba(10, 18, 12, 0.75);
  border: 1px dashed rgba(0, 255, 102, 0.2);
  border-radius: 3px;
  padding: 6px 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 10px 12px;
}

.panel-box h3 {
  font-size: 0.8rem;
  color: #fff;
  letter-spacing: 0.8px;
}

.admin-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.admin-field label {
  font-size: 0.66rem;
  color: var(--text-dim);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.admin-action-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.recipe-editor-box {
  background: rgba(8, 14, 20, 0.95);
  border: 1px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 10px;
}

.recipe-editor-box h4 {
  color: var(--accent-cyan);
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.deprecation-table-container {
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background: rgba(5, 8, 12, 0.8);
}

/* ================= 14. AUTHENTICATION PORTAL & USER PREFERENCES ================= */
.auth-portal-card {
  max-width: 460px;
  width: 95%;
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 35px rgba(0, 229, 255, 0.25), 0 8px 32px rgba(0, 0, 0, 0.85);
  background: #090e17;
  border-radius: 4px;
  overflow: hidden;
}

.auth-tabs-nav {
  display: flex;
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
  margin-bottom: 14px;
  background: rgba(0, 229, 255, 0.04);
}

.auth-tab-btn {
  flex: 1;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  text-transform: uppercase;
}

.auth-tab-btn:hover {
  color: #fff;
  background: rgba(0, 229, 255, 0.08);
}

.auth-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
}

.auth-status-msg {
  padding: 8px 12px;
  border-radius: 3px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  margin-bottom: 12px;
  line-height: 1.4;
}

.auth-status-msg.error {
  background: rgba(255, 59, 48, 0.15);
  border: 1px solid var(--accent-danger);
  color: #ff8585;
}

.auth-status-msg.success {
  background: rgba(0, 255, 102, 0.15);
  border: 1px solid var(--pip-green);
  color: var(--pip-green);
}

/* ================= 15. MODALS & TOAST NOTIFICATIONS ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-card {
  background: rgba(14, 22, 32, 0.98);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 24px var(--accent-cyan-glow);
  border-radius: 4px;
  width: 90%;
  max-width: 400px;
  overflow: hidden;
}

.modal-header {
  padding: 8px 12px;
  background: rgba(0, 229, 255, 0.08);
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 0.8rem;
  color: #fff;
  letter-spacing: 0.8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 12px;
}

/* Toast Notification Floating Stack */
.toast-container {
  position: fixed;
  bottom: 45px;
  right: 18px;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  z-index: 2000;
  max-width: 360px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(14, 22, 32, 0.95);
  border: 1px solid rgba(0, 229, 255, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  font-size: 0.74rem;
  color: #fff;
  transition: all 0.25s ease;
}

.toast-item.success {
  border-color: var(--accent-emerald);
}

.toast-item.error {
  border-color: var(--accent-danger);
}

.toast-item.info {
  border-color: var(--accent-cyan);
}

.toast-icon {
  font-size: 0.85rem;
}

.toast-message {
  flex: 1;
}

/* Highlight animation when jumping to a section */
@keyframes deckPulse {
  0% { box-shadow: 0 0 0 rgba(0, 229, 255, 0); }
  50% { box-shadow: 0 0 16px rgba(0, 229, 255, 0.6); }
  100% { box-shadow: 0 0 0 rgba(0, 229, 255, 0); }
}

.deck-pulse {
  animation: deckPulse 1.2s ease-in-out;
}

/* ================= OPERATIONS RAIL ================= */
.ops-rail {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(6, 12, 16, 0.97), rgba(6, 12, 16, 0.88));
  border-top: 1px solid rgba(0, 229, 255, 0.14);
  border-bottom: 1px solid rgba(0, 229, 255, 0.22);
  padding: 6px 12px 7px;
  backdrop-filter: blur(6px);
}

.ops-rail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.ops-rail-title {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  font-weight: bold;
}

.ops-rail-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(0, 229, 255, 0.12);
  border-radius: 10px;
  padding: 1px 8px;
}

.ops-attention-btn {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 2px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ops-attention-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ops-attention-btn.has-alerts {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.55);
  background: rgba(255, 209, 102, 0.1);
  animation: opsPulse 2.4s ease-in-out infinite;
}

.ops-attention-btn.has-alerts:hover {
  background: rgba(255, 209, 102, 0.22);
  color: #fff;
}

@keyframes opsPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.14); }
}

.ops-phase {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  min-width: 240px;
}

.ops-phase-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--pip-green);
  white-space: nowrap;
}

.ops-phase .mini-progress-track {
  flex: 1;
  min-width: 70px;
}

.ops-phase-steps {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.ops-rail-body {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.ops-rail-empty {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 3px 0;
}

.ops-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-width: 230px;
  max-width: 320px;
  text-align: left;
  font-family: var(--font-mono);
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--text-dim);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ops-chip:disabled { cursor: default; }
.ops-chip:not(:disabled):hover {
  background: rgba(0, 229, 255, 0.09);
  border-color: rgba(0, 229, 255, 0.4);
}
.ops-chip:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 1px;
}

.ops-chip[data-tone='build'] { border-left-color: #ffd166; }
.ops-chip[data-tone='run'] { border-left-color: var(--pip-green); }
.ops-chip[data-tone='move'] { border-left-color: #ff9f1c; }
.ops-chip[data-tone='science'] { border-left-color: #b388ff; }

.ops-chip-icon { font-size: 0.85rem; line-height: 1; }

.ops-chip-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ops-chip-title {
  font-size: 0.67rem;
  color: var(--text-bright, #d6e4e8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ops-chip-eta {
  font-size: 0.63rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.ops-chip.indeterminate .mini-progress-fill {
  background: repeating-linear-gradient(90deg, rgba(255, 159, 28, 0.85) 0 8px, rgba(255, 159, 28, 0.25) 8px 16px);
  animation: opsStripes 1s linear infinite;
}

@keyframes opsStripes {
  from { background-position: 0 0; }
  to { background-position: 16px 0; }
}

.ops-attention-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px dashed rgba(255, 209, 102, 0.3);
  padding-top: 6px;
}

.ops-alert-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  background: rgba(255, 209, 102, 0.06);
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background 0.15s ease;
}

.ops-alert-row:hover { background: rgba(255, 209, 102, 0.18); }
.ops-alert-icon { font-size: 0.85rem; }
.ops-alert-text { display: flex; flex-direction: column; gap: 1px; }
.ops-alert-label { font-size: 0.68rem; color: #ffd166; }
.ops-alert-hint { font-size: 0.63rem; color: var(--text-dim); }

@media (max-width: 800px) {
  .ops-phase { margin-left: 0; width: 100%; min-width: 0; }
  .ops-chip { min-width: 190px; }
}

/* ================= TASK FOCUS MODES ================= */
.task-mode-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.task-mode-caption {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}

.task-mode-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.task-mode-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-card-inset);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 4px 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-mode-btn:hover {
  color: #fff;
  border-color: rgba(0, 229, 255, 0.5);
}

.task-mode-btn.active {
  color: #04070a;
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  font-weight: bold;
}

.task-mode-btn:focus-visible {
  outline: 2px solid var(--pip-green);
  outline-offset: 2px;
}

.task-mode-hint {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-style: italic;
  flex: 1;
  min-width: 200px;
}

@media (max-width: 800px) {
  .task-mode-hint { display: none; }
  .task-mode-group { flex: 1; }
  .task-mode-btn { flex: 1 0 auto; }
}

/* ================= WHILE YOU WERE AWAY ================= */
.offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 5, 8, 0.82);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.offline-overlay[hidden] { display: none; }

.offline-panel {
  width: min(620px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #0a1014);
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 4px;
  box-shadow: 0 0 34px rgba(0, 229, 255, 0.18);
}

.offline-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
}

.offline-panel-head h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
}

#offlineElapsed { font-size: 0.7rem; color: var(--text-dim); }

.offline-panel-body {
  padding: 12px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.offline-panel-foot {
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: right;
}

.offline-section h4 {
  margin: 0 0 5px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.offline-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 3px 10px;
}

.offline-section li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 6px;
  border-left: 2px solid transparent;
  border-radius: 2px;
}

.offline-section.tone-good li { color: var(--pip-green); border-left-color: rgba(51, 255, 51, 0.35); }
.offline-section.tone-neutral li { color: var(--text-muted); border-left-color: rgba(255, 255, 255, 0.14); }
.offline-section.tone-warn li { color: #ffd166; border-left-color: rgba(255, 209, 102, 0.5); grid-column: 1 / -1; }

.offline-section li.clickable { cursor: pointer; }
.offline-section li.clickable:hover,
.offline-section li.clickable:focus-visible {
  background: rgba(255, 209, 102, 0.16);
  outline: none;
}
