:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  position: relative;
  margin: 0;
  background: var(--bg);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  font-synthesis: none;
}

.admin-loading body {
  min-height: 100vh;
  overflow: hidden;
}

.admin-loading .skip-link,
.admin-loading .mobile-nav-toggle,
.admin-loading .sidebar-overlay,
.admin-loading .traffic-background,
.admin-loading .shell {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.admin-loader {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(12, 22, 40, 0.98), rgba(10, 18, 32, 0.96)),
    var(--sidebar);
  color: #f7fafc;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.admin-loaded .admin-loader {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.admin-loader-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}

.admin-loader-mark {
  width: 40px;
  height: 40px;
}

.admin-loader-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-loader-copy strong {
  font-size: 16px;
  line-height: 1.2;
}

.admin-loader-copy span {
  color: #aebfba;
  font-size: 13px;
}

.admin-loader-progress {
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  height: 3px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.admin-loader-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #f2b84b);
  animation: admin-loader-progress 1100ms ease-in-out infinite;
}

.admin-loader.error .admin-loader-progress span {
  background: var(--danger);
  animation: none;
}

@keyframes admin-loader-progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

.auth-screen {
  --auth-screen-gutter: 24px;
  --auth-screen-inset: 48px;
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--auth-screen-gutter);
  background:
    radial-gradient(circle at 14% 16%, rgba(47, 211, 176, 0.18), transparent 28%),
    radial-gradient(circle at 80% 82%, rgba(33, 150, 243, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(11, 28, 43, 0.98), rgba(8, 21, 32, 0.99)),
    var(--sidebar);
  color: #f7fafc;
  overflow: hidden;
}

html:has(.auth-screen:not([hidden])),
body:has(.auth-screen:not([hidden])) {
  overflow: hidden;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.82fr);
  width: min(1120px, 100%);
  height: min(872px, calc(100dvh - var(--auth-screen-inset)));
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(8, 21, 32, 0.9);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.auth-visual {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
  min-height: 100%;
  padding: clamp(26px, 4vw, 42px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(9, 33, 49, 0.96), rgba(7, 24, 35, 0.96));
}

.auth-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.8), transparent 92%);
  pointer-events: none;
}

.auth-visual-brand,
.auth-visual-copy,
.auth-network-stage {
  position: relative;
  z-index: 1;
}

.auth-visual-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-visual-brand div,
.auth-card-head {
  display: grid;
  gap: 4px;
}

.auth-visual-brand strong {
  font-size: 20px;
  line-height: 1.2;
}

.auth-visual-brand span,
.auth-visual-copy p {
  color: #b7c7c2;
}

.auth-network-stage {
  min-height: 360px;
  display: grid;
  place-items: center;
}

.auth-network {
  width: 100%;
  max-width: 620px;
  min-height: 360px;
}

