:root {
  --bg: #020714;
  --bg-2: #061123;
  --surface: rgba(9, 20, 42, 0.76);
  --surface-strong: rgba(11, 27, 58, 0.94);
  --surface-soft: rgba(18, 42, 83, 0.58);
  --line: rgba(131, 172, 255, 0.18);
  --line-strong: rgba(121, 170, 255, 0.36);
  --text: #f5f8ff;
  --muted: #91a3c2;
  --soft: #c8d7f2;
  --accent: #2c6cff;
  --accent-2: #5bd7ff;
  --accent-strong: #1745c4;
  --success: #52d6b3;
  --warn: #ffbf5c;
  --danger: #ff6f7d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(44, 108, 255, 0.48), transparent 36rem),
    radial-gradient(circle at 82% 18%, rgba(91, 215, 255, 0.18), transparent 24rem),
    linear-gradient(180deg, #030816 0%, #020714 48%, #01040c 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(120, 164, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 164, 255, 0.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 64%);
}

body::after {
  content: "";
  position: fixed;
  left: 50%;
  top: 116px;
  z-index: -1;
  width: min(1180px, 118vw);
  height: 360px;
  transform: translateX(-50%);
  border-top: 2px solid rgba(105, 174, 255, 0.86);
  border-radius: 50% 50% 0 0;
  filter: drop-shadow(0 0 18px rgba(70, 135, 255, 0.9));
  opacity: 0.78;
}

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

button,
.ghostButton {
  min-height: 40px;
  border: 1px solid rgba(118, 174, 255, 0.28);
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--accent), #1747cf);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(44, 108, 255, 0.24);
}

button:hover,
.ghostButton:hover {
  border-color: rgba(91, 215, 255, 0.62);
  background: linear-gradient(135deg, #3579ff, #1e56de);
}

button.secondary,
.ghostButton {
  background: rgba(8, 18, 38, 0.68);
  box-shadow: none;
}

button.secondary:hover,
.ghostButton:hover {
  background: rgba(19, 42, 82, 0.78);
}

.iconButton {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 18px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(136, 175, 255, 0.22);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(4, 11, 25, 0.78);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(91, 215, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(91, 215, 255, 0.12);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

body.authLocked .appShell {
  display: none;
}

body:not(.authLocked) .loginView {
  display: none;
}

.loginView {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loginBox {
  position: relative;
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 29, 61, 0.92), rgba(5, 12, 28, 0.94));
  box-shadow: var(--shadow);
}

.loginBox::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 220px;
  background: radial-gradient(circle, rgba(91, 215, 255, 0.26), transparent 62%);
  pointer-events: none;
}

.loginBox > * {
  position: relative;
}

.loginBox h1 {
  margin-bottom: 0;
  font-size: 28px;
}

.loginCopy,
.hint {
  color: var(--muted);
  line-height: 1.6;
}

.hint {
  margin: 0;
  font-size: 13px;
}

.appShell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 18px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid rgba(118, 174, 255, 0.12);
  background: rgba(3, 8, 20, 0.76);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand span:last-child {
  display: grid;
  gap: 1px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.brandMark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(91, 215, 255, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #9feaff, transparent 20%),
    linear-gradient(135deg, #1745c4, #061b4f);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 28px rgba(44, 108, 255, 0.42);
}

.topNav {
  justify-self: center;
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(118, 174, 255, 0.14);
  border-radius: 999px;
  background: rgba(8, 17, 35, 0.62);
}

.topNav span {
  padding: 7px 12px;
  color: var(--muted);
  font-size: 12px;
}

.topNav span:first-child {
  border-radius: 999px;
  background: rgba(44, 108, 255, 0.28);
  color: var(--text);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.adminIdentity {
  max-width: 260px;
  color: var(--soft);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.heroPanel {
  position: relative;
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 460px);
  align-items: center;
  gap: 36px;
  padding: 52px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(10, 27, 59, 0.88), rgba(4, 10, 25, 0.92)),
    radial-gradient(circle at 74% 24%, rgba(91, 215, 255, 0.22), transparent 22rem);
  box-shadow: var(--shadow);
}

.heroGlow {
  position: absolute;
  left: 50%;
  top: 42px;
  width: 86%;
  height: 260px;
  transform: translateX(-50%);
  border-top: 2px solid rgba(91, 215, 255, 0.72);
  border-radius: 50% 50% 0 0;
  filter: drop-shadow(0 0 20px rgba(91, 215, 255, 0.8));
  opacity: 0.62;
}

.heroCopy,
.statusDeck {
  position: relative;
  z-index: 1;
}

.heroCopy h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: 48px;
  line-height: 1.08;
}

.heroCopy p:not(.eyebrow) {
  max-width: 650px;
  color: var(--soft);
  line-height: 1.7;
}

.heroActions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.statusDeck {
  min-height: 300px;
  display: grid;
  align-content: space-between;
  gap: 22px;
  padding: 24px;
  border: 1px solid rgba(118, 174, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 20, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 22px 60px rgba(0, 0, 0, 0.28);
}

.deckHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--soft);
  font-size: 13px;
}

.deckHeader small {
  color: var(--accent-2);
}

.flowMeter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(121, 170, 255, 0.14);
}

