/* TunnelForge dashboard — self-contained theme on top of Tailwind's CDN reset. */

:root {
  --bg: #06070a;
  --bg-soft: #0a0c12;
  --panel: rgba(14, 17, 25, 0.78);
  --panel-solid: #0e1119;
  --panel-raised: #121620;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #f3f6fb;
  --text-soft: #aab3c5;
  --text-muted: #6f788a;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --accent-ink: #032420;
  --blue: #7dd3fc;
  --violet: #a78bfa;
  --green: #34d399;
  --orange: #fbbf24;
  --red: #fb7185;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", "Roboto Mono",
    Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 16%, black 0%, transparent 78%);
}

.ambient-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 85%);
}

.ambient-glow {
  position: fixed;
  z-index: -2;
  width: 48rem;
  height: 48rem;
  border-radius: 999px;
  filter: blur(120px);
  pointer-events: none;
  opacity: 0.16;
}

.ambient-glow-one {
  top: -24rem;
  left: 18%;
  background: #14b8a6;
}

.ambient-glow-two {
  right: -24rem;
  top: 22rem;
  background: #4f46e5;
  opacity: 0.1;
}

/* Shared components ------------------------------------------------------ */
.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 720;
  letter-spacing: -0.025em;
  font-size: 1.02rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.24);
  border-radius: 10px;
  background:
    radial-gradient(circle at 30% 20%, rgba(94, 234, 212, 0.22), transparent 65%),
    #0c1717;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.brand-mark svg {
  width: 1.35rem;
  height: 1.35rem;
}

.brand-name {
  background: linear-gradient(180deg, #fff, #c7d1e0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.version-pill {
  padding: 0.18rem 0.46rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.02em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.52rem;
  min-height: 2.55rem;
  padding: 0.62rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.1;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
  white-space: nowrap;
}

.button svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
}

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

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

.button:focus-visible,
.icon-button:focus-visible,
.code-copy:focus-visible,
.modal-close:focus-visible,
.segment input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button-primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, #7ff4e0, #45d7c2);
  border-color: rgba(188, 255, 245, 0.55);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 10px 30px rgba(45, 212, 191, 0.2);
}

.button-primary:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 14px 38px rgba(45, 212, 191, 0.28);
}

.button-secondary {
  color: #e9f1fb;
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line-strong);
}

.button-secondary:hover,
.button-ghost:hover,
.button-quiet:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

.button-ghost {
  min-height: 2.35rem;
  padding: 0.5rem 0.85rem;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
  font-size: 0.78rem;
}

.button-quiet {
  color: var(--text-soft);
  background: transparent;
  border-color: var(--line);
}

.button-danger {
  color: #ffe4e6;
  background: linear-gradient(180deg, #f43f5e, #be123c);
  border-color: rgba(255, 205, 210, 0.3);
  box-shadow: 0 8px 26px rgba(190, 18, 60, 0.22);
}

.button-full {
  width: 100%;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: 140ms ease;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.spinner {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid rgba(3, 36, 32, 0.25);
  border-top-color: currentColor;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}

.spinner-large {
  width: 1.5rem;
  height: 1.5rem;
  border-width: 2.5px;
  border-color: rgba(94, 234, 212, 0.15);
  border-top-color: var(--accent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  margin: 0 0 1rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.09);
}

/* Login ------------------------------------------------------------------ */
.login-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: min(100%, 26.5rem);
  padding: 2rem;
}

.brand-centered {
  justify-content: center;
  margin-bottom: 2.4rem;
}

.login-heading {
  margin-bottom: 1.6rem;
  text-align: center;
}

.login-heading .eyebrow {
  margin-bottom: 0.75rem;
}

.login-heading h1 {
  margin: 0 0 0.55rem;
  font-size: 1.9rem;
  letter-spacing: -0.045em;
}

.login-heading p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
}

.login-hint {
  margin: 1.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: center;
}

/* Application shell ------------------------------------------------------ */
.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, 78rem);
  min-height: 4.5rem;
  margin: 0 auto;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.1),
      transparent
    )
    1;
  background: rgba(6, 7, 10, 0.62);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.gateway-state {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 0.2rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.status-dot {
  position: relative;
  display: inline-block;
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 999px;
  flex: none;
}

.status-dot-online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.status-dot-online::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: inherit;
  animation: status-pulse 2.4s ease-out infinite;
}

.status-dot-error {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.09);
}

@keyframes status-pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  85%,
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.content {
  width: min(100% - 2rem, 78rem);
  margin: 0 auto;
  padding: 4.2rem 0 3rem;
}

/* Hero ------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  align-items: center;
  gap: 3rem;
  min-height: 22rem;
  margin-bottom: 3.2rem;
}

.hero h1 {
  margin: 0;
  max-width: 43rem;
  font-size: clamp(2.5rem, 5.4vw, 4.4rem);
  font-weight: 760;
  line-height: 0.99;
  letter-spacing: -0.065em;
}

.gradient-text {
  background: linear-gradient(100deg, #98fff0 3%, #5eead4 38%, #8b9dff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-description {
  max-width: 37rem;
  margin: 1.35rem 0 0;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.8rem;
}

.hero-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  max-width: 23rem;
  justify-self: center;
}

.orbit-ring {
  position: absolute;
  border: 1px solid rgba(94, 234, 212, 0.13);
  border-radius: 999px;
}

.orbit-ring-one {
  inset: 12%;
  border-style: dashed;
  animation: orbit-spin 36s linear infinite;
}

.orbit-ring-two {
  inset: 27%;
  border-color: rgba(125, 211, 252, 0.11);
  animation: orbit-spin 22s linear infinite reverse;
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

.orbit-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 6.6rem;
  height: 6.6rem;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 24px;
  background:
    radial-gradient(circle at 32% 22%, rgba(94, 234, 212, 0.2), transparent 65%),
    #0b1118;
  box-shadow:
    0 0 70px rgba(45, 212, 191, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  transform: rotate(4deg);
}

.orbit-core svg {
  width: 3.1rem;
  height: 3.1rem;
  transform: rotate(-4deg);
}

.orbit-node {
  position: absolute;
  padding: 0.35rem 0.62rem;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 12, 18, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.orbit-node-a {
  top: 8%;
  left: 24%;
}

.orbit-node-b {
  top: 42%;
  right: 4%;
}

.orbit-node-c {
  bottom: 8%;
  left: 20%;
}

/* Stats ------------------------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 3.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid;
  border-radius: 10px;
  flex: none;
}

.stat-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.stat-icon-green {
  color: var(--green);
  border-color: rgba(52, 211, 153, 0.2);
  background: rgba(52, 211, 153, 0.07);
}

.stat-icon-blue {
  color: var(--blue);
  border-color: rgba(125, 211, 252, 0.18);
  background: rgba(125, 211, 252, 0.06);
}

.stat-icon-purple {
  color: var(--violet);
  border-color: rgba(167, 139, 250, 0.18);
  background: rgba(167, 139, 250, 0.06);
}

.stat-label {
  margin: 0 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.stat-value {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 580;
  letter-spacing: -0.03em;
}

.stat-value-small {
  font-size: 0.95rem;
}

/* Section / table -------------------------------------------------------- */
.tunnels-section {
  scroll-margin-top: 6rem;
  margin-bottom: 3.5rem;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.section-heading p {
  margin: 0;
  font-size: 0.8rem;
}

.table-panel {
  overflow: hidden;
  border-radius: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

thead {
  background: rgba(255, 255, 255, 0.024);
}

th {
  padding: 0.78rem 1rem;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

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

.tunnel-name {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 10.5rem;
}

.protocol-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.026);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex: none;
}

.tunnel-name strong {
  display: block;
  font-size: 0.81rem;
  font-weight: 600;
}

.tunnel-name small {
  display: block;
  margin-top: 0.12rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: #dbe5f3;
  font-family: var(--mono);
  font-size: 0.73rem;
  white-space: nowrap;
}

.copy-mini {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: 120ms ease;
}

.copy-mini:hover {
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
}

.copy-mini svg {
  width: 0.82rem;
  height: 0.82rem;
}

.token-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.token-value {
  max-width: 11.5rem;
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-value.revealed {
  max-width: 14rem;
  overflow: visible;
  color: #d6e2ef;
  line-height: 1.55;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-all;
}

.token-action {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.token-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.token-action svg {
  width: 0.9rem;
  height: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.24rem 0.52rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.badge-dot {
  width: 0.33rem;
  height: 0.33rem;
  border-radius: 999px;
  background: currentColor;
}

.badge-online {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.18);
  background: rgba(52, 211, 153, 0.075);
}

.badge-online .badge-dot {
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.08);
}

.badge-offline {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.11);
  background: rgba(148, 163, 184, 0.04);
}

.time-cell {
  color: var(--text-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
}

.row-action {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: 120ms ease;
}

.row-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.row-action-danger:hover {
  color: var(--red);
  background: rgba(251, 113, 133, 0.07);
  border-color: rgba(251, 113, 133, 0.16);
}

.row-action svg {
  width: 0.95rem;
  height: 0.95rem;
}

.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 12rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.8rem 1.5rem;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  margin-bottom: 1.1rem;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 16px;
  background: rgba(94, 234, 212, 0.04);
}

.empty-icon svg {
  width: 1.9rem;
  height: 1.9rem;
}

.empty-state h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.empty-state p {
  max-width: 26rem;
  margin: 0 0 1.4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

/* Info cards ------------------------------------------------------------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.info-card {
  padding: 1.25rem;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.info-step {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
}

.info-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.87rem;
  letter-spacing: -0.015em;
}

.info-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.62;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, 78rem);
  margin: 0 auto;
  padding: 1.5rem 0 2.2rem;
  color: var(--text-muted);
  font-size: 0.69rem;
  border-top: 1px solid var(--line);
}

.footer-separator {
  margin: 0 0.4rem;
  color: rgba(255, 255, 255, 0.2);
}

.footer-meta {
  font-family: var(--mono);
  font-size: 0.64rem;
}

/* Forms ------------------------------------------------------------------ */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  min-width: 0;
}

.field-label {
  color: #cdd6e5;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.field-help {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.port-status {
  min-height: 1rem;
  font-size: 0.66rem;
  line-height: 1.45;
}

.port-status.ok {
  color: var(--green);
}

.port-status.bad {
  color: #fda4af;
}

.port-status.checking {
  color: var(--text-muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.85rem;
  color: var(--text);
  background: rgba(5, 8, 13, 0.65);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.input::placeholder {
  color: #4e596b;
}

.input:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(5, 9, 14, 0.9);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08);
}

.input-mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.input[type="number"] {
  appearance: textfield;
}

.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.segment {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: 130ms ease;
}

.segment:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
}

.segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment span {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.segment small {
  color: var(--text-muted);
  font-size: 0.61rem;
}

.segment:has(input:checked) {
  border-color: rgba(94, 234, 212, 0.42);
  background: rgba(94, 234, 212, 0.055);
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.08);
}

.segment:has(input:checked) span {
  color: var(--accent);
}

.form-notice {
  display: flex;
  gap: 0.55rem;
  padding: 0.72rem 0.8rem;
  color: var(--text-muted);
  font-size: 0.67rem;
  line-height: 1.5;
  border: 1px solid rgba(251, 191, 36, 0.1);
  border-radius: 9px;
  background: rgba(251, 191, 36, 0.035);
}

.form-notice svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
  color: var(--orange);
  margin-top: 0.1rem;
}

.form-error {
  margin: 0;
  padding: 0.6rem 0.7rem;
  color: #fecdd3;
  font-size: 0.72rem;
  line-height: 1.5;
  border: 1px solid rgba(251, 113, 133, 0.2);
  border-radius: 8px;
  background: rgba(251, 113, 133, 0.07);
}

/* Modals ----------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(10px);
  animation: fade-in 150ms ease-out;
}

.modal {
  position: relative;
  width: min(100%, 30rem);
  margin: auto;
  padding: 1.75rem;
  border-radius: 19px;
  animation: modal-in 180ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.modal-wide {
  width: min(100%, 38rem);
}

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

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.modal-close svg {
  width: 1rem;
  height: 1rem;
}

.modal-header {
  margin-bottom: 1.4rem;
}

.modal-header-centered {
  text-align: center;
}

.modal-kicker {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.modal-kicker-danger {
  color: var(--red);
}

.modal-header h2 {
  margin: 0 0 0.42rem;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.modal-header p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1.35rem;
}

.modal-actions-centered {
  justify-content: center;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 3.3rem;
  height: 3.3rem;
  margin: 0 auto 1.1rem;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.07);
  box-shadow: 0 0 38px rgba(45, 212, 191, 0.14);
}

.success-mark svg {
  width: 1.55rem;
  height: 1.55rem;
}

.code-box {
  position: relative;
  padding: 1.15rem 1rem 3rem;
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(94, 234, 212, 0.055), transparent 60%),
    rgba(4, 10, 11, 0.72);
}

.code-box code {
  display: block;
  overflow-wrap: anywhere;
  color: #b9fff4;
  font-family: var(--mono);
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  line-height: 1.6;
  letter-spacing: 0.075em;
  text-align: center;
  word-break: break-all;
  text-shadow: 0 0 24px rgba(94, 234, 212, 0.18);
}

.code-copy {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.65rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(94, 234, 212, 0.07);
  border: 1px solid rgba(94, 234, 212, 0.17);
  border-radius: 7px;
  cursor: pointer;
  transform: translateX(-50%);
  transition: 130ms ease;
}

.code-copy:hover {
  background: rgba(94, 234, 212, 0.12);
  border-color: rgba(94, 234, 212, 0.3);
}

.code-copy svg {
  width: 0.85rem;
  height: 0.85rem;
}

.mapping-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.mapping-side {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.mapping-side-right {
  text-align: right;
}

.mapping-label {
  color: var(--text-muted);
  font-size: 0.59rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mapping-value {
  overflow: hidden;
  color: #d6e3f0;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-arrow {
  display: flex;
  gap: 0.15rem;
}

.mapping-arrow span {
  width: 0.2rem;
  height: 0.2rem;
  border-radius: 999px;
  background: var(--accent);
  animation: mapping-blink 1.4s infinite;
}

.mapping-arrow span:nth-child(2) {
  animation-delay: 0.18s;
}

.mapping-arrow span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes mapping-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.pairing-footnote {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.64rem;
  line-height: 1.5;
  text-align: center;
}

/* Toasts ----------------------------------------------------------------- */
.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  width: min(100% - 2rem, 22rem);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  color: #e5edf7;
  font-size: 0.75rem;
  line-height: 1.45;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(13, 17, 25, 0.96);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast.toast-success {
  border-color: rgba(52, 211, 153, 0.22);
}

.toast.toast-error {
  border-color: rgba(251, 113, 133, 0.26);
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  margin-top: 0.05rem;
}

.toast-success .toast-icon {
  color: var(--green);
}

.toast-error .toast-icon {
  color: var(--red);
}

.toast-icon svg {
  width: 1rem;
  height: 1rem;
}

.toast.toast-leaving {
  animation: toast-out 160ms ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Responsive ------------------------------------------------------------- */
/* Activity log ----------------------------------------------------------- */
.activity-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.activity-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.06);
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.activity-live.is-paused {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.activity-live-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0.2rem rgba(94, 234, 212, 0.08);
}

.activity-live.is-paused .activity-live-dot {
  box-shadow: none;
}

.activity-panel {
  overflow: hidden;
  border-radius: 16px;
}

.activity-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.log-filters {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.log-filter {
  padding: 0.32rem 0.62rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.68rem;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}

.log-filter:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.045);
}

.log-filter.is-active {
  color: var(--accent);
  background: rgba(94, 234, 212, 0.075);
  border-color: rgba(94, 234, 212, 0.17);
}

.activity-count {
  flex: none;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  white-space: nowrap;
}

.active-connections {
  display: grid;
  gap: 0.32rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: rgba(94, 234, 212, 0.025);
}

.active-connection {
  display: grid;
  grid-template-columns: auto minmax(7rem, 1fr) auto auto auto;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.conn-peer {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-meta {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  white-space: nowrap;
}

.log-list {
  max-height: 25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.log-list::-webkit-scrollbar {
  width: 0.55rem;
}

.log-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.log-entry {
  display: grid;
  grid-template-columns: 4.8rem 4.6rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
  padding: 0.58rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.log-entry:last-child {
  border-bottom: 0;
}

.log-entry.log-warning {
  box-shadow: inset 2px 0 0 rgba(251, 191, 36, 0.65);
}

.log-entry.log-error {
  box-shadow: inset 2px 0 0 rgba(251, 113, 133, 0.75);
}

.log-time {
  padding-top: 0.08rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  white-space: nowrap;
}

.log-badge {
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.16rem 0.38rem;
  overflow: hidden;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.log-badge-agent,
.log-badge-listener {
  color: var(--accent);
  background: rgba(94, 234, 212, 0.06);
  border-color: rgba(94, 234, 212, 0.16);
}

.log-badge-client {
  color: var(--blue);
  background: rgba(125, 211, 252, 0.06);
  border-color: rgba(125, 211, 252, 0.16);
}

.log-badge-tunnel,
.log-badge-port {
  color: var(--violet);
  background: rgba(167, 139, 250, 0.06);
  border-color: rgba(167, 139, 250, 0.16);
}

.log-badge-server {
  color: var(--orange);
  background: rgba(251, 191, 36, 0.06);
  border-color: rgba(251, 191, 36, 0.16);
}

.log-message {
  color: var(--text);
  font-size: 0.74rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.log-details {
  margin-top: 0.12rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.log-empty {
  margin: 0;
  padding: 1.8rem 1rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  text-align: center;
}

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

  .active-connection {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .active-connection .conn-meta:nth-of-type(2),
  .active-connection .conn-meta:nth-of-type(3) {
    display: none;
  }

  .log-entry {
    grid-template-columns: 1fr auto;
  }

  .log-time {
    grid-column: 1;
  }

  .log-badge {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .log-body {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-top: 1.5rem;
  }

  .hero-orbit {
    display: none;
  }

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

  .gateway-state {
    display: none;
  }
}

@media (max-width: 720px) {
  .content {
    padding-top: 2.8rem;
  }

  .topbar {
    width: calc(100% - 1.4rem);
  }

  .brand .version-pill {
    display: none;
  }

  .download-label {
    display: none;
  }

  .button-ghost {
    padding-inline: 0.6rem;
  }

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

  .stat-card {
    padding: 0.85rem 1rem;
  }

  .section-heading {
    align-items: center;
  }

  .footer {
    width: calc(100% - 1.4rem);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .mapping-card {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    text-align: center;
  }

  .mapping-side-right {
    text-align: center;
  }

  .mapping-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }

  .modal {
    padding: 1.4rem;
  }

  .hero h1 {
    font-size: clamp(2.3rem, 12vw, 3.4rem);
  }
}

@media (max-width: 520px) {
  .content,
  .topbar {
    width: calc(100% - 1.2rem);
  }

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

  .section-heading .button {
    width: 100%;
  }

  .login-card {
    padding: 1.5rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Accounts --------------------------------------------------------------- */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.32rem 0.6rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  white-space: nowrap;
}

.user-chip-dot {
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08);
}

.user-chip-name {
  color: var(--text);
  font-weight: 600;
}

.user-chip-role {
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.admin-content {
  max-width: 1120px;
}

.admin-title {
  margin: 0 0 0.35rem;
  font-size: 2rem;
  letter-spacing: -0.045em;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-card {
  padding: 1.4rem;
}

.admin-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.admin-card > .muted {
  margin: 0 0 1.15rem;
  font-size: 0.76rem;
  line-height: 1.6;
}

.admin-facts {
  display: grid;
  gap: 0.6rem;
  margin: 1.2rem 0 0;
}

.admin-facts div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed var(--line);
  font-size: 0.76rem;
}

.admin-facts div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.admin-facts dt {
  color: var(--text-muted);
}

.admin-facts dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.admin-table-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.admin-table-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.admin-table-head .muted {
  margin: 0;
  font-size: 0.72rem;
}

.badge-admin {
  color: #c7bdfd;
  border-color: rgba(167, 139, 250, 0.22);
  background: rgba(167, 139, 250, 0.08);
}

.badge-operator {
  color: #9bd7f7;
  border-color: rgba(125, 211, 252, 0.18);
  background: rgba(125, 211, 252, 0.06);
}

.account-identity {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.account-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.account-sub {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.you-tag {
  padding: 0.08rem 0.34rem;
  color: var(--text-muted);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.align-right {
  text-align: right;
}

.row-actions .button {
  padding: 0.3rem 0.55rem;
  font-size: 0.66rem;
  white-space: nowrap;
}

.row-actions .button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 860px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .admin-table-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.admin-security {
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.admin-security h3 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
}

.admin-security .muted {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  line-height: 1.6;
}

.admin-activity {
  margin-top: 1rem;
  padding: 0;
}

.admin-activity-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-activity-list > li {
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
}

.admin-activity-list > li:last-child {
  border-bottom: 0;
}

.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.activity-dot {
  flex: none;
  width: 0.36rem;
  height: 0.36rem;
  margin-top: 0.42rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.07);
}

.activity-warning .activity-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.08);
}

.activity-error .activity-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.08);
}

.activity-body {
  display: flex;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.activity-text {
  color: var(--text-soft);
}

.activity-actor {
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.activity-time {
  flex: none;
  color: var(--text-muted);
  font-size: 0.64rem;
  white-space: nowrap;
}
