@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Premium Dark/Light color tokens */
  color-scheme: light dark;
  
  /* Base Palette */
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f9fafb;
  --panel: #ffffff;
  
  /* Brand Accents */
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  
  /* Semantic */
  --teal: #0f766e;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  
  /* Shadows & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 12px 0 rgba(37, 99, 235, 0.3);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f9fafb;
    --muted: #9ca3af;
    --line: #374151;
    --soft: #111827;
    --panel: #1f2937;
    
    --brand: #3b82f6;
    --brand-hover: #60a5fa;
    --brand-soft: #1e3a8a;
    
    --green: #10b981;
    --green-soft: #064e3b;
    --amber: #f59e0b;
    --amber-soft: #78350f;
    --red: #ef4444;
    --red-soft: #7f1d1d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--soft);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Reset & Base Elements */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

p { margin: 0 0 1rem; color: var(--muted); }

button, input, select {
  font-family: inherit;
  font-size: 14px;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: var(--transition);
}

a:hover { color: var(--brand-hover); }

/* Layout Utilities */
.container {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* App Shell */
.app-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  display: flex;
  align-items: center;
}

.brand-logo {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, var(--brand), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* UI Components */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.panel:hover {
  box-shadow: var(--shadow-md);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgb(15 23 42 / 0.72);
}

.modal-panel {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--soft);
  border-color: var(--muted);
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem;
  background: var(--panel);
  color: var(--ink);
  transition: var(--transition);
  outline: none;
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--ink);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--ink);
}

