@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

:root {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-2: #111827;
  --panel: #0b1220;
  --panel-border: #1f2937;
  --text: #e5e7eb;
  --text-dim: #94a3b8;
  --accent: #0ea5e9;
  --accent-soft: rgba(14, 165, 233, 0.12);
  --success: #22c55e;
  --warn: #f59e0b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.scanline {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(14, 165, 233, 0.08) 40%, transparent 80%);
  opacity: 0.35;
  animation: scan 10s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.particle-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.particle-field span {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.35);
  animation: float 12s linear infinite;
}

@keyframes float {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0.2;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    transform: translate3d(0, -40px, 0);
    opacity: 0.1;
  }
}

@keyframes scan {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

.sidebar {
  background: #0b1220;
  border-right: 1px solid var(--panel-border);
  padding: 2rem 1.5rem;
  display: grid;
  gap: 1.8rem;
  align-content: start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #1e40af);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.brand-title {
  margin: 0;
  font-weight: 600;
}

.brand-sub {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.nav {
  display: grid;
  gap: 1.2rem;
}

.nav-group {
  display: grid;
  gap: 0.4rem;
}

.nav-label {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.nav-item {
  text-decoration: none;
  color: var(--text-dim);
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item.is-active,
.nav-item:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-item .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

.nav-item .badge {
  margin-left: auto;
  background: #111827;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.65rem;
  color: var(--text-dim);
}

.sidebar-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.2rem;
  display: grid;
  gap: 0.6rem;
}

.sidebar-card.compact {
  padding: 1rem;
}

.sidebar-quick {
  display: grid;
  gap: 0.6rem;
}

.sidebar-footer {
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.sidebar-footer a,
.link-btn {
  color: var(--text-dim);
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-size: 0.8rem;
}

.main {
  background: var(--bg-2);
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  padding: 2rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.topbar h1 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
}

.topbar-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.status-chip,
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: #0f1a2b;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.status-chip .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.user-chip .user-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #111827;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-weight: 600;
}

.content {
  padding: 2rem 2.5rem 3rem;
  display: grid;
  gap: 2rem;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  align-items: start;
}

.hero-card h2 {
  margin: 0.5rem 0 1rem;
  font-size: 1.6rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: var(--accent);
}

.lead {
  color: var(--text-dim);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-metrics {
  display: grid;
  gap: 1rem;
  background: #0f1c2e;
  border-radius: 16px;
  padding: 1.2rem;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.hero-bg {
  position: absolute;
  inset: -10% -10%;
  z-index: 0;
  pointer-events: none;
}

.hero-card > :not(.hero-bg) {
  position: relative;
  z-index: 1;
}

.square-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  padding: 2rem;
  opacity: 0.4;
}

.square-grid span {
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.square-grid span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(14, 165, 233, 0.4), transparent 65%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.square-grid span.is-active::after {
  opacity: 1;
}

.hero-video-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(14, 165, 233, 0.14), transparent 55%),
    radial-gradient(circle at 80% 60%, rgba(148, 163, 184, 0.12), transparent 60%),
    linear-gradient(120deg, rgba(11, 18, 32, 0.9), rgba(15, 23, 42, 0.9));
  mix-blend-mode: screen;
  animation: drift 9s ease-in-out infinite;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-2%, 2%, 0);
  }
}

.metric .value {
  font-size: 1.4rem;
  margin: 0.3rem 0 0;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

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

.grid.three-col {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.6rem;
  display: grid;
  gap: 1.2rem;
  align-content: start;
}

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

.ops-tile {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1rem;
  min-height: 120px;
  display: grid;
  gap: 0.4rem;
}

.tile-status {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-good {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.status-warn {
  background: var(--warn);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.section-divider {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  opacity: 0.6;
}

.section-divider span {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.5), transparent);
  animation: divider 3s ease-in-out infinite;
}

.section-divider span:nth-child(2) {
  animation-delay: 0.6s;
}

.section-divider span:nth-child(3) {
  animation-delay: 1.2s;
}

@keyframes divider {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.9;
  }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

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

.label {
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin: 0;
}

.value {
  margin: 0.4rem 0 0;
  font-weight: 600;
}

.meta {
  color: var(--text-dim);
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.pill {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}

.pill-good {
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.pill-warn {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #111827;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.9));
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  padding: 0.4rem 0.8rem;
  border-radius: 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.tab.is-active {
  border-color: rgba(14, 165, 233, 0.5);
  color: var(--text);
  background: var(--accent-soft);
}

.tab-panels {
  display: grid;
}

.tab-panel {
  display: none;
  color: var(--text-dim);
}

.tab-panel.is-active {
  display: grid;
  gap: 0.8rem;
}

.tab-panel ul {
  margin: 0;
  padding-left: 1.2rem;
}

.tab-panels {
  background: #0f1a2b;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  padding: 1rem 1.2rem;
}

.tab-panel {
  font-size: 0.92rem;
}

.tab-panel ul {
  display: grid;
  gap: 0.4rem;
}

.timeline {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.6rem;
  display: grid;
  gap: 1.2rem;
}

.timeline-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.4rem;
  position: relative;
}

.timeline-track::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.5), rgba(14, 165, 233, 0.2));
  opacity: 0.4;
}

.timeline-node {
  position: relative;
  background: #0f1a2b;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.2rem;
  min-height: 140px;
}

.timeline-node .node-dot {
  position: absolute;
  top: -4px;
  left: 1.2rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.4);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

.timeline-node.is-active .node-dot {
  background: rgba(14, 165, 233, 0.9);
}

.geo-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 240px);
  gap: 1.6rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.6rem;
  align-items: start;
}

.geo-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  min-height: 220px;
}

.geo-grid span {
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.7);
  position: relative;
  overflow: hidden;
}

.geo-grid span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(14, 165, 233, 0.5), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.geo-grid span.is-hot::after {
  opacity: 1;
}

.geo-metrics {
  display: grid;
  gap: 0.6rem;
  background: #0f1a2b;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1rem;
  align-self: end;
}

.guardian-map {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.6rem;
  display: grid;
  gap: 1.4rem;
  place-items: center;
  position: relative;
}

.guardian-stage {
  position: relative;
  width: 320px;
  height: 320px;
  display: grid;
  place-items: center;
}

.guardian-ring {
  position: relative;
  width: 280px;
  height: 280px;
  --ring-radius: 140px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 50%;
}

.guardian-ring span {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.8);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
  cursor: pointer;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--ring-radius));
}

.guardian-ring span::after {
  content: attr(data-role);
  position: absolute;
  top: -2.2rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #0f1a2b;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.65rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.guardian-ring span:hover::after {
  opacity: 1;
}

.guardian-ring span:nth-child(1) {
  --angle: 270deg;
}

.guardian-ring span:nth-child(2) {
  --angle: 330deg;
}

.guardian-ring span:nth-child(3) {
  --angle: 30deg;
}

.guardian-ring span:nth-child(4) {
  --angle: 90deg;
}

.guardian-ring span:nth-child(5) {
  --angle: 150deg;
}

.guardian-ring span:nth-child(6) {
  --angle: 210deg;
}

.guardian-core {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1px solid rgba(14, 165, 233, 0.4);
  background: #0b1220;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 0.85rem;
}

.guardian-core span {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.posture-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: center;
}

.posture-card .progress {
  margin-top: 0.8rem;
}

.posture-card .progress-labels {
  margin-top: 0.4rem;
}

.posture-card .meta-grid {
  align-content: center;
}

.tier {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 0;
  border-top: 1px solid var(--panel-border);
}

.tier:first-of-type {
  border-top: none;
  padding-top: 0;
}

.ledger {
  display: grid;
  gap: 0.6rem;
}

.ledger-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #0f1a2b;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.button {
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.button-primary {
  background: var(--accent);
  color: #0b1220;
  font-weight: 600;
}

.button-outline {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
}

.button-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 50;
}

.modal.is-open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 12, 0.75);
  backdrop-filter: blur(6px);
}

.modal-shell {
  position: relative;
  width: min(820px, 90vw);
  max-height: 85vh;
  background: linear-gradient(160deg, #0b1220 0%, #0f1a2b 100%);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 40px 120px rgba(2, 6, 12, 0.6);
  display: grid;
  gap: 1.6rem;
  overflow: hidden;
  z-index: 1;
}

.modal-shell::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  background: radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.2), transparent 60%);
  opacity: 0.6;
  pointer-events: none;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.5rem;
  max-height: 50vh;
}

.wizard {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.6rem;
}

.wizard-rail {
  display: grid;
  gap: 1rem;
  border-right: 1px solid var(--panel-border);
  padding-right: 1rem;
}

.wizard-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.6rem;
  align-items: center;
  color: var(--text-dim);
}

.wizard-step span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
}

.wizard-step.is-active {
  color: var(--text);
}

.wizard-step.is-active span {
  border-color: rgba(14, 165, 233, 0.6);
  background: var(--accent-soft);
}

.wizard-body {
  display: grid;
  gap: 1rem;
  overflow: hidden;
}

.wizard-panel {
  display: none;
}

.wizard-panel.is-active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.field input,
.field select,
.field textarea {
  background: #0b1220;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
}

.field textarea {
  resize: vertical;
}

.wizard-actions {
  display: flex;
  gap: 0.8rem;
}

@media (max-width: 840px) {
  .wizard {
    grid-template-columns: 1fr;
  }

  .wizard-rail {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 1rem;
  }
}

.modal-panel {
  background: #0b1220;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.4rem;
  position: relative;
  z-index: 1;
}

.modal-panel ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-dim);
}

.icon-btn {
  border: 1px solid var(--panel-border);
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 840px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .geo-panel {
    grid-template-columns: 1fr;
  }

  .posture-card {
    grid-template-columns: 1fr;
  }

  .ledger-row {
    grid-template-columns: 1fr;
  }
}
