/* SPDX-License-Identifier: GPL-3.0-or-later */

:root {
  color-scheme: dark;
  --bg: #070d18;
  --bg-surface: #0a1424;
  --panel: #0d1b2e;
  --panel-alt: #10243b;
  --panel-border: #1a3654;
  --line: #224368;
  --text: #e7f1ff;
  --text-muted: #8da5bd;
  --cyan: #61e7e0;
  --cyan-dim: rgba(97, 231, 224, 0.15);
  --green: #91ed9a;
  --green-dim: rgba(145, 237, 154, 0.15);
  --amber: #ffc56d;
  --amber-dim: rgba(255, 197, 109, 0.15);
  --red: #ff7d83;
  --red-dim: rgba(255, 125, 131, 0.15);
  --purple: #c084fc;
  --purple-dim: rgba(192, 132, 252, 0.15);
  --sigint-cyan: #00d4ff;
  --ops-green: #10b981;
  --dfir-amber: #f59e0b;
  --res-red: #f43f5e;
  --gov-purple: #a855f7;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Fira Code", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 85% 10%, #132b45 0, transparent 40rem),
                    radial-gradient(circle at 10% 90%, #0d1e33 0, transparent 35rem);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45 !important;
}

/* Accessibility Focus Rings */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* Typography & Utility */
h1, h2, h3, h4, p {
  margin-top: 0;
}

h2 { font-size: 1.4rem; letter-spacing: -0.03em; margin-bottom: 0.25rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }
h4 { font-size: 1.0rem; margin-bottom: 0.2rem; }

.eyebrow {
  color: var(--cyan);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.lede {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0;
}

.text-cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-purple { color: var(--purple); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: bold; }

/* Layout Shell */
.layout-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Resource Rail */
.top-resource-rail {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: rgba(10, 20, 36, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel-border);
  padding: 0.65rem 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.rail-left {
  display: flex;
  align-items: center;
}

.stage-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.rail-resources {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  overflow-x: auto;
  white-space: nowrap;
}

.resource-item {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
}

.res-label {
  color: var(--text-muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.res-value {
  font-weight: 700;
  font-size: 0.88rem;
}

.res-sub {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.res-rate-pos { color: var(--cyan); font-weight: 600; }
.res-rate-neg { color: var(--red); font-weight: 600; }
.res-rate-neutral { color: var(--green); font-weight: 600; }

.resource-item {
  cursor: help;
  position: relative;
  transition: transform 0.1s ease;
}

.resource-item:hover {
  transform: translateY(-1px);
}

.mini-bar-wrapper {
  width: 5.5rem;
  height: 0.35rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.15rem;
}

.mini-bar {
  height: 100%;
  background: var(--cyan);
  transition: width 0.3s ease;
}

.gauge-warning .mini-bar { background: var(--amber); }
.gauge-critical .mini-bar { background: var(--red); }

/* Status Badges */
.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.badge-healthy { background: var(--green-dim); color: var(--green); border: 1px solid rgba(145, 237, 154, 0.4); }
.badge-warning { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(255, 197, 109, 0.4); }
.badge-critical { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 125, 131, 0.4); }

/* Layout Body & Desktop Nav */
.layout-body {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3.5rem;
  gap: 2rem;
}

.desktop-nav {
  width: 15rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-group-title {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  padding-left: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  background: var(--panel);
  color: var(--text);
  border-color: var(--panel-border);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(97, 231, 224, 0.12), transparent);
  border-left: 3px solid var(--cyan);
  color: var(--cyan);
  font-weight: 700;
}

.nav-link.locked-nav {
  opacity: 0.5;
  cursor: not-allowed;
  border-left: 3px solid transparent;
}

.nav-link.locked-nav:hover {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.nav-link-main {
  display: block;
}

.nav-lock-badge {
  display: block;
  font-size: 0.64rem;
  color: var(--amber);
  margin-top: 0.2rem;
  font-weight: 500;
  white-space: normal;
  line-height: 1.25;
}

/* Main Content Area */
.main-content {
  flex: 1;
  min-width: 0;
}

.view-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 1rem;
}

.sector-chip, .triage-stat-chip, .telemetry-stat-chip, .team-stat-chip, .lessons-stat-chip, .archive-stat-chip {
  font-size: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  white-space: nowrap;
}

.header-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.poll-telemetry-btn {
  font-size: 0.78rem;
  padding: 0.45rem 0.85rem;
  border: 1px dashed var(--cyan);
  background: rgba(97, 231, 224, 0.08);
  color: var(--cyan);
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.poll-telemetry-btn:hover {
  background: rgba(97, 231, 224, 0.18);
  border-color: #78efe9;
  transform: translateY(-1px);
}

/* Cards & Containers */
.card {
  background: linear-gradient(135deg, rgba(16, 36, 59, 0.95), rgba(11, 23, 40, 0.95));
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

/* Action Buttons */
.primary-action, .secondary-action, .danger-action {
  padding: 0.65rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.primary-action {
  background: var(--cyan);
  color: #06121f;
  border: 1px solid var(--cyan);
}

.primary-action:hover {
  background: #78efe9;
  transform: translateY(-1px);
}

.secondary-action {
  background: var(--panel-alt);
  border: 1px solid #2d4f73;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.secondary-action:hover {
  border-color: var(--cyan);
  background: #152f4c;
  transform: translateY(-1px);
}

.secondary-action span {
  color: var(--cyan);
}

.danger-action {
  background: var(--red-dim);
  border: 1px solid rgba(255, 125, 131, 0.5);
  color: var(--red);
}

.danger-action:hover {
  background: rgba(255, 125, 131, 0.3);
  transform: translateY(-1px);
}

.deliberate-action {
  padding: 0.85rem 1.5rem;
  font-size: 0.92rem;
  border-width: 2px;
}

/* Bottlenecks */
.bottleneck-card.critical { border-color: rgba(255, 125, 131, 0.6); background: rgba(36, 12, 18, 0.8); }
.bottleneck-card.warning { border-color: rgba(255, 197, 109, 0.6); background: rgba(36, 28, 12, 0.8); }
.bottleneck-text { margin-bottom: 0; font-size: 0.88rem; line-height: 1.6; }
.advisory-action-row {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

/* Objectives List */
.objectives-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.obj-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  padding: 0.85rem 1rem;
  border-radius: 6px;
}

.obj-item.completed {
  border-color: rgba(145, 237, 154, 0.4);
  background: rgba(145, 237, 154, 0.05);
}

.obj-check {
  font-size: 1.2rem;
  color: var(--cyan);
  width: 1.5rem;
  text-align: center;
}

.obj-item.completed .obj-check {
  color: var(--green);
}

.obj-content {
  flex: 1;
}

.obj-content strong {
  display: block;
  font-size: 0.88rem;
}

.obj-content p {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 0;
}

.obj-reward {
  font-size: 0.78rem;
  color: var(--purple);
  font-weight: 700;
  background: var(--purple-dim);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

/* Operations Sub-Navigation */
.ops-subnav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.ops-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ops-tab-btn:hover {
  background: var(--panel-alt);
  color: var(--text);
  border-color: var(--line);
}

.ops-tab-btn.active {
  background: rgba(97, 231, 224, 0.12);
  color: var(--cyan);
  border-color: var(--cyan);
}

.ops-tab-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.ops-tab-btn.active .ops-tab-badge {
  background: var(--cyan-dim);
  color: var(--cyan);
}

.ops-tab-badge.badge-ready {
  background: var(--amber-dim) !important;
  color: var(--amber) !important;
  border: 1px solid rgba(255, 197, 109, 0.4);
  font-weight: 700;
}

/* Operations Queue Table */
.queue-table-wrapper {
  overflow-x: auto;
  max-height: 420px;
  min-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--bg-surface);
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.queue-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
  box-shadow: 0 1px 0 var(--line);
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.queue-row {
  border-bottom: 1px solid rgba(34, 67, 104, 0.4);
}

.queue-row:hover {
  background: rgba(26, 54, 84, 0.3);
}

.queue-row td {
  padding: 0.75rem;
  vertical-align: middle;
}

.signal-desc {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0.2rem 0 0.3rem;
}

.sev-badge {
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.sev-critical { color: var(--red); background: var(--red-dim); }
.sev-high { color: var(--amber); background: var(--amber-dim); }
.sev-medium { color: #facc15; background: rgba(250, 204, 21, 0.15); }
.sev-low { color: var(--cyan); background: var(--cyan-dim); }

.telemetry-chip {
  font-size: 0.68rem;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.technique-tag {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.action-btn-group {
  display: flex;
  gap: 0.4rem;
}

.triage-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  border: 1px solid transparent;
  min-width: 5.6rem;
  transition: all 0.15s ease;
}

.btn-main {
  font-weight: 700;
  font-size: 0.74rem;
}

.btn-sub {
  font-size: 0.62rem;
  opacity: 0.82;
  font-family: var(--font-mono, monospace);
}

.btn-dismiss { background: var(--cyan-dim); color: var(--cyan); border-color: rgba(97, 231, 224, 0.3); }
.btn-dismiss:hover { background: rgba(97, 231, 224, 0.3); }

.btn-contain { background: var(--red-dim); color: var(--red); border-color: rgba(255, 125, 131, 0.3); }
.btn-contain:hover { background: rgba(255, 125, 131, 0.3); }

.btn-investigate { background: var(--amber-dim); color: var(--amber); border-color: rgba(255, 197, 109, 0.3); }
.btn-investigate:hover { background: rgba(255, 197, 109, 0.3); }

.empty-queue-msg {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  justify-content: center;
}

/* Capacity Shift Controls */
.capacity-sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.capacity-control {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: 6px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.3rem;
}

.control-header label { font-weight: 700; font-size: 0.82rem; }
.stepper-val { font-size: 0.82rem; font-weight: 700; }
.control-desc { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.stepper-actions {
  display: flex;
  gap: 0.5rem;
}

.stepper-btn {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

.stepper-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.workforce-hire-section {
  margin-top: 1.25rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1rem;
}

.quick-hire-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid rgba(97, 231, 224, 0.25);
  border-radius: 6px;
  padding: 0.85rem 1.15rem;
  gap: 1rem;
}

.quick-hire-bar.locked {
  border: 1px dashed rgba(255, 197, 109, 0.35);
  background: rgba(255, 197, 109, 0.04);
}

.hire-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hire-info strong {
  font-size: 0.85rem;
  color: var(--text);
}

.hire-info p {
  font-size: 0.75rem;
  margin: 0;
}

.lock-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hire-analyst-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.6rem 1.1rem;
  font-weight: 700;
}

.pipeline-quick-bar {
  border-color: rgba(97, 231, 224, 0.2);
  background: rgba(16, 36, 59, 0.6);
}

.pipeline-hire-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.hunting-active-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--purple);
  background: var(--purple-dim);
  border: 1px solid rgba(216, 180, 254, 0.4);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* Incident Cases Cards */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.case-card {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.case-card.case-in-progress {
  border-color: rgba(97, 231, 224, 0.4);
  box-shadow: 0 0 16px rgba(97, 231, 224, 0.08);
}

.case-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.case-header h4 {
  font-size: 0.95rem;
  margin: 0;
}

.family-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.case-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.case-stage-info {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stage-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.phase-title {
  font-size: 0.82rem;
}

.case-requirements, .case-rewards {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
}

.case-advance-btn {
  margin-top: auto;
}

/* Coverage & Detection */
.coverage-families-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.family-coverage-card {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: 6px;
}

.family-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.coverage-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.coverage-bar-wrapper {
  width: 100%;
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.75rem 0 1rem;
}

.coverage-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 0.3s ease;
}

.tactics-list ul {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
}

.tactics-list a {
  color: var(--text-muted);
  text-decoration: none;
}

.tactics-list a:hover {
  color: var(--cyan);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.prestige-metrics-grid, .offline-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.metric-box {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  padding: 0.85rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.highlight-box {
  border-color: rgba(97, 231, 224, 0.4);
  background: rgba(97, 231, 224, 0.05);
}

.box-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.box-val {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.breakdown-list {
  list-style: none;
  margin: 0.5rem 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.breakdown-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

.reset-scopes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scope-card {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: 6px;
}

.scope-card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Event Log Stream */
.event-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 18rem;
  overflow-y: auto;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
}

.event-log li {
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(34, 67, 104, 0.4);
  color: var(--text-muted);
}

.event-log li::before {
  content: "> ";
  color: var(--green);
}

/* Settings */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.setting-select {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  padding: 0.5rem;
  border-radius: 4px;
}

.save-actions-grid {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.file-action {
  cursor: pointer;
  align-items: center;
  display: flex;
  justify-content: center;
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 20, 36, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--panel-border);
  z-index: 50;
  padding: 0.5rem;
  justify-content: space-around;
}

.mobile-nav-btn {
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.mobile-nav-btn.active {
  color: var(--cyan);
  font-weight: 700;
  background: var(--cyan-dim);
}

.mobile-nav-btn.locked-nav {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Responsive Styles */
@media (max-width: 900px) {
  .layout-body {
    flex-direction: column;
    padding-bottom: 5rem;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .reset-scopes-grid {
    grid-template-columns: 1fr;
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after {
  animation: none !important;
  transition: none !important;
}

/* ==========================================================================
   Strategic Governance & Prestige Tree Styles
   ========================================================================== */

/* Active Doctrines */
.doctrines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.doctrine-item-card {
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.doctrine-equipped {
  border-color: var(--cyan);
  background: rgba(97, 231, 224, 0.05);
}

.doctrine-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0.5rem 0 1rem;
}

.doctrine-toggle-btn {
  margin-top: auto;
  width: 100%;
  padding: 0.55rem;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Tree Toolbar & Respec */
.tree-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.85rem 1.25rem;
  margin: 1.25rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.tree-metrics {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.tree-stat {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.tree-stat-val {
  font-size: 1rem;
}

.respec-btn {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--purple);
  color: var(--purple);
  background: var(--purple-dim);
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.respec-btn:hover:not(:disabled) {
  background: rgba(192, 132, 252, 0.3);
  border-color: #d8b4fe;
  color: #fff;
}

/* Domain Filter Tabs */
.domain-filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.domain-tab {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.domain-tab:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.domain-tab.active {
  color: #fff;
  border-color: var(--cyan);
  background: var(--panel-alt);
}

.domain-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Node Cards Grid */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.lesson-node-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  transition: all 0.2s ease;
  position: relative;
}

.lesson-node-card:hover {
  border-color: var(--line);
  transform: translateY(-2px);
}

.lesson-node-card.node-unlocked {
  border-color: rgba(97, 231, 224, 0.4);
  background: rgba(13, 27, 46, 0.95);
}

.lesson-node-card.node-maxed {
  border-color: rgba(145, 237, 154, 0.4);
}

.lesson-node-card.keystone-card {
  border-width: 2px;
  border-color: var(--amber);
  box-shadow: 0 0 16px rgba(255, 197, 109, 0.12);
}

.node-badges {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tier-badge {
  border: 1px solid;
}

.badge-keystone {
  background: rgba(255, 197, 109, 0.15);
}

.domain-badge {
  background: var(--panel-alt);
  color: var(--text-muted);
  border: 1px solid var(--line);
}

.rank-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.rank-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.rank-mini-bar {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.rank-mini-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.node-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.75rem 0;
  line-height: 1.45;
}

.node-effect-preview {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.85rem;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.effect-line {
  display: flex;
  justify-content: space-between;
}

.node-lock-notice {
  font-size: 0.72rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.node-buy-btn {
  width: 100%;
  padding: 0.65rem;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
  transition: all 0.2s ease;
  margin-top: auto;
}

.node-buy-btn.btn-affordable {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--purple-dim);
}

.node-buy-btn.btn-affordable:hover:not(:disabled) {
  background: rgba(192, 132, 252, 0.3);
  border-color: #d8b4fe;
  color: #fff;
}

.node-buy-btn.btn-maxed {
  border-color: rgba(145, 237, 154, 0.3);
  color: var(--green);
  background: var(--green-dim);
}

/* Loop Matrix Toolbar & Controls */
.tree-toolbar-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.buy-mode-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.2rem;
  gap: 0.25rem;
}

.buy-mode-label {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 0.4rem;
  letter-spacing: 0.05em;
}

.btn-buy-mode {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-buy-mode:hover {
  color: var(--text);
}

.btn-buy-mode.active {
  background: var(--purple-dim);
  color: var(--purple);
  border-color: var(--purple);
}

/* Active Loop Modifiers HUD */
.loop-modifiers-hud {
  background: rgba(13, 27, 46, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
}

.hud-stat strong {
  font-size: 0.95rem;
  color: var(--cyan);
}

/* Search & Status Filter Bar */
.tree-search-filter-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  flex: 1;
  min-width: 250px;
}

.lesson-search-input {
  width: 100%;
  padding: 0.5rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.lesson-search-input:focus {
  border-color: var(--cyan);
}

.status-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.status-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-pill:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.status-pill.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--cyan);
}

.nexus-card {
  border-width: 2px !important;
  border-color: #ec4899 !important;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.18) !important;
}

.empty-filter-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px dashed var(--panel-border);
}

