*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { background: #080b12; color: #e8edf5; font-family: 'Inter', sans-serif; line-height: 1.6; min-height: 100vh; padding: 3rem 1.5rem 4rem; }

.wrap { width: 100%; max-width: 480px; margin: 0 auto; }

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-bottom: 2rem; }
.logo-mark { width: 30px; height: 30px; background: linear-gradient(135deg, #3b82f6, #6366f1); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.logo-name { font-weight: 700; font-size: 17px; color: #e8edf5; letter-spacing: -0.3px; }

/* Progress steps */
.steps { display: flex; gap: 4px; margin-bottom: 2rem; }
.step { flex: 1; height: 2px; background: #1e2a40; border-radius: 2px; }
.step.active { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.step.done { background: #10b981; }

/* Card */
.card { background: #0f1420; border: 1px solid #1e2a40; border-radius: 12px; padding: 2rem; margin-bottom: 1rem; position: relative; overflow: visible; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, #3b82f6, #6366f1, transparent); }
.card-title { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 0.25rem; }
.card-sub { font-size: 13px; color: #94a3b8; margin-bottom: 1.5rem; }

/* Alerts */
.alert { border-radius: 8px; padding: 0.875rem 1rem; font-size: 13px; margin-bottom: 1rem; line-height: 1.5; }
.alert-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }
.alert-warn  { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: #fcd34d; }
.alert-success { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.alert-info { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #93c5fd; }
.alert a { color: inherit; font-weight: 600; }

/* Form */
label { display: block; font-size: 11px; font-weight: 600; color: #94a3b8; letter-spacing: 0.8px; text-transform: uppercase; margin: 1.25rem 0 0.4rem; }
input, select { width: 100%; background: #080b12; border: 1px solid #253450; color: #e8edf5; font-family: 'Inter', sans-serif; font-size: 14px; padding: 10px 12px; border-radius: 8px; outline: none; transition: border-color 0.2s; appearance: none; }
input:focus, select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
input::placeholder { color: #4a5568; }
.field-hint { font-size: 11px; color: #4a5568; margin-top: 0.4rem; line-height: 1.5; }
.field-hint a { color: #94a3b8; }

/* Password toggle */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 3rem; }
.toggle-pw { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #4a5568; font-size: 12px; font-family: 'Inter', sans-serif; padding: 0; }
.toggle-pw:hover { color: #94a3b8; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px; border-radius: 8px; padding: 10px 20px; cursor: pointer; transition: all 0.12s; border: none; text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(0.96) !important; opacity: 0.9; box-shadow: none !important; }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff; width: 100%; margin-top: 1.5rem; padding: 12px; font-size: 15px; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.3); }
.btn-ghost { background: transparent; color: #94a3b8; border: 1px solid #253450; }
.btn-ghost:hover { border-color: #3b82f6; color: #e8edf5; }
.btn-danger { background: transparent; color: #ef4444; border: 1px solid rgba(239,68,68,0.3); font-size: 12px; }
.btn-danger:hover { background: rgba(239,68,68,0.08); }
.btn-green { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-green:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.3); }

/* Stat rows */
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid #1e2a40; font-size: 13px; }
.stat-row:last-child { border-bottom: none; }
.stat-label { color: #94a3b8; }
.stat-value { color: #e8edf5; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.connected-pill { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; display: inline-block; white-space: nowrap; }

/* Sync log table */
.log-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.log-table th { text-align: left; color: #4a5568; font-weight: 600; padding: 0 1rem 0.5rem 0; letter-spacing: 0.05em; text-transform: uppercase; font-size: 10px; }
.log-table td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid #1e2a40; color: #94a3b8; vertical-align: middle; }
.log-table tr:last-child td { border-bottom: none; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.badge-success { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.badge-fail { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }

/* Actions row */
.actions-row { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; flex-wrap: wrap; gap: 0.5rem; }

/* Footer nav */
.footer-nav { display: flex; gap: 1.5rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.footer-nav a { font-size: 12px; color: #4a5568; text-decoration: none; transition: color 0.2s; }
.footer-nav a:hover, .footer-nav a.active { color: #e8edf5; }

/* App footer */
.app-footer { border-top: 1px solid #1e2a40; padding: 1.5rem; display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
.app-footer a { font-size: 12px; color: #4a5568; text-decoration: none; }
.app-footer a:hover { color: #94a3b8; }

/* Select country row */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 480px) {
  body { padding: 1.5rem 1rem 5rem; }
  .field-row { grid-template-columns: 1fr; }
}

body.has-sidebar {
  background:
    radial-gradient(circle at top left, rgba(59,130,246,0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(99,102,241,0.08), transparent 32%),
    linear-gradient(180deg, #09101c 0%, #080b12 100%);
  padding: 0;
}

body.has-sidebar .app-shell {
  max-width: 1480px;
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
}

body.has-sidebar .sidebar {
  display: flex;
  flex-direction: column;
  padding: 32px 22px;
  background: linear-gradient(180deg, rgba(59,130,246,0.06), transparent 24%), #0d1321;
  border-right: 1px solid rgba(148,163,184,0.12);
  position: sticky;
  top: 0;
  min-height: 100vh;
}

body.has-sidebar .sidebar .logo { margin-bottom: 28px; }
body.has-sidebar .logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 1.1rem;
  color: #fff;
}
body.has-sidebar .logo-name {
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  color: #e8edf5;
}

body.has-sidebar .sidebar-nav { display: flex; flex-direction: column; gap: 6px; }
body.has-sidebar .sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 14px 14px 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
body.has-sidebar .sidebar-nav a:hover {
  background: rgba(18,25,43,0.92);
  color: #e8edf5;
  transform: translateX(2px);
}
body.has-sidebar .sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.18), transparent 90%), rgba(18,25,43,0.96);
  color: #e8edf5;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.16);
}
body.has-sidebar .sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #10b981, #22c55e);
  box-shadow: 0 0 12px rgba(16,185,129,0.42);
}
body.has-sidebar .sidebar-nav .nav-icon { width: 26px; text-align: center; flex-shrink: 0; }

body.has-sidebar .sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid rgba(148,163,184,0.12);
}
body.has-sidebar .sidebar-footer a,
body.has-sidebar .sidebar-footer span {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: none;
}

body.has-sidebar .main-content {
  overflow: auto;
  padding: 32px 34px 40px;
  background:
    radial-gradient(circle at top right, rgba(16,185,129,0.05), transparent 26%),
    rgba(8,11,18,0.52);
}

body.has-sidebar .wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}

body.has-sidebar .dashboard-surface {
  min-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

body.has-sidebar .footer-nav {
  display: none;
  gap: 10px;
  overflow: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
  justify-content: flex-start;
  flex-wrap: nowrap;
}
body.has-sidebar .footer-nav a {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(18,25,43,0.92);
  color: #94a3b8;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
body.has-sidebar .footer-nav a.active {
  color: #e8edf5;
  border-color: rgba(16,185,129,0.26);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,0.18);
}

body.has-sidebar .card {
  background: linear-gradient(180deg, rgba(18,25,43,0.94), rgba(15,20,32,0.96));
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}
body.has-sidebar .card::before { background: linear-gradient(90deg, transparent, #3b82f6, #6366f1, transparent); }
body.has-sidebar .card-title { font-size: 28px; color: #e8edf5; }
body.has-sidebar .card-sub { color: #94a3b8; }

body.has-sidebar .step { height: 4px; background: #1e2a40; }
body.has-sidebar .step.active { background: linear-gradient(90deg, #3b82f6, #6366f1); }
body.has-sidebar .step.done { background: linear-gradient(90deg, #10b981, #22c55e); }

body.has-sidebar label { color: #94a3b8; }
body.has-sidebar input,
body.has-sidebar select {
  background: rgba(8,11,18,0.86);
  border: 1px solid #253450;
  color: #e8edf5;
  border-radius: 12px;
}
body.has-sidebar input:focus,
body.has-sidebar select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
body.has-sidebar input::placeholder { color: #4a5568; }
body.has-sidebar .field-hint { color: #64748b; }
body.has-sidebar .field-hint a { color: #94a3b8; }

body.has-sidebar .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 28px rgba(59,130,246,0.22);
}
body.has-sidebar .btn-ghost {
  background: rgba(18,25,43,0.92);
  color: #e8edf5;
  border: 1px solid rgba(148,163,184,0.14);
}
body.has-sidebar .btn-ghost:hover { border-color: #3b82f6; }
body.has-sidebar .btn-danger {
  color: #fca5a5;
  border-color: rgba(239,68,68,0.2);
  background: rgba(239,68,68,0.12);
}

body.has-sidebar .stat-row { border-color: rgba(148,163,184,0.1); }
body.has-sidebar .stat-label { color: #94a3b8; }
body.has-sidebar .stat-value { color: #e8edf5; }
body.has-sidebar .connected-pill {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.22);
  color: #6ee7b7;
}

body.has-sidebar .log-table th { color: #94a3b8; }
body.has-sidebar .log-table td {
  border-color: rgba(148,163,184,0.1);
  color: #cbd5e1;
}
body.has-sidebar .badge-success {
  background: rgba(16,185,129,0.12);
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.22);
}
body.has-sidebar .badge-fail {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.2);
}

body.has-sidebar .alert-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }
body.has-sidebar .alert-warn { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: #fcd34d; }
body.has-sidebar .alert-success { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
body.has-sidebar .alert-info { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #93c5fd; }

body.has-sidebar .page-license .dashboard-surface,
body.has-sidebar .page-actual .dashboard-surface,
body.has-sidebar .page-notifications .dashboard-surface {
  max-width: 900px;
}

body.has-sidebar .status-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}
body.has-sidebar .status-main,
body.has-sidebar .status-side {
  display: grid;
  gap: 18px;
}

@media (max-width: 1080px) {
  body.has-sidebar .app-shell {
    min-height: 100vh;
  }
  body.has-sidebar .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
  body.has-sidebar .main-content { padding: 22px; }
}

@media (max-width: 900px) {
  body.has-sidebar .app-shell {
    max-width: none;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }
  body.has-sidebar .sidebar { display: none; }
  body.has-sidebar .main-content { padding: 16px; }
  body.has-sidebar .footer-nav { display: flex; }
  body.has-sidebar .status-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body.has-sidebar .main-content { padding: 14px; }
}
