:root {
  --bg-0: #081622;
  --bg-1: #0f2433;
  --bg-2: #16344a;
  --panel: rgba(11, 27, 38, 0.8);
  --panel-strong: rgba(11, 27, 38, 0.96);
  --line: rgba(131, 184, 214, 0.28);
  --ink: #e8f5ff;
  --ink-soft: #9ebfd4;
  --teal: #1cd6a6;
  --amber: #ffb454;
  --danger: #ff6b6b;
  --shadow: 0 26px 60px rgba(3, 10, 16, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 10% -10%, #1e4a5f 0%, transparent 65%),
    radial-gradient(800px 600px at 100% 0%, #5a3e22 0%, transparent 60%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  overflow-x: hidden;
  position: relative;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  background-image: radial-gradient(#ffffff 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  z-index: 0;
}

.orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(38px);
  z-index: 0;
  opacity: 0.4;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #19c39b;
  top: -120px;
  right: -80px;
}

.orb-b {
  width: 260px;
  height: 260px;
  background: #ec9f37;
  bottom: -90px;
  left: -70px;
}

.orb-c {
  width: 190px;
  height: 190px;
  background: #6eb7df;
  right: 30%;
  bottom: 12%;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 28px));
  margin: 18px auto 32px;
  display: grid;
  gap: 14px;
}

.masthead {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background: linear-gradient(120deg, rgba(14, 35, 49, 0.96), rgba(17, 42, 57, 0.74));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  color: var(--amber);
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
}

h1 {
  margin: 8px 0;
  font-size: clamp(1.8rem, 5.2vw, 3.2rem);
  line-height: 1.06;
}

h2,
h3 {
  margin: 0 0 12px;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  max-width: 780px;
}

.status-chip {
  justify-self: start;
  border: 1px solid rgba(226, 245, 255, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.06);
}

.row-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(160deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
}

.stack {
  display: grid;
  gap: 10px;
}

.stack.compact {
  margin-top: 10px;
}

.field-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

label {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

input,
select,
button {
  width: 100%;
  font: inherit;
}

input,
select {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 20, 30, 0.64);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(28, 214, 166, 0.18);
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #05201b;
  background: linear-gradient(120deg, #1cd6a6, #87efcf);
  box-shadow: 0 12px 26px rgba(12, 158, 120, 0.3);
}

.btn-ghost {
  color: var(--ink);
  border-color: rgba(170, 209, 232, 0.5);
  background: rgba(22, 55, 74, 0.45);
}

.btn-danger {
  color: #2e0505;
  background: linear-gradient(120deg, #ff6b6b, #ffc2c2);
  box-shadow: 0 12px 26px rgba(211, 57, 57, 0.27);
}

.button-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#sessionMeta {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--ink-soft);
}

.stats-band {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(11, 27, 38, 0.92), rgba(18, 46, 63, 0.84));
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.stat-card {
  border: 1px solid rgba(148, 195, 221, 0.26);
  border-radius: 14px;
  padding: 10px;
  background: rgba(7, 20, 29, 0.54);
}

.stat-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  font-size: 1.55rem;
  margin-top: 4px;
}

.alias-list {
  display: grid;
  gap: 10px;
}

.alias-item {
  border: 1px solid rgba(144, 188, 211, 0.3);
  border-radius: 12px;
  background: rgba(8, 22, 33, 0.78);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.alias-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.alias-email {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
}

.badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge.active {
  background: rgba(28, 214, 166, 0.17);
  border-color: rgba(55, 235, 191, 0.4);
  color: #83f1d3;
}

.badge.blocked {
  background: rgba(255, 107, 107, 0.16);
  border-color: rgba(255, 171, 171, 0.52);
  color: #ffc1c1;
}

.alias-meta {
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.4;
}

.addy-key-reveal {
  border-color: rgba(255, 180, 84, 0.55);
  background: linear-gradient(145deg, rgba(58, 36, 14, 0.5), rgba(19, 34, 44, 0.78));
}

.addy-key-warning {
  color: #ffd9a3;
}

.detail-empty {
  color: var(--ink-soft);
}

.detail-block {
  display: grid;
  gap: 8px;
}

.detail-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
}

.events-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.admin-stats div {
  border: 1px solid rgba(157, 203, 229, 0.3);
  border-radius: 12px;
  padding: 8px;
  background: rgba(8, 20, 31, 0.7);
}

.admin-stats span {
  color: var(--ink-soft);
  display: block;
  font-size: 0.78rem;
}

.admin-stats strong {
  font-size: 1.1rem;
}

#log {
  margin: 0;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  border: 1px solid rgba(161, 205, 231, 0.28);
  border-radius: 10px;
  background: rgba(7, 19, 28, 0.7);
  padding: 10px;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal-in 450ms ease forwards;
}

.reveal:nth-of-type(2) { animation-delay: 70ms; }
.reveal:nth-of-type(3) { animation-delay: 120ms; }
.reveal:nth-of-type(4) { animation-delay: 170ms; }
.reveal:nth-of-type(5) { animation-delay: 220ms; }
.reveal:nth-of-type(6) { animation-delay: 280ms; }

@keyframes reveal-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 880px) {
  .masthead {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .row-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .row-grid .panel-api,
  .row-grid .panel-search {
    grid-column: span 1;
  }

  .stats-band {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
  }

  .panel-detail {
    grid-column: span 2;
  }
}
