:root {
  --bg-app: #070c17;
  --bg-surface: #0c1527;
  --bg-card: #0e1a30;
  --bg-input: #080f1e;
  --border: #172a47;
  --border-strong: #1e3256;
  --text-main: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-dim: #7686a0;
  --accent: #10b981;
  --accent-strong: #0d8f66;
  --accent-soft: #34d399;
  --blue: #2563eb;
  --blue-soft: #60a5fa;
  --red: #ef4444;
  --red-soft: #f87171;
  --amber: #f59e0b;
  --amber-soft: #fbbf24;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(16, 185, 129, 0.16) 0%, rgba(37, 99, 235, 0.1) 42%, transparent 75%),
    linear-gradient(180deg, #081120 0%, #070c17 55%, #060a14 100%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  top: -9999px;
  left: 20px;
  background: var(--blue);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.skip-link:focus {
  top: 16px;
  outline: 2px solid #ffffff;
}

:target,
.content-panel,
.panel-title {
  scroll-margin-top: 80px;
}

.view {
  min-height: 100vh;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(56, 189, 248, 0.25);
}

.login-logo img,
.login-logo-small img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-logo-small {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
}

.login-title {
  font-size: 24px;
  color: #f8fafc;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-title span {
  color: var(--accent-soft);
  font-weight: 700;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 14px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(12, 21, 39, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(2, 6, 16, 0.55);
  padding: 30px;
}

.login-hint {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 20px;
}

.alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 13px;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.field-help {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 5px;
  line-height: 1.4;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"] {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: #f1f5f9;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.field input::placeholder {
  color: #3d4f6d;
}

.input-disabled {
  background: rgba(10, 18, 32, 0.7) !important;
  color: var(--text-dim) !important;
  border-color: #16243b !important;
  cursor: not-allowed;
}

.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-action input {
  flex: 1;
}

.field-group-box {
  background: rgba(8, 15, 30, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.field-group-title {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: #04140e;
  border-color: var(--accent-strong);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-soft);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
  background: var(--accent-strong);
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: rgba(14, 26, 48, 0.9);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: #172a4a;
  border-color: #243f6c;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
  transform: scale(0.98);
  background: #111e35;
}

.btn-secondary:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 6px 12px;
  font-size: 13px;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
}

.btn-link:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 6px;
  height: 38px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none !important;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.segmented-control {
  display: inline-flex;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  text-align: center;
  outline: none;
}

.segment-btn:hover:not(:disabled) {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
}

.segment-btn.active {
  background: #192b47;
  color: #f8fafc;
  border-color: var(--border-strong);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.segment-btn.segment-active.active {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.45);
}

.segment-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--blue);
}

.segment-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.site-header {
  background: rgba(8, 15, 29, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-title {
  font-size: 15px;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

.site-title strong {
  color: var(--accent-soft);
}

.admin-nav {
  display: flex;
  gap: 6px;
  background: rgba(10, 18, 34, 0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover {
  color: #f1f5f9;
}

.nav-tab-btn.active {
  background: #1b2f52;
  color: #ffffff;
  border-color: #274374;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.site-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-role {
  background: rgba(37, 99, 235, 0.14);
  color: var(--blue-soft);
  border-color: rgba(37, 99, 235, 0.35);
}

.badge-admin {
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.4);
}

.badge-user {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.25);
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.badge-ip-restricted {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-ip-open {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.3);
}

.site-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.content-panel {
  display: block;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 22px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.telemetry-cockpit {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 16px;
  margin-bottom: 24px;
}

.telemetry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color 0.15s ease;
}

.telemetry-card:hover {
  border-color: var(--border-strong);
}

.telemetry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.telemetry-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.telemetry-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-soft);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
}

.status-dot-active {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.telemetry-metric-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.telemetry-metric-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.telemetry-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.telemetry-metric-sub {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.telemetry-subnumber {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 600;
  color: #cbd5e1;
}

.telemetry-metric-label {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.telemetry-metric-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
}

.telemetry-subtag {
  font-size: 12px;
  color: var(--text-secondary);
}

.telemetry-ip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.telemetry-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
}

.ip-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 6px;
}

.telemetry-caption {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

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

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

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

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

.table-toolbar {
  margin-bottom: 16px;
}

.search-wrap {
  position: relative;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: #f1f5f9;
  border-radius: 8px;
  padding: 0 12px 0 36px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.alert-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.data-table th {
  background: rgba(10, 18, 34, 0.95);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #132238;
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

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

.user-email-cell {
  font-weight: 600;
  color: #f8fafc;
}

.table-state-box {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  background: #0d172a;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  padding: 26px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ip-audit-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.ip-audit-label {
  font-weight: 500;
}

.ip-audit-time {
  color: #64748b;
}

.hero {
  text-align: center;
  padding: 48px 20px 72px;
}

.hero-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-soft);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  color: #f8fafc;
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 760px;
  margin: 0 auto;
}

.hero-text {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 560px;
  margin: 18px auto 30px;
}

.hero-note {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 14px;
}

.installer-meta {
  max-width: 560px;
  margin: 20px auto 0;
  text-align: left;
}

.checksum-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(8, 15, 30, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.checksum-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-soft);
  white-space: nowrap;
}

.checksum-value {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  user-select: all;
}

.installer-filename {
  color: var(--text-dim);
  font-size: 12px;
  margin: 8px 2px 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 24px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

@media (max-width: 768px) {
  .site-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .site-brand {
    justify-content: space-between;
  }

  .admin-nav {
    width: 100%;
    justify-content: center;
  }

  .site-user {
    justify-content: space-between;
    width: 100%;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-header-actions {
    justify-content: flex-start;
  }

  .ip-info-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
