:root {
  --ink: #1a1d24;
  --muted: #5c6470;
  --accent: #d8672f;
  --accent-2: #2e7d78;
  --card: rgba(255, 255, 255, 0.9);
  --stroke: rgba(26, 29, 36, 0.1);
  --shadow: 0 24px 60px rgba(26, 29, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Futura", "Gill Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #f8f1e4 0%, #f2f4f8 35%, #e1e8f1 100%);
}

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 20%, rgba(216, 103, 47, 0.16), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(46, 125, 120, 0.18), transparent 50%);
  opacity: 0.8;
}

.frame {
  position: relative;
  padding: 48px clamp(20px, 6vw, 72px);
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  animation: fade-in 0.6s ease;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 42px);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(46, 125, 120, 0.12);
  color: var(--accent-2);
  font-size: 13px;
}

.ghost {
  text-decoration: none;
  color: var(--accent);
  border: 1px solid rgba(216, 103, 47, 0.3);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
}

.ghost.small {
  padding: 6px 12px;
  font-size: 12px;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 180px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-menu button {
  background: rgba(26, 29, 36, 0.06);
  color: var(--ink);
  border: 1px solid rgba(26, 29, 36, 0.1);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background: rgba(26, 29, 36, 0.12);
}

.dropdown-menu .danger {
  color: #b43d2c;
  border-color: rgba(180, 61, 44, 0.3);
}

.dropdown-status {
  font-size: 12px;
  color: var(--muted);
}

.dropdown-status.error {
  color: #b43d2c;
}

.log-panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(26, 29, 36, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.log-panel.open {
  opacity: 1;
  pointer-events: auto;
}

.log-card {
  width: min(900px, 92vw);
  max-height: 84vh;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-card h3 {
  margin: 0;
  font-size: 18px;
}

.log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.log-actions {
  display: flex;
  gap: 8px;
}

.log-output {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: rgba(26, 29, 36, 0.06);
  font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", monospace;
  font-size: 12px;
  color: var(--ink);
  overflow: auto;
  white-space: pre-wrap;
  flex: 1;
}

.log-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 0.6s ease;
}

.card.wide {
  grid-column: 1 / -1;
}

.card h2 {
  margin: 0;
  font-size: 18px;
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.network {
  display: grid;
  gap: 12px;
  font-size: 13px;
}

.network-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.network-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(26, 29, 36, 0.08);
  background: rgba(26, 29, 36, 0.03);
}

.network-kpi .stat-value {
  font-size: 24px;
}

.kpi-sub {
  font-size: 12px;
}

.network-graphs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.network-graph {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(26, 29, 36, 0.08);
  background: rgba(26, 29, 36, 0.03);
}

.graph-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sparkline {
  width: 100%;
  height: 72px;
}

.spark-line {
  fill: none;
  stroke: var(--spark-color, var(--accent));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spark-area {
  fill: var(--spark-color, var(--accent));
  opacity: 0.18;
}

.network-graph.in {
  --spark-color: var(--accent-2);
}

.network-graph.out {
  --spark-color: var(--accent);
}

.network-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) minmax(80px, 1fr) minmax(80px, 1fr);
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(26, 29, 36, 0.08);
}

.network-row.muted {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.auth {
  display: grid;
  place-items: center;
}

.auth-card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 28px;
  padding: 36px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
  animation: rise 0.6s ease;
}

.auth-header h1 {
  margin-top: 8px;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(26, 29, 36, 0.15);
  font-size: 15px;
  font-family: inherit;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(216, 103, 47, 0.3);
}

.error {
  display: none;
  color: #b43d2c;
  margin: 0;
  font-size: 13px;
}

.error.show {
  display: block;
}

.muted {
  color: var(--muted);
}

@keyframes rise {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

  .actions {
    width: 100%;
    justify-content: space-between;
  }

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