:root {
  --bg: #07111f;
  --bg-soft: #0d1a2d;
  --surface: rgba(12, 22, 38, 0.88);
  --surface-strong: rgba(14, 27, 46, 0.96);
  --surface-alt: rgba(17, 31, 54, 0.78);
  --text: #eef4ff;
  --muted: #9eafd1;
  --line: rgba(158, 175, 209, 0.16);
  --line-strong: rgba(115, 183, 255, 0.24);
  --accent: #59c3ff;
  --accent-2: #7a7cff;
  --ok: #27d08a;
  --warn: #f4b84a;
  --bad: #ff6b87;
  --info: #59c3ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

:root.light {
  --bg: #edf3ff;
  --bg-soft: #f7faff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-alt: rgba(243, 247, 255, 0.96);
  --text: #142033;
  --muted: #5e6f8e;
  --line: rgba(20, 32, 51, 0.1);
  --line-strong: rgba(55, 121, 214, 0.18);
  --accent: #1570ef;
  --accent-2: #5e5ce6;
  --ok: #0f9f61;
  --warn: #b97807;
  --bad: #d6336c;
  --info: #1570ef;
  --shadow: 0 24px 60px rgba(33, 51, 84, 0.12);
}

* { box-sizing: border-box; }
* { -ms-overflow-style: none; scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(89, 195, 255, 0.16), transparent 24%),
    radial-gradient(circle at top right, rgba(122, 124, 255, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.025), transparent 34%);
}

button, input, table, pre { font: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 18px;
  max-width: 96vw;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
}

.brand-wrap { display: flex; align-items: center; }
.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.brand-btn strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.01em;
}
.brand-btn small {
  display: block;
  color: var(--muted);
}

.top-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}
.nav-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.nav-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.nav-btn.is-current {
  border-color: rgba(89, 195, 255, 0.34);
  background: linear-gradient(180deg, rgba(89, 195, 255, 0.18), rgba(122, 124, 255, 0.12));
}

.page {
  max-width: 96vw;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.app-footer {
  max-width: 96vw;
  margin: 18px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-strong) 76%, transparent);
  box-shadow: var(--shadow);
  color: var(--muted);
  text-align: center;
}
.app-footer a {
  color: var(--text);
  text-decoration: none;
}
.app-footer a:hover {
  color: var(--muted);
}