.flowFill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(91, 215, 255, 0.72);
  transition: width 300ms ease;
}

.deckValue strong {
  display: block;
  font-size: 46px;
  line-height: 1;
}

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

.chartBars {
  height: 118px;
  display: grid;
  grid-template-columns: repeat(7, minmax(22px, 1fr));
  align-items: end;
  gap: 10px;
}

.chartBars span {
  min-height: 12px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, rgba(91, 215, 255, 0.96), rgba(44, 108, 255, 0.34));
  box-shadow: 0 0 22px rgba(44, 108, 255, 0.35);
}

.metrics,
.signalGrid {
  display: grid;
  gap: 14px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin: 18px 0;
}

.metrics div,
.signalGrid article,
.form,
.tableWrap,
.output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: blur(18px);
}

.metrics div {
  padding: 18px;
}

.metrics span {
  display: block;
  margin-bottom: 4px;
  font-size: 30px;
  font-weight: 800;
}

.metrics small,
.sectionHeader p,
small {
  color: var(--muted);
}

.signalGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}

.signalGrid article {
  min-height: 154px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(13, 31, 66, 0.78), rgba(6, 14, 31, 0.78)),
    radial-gradient(circle at 80% 12%, rgba(91, 215, 255, 0.16), transparent 10rem);
}

.signalIcon {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.signalGrid h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.signalGrid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 18px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid rgba(118, 174, 255, 0.15);
  border-radius: 999px;
  background: rgba(5, 13, 30, 0.74);
}

.tabs button {
  min-width: 88px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.tabs button.active {
  background: linear-gradient(135deg, var(--accent), #1747cf);
  color: #fff;
}

.notice {
  border: 1px solid rgba(91, 215, 255, 0.38);
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  background: rgba(13, 43, 80, 0.82);
  padding: 13px 15px;
  margin: 0 0 18px;
  color: var(--text);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: end;
  margin: 24px 0 16px;
}

.sectionHeader h2 {
  font-size: 24px;
}

.sectionHeader p:last-child {
  max-width: 440px;
  margin-bottom: 0;
  line-height: 1.6;
  text-align: right;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.form {
  display: grid;
  gap: 13px;
  padding: 20px;
  background: var(--surface-strong);
}

.form h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.tableWrap {
  overflow-x: auto;
  background: rgba(5, 13, 30, 0.86);
}

table {
  width: 100%;
  min-width: 740px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(118, 174, 255, 0.12);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--soft);
  background: rgba(16, 34, 70, 0.62);
  font-weight: 700;
}

td {
  color: #e7eefc;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid rgba(82, 214, 179, 0.32);
  border-radius: 999px;
  background: rgba(82, 214, 179, 0.12);
  color: #9cf3dd;
  font-size: 12px;
  font-weight: 700;
}

.badge.warn {
  border-color: rgba(255, 191, 92, 0.36);
  background: rgba(255, 191, 92, 0.12);
  color: #ffd595;
}

.badge.danger {
  border-color: rgba(255, 111, 125, 0.36);
  background: rgba(255, 111, 125, 0.12);
  color: #ffabb3;
}

.output {
  max-height: 340px;
  padding: 16px;
  overflow: auto;
  background: #030812;
  color: #d8ecff;
  white-space: pre-wrap;
}

@media (max-width: 960px) {
  body::after {
    top: 96px;
    width: 1120px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topNav {
    justify-self: start;
    max-width: 100%;
    overflow-x: auto;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .heroPanel,
  .metrics,
  .signalGrid,
  .split {
    grid-template-columns: 1fr;
  }

  .heroPanel {
    padding: 34px 24px;
  }

  .heroCopy h1 {
    font-size: 36px;
  }

  .sectionHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .sectionHeader p:last-child {
    text-align: left;
  }
}

@media (max-width: 560px) {
  main {
    padding: 28px 14px 48px;
  }

  .heroPanel {
    min-height: 0;
    padding: 28px 18px;
  }

  .heroCopy h1 {
    font-size: 30px;
  }

  .tabs {
    border-radius: 8px;
  }

  .tabs button {
    min-width: 78px;
  }

  .loginBox {
    padding: 22px;
  }
}