.auth-routes use {
  fill: none;
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-routes .route-allow {
  stroke: rgba(47, 211, 176, 0.44);
}

.auth-routes .route-drop {
  stroke: rgba(248, 113, 113, 0.28);
  stroke-dasharray: 7 8;
}

.auth-filter-core {
  transform-origin: 310px 210px;
  animation: authCoreBreathe 4.6s ease-in-out infinite;
}

.auth-core-halo {
  fill: url(#auth-core-glow);
}

.auth-core-links line {
  stroke: rgba(47, 211, 176, 0.72);
  stroke-width: 3;
  stroke-linecap: round;
  filter: url(#auth-packet-glow);
}

.auth-core-nodes circle {
  fill: #0b2631;
  stroke: #2fd3b0;
  stroke-width: 3;
  filter: url(#auth-packet-glow);
}

.auth-core-nodes circle:first-child {
  fill: rgba(47, 211, 176, 0.22);
  stroke: #7fffe1;
}

.auth-nodes circle {
  fill: #0e2932;
  stroke: rgba(47, 211, 176, 0.55);
  stroke-width: 2;
}

.auth-nodes .drop-node {
  stroke: rgba(248, 113, 113, 0.72);
}

.auth-packet {
  filter: url(#auth-packet-glow);
}

.auth-packet rect {
  fill: currentColor;
}

.auth-packet.packet-allow {
  color: var(--accent);
}

.auth-packet.packet-info {
  color: var(--info);
}

.auth-packet.packet-warning {
  color: var(--warning);
}

.auth-packet.packet-danger {
  color: var(--danger);
}

.auth-packet.packet-cycle {
  color: var(--accent-dark);
}

.auth-packet.packet-cycle rect {
  fill: #0f9f86;
}

.auth-packet.packet-drop {
  opacity: 0.72;
}

.auth-visual-copy {
  max-width: 460px;
}

.auth-visual-copy span,
.auth-eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-visual-copy h2 {
  margin: 10px 0 10px;
  color: #f7fafc;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

.auth-visual-copy p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
}

.auth-card {
  display: grid;
  align-content: start;
  gap: 18px;
  width: 100%;
  min-height: 0;
  padding: clamp(56px, 10vh, 92px) clamp(28px, 4vw, 46px) clamp(28px, 4vw, 46px);
  overflow: hidden;
  color: var(--text);
  background: rgba(255, 255, 255, 0.98);
}

.auth-logo {
  width: 42px;
  height: 42px;
}

.auth-tabs {
  display: none;
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: #c8d6d2;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  color: #06231d;
  background: var(--accent);
}

.auth-card-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.12;
}

.auth-card-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form.compact {
  padding-top: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

.auth-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(47, 211, 176, 0.18);
}

.auth-form .button {
  min-height: 48px;
  justify-content: center;
}

.auth-inline-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
}

.auth-mode-link {
  border: 0;
  padding: 0;
  color: #087d6a;
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-mode-link:hover,
.auth-mode-link:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
}

.auth-token-fallback {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.auth-token-fallback summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.auth-message.error {
  color: #dc2626;
}

.auth-message.success {
  color: #0f9f7f;
}

@keyframes authCoreBreathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.94;
  }
  50% {
    transform: scale(1.035);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .auth-screen {
    overflow-y: auto;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .auth-card {
    padding: 40px clamp(28px, 4vw, 46px);
    overflow: visible;
  }

  .auth-visual {
    min-height: 340px;
  }

  .auth-network-stage {
    min-height: 230px;
  }

  .auth-network {
    min-height: 250px;
  }

  .auth-visual-copy h2 {
    max-width: 620px;
  }
}

@media (min-width: 981px) and (max-height: 760px) {
  .auth-screen {
    overflow-y: auto;
  }

  .auth-layout {
    height: auto;
    min-height: 680px;
  }

  .auth-card {
    padding-top: 40px;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .auth-screen {
    --auth-screen-gutter: 14px;
    --auth-screen-inset: 28px;
    align-items: start;
  }

  .auth-layout {
    border-radius: 10px;
  }

  .auth-visual {
    min-height: 190px;
    gap: 16px;
    padding: 20px;
  }

  .auth-network-stage {
    display: none;
  }

  .auth-visual-copy h2 {
    font-size: 24px;
  }

  .auth-visual-copy p {
    display: none;
  }

  .auth-card {
    padding: 22px;
  }
}

.traffic-background {
  position: fixed;
  z-index: 0;
  inset: 0 0 0 272px;
  overflow: hidden;
  pointer-events: none;
}

.traffic-background::after {
  position: absolute;
  inset: 0;
  content: "";
}

.traffic-background svg {
  width: 100%;
  height: 100%;
}

.traffic-routes {
  fill: none;
  stroke: #76928b;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.15;
  opacity: 0.24;
}

.traffic-nodes {
  fill: #f4f6f8;
  stroke: #64827a;
  stroke-width: 1.4;
  opacity: 0.55;
}

.traffic-packet {
  filter: url("#packet-glow");
  opacity: 0.72;
}

.traffic-packet rect {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 0.8;
}

.traffic-packet.packet-allow {
  fill: var(--accent);
}

.traffic-packet.packet-info {
  fill: var(--info);
}

.traffic-packet.packet-warning {
  fill: var(--warning);
}

.traffic-packet.packet-danger {
  fill: var(--danger);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}