.check-row input {
  width: 16px;
  height: 16px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.75rem;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-hero,
.domain-ops-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 2rem;
  align-items: center;
  overflow: hidden;
  min-height: 300px;
  padding: 2rem;
  background:
    linear-gradient(135deg, rgb(37 99 235 / 0.20), transparent 34%),
    linear-gradient(45deg, rgb(16 185 129 / 0.16), transparent 45%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.customer-hero h1,
.domain-ops-hero h1 {
  max-width: 680px;
  font-size: 2.4rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.customer-hero p,
.domain-ops-hero p {
  max-width: 640px;
  margin-top: 0.8rem;
}

.domain-quick-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 1.5rem;
  max-width: 560px;
}

.signal-stage {
  position: relative;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgb(15 23 42 / 0.24);
}

.signal-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(148 163 184 / 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgb(148 163 184 / 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  animation: gridDrift 12s linear infinite;
}

.signal-sweep {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent 0 72%, rgb(59 130 246 / 0.28), transparent 82% 100%);
  animation: sweep 6s linear infinite;
}

.edge-node,
.edge-core {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid rgb(148 163 184 / 0.35);
  background: rgb(15 23 42 / 0.66);
  color: #f8fafc;
  box-shadow: 0 0 28px rgb(37 99 235 / 0.18);
}

.edge-node {
  width: 56px;
  height: 38px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.edge-node-a { top: 26px; left: 42px; }
.edge-node-b { right: 44px; top: 64px; }
.edge-node-c { left: 78px; bottom: 42px; }

.edge-core {
  inset: 50% auto auto 50%;
  width: 124px;
  height: 124px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
}

.edge-core strong {
  display: block;
  color: #34d399;
  font-size: 2rem;
}

.edge-core span {
  color: #cbd5e1;
  font-size: 0.75rem;
}

.metric-card {
  border-radius: 8px;
}

.stats-row {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.domain-command-list {
  display: grid;
  gap: 1rem;
}

.domain-command {
  display: grid;
  gap: 1rem;
  width: 100%;
  padding: 1.25rem;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.domain-command:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.domain-command-top,
.domain-command-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.domain-command-top strong {
  display: block;
  font-size: 1.125rem;
}

.domain-command-top small,
.domain-command-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.domain-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.domain-command-meter,
.setup-meter {
  display: block;
  height: 8px;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.domain-command-meter span,
.setup-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--green), var(--amber));
}

.empty-command {
  display: grid;
  place-items: center;
  gap: 0.75rem;
  min-height: 260px;
  padding: 2rem;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-command-visual {
  position: relative;
  width: 120px;
  height: 78px;
}

.empty-command-visual span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  transform: translate(-50%, -50%);
  animation: tilePulse 2.4s ease-in-out infinite;
}

.empty-command-visual span:nth-child(2) {
  margin-left: -44px;
  border-color: var(--green);
  animation-delay: 0.3s;
}

.empty-command-visual span:nth-child(3) {
  margin-left: 44px;
  border-color: var(--amber);
  animation-delay: 0.6s;
}

.ops-radar {
  position: relative;
  min-height: 240px;
}

.radar-ring,
.radar-line,
.radar-core {
  position: absolute;
  left: 50%;
  top: 50%;
}

.radar-ring {
  border: 1px solid rgb(59 130 246 / 0.42);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.ring-a {
  width: 150px;
  height: 150px;
  animation: radarPulse 2.8s ease-in-out infinite;
}

.ring-b {
  width: 230px;
  height: 230px;
  animation: radarPulse 2.8s ease-in-out infinite 0.7s;
}

.radar-line {
  width: 112px;
  height: 2px;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--brand), transparent);
  animation: radarSpin 4s linear infinite;
}

.radar-core {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  color: #fff;
  font-weight: 800;
  background: var(--brand);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.setup-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.setup-step {
  min-height: 130px;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.setup-step span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 0.75rem;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 800;
}

.setup-step strong,
.setup-step small {
  display: block;
}

.setup-step small {
  margin-top: 0.35rem;
  color: var(--muted);
}

.setup-step.is-done span {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.setup-step.is-current {
  border-color: var(--brand);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ns-summary {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.ns-summary > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ns-summary-warning .code-chip {
  color: var(--amber);
  border-color: rgb(217 119 6 / 0.45);
  background: var(--amber-soft);
}

.code-chip {
  display: inline-flex;
  padding: 0.45rem 0.6rem;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success { background: var(--green-soft); color: var(--green); }
.badge-warning { background: var(--amber-soft); color: var(--amber); }
.badge-danger { background: var(--red-soft); color: var(--red); }
.badge-neutral { background: var(--soft); color: var(--muted); border: 1px solid var(--line); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--soft); }

/* Sidebar & Layout */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 64px);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem;
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-item:hover, .sidebar-item.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.main-content {
  padding: 2rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gridDrift {
  from { background-position: 0 0; }
  to { background-position: 56px 56px; }
}

@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes tilePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.65; }
  50% { transform: translate(-50%, -50%) scale(1.16); opacity: 1; }
}

@keyframes radarPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
}

@keyframes radarSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fade {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Utility */
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-accent { color: var(--brand); }
.w-full { width: 100%; }
.block { display: block; }
.border { border: 1px solid var(--line); }
.border-t { border-top: 1px solid var(--line); }
.rounded { border-radius: var(--radius-sm); }
.p-2 { padding: 0.5rem; }
.p-8 { padding: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-4 { margin-left: 1rem; }
.pt-4 { padding-top: 1rem; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@media (max-width: 900px) {
  .container {
    width: min(100% - 24px, 1200px);
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .customer-hero,
  .domain-ops-hero,
  .setup-board,
  .domain-command-grid {
    grid-template-columns: 1fr;
  }

  .customer-hero,
  .domain-ops-hero {
    padding: 1.25rem;
  }

  .customer-hero h1,
  .domain-ops-hero h1 {
    font-size: 2rem;
  }

  .domain-quick-form {
    grid-template-columns: 1fr;
  }

  .signal-stage,
  .ops-radar {
    min-height: 220px;
  }

  .table {
    min-width: 760px;
  }

  .panel[style*="overflow:hidden"] {
    overflow-x: auto !important;
  }
}