.hero-card,
.panel-card,
.metric-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  border-radius: 28px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(89, 195, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero-card h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.hero-copy {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  font-size: 15px;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.hero-side {
  display: grid;
  gap: 14px;
}
.clock-card,
.pulse-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  padding: 18px;
}
.clock-label,
.pulse-sub,
.clock-date { color: var(--muted); }
.clock-value {
  margin: 4px 0 6px;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
}
.pulse-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(39, 208, 138, 0.45);
  animation: pulse 1.8s infinite;
}
.pulse-title { font-weight: 700; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(39, 208, 138, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(39, 208, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 208, 138, 0); }
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.metric-card {
  border-radius: 24px;
  padding: 20px;
}
.metric-card.accent {
  background: linear-gradient(180deg, rgba(89, 195, 255, 0.18), rgba(18, 33, 58, 0.92));
}
.metric-label {
  color: var(--muted);
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.metric-value {
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.metric-value-small {
  font-size: clamp(24px, 2.4vw, 32px);
}
.metric-sub {
  margin-top: 10px;
  color: var(--muted);
}

.content-grid,
.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}
.panel-span-2 { min-width: 0; }
.panel-card {
  min-width: 0;
  border-radius: 26px;
  padding: 18px 18px 12px;
}
.wide-card { padding-bottom: 14px; }
.side-panel-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}
.panel-head-embedded {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.embedded-section {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.panel-subtitle,
.panel-meta {
  color: var(--muted);
}
.panel-meta {
  white-space: nowrap;
  font-weight: 700;
}

.summary-stack {
  display: grid;
  gap: 12px;
}
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}
.summary-row span { color: var(--muted); }
.summary-row strong { font-size: 16px; }

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.table tbody tr {
  transition: background 150ms ease, transform 150ms ease;
}
.table tbody tr:hover {
  background: rgba(89, 195, 255, 0.08);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table td.numeric { font-variant-numeric: tabular-nums; }
.table td.emphasis { font-weight: 700; }
.table td.ok { color: var(--ok); font-weight: 700; }
.table td.bad { color: var(--bad); font-weight: 700; }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.table-pagination .chip {
  min-width: 92px;
  justify-content: center;
}

.badge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge.ob { border-color: rgba(39, 208, 138, 0.4); color: #9df0c7; }
.badge.aprs { border-color: rgba(89, 195, 255, 0.38); color: #a7dcff; }
.badge.sms { border-color: rgba(244, 184, 74, 0.38); color: #ffd68b; }
.badge.talk { border-color: rgba(158, 175, 209, 0.32); color: var(--text); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(39, 208, 138, 0.28);
  background: rgba(39, 208, 138, 0.12);
  font-size: 12px;
  font-weight: 800;
}
.chip-soft {
  border-color: var(--line);
  background: rgba(255,255,255,0.04);
}
.chip-warn {
  border-color: rgba(244, 184, 74, 0.3);
  background: rgba(244, 184, 74, 0.12);
}
.chip-bad {
  border-color: rgba(255, 107, 135, 0.3);
  background: rgba(255, 107, 135, 0.12);
}

.monitor-grid { grid-template-columns: 1fr; }
.monitor-stat-card { padding-bottom: 18px; }
.terminal {
  margin: 0;
  min-height: 420px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 11, 22, 0.92), rgba(7, 15, 28, 0.98));
  color: #a9ffc9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.is-live {
  border-color: rgba(255, 107, 135, 0.22);
  box-shadow: 0 24px 80px rgba(255, 107, 135, 0.1);
}

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { padding: 14px; }
  .topbar,
  .hero-card,
  .panel-card,
  .metric-card { border-radius: 22px; }
  .topbar,
  .hero-card { padding: 16px; }
  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }
  .top-actions { width: 100%; }
  .top-actions .nav-btn { flex: 1; }
  .hero-card,
  .monitor-hero,
  .metric-grid { grid-template-columns: 1fr; }
  .clock-value { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.is-hidden { display: none !important; }

.form-card { padding-bottom: 18px; }
.register-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field {
  display: grid;
  gap: 8px;
}
.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
}
.field input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(89, 195, 255, 0.12);
}
.field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.field-span-2 { grid-column: span 2; }
.field-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.submit-btn {
  min-width: 180px;
  justify-content: center;
}
.submit-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}
.form-note { color: var(--muted); }
.form-status {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
}
.form-status.is-ok {
  border-color: rgba(39, 208, 138, 0.28);
  background: rgba(39, 208, 138, 0.12);
  color: var(--text);
}
.form-status.is-warn {
  border-color: rgba(244, 184, 74, 0.3);
  background: rgba(244, 184, 74, 0.12);
  color: var(--text);
}
.form-status.is-bad {
  border-color: rgba(255, 107, 135, 0.3);
  background: rgba(255, 107, 135, 0.12);
  color: var(--text);
}
.terminal-short {
  min-height: 0;
  margin-bottom: 16px;
}
.compact-stack { gap: 10px; }
@media (max-width: 1180px) {
  .register-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .register-form { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .field-actions { align-items: stretch; }
  .submit-btn { width: 100%; }
}


.lang-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
}

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

.lang-select {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.auth-slot {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.profile-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.compact-form {
  grid-template-columns: 1fr;
}

.compact-form .field-span-2 {
  grid-column: auto;
}

.auth-actions-row {
  align-items: stretch;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 10, 18, 0.68);
  backdrop-filter: blur(12px);
}

.modal-card {
  width: min(520px, 100%);
  padding: 18px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
}

.modal-head {
  margin-bottom: 10px;
}

.modal-close {
  min-width: 96px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 820px) {
  .lang-slot,
  .auth-slot {
    width: 100%;
  }

  .lang-slot {
    justify-content: center;
  }

  .auth-slot .nav-btn,
  .auth-slot .chip {
    flex: 1;
    justify-content: center;
  }

  .modal-card {
    padding: 16px;
    border-radius: 22px;
  }
}

.table td .badge-stack { margin: 0; }

@media (max-width: 900px) {
  #tab-openbridge { min-width: 1100px; }
}

.dv-form-grid {
  align-items: start;
}

.field select.field-select,
.field-select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
}

.field-select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(89, 195, 255, 0.12);
}

.field-select option {
  background: var(--bg-soft);
  color: var(--text);
}

.field-select-multi1 {
  height: 120px;
  padding: 10px;
}

.field-select-multi2 {
  height: 250px;
  padding: 10px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 700;
}

.toggle-pill input {
  margin: 0;
  accent-color: var(--accent);
  width: 48px;
}

.toggle-pill span {
  width: 320px;
}

@media (max-width: 820px) {
  .toggle-row {
    flex-direction: column;
  }

  .toggle-pill {
    width: 100%;
  }
}

.map-shell {
  padding: 20px;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 700;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.station { background: #59c3ff; }
.legend-dot.hotspot { background: #27d08a; }

.map-canvas {
  width: 100%;
  min-height: 540px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-alt), var(--surface));
}

.coord {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.leaflet-container {
  font: 14px/1.4 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142033;
}

.map-popup-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.map-popup-meta {
  margin: 2px 0;
  font-size: 13px;
}

.map-popup-meta strong {
  font-weight: 700;
}


.floating-language-switcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
}

.floating-language-button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
}

.floating-language-menu {
  min-width: 110px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

@media (max-width: 820px) {
  .floating-language-switcher {
    left: 12px;
    right: 12px;
    bottom: 12px;
    justify-content: space-between;
  }

  .floating-language-button,
  .floating-language-menu {
    flex: 1;
  }
}


.nav-language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.nav-language-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav-language-menu {
  min-width: 108px;
}

@media (max-width: 820px) {
  .nav-language-switcher {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }

  .nav-language-label {
    display: none;
  }
}
