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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0d0d0f;
  color: #e8e8ed;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  background: #111114;
  border-bottom: 1px solid #1e1e26;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.logo-mark {
  width: 28px; height: 28px;
  background: #6c63ff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 16px; height: 16px; }

.app-name { font-size: 15px; font-weight: 600; color: #f0f0f5; letter-spacing: -0.3px; }
.app-sub { font-size: 12px; color: #555560; margin-left: 4px; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.status-indicator { display: flex; align-items: center; gap: 6px; }
.status-dot { width: 7px; height: 7px; background: #22c55e; border-radius: 50%; }
.status-label { font-size: 12px; color: #44444e; }

.user-badge {
  background: #1a1a20;
  border: 1px solid #2a2a32;
  border-radius: 20px;
  padding: 4px 12px 4px 6px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #888890;
}

.user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: #6c63ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.layout { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: 220px; min-width: 220px;
  background: #111114;
  border-right: 1px solid #1a1a20;
  padding: 1.25rem 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px; font-weight: 600; color: #303038;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0 1.25rem;
  margin: 1.25rem 0 4px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 1.25rem;
  font-size: 13px; color: #555560;
  cursor: pointer;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: background 0.1s;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-item:hover { background: #14141a; color: #888890; }
.nav-item.active { color: #a89eff; background: #14121e; border-left-color: #6c63ff; }

.content { flex: 1; padding: 2rem; min-width: 0; }

/* ─── Page header ────────────────────────────────────────────────────────── */

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap; gap: 1rem;
}

.page-title { font-size: 26px; font-weight: 700; color: #f0f0f5; letter-spacing: -0.5px; }
.page-sub { font-size: 13px; color: #3a3a44; margin-top: 4px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #555560; text-decoration: none;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: #888890; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn-primary {
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.1s;
  text-decoration: none;
}
.btn-primary:hover { background: #7c74ff; }
.btn-primary svg { width: 13px; height: 13px; }

.btn-secondary {
  background: #1a1a20;
  border: 1px solid #2a2a32;
  color: #888890;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.1s;
  text-decoration: none;
}
.btn-secondary:hover { background: #222228; color: #a0a0aa; }
.btn-secondary svg { width: 13px; height: 13px; }

.btn-sm {
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid; transition: opacity 0.1s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn-sm:hover { opacity: 0.8; }
.btn-dl { background: #0e1e36; color: #60a5fa; border-color: #1a3050; }
.btn-del { background: #2a0d0d; color: #f87171; border-color: #3d1515; }

.panel-close {
  cursor: pointer;
  color: #44444e;
  font-size: 18px;
  background: none;
  border: none;
  line-height: 1;
  padding: 0;
}
.panel-close:hover { color: #888890; }

/* ─── Stats ──────────────────────────────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}

.stat-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.stat-label {
  font-size: 10px; font-weight: 600; color: #3a3a44;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.stat-value { font-size: 28px; font-weight: 700; color: #f0f0f5; letter-spacing: -1px; line-height: 1; }
.stat-sub { font-size: 11px; color: #3a3a44; margin-top: 6px; }
.stat-accent { color: #22c55e; }

/* ─── Panels ─────────────────────────────────────────────────────────────── */

.panel {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #1a1a20;
}
.panel-title { font-size: 13px; font-weight: 600; color: #888890; }
.panel-body { padding: 1.25rem; }
.panel-body-flush { padding: 0; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */

.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 150px; }
.form-label { font-size: 10px; font-weight: 600; color: #3a3a44; text-transform: uppercase; letter-spacing: 0.07em; }

.form-input {
  background: #0d0d0f;
  border: 1px solid #2a2a32;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 13px;
  color: #c0c0cc;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus { border-color: #6c63ff; }
.form-input::placeholder { color: #2a2a32; }

.logo-upload-label {
  background: #0d0d0f;
  border: 1px solid #2a2a32;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 12px; color: #555560;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: border-color 0.15s;
}
.logo-upload-label:hover { border-color: #44444e; color: #888890; }

.color-input {
  width: 38px; height: 38px;
  border: 1px solid #2a2a32;
  border-radius: 7px;
  background: #0d0d0f;
  cursor: pointer;
  padding: 2px;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.tbl-wrap {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.section-title { font-size: 13px; font-weight: 600; color: #888890; }
.section-count { font-size: 12px; color: #333338; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 1px solid #1a1a20; }
th {
  text-align: left; padding: 10px 16px;
  font-size: 10px; font-weight: 600; color: #707080;
  text-transform: uppercase; letter-spacing: 0.07em;
  background: #0e0e12;
}
td { padding: 11px 16px; border-bottom: 1px solid #14141a; color: #c0c0cc; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #13131a; }

/* Table cell text helpers */
.td-primary { color: #f0f0f5; font-weight: 500; }
.td-secondary { font-size: 12px; color: #888890; }
.td-muted { font-size: 12px; color: #44444e; }
.td-dim { font-size: 12px; color: #333338; }
.td-mono { font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace; font-size: 11px; color: #707080; }
.td-mono-dim { font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace; font-size: 11px; color: #44444e; }
.td-nowrap { white-space: nowrap; }
.td-truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-empty { text-align: center; color: #333338; padding: 2rem; }
.td-bold { font-weight: 600; color: #f0f0f5; }

/* ─── Inline status indicators ───────────────────────────────────────────── */

.save-status {
  font-size: 12px;
  color: #22c55e;
  display: none;
}
.save-error {
  font-size: 12px;
  color: #f87171;
  display: none;
}
.info-text { font-size: 12px; color: #44444e; }
.info-text-sm { font-size: 11px; color: #44444e; line-height: 1.6; }

/* ─── Codes & pills ──────────────────────────────────────────────────────── */

.code-pill {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 11px;
  color: #a89eff;
  background: #16141e;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #2a2638;
  text-decoration: none;
}
.code-pill:hover { background: #1e1a28; }

.url-cell {
  font-size: 12px; color: #44444e;
  max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-green { background: #0a2015; color: #22c55e; border: 1px solid #112d1a; }
.badge-gray { background: #161618; color: #44444e; border: 1px solid #1e1e22; }
.badge-gps { background: #0d1a2e; color: #60a5fa; border: 1px solid #1a3050; }
.badge-ip { background: #1a140d; color: #f59e0b; border: 1px solid #2d2010; }

.action-row { display: flex; align-items: center; gap: 6px; }

/* ─── Maps ───────────────────────────────────────────────────────────────── */

.map-thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  border: 1px solid #2a2a32;
  object-fit: cover;
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
}
.map-thumb:hover { border-color: #6c63ff; opacity: 0.9; }

.no-map { font-size: 11px; color: #2a2a32; }

/* ─── Lightbox ───────────────────────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 999;
  align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 600px; max-height: 600px;
  border-radius: 12px;
  border: 2px solid #2a2a32;
}
.lightbox-close {
  position: fixed; top: 1.5rem; right: 1.5rem;
  color: #555560; font-size: 1.5rem; cursor: pointer;
  width: 36px; height: 36px;
  background: #1a1a20; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #2a2a32;
}
.lightbox-close:hover { color: #f0f0f5; border-color: #44444e; }

/* ─── Misc ───────────────────────────────────────────────────────────────── */

.scan-count-big { font-size: 13px; font-weight: 600; color: #f0f0f5; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 13px;
  color: #44444e;
}
.pagination-bar-btns { display: flex; gap: 8px; }

/* ─── Public scan card (scan_wifi, scan_vcard, expired) ─────────────────── */

.scan-card-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.scan-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.scan-card-icon {
  width: 56px; height: 56px;
  background: #16141e;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}

.scan-card-icon-error {
  background: #2a0d0d;
}

.scan-card h1 { font-size: 20px; font-weight: 700; color: #f0f0f5; margin-bottom: 8px; }
.scan-card .scan-card-sub { font-size: 13px; color: #44444e; margin-bottom: 2rem; }
.scan-card p { font-size: 14px; color: #44444e; line-height: 1.6; }
.scan-card .scan-card-label { margin-top: 1.5rem; font-size: 12px; color: #333338; }

/* WiFi card specific */
.wifi-field {
  background: #0d0d0f;
  border: 1px solid #2a2a32;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-align: left;
}
.wifi-field-label { font-size: 10px; font-weight: 600; color: #44444e; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.wifi-field-value { font-size: 16px; color: #f0f0f5; font-weight: 500; word-break: break-all; }
.wifi-field-value.password { font-family: 'SF Mono', 'Fira Code', monospace; letter-spacing: 0.05em; }

.wifi-security-badge {
  display: inline-block;
  background: #0d1a2e;
  color: #60a5fa;
  border: 1px solid #1a3050;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.scan-card-btn {
  width: 100%;
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: background 0.15s;
  margin-top: 1rem;
}
.scan-card-btn:hover { background: #7c74ff; }
.scan-card-btn-copied { background: #22c55e !important; }

.scan-card-hint { font-size: 11px; color: #44444e; margin-top: 10px; line-height: 1.5; }

/* vCard specific */
.vcard-avatar {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #6c63ff, #a89eff);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 28px; font-weight: 700; color: #fff;
}
.vcard-name { font-size: 22px; font-weight: 700; color: #f0f0f5; margin-bottom: 4px; }
.vcard-org { font-size: 14px; color: #6c63ff; margin-bottom: 1.5rem; }
.vcard-fields { text-align: left; margin-bottom: 1.5rem; }
.vcard-field {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a20;
}
.vcard-field:last-child { border-bottom: none; }
.vcard-field-icon {
  width: 32px; height: 32px;
  background: #16141e;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vcard-field-label { font-size: 10px; color: #44444e; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 2px; }
.vcard-field-text { font-size: 14px; color: #c0c0cc; }

/* ─── Login / Register card ──────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #f0f0f5;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: #44444e;
  margin-bottom: 2rem;
}

.login-field { margin-bottom: 1.25rem; }
.login-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #44444e;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  background: #0d0d0f;
  border: 1px solid #2a2a32;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 14px;
  color: #e8e8ed;
  outline: none;
  transition: border-color 0.15s;
}
.login-field input:focus { border-color: #6c63ff; }

.login-error {
  background: #2a0d0d;
  border: 1px solid #3d1515;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #f87171;
  margin-bottom: 1.25rem;
}

.login-success {
  background: #0a2015;
  border: 1px solid #112d1a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #22c55e;
  margin-bottom: 1.25rem;
}

.btn-login {
  width: 100%;
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-login:hover { background: #7c74ff; }

.login-footer {
  text-align: center;
  color: #44444e;
  font-size: 13px;
  margin-top: 1rem;
}
.login-footer a { color: #6c63ff; text-decoration: none; }

/* ─── Impersonate banner ─────────────────────────────────────────────────── */

.impersonate-banner {
  background: #f59e0b;
  color: #1a1a00;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 56px;
  z-index: 99;
}
.impersonate-banner a {
  color: #1a1a00;
  text-decoration: underline;
  font-size: 12px;
}

/* ─── QR tooltip ─────────────────────────────────────────────────────────── */

.qr-tooltip {
  display: none;
  position: fixed;
  z-index: 500;
  background: #1a1a20;
  border: 1px solid #2a2a32;
  border-radius: 10px;
  padding: 8px;
  pointer-events: none;
}
.qr-tooltip img { width: 140px; height: 140px; display: block; border-radius: 6px; }
.qr-tooltip-label { font-size: 11px; color: #44444e; text-align: center; margin-top: 6px; }

/* ─── Hamburger / mobile ─────────────────────────────────────────────────── */

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #888890;
  border-radius: 2px;
  transition: background 0.15s;
}
.hamburger:hover span { background: #f0f0f5; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-sub { display: none; }
  .hamburger { display: flex; }

  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: -220px;
    height: 100vh;
    z-index: 200;
    transition: left 0.25s ease;
  }
  .sidebar.open { left: 0; }
  .charts-grid {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }
}

/* ─── Alerts ─────────────────────────────────────────────────────────────── */

.alert-success {
  background: #0a2015;
  border: 1px solid #112d1a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #22c55e;
  margin-bottom: 1rem;
}

.alert-error {
  background: #2a0d0d;
  border: 1px solid #3d1515;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #f87171;
  margin-bottom: 1rem;
}

/* ─── Misc components ────────────────────────────────────────────────────── */

.qr-preview-box {
  background: #1a1a20;
  border: 1px solid #2a2a32;
}

.project-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 10px;
}
.project-banner-name { color: #f0f0f5; font-size: 14px; font-weight: 600; }
.project-banner-count { color: #44444e; font-size: 12px; }

.api-key-display {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: #0d0d0f;
  border: 1px solid #2a2a32;
  border-radius: 7px;
  padding: 8px 12px;
  color: #22c55e;
  word-break: break-all;
  flex: 1;
  display: block;
}

.expires-select {
  background: #0d0d0f;
  border: 1px solid #2a2a32;
  color: #c0c0cc;
}

.project-actions { display: flex; gap: 6px; }

/* ─── Light mode ─────────────────────────────────────────────────────────── */

body.light {
  background: #f5f5f7;
  color: #1a1a2e;
}
body.light .topbar {
  background: #ffffff;
  border-bottom: 1px solid #e0e0e8;
}
body.light .app-name { color: #1a1a2e; }
body.light .app-sub { color: #9090a0; }
body.light .status-label { color: #9090a0; }
body.light .user-badge {
  background: #f0f0f5;
  border-color: #e0e0e8;
  color: #555560;
}
body.light .sidebar {
  background: #ffffff;
  border-right: 1px solid #e0e0e8;
}
body.light .nav-section-label { color: #b0b0c0; }
body.light .nav-item { color: #555560; }
body.light .nav-item:hover { background: #f5f5f7; color: #1a1a2e; }
body.light .nav-item.active { color: #6c63ff; background: #f0eeff; border-left-color: #6c63ff; }
body.light .content { background: #f5f5f7; }
body.light .stat-card { background: #ffffff; border-color: #e0e0e8; }
body.light .stat-label { color: #9090a0; }
body.light .stat-value { color: #1a1a2e; }
body.light .stat-sub { color: #9090a0; }
body.light .panel { background: #ffffff; border-color: #e0e0e8; }
body.light .panel-header { border-bottom-color: #e0e0e8; }
body.light .panel-title { color: #555560; }
body.light .tbl-wrap { background: #ffffff; border-color: #e0e0e8; }
body.light th { background: #f5f5f7; color: #9090a0; border-bottom-color: #e0e0e8; }
body.light td { color: #1a1a2e; border-bottom-color: #f0f0f5; }
body.light tbody tr:hover td { background: #f8f8fc; }
body.light .td-primary { color: #1a1a2e; }
body.light .td-secondary { color: #555560; }
body.light .td-muted { color: #9090a0; }
body.light .td-dim { color: #9090a0; }
body.light .td-mono { color: #555560; }
body.light .td-mono-dim { color: #9090a0; }
body.light .td-bold { color: #1a1a2e; }
body.light .code-pill { color: #6c63ff; background: #f0eeff; border-color: #d0c8ff; }
body.light .form-input { background: #ffffff; border-color: #d0d0e0; color: #1a1a2e; }
body.light .form-input:focus { border-color: #6c63ff; }
body.light .logo-upload-label { background: #ffffff; border-color: #d0d0e0; color: #555560; }
body.light .color-input { background: #ffffff; border-color: #d0d0e0; }
body.light .section-title { color: #555560; }
body.light .section-count { color: #9090a0; }
body.light .page-title { color: #1a1a2e; }
body.light .page-sub { color: #9090a0; }
body.light .back-link { color: #9090a0; }
body.light .url-cell { color: #9090a0; }
body.light .no-map { color: #c0c0cc; }
body.light .scan-count-big { color: #1a1a2e; }
body.light .info-text { color: #9090a0; }
body.light .info-text-sm { color: #9090a0; }
body.light .pagination-bar { color: #9090a0; }
body.light .project-filter-btn { background: #ffffff; border-color: #d0d0e0; color: #555560; }
body.light .project-filter-btn.active { background: #f0eeff; border-color: #6c63ff; color: #6c63ff; }
body.light .hamburger span { background: #555560; }
body.light .sidebar-overlay { background: rgba(0,0,0,0.4); }
body.light .qr-tooltip { background: #ffffff; border-color: #e0e0e8; }
body.light .lightbox { background: rgba(0,0,0,0.7); }
body.light .lightbox img { border-color: #e0e0e8; }
body.light .lightbox-close { background: #ffffff; border-color: #e0e0e8; color: #555560; }
body.light .impersonate-banner { background: #f59e0b; color: #1a1a00; }
body.light .btn-primary { background: #6c63ff; color: #ffffff; }
body.light .btn-primary:hover { background: #7c74ff; }
body.light .btn-secondary { background: #f0f0f5; border-color: #d0d0e0; color: #555560; }
body.light .btn-secondary:hover { background: #e8e8f0; }
body.light .btn-sm.btn-dl { background: #e8f0fe; color: #3b6fd4; border-color: #c5d8f5; }
body.light .btn-sm.btn-del { background: #fce8e8; color: #c0392b; border-color: #f5c5c5; }
body.light .badge-green { background: #e6f9ef; color: #1a7a3c; border-color: #b8ecd0; }
body.light .badge-gray { background: #f0f0f5; color: #707080; border-color: #d0d0e0; }
body.light .badge-gps { background: #e8f0fe; color: #3b6fd4; border-color: #c5d8f5; }
body.light .badge-ip { background: #fff8e6; color: #a07000; border-color: #f5e0a0; }
body.light .project-actions .btn-sm.btn-del { background: #fce8e8; color: #c0392b; border-color: #f5c5c5; }
body.light select.form-input,
body.light select { background: #ffffff; color: #1a1a2e; border-color: #d0d0e0; }
body.light .expires-select { background: #ffffff !important; border: 1px solid #d0d0e0 !important; color: #1a1a2e !important; }
body.light .alert-success { background: #e6f9ef; border-color: #b8ecd0; color: #1a7a3c; }
body.light .alert-error { background: #fce8e8; border-color: #f5c5c5; color: #c0392b; }
body.light .qr-preview-box { background: #ffffff; border: 1px solid #d0d0e0; }
body.light .project-active-banner { background: #f0eeff; border-color: #d0c8ff; }
body.light .project-banner-name { color: #1a1a2e; }
body.light .project-banner-count { color: #6060a0; }
body.light .api-key-display { background: #f0fff4; border-color: #b8ecd0; color: #1a7a3c; }
body.light .api-key-display { background: #f0fff4; border-color: #b8ecd0; color: #1a7a3c; }
body.light #bulk-bar { background: #f0eeff !important; border-color: #d0c8ff !important; }
body.light #bulk-count { color: #6c63ff !important; }
body.light #bulk-bar .btn-primary[style*="#2a0d0d"] { background: #fce8e8 !important; border-color: #f5c5c5 !important; color: #c0392b !important; }
body.light .panel-close { color: #9090a0; }
body.light .panel-close:hover { color: #555560; }
body.light .save-status { color: #1a7a3c; }
body.light .wifi-field { background: #f5f5f7; border-color: #d0d0e0; }
body.light .wifi-field-value { color: #1a1a2e; }
body.light .wifi-security-badge { background: #e8f0fe; color: #3b6fd4; border-color: #c5d8f5; }
body.light .scan-card { background: #ffffff; border-color: #e0e0e8; }
body.light .scan-card h1 { color: #1a1a2e; }
body.light .scan-card-icon { background: #f0eeff; }
body.light .vcard-field { border-bottom-color: #e0e0e8; }
body.light .vcard-field-icon { background: #f0eeff; }
body.light .vcard-field-text { color: #1a1a2e; }
body.light .login-card { background: #ffffff; border-color: #e0e0e8; }
body.light .login-title { color: #1a1a2e; }
body.light .login-sub { color: #9090a0; }
body.light .login-field label { color: #9090a0; }
body.light .login-field input { background: #ffffff; border-color: #d0d0e0; color: #1a1a2e; }
body.light .copy-toast { background: #ffffff; border-color: #e0e0e8; color: #1a1a2e; }
/* ─── Upgrade Modal ──────────────────────────────────────────────────────── */

.upgrade-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.upgrade-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.upgrade-modal-content {
  position: relative;
  z-index: 1001;
  background: #111114;
  border: 1px solid #2a2a32;
  border-radius: 12px;
  padding: 2rem;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.upgrade-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: #888890;
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgrade-modal-close:hover {
  color: #e8e8ed;
}

.upgrade-modal-header {
  margin-bottom: 2rem;
  text-align: center;
}

.upgrade-modal-header h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.upgrade-modal-header p {
  color: #888890;
  font-size: 14px;
}

.upgrade-tier-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.tier-col {
  background: #0d0d0f;
  border: 1px solid #1a1a20;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.tier-col.upgrade-highlight {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.05);
}

.tier-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tier-current {
  font-size: 11px;
  color: #22c55e;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.tier-price {
  font-size: 1.75rem;
  font-weight: 700;
  color: #6c63ff;
  margin-bottom: 1rem;
}

.tier-price span {
  font-size: 0.9rem;
  color: #888890;
  margin-left: 0.25rem;
}

.btn-upgrade {
  background: #6c63ff;
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

.btn-upgrade:hover {
  background: #7d72ff;
}

.tier-list {
  list-style: none;
  font-size: 12px;
  color: #888890;
  flex: 1;
}

.tier-list li {
  padding: 6px 0;
  border-bottom: 1px solid #1a1a20;
}

.tier-list li:last-child {
  border-bottom: none;
}

/* Light mode */
body.light .upgrade-modal-content {
  background: #f5f5f5;
  border-color: #e0e0e0;
}

body.light .upgrade-modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}

body.light .tier-col {
  background: #fff;
  border-color: #e0e0e0;
}

body.light .tier-col.upgrade-highlight {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.05);
}

body.light .upgrade-modal-header p,
body.light .tier-list li {
  color: #666;
}

body.light .tier-current {
  color: #22c55e;
}

/* ─── New utility classes ─────────────────────────────────────────────────── */

/* Checkbox / toggle label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #888890;
  cursor: pointer;
}
.checkbox-label.disabled {
  color: #555560;
  cursor: not-allowed;
}
body.light .checkbox-label { color: #555560; }
body.light .checkbox-label.disabled { color: #9090a0; }

/* Monospace text (used for API keys, hex values, etc.) */
.mono-text {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: #6c63ff;
}
body.light .mono-text { color: #5a52cc; }

/* Project dot indicator */
.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Admin section card (registrations panel etc.) */
.admin-card {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #111114;
  border: 1px solid #1a1a20;
  border-radius: 8px;
}
body.light .admin-card {
  background: #ffffff;
  border-color: #e0e0e8;
}

.admin-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #e8e8ed;
  margin-bottom: 0.25rem;
}
body.light .admin-card-title { color: #1a1a2e; }

.admin-card-sub {
  font-size: 13px;
  color: #888890;
}
body.light .admin-card-sub { color: #9090a0; }

/* Form section spacing */
.form-section { margin-bottom: 1.5rem; }

/* Detail row cell padding (code_detail/settings info rows) */
.detail-cell { padding: 4px 16px 4px 0; }
.detail-cell-wide { padding: 4px 16px 4px 0; width: 120px; }
.settings-cell { padding: 8px 16px 8px 0; }
.settings-cell-wide { padding: 8px 16px 8px 0; width: 200px; }

/* Inline flex row with wrap */
.flex-row-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Copy toast dark mode base (light mode already defined above) */
.copy-toast {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e26;
  border: 1px solid #2a2a32;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  color: #c0c0cc;
  z-index: 999;
}
.text-danger {
  color: #f87171;
}
body.light .text-danger { color: #c0392b; }
#bulk-bar {
  display: none;
  margin-bottom: 1rem;
  padding: 10px 14px;
  background: #16141e;
  border: 1px solid #2a2a32;
  border-radius: 10px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#bulk-count {
  font-size: 13px;
  color: #a89eff;
  font-weight: 600;
}
body.light #bulk-count { color: #6c63ff; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.chart-box {
  padding: 1rem;
}
.registrations-toggle-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #2a2a32;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
body.light .registrations-toggle-btn { border-color: #d0d0e0; }

/* ─── Public page auto-theming (follows device preference) ──────────────── */
/* Applied when device prefers light mode and no explicit theme class is set */
@media (prefers-color-scheme: light) {

  body:not(.dark):not(.light) {
    background: #f5f5f7;
    color: #1a1a2e;
  }

  body:not(.dark):not(.light) .topbar {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e8;
  }

  body:not(.dark):not(.light) .app-name { color: #1a1a2e; }

  body:not(.dark):not(.light) .app-sub { color: #9090a0; }

  body:not(.dark):not(.light) .status-label { color: #9090a0; }

  body:not(.dark):not(.light) .user-badge {
    background: #f0f0f5;
    border-color: #e0e0e8;
    color: #555560;
  }

  body:not(.dark):not(.light) .sidebar {
    background: #ffffff;
    border-right: 1px solid #e0e0e8;
  }

  body:not(.dark):not(.light) .nav-section-label { color: #b0b0c0; }

  body:not(.dark):not(.light) .nav-item { color: #555560; }

  body:not(.dark):not(.light) .nav-item:hover { background: #f5f5f7; color: #1a1a2e; }

  body:not(.dark):not(.light) .nav-item.active { color: #6c63ff; background: #f0eeff; border-left-color: #6c63ff; }

  body:not(.dark):not(.light) .content { background: #f5f5f7; }

  body:not(.dark):not(.light) .stat-card { background: #ffffff; border-color: #e0e0e8; }

  body:not(.dark):not(.light) .stat-label { color: #9090a0; }

  body:not(.dark):not(.light) .stat-value { color: #1a1a2e; }

  body:not(.dark):not(.light) .stat-sub { color: #9090a0; }

  body:not(.dark):not(.light) .panel { background: #ffffff; border-color: #e0e0e8; }

  body:not(.dark):not(.light) .panel-header { border-bottom-color: #e0e0e8; }

  body:not(.dark):not(.light) .panel-title { color: #555560; }

  body:not(.dark):not(.light) .tbl-wrap { background: #ffffff; border-color: #e0e0e8; }

  body:not(.dark):not(.light) th { background: #f5f5f7; color: #9090a0; border-bottom-color: #e0e0e8; }

  body:not(.dark):not(.light) td { color: #1a1a2e; border-bottom-color: #f0f0f5; }

  body:not(.dark):not(.light) tbody tr:hover td { background: #f8f8fc; }

  body:not(.dark):not(.light) .td-primary { color: #1a1a2e; }

  body:not(.dark):not(.light) .td-secondary { color: #555560; }

  body:not(.dark):not(.light) .td-muted { color: #9090a0; }

  body:not(.dark):not(.light) .td-dim { color: #9090a0; }

  body:not(.dark):not(.light) .td-mono { color: #555560; }

  body:not(.dark):not(.light) .td-mono-dim { color: #9090a0; }

  body:not(.dark):not(.light) .td-bold { color: #1a1a2e; }

  body:not(.dark):not(.light) .code-pill { color: #6c63ff; background: #f0eeff; border-color: #d0c8ff; }

  body:not(.dark):not(.light) .form-input { background: #ffffff; border-color: #d0d0e0; color: #1a1a2e; }

  body:not(.dark):not(.light) .form-input:focus { border-color: #6c63ff; }

  body:not(.dark):not(.light) .logo-upload-label { background: #ffffff; border-color: #d0d0e0; color: #555560; }

  body:not(.dark):not(.light) .color-input { background: #ffffff; border-color: #d0d0e0; }

  body:not(.dark):not(.light) .section-title { color: #555560; }

  body:not(.dark):not(.light) .section-count { color: #9090a0; }

  body:not(.dark):not(.light) .page-title { color: #1a1a2e; }

  body:not(.dark):not(.light) .page-sub { color: #9090a0; }

  body:not(.dark):not(.light) .back-link { color: #9090a0; }

  body:not(.dark):not(.light) .url-cell { color: #9090a0; }

  body:not(.dark):not(.light) .no-map { color: #c0c0cc; }

  body:not(.dark):not(.light) .scan-count-big { color: #1a1a2e; }

  body:not(.dark):not(.light) .info-text { color: #9090a0; }

  body:not(.dark):not(.light) .info-text-sm { color: #9090a0; }

  body:not(.dark):not(.light) .pagination-bar { color: #9090a0; }

  body:not(.dark):not(.light) .project-filter-btn { background: #ffffff; border-color: #d0d0e0; color: #555560; }

  body:not(.dark):not(.light) .project-filter-btn.active { background: #f0eeff; border-color: #6c63ff; color: #6c63ff; }

  body:not(.dark):not(.light) .hamburger span { background: #555560; }

  body:not(.dark):not(.light) .sidebar-overlay { background: rgba(0,0,0,0.4); }

  body:not(.dark):not(.light) .qr-tooltip { background: #ffffff; border-color: #e0e0e8; }

  body:not(.dark):not(.light) .lightbox { background: rgba(0,0,0,0.7); }

  body:not(.dark):not(.light) .lightbox img { border-color: #e0e0e8; }

  body:not(.dark):not(.light) .lightbox-close { background: #ffffff; border-color: #e0e0e8; color: #555560; }

  body:not(.dark):not(.light) .impersonate-banner { background: #f59e0b; color: #1a1a00; }

  body:not(.dark):not(.light) .btn-primary { background: #6c63ff; color: #ffffff; }

  body:not(.dark):not(.light) .btn-primary:hover { background: #7c74ff; }

  body:not(.dark):not(.light) .btn-secondary { background: #f0f0f5; border-color: #d0d0e0; color: #555560; }

  body:not(.dark):not(.light) .btn-secondary:hover { background: #e8e8f0; }

  body:not(.dark):not(.light) .btn-sm.btn-dl { background: #e8f0fe; color: #3b6fd4; border-color: #c5d8f5; }

  body:not(.dark):not(.light) .btn-sm.btn-del { background: #fce8e8; color: #c0392b; border-color: #f5c5c5; }

  body:not(.dark):not(.light) .badge-green { background: #e6f9ef; color: #1a7a3c; border-color: #b8ecd0; }

  body:not(.dark):not(.light) .badge-gray { background: #f0f0f5; color: #707080; border-color: #d0d0e0; }

  body:not(.dark):not(.light) .badge-gps { background: #e8f0fe; color: #3b6fd4; border-color: #c5d8f5; }

  body:not(.dark):not(.light) .badge-ip { background: #fff8e6; color: #a07000; border-color: #f5e0a0; }

  body:not(.dark):not(.light) .project-actions .btn-sm.btn-del { background: #fce8e8; color: #c0392b; border-color: #f5c5c5; }

  body:not(.dark):not(.light) select.form-input,
  body:not(.dark):not(.light) select { background: #ffffff; color: #1a1a2e; border-color: #d0d0e0; }

  body:not(.dark):not(.light) .expires-select { background: #ffffff !important; border: 1px solid #d0d0e0 !important; color: #1a1a2e !important; }

  body:not(.dark):not(.light) .alert-success { background: #e6f9ef; border-color: #b8ecd0; color: #1a7a3c; }

  body:not(.dark):not(.light) .alert-error { background: #fce8e8; border-color: #f5c5c5; color: #c0392b; }

  body:not(.dark):not(.light) .qr-preview-box { background: #ffffff; border: 1px solid #d0d0e0; }

  body:not(.dark):not(.light) .project-active-banner { background: #f0eeff; border-color: #d0c8ff; }

  body:not(.dark):not(.light) .project-banner-name { color: #1a1a2e; }

  body:not(.dark):not(.light) .project-banner-count { color: #6060a0; }

  body:not(.dark):not(.light) .api-key-display { background: #f0fff4; border-color: #b8ecd0; color: #1a7a3c; }

  body:not(.dark):not(.light) .api-key-display { background: #f0fff4; border-color: #b8ecd0; color: #1a7a3c; }

  body:not(.dark):not(.light) #bulk-bar { background: #f0eeff !important; border-color: #d0c8ff !important; }

  body:not(.dark):not(.light) #bulk-count { color: #6c63ff !important; }

  body:not(.dark):not(.light) #bulk-bar .btn-primary[style*="#2a0d0d"] { background: #fce8e8 !important; border-color: #f5c5c5 !important; color: #c0392b !important; }

  body:not(.dark):not(.light) .panel-close { color: #9090a0; }

  body:not(.dark):not(.light) .panel-close:hover { color: #555560; }

  body:not(.dark):not(.light) .save-status { color: #1a7a3c; }

  body:not(.dark):not(.light) .wifi-field { background: #f5f5f7; border-color: #d0d0e0; }

  body:not(.dark):not(.light) .wifi-field-value { color: #1a1a2e; }

  body:not(.dark):not(.light) .wifi-security-badge { background: #e8f0fe; color: #3b6fd4; border-color: #c5d8f5; }

  body:not(.dark):not(.light) .scan-card { background: #ffffff; border-color: #e0e0e8; }

  body:not(.dark):not(.light) .scan-card h1 { color: #1a1a2e; }

  body:not(.dark):not(.light) .scan-card-icon { background: #f0eeff; }

  body:not(.dark):not(.light) .vcard-field { border-bottom-color: #e0e0e8; }

  body:not(.dark):not(.light) .vcard-field-icon { background: #f0eeff; }

  body:not(.dark):not(.light) .vcard-field-text { color: #1a1a2e; }

  body:not(.dark):not(.light) .login-card { background: #ffffff; border-color: #e0e0e8; }

  body:not(.dark):not(.light) .login-title { color: #1a1a2e; }

  body:not(.dark):not(.light) .login-sub { color: #9090a0; }

  body:not(.dark):not(.light) .login-field label { color: #9090a0; }

  body:not(.dark):not(.light) .login-field input { background: #ffffff; border-color: #d0d0e0; color: #1a1a2e; }

  body:not(.dark):not(.light) .copy-toast { background: #ffffff; border-color: #e0e0e8; color: #1a1a2e; }

  body:not(.dark):not(.light) .upgrade-modal-content {
    background: #f5f5f5;
    border-color: #e0e0e0;
  }

  body:not(.dark):not(.light) .upgrade-modal-overlay {
    background: rgba(0, 0, 0, 0.4);
  }

  body:not(.dark):not(.light) .tier-col {
    background: #fff;
    border-color: #e0e0e0;
  }

  body:not(.dark):not(.light) .tier-col.upgrade-highlight {
    border-color: #6c63ff;
    background: rgba(108, 99, 255, 0.05);
  }

  body:not(.dark):not(.light) .upgrade-modal-header p,
  body:not(.dark):not(.light) .tier-list li {
    color: #666;
  }

  body:not(.dark):not(.light) .tier-current {
    color: #22c55e;
  }

}

/* ─── Signup page ─────────────────────────────────────────────────────────── */
.signup-wrap { width:100%; max-width:380px; }

.signup-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  padding: 2.5rem 2rem;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .signup-card,
  body.light .signup-card { background:#ffffff; border-color:#e0e0e8; }
}


.signup-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.signup-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .signup-title,
  body.light .signup-title { color: #1a1a2e; }
}


.signup-sub {
  font-size: 13px;
  color: #888890;
  text-align: center;
  margin-bottom: 2rem;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .signup-sub,
  body.light .signup-sub { color: #9090a0; }
}


.signup-footer { text-align:center; font-size:12px; color:#888890; }
.signup-footer a { color:#6c63ff; text-decoration:none; font-weight:600; }
.signup-footer a:hover { text-decoration:underline; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .signup-footer,
  body.light .signup-footer { color: #9090a0; }
}


.free-tier-badge {
  display: inline-block;
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid #6c63ff;
  color: #a89eff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 1rem;
  width: 100%;
  text-align: center;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .free-tier-badge,
  body.light .free-tier-badge { color: #6c63ff; background: rgba(108,99,255,0.08); }
}


.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #e8e8ed;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .field label,
  body.light .field label { color: #1a1a2e; }
}


.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #2a2a32;
  border-radius: 6px;
  background: #0d0d0f;
  color: #e8e8ed;
  font-size: 13px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.field input:focus { outline:none; border-color:#6c63ff; box-shadow:0 0 0 3px rgba(108,99,255,0.1); }
.field input::placeholder { color: #555560; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .field input,
  body.light .field input { background:#ffffff; border-color:#d0d0e0; color:#1a1a2e; }
  body:not(.dark):not(.light) .field input::placeholder,
  body.light .field input::placeholder { color: #9090a0; }
}


.btn-signup {
  width: 100%;
  padding: 12px;
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 1rem;
}
.btn-signup:hover { background: #7d72ff; }

.signup-error {
  background: #2a1f1f;
  border: 1px solid #5a3333;
  color: #ff6b6b;
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .signup-error,
  body.light .signup-error { background:#fce8e8; border-color:#f5c5c5; color:#c0392b; }
}


.signup-success {
  background: #1f2a1f;
  border: 1px solid #33553a;
  color: #22c55e;
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .signup-success,
  body.light .signup-success { background:#e6f9ef; border-color:#b8ecd0; color:#1a7a3c; }
}


.page-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

/* ─── Public page layout ──────────────────────────────────────────────────── */
.page-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 3rem 1rem;
}

.topbar-pricing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 860px;
  margin-bottom: 2rem;
}

.topbar-pricing-narrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 560px;
  margin-bottom: 2rem;
}

.topbar-pricing-legal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 720px;
  margin-bottom: 2rem;
}

.coming-soon-badge {
  display: inline-block;
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid #6c63ff;
  color: #a89eff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .coming-soon-badge,
  body.light .coming-soon-badge { color: #6c63ff; background: rgba(108,99,255,0.08); }
}


/* ─── Pricing page ────────────────────────────────────────────────────────── */
.pricing-wrap { width: 100%; max-width: 860px; }

.pricing-header { text-align: center; margin-bottom: 3rem; }
.pricing-header h1 { font-size: 2rem; font-weight: 700; color: #e8e8ed; margin-bottom: 0.5rem; }
.pricing-header p { color: #888890; font-size: 14px; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .pricing-header h1,
  body.light .pricing-header h1 { color: #1a1a2e; }
  body:not(.dark):not(.light) .pricing-header p,
  body.light .pricing-header p { color: #9090a0; }
}


.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}
@media (max-width: 700px) { .pricing-grid { grid-template-columns: 1fr; } }

.plan-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.plan-card.highlight { border-color: #6c63ff; box-shadow: 0 0 0 1px #6c63ff; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .plan-card,
  body.light .plan-card { background: #ffffff; border-color: #e0e0e8; }
  body:not(.dark):not(.light) .plan-card.highlight,
  body.light .plan-card.highlight { border-color: #6c63ff; box-shadow: 0 0 0 1px #6c63ff; }
}


.plan-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888890; }
.plan-card.highlight .plan-name { color: #a89eff; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .plan-name,
  body.light .plan-name { color: #9090a0; }
}


.plan-price { font-size: 2.5rem; font-weight: 700; color: #e8e8ed; line-height: 1; }
.plan-price span { font-size: 14px; font-weight: 400; color: #888890; }
.plan-price.free-price { font-size: 1.8rem; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .plan-price,
  body.light .plan-price { color: #1a1a2e; }
  body:not(.dark):not(.light) .plan-price span,
  body.light .plan-price span { color: #9090a0; }
}


.plan-desc { font-size: 13px; color: #888890; line-height: 1.5; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .plan-desc,
  body.light .plan-desc { color: #9090a0; }
}


.plan-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-features li { font-size: 13px; color: #c0c0cc; display: flex; align-items: center; gap: 8px; }
.plan-features li.yes::before { content: "✓"; color: #22c55e; font-weight: 700; }
.plan-features li.no::before { content: "✗"; color: #555560; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .plan-features li,
  body.light .plan-features li { color: #555560; }
  body:not(.dark):not(.light) .plan-features li.no::before,
  body.light .plan-features li.no::before { color: #9090a0; }
}


.plan-cta { margin-top: auto; padding-top: 1rem; }

.btn-plan { width: 100%; padding: 10px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: background 0.2s; }
.btn-plan-free { background: #1e1e26; color: #888890; cursor: default; }
.btn-plan-upgrade { background: #6c63ff; color: #fff; }
.btn-plan-upgrade:hover { background: #7d72ff; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .btn-plan-free,
  body.light .btn-plan-free { background: #f0f0f5; color: #9090a0; }
}


.pricing-note { text-align: center; font-size: 13px; color: #888890; line-height: 1.8; }
.pricing-note a { color: #6c63ff; text-decoration: none; }
.pricing-note a:hover { text-decoration: underline; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .pricing-note,
  body.light .pricing-note { color: #9090a0; }
}


/* ─── Legal pages (privacy, terms) ───────────────────────────────────────── */
.legal-wrap { width: 100%; max-width: 720px; }
.legal-header { margin-bottom: 2.5rem; }
.legal-header h1 { font-size: 2rem; font-weight: 700; color: #e8e8ed; margin-bottom: 0.5rem; }
.legal-header p { color: #888890; font-size: 13px; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .legal-header h1,
  body.light .legal-header h1 { color: #1a1a2e; }
  body:not(.dark):not(.light) .legal-header p,
  body.light .legal-header p { color: #9090a0; }
}


.legal-wrap h2 { font-size: 15px; font-weight: 600; color: #e8e8ed; margin: 2rem 0 0.75rem; }
.legal-wrap p, .legal-wrap li { font-size: 13px; color: #888890; line-height: 1.8; }
.legal-wrap ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.legal-wrap li { margin-bottom: 0.25rem; }
.legal-wrap a { color: #6c63ff; text-decoration: none; }
.legal-wrap a:hover { text-decoration: underline; }
.legal-wrap hr { border: none; border-top: 1px solid #1e1e26; margin: 2rem 0; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .legal-wrap h2,
  body.light .legal-wrap h2 { color: #1a1a2e; }
  body:not(.dark):not(.light) .legal-wrap p,
  body:not(.dark):not(.light) .legal-wrap li,
  body.light .legal-wrap p,
  body.light .legal-wrap li { color: #555560; }
  body:not(.dark):not(.light) .legal-wrap hr,
  body.light .legal-wrap hr { border-top-color: #e0e0e8; }
}


/* ─── Contact page ────────────────────────────────────────────────────────── */
.contact-wrap { width: 100%; max-width: 560px; }
.contact-header { text-align: center; margin-bottom: 3rem; }
.contact-header h1 { font-size: 2rem; font-weight: 700; color: #e8e8ed; margin-bottom: 0.5rem; }
.contact-header p { color: #888890; font-size: 14px; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .contact-header h1,
  body.light .contact-header h1 { color: #1a1a2e; }
  body:not(.dark):not(.light) .contact-header p,
  body.light .contact-header p { color: #9090a0; }
}


.contact-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.contact-card h3 { font-size: 14px; font-weight: 600; color: #e8e8ed; margin-bottom: 0.5rem; }
.contact-card p { font-size: 13px; color: #888890; line-height: 1.6; margin-bottom: 1rem; }
.contact-card a { color: #6c63ff; text-decoration: none; font-weight: 600; }
.contact-card a:hover { text-decoration: underline; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .contact-card,
  body.light .contact-card { background: #ffffff; border-color: #e0e0e8; }
  body:not(.dark):not(.light) .contact-card h3,
  body.light .contact-card h3 { color: #1a1a2e; }
  body:not(.dark):not(.light) .contact-card p,
  body.light .contact-card p { color: #9090a0; }
}


/* ─── Error pages (404, 500) ──────────────────────────────────────────────── */
.error-wrap { text-align: center; max-width: 400px; padding: 2rem; }
.error-code { font-size: 6rem; font-weight: 700; color: #2a2a32; line-height: 1; }
.error-title { font-size: 1.5rem; font-weight: 600; color: #e8e8ed; margin: 1rem 0 0.5rem; }
.error-sub { font-size: 14px; color: #888890; margin-bottom: 2rem; line-height: 1.6; }
.error-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .error-code,
  body.light .error-code { color: #d0d0e0; }
  body:not(.dark):not(.light) .error-title,
  body.light .error-title { color: #1a1a2e; }
  body:not(.dark):not(.light) .error-sub,
  body.light .error-sub { color: #9090a0; }
}


/* ─── Public page logo mark link ──────────────────────────────────────────── */
.pub-logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pub-logo-box {
  width: 32px;
  height: 32px;
  background: #6c63ff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pub-logo-name {
  font-size: 15px;
  font-weight: 600;
  color: #e8e8ed;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .pub-logo-name,
  body.light .pub-logo-name { color: #1a1a2e; }
}


/* ─── Public footer ───────────────────────────────────────────────────────── */
.pub-footer {
  width: 100%;
  border-top: 1px solid #1a1a20;
  padding: 2rem 1rem;
  margin-top: 4rem;
}
.pub-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.pub-footer-copy { font-size: 12px; color: #555560; }
.pub-footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.pub-footer-links a { font-size: 12px; color: #555560; text-decoration: none; }
.pub-footer-links a:hover { color: #888890; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .pub-footer,
  body.light .pub-footer { border-top-color: #e0e0e8; }
  body:not(.dark):not(.light) .pub-footer-copy,
  body.light .pub-footer-copy { color: #9090a0; }
  body:not(.dark):not(.light) .pub-footer-links a,
  body.light .pub-footer-links a { color: #9090a0; }
}


/* ─── Registrations closed page ───────────────────────────────────────────── */
.closed-container {
  max-width: 500px;
  margin: 60px auto;
  padding: 2rem;
  text-align: center;
}
.closed-icon { font-size: 4rem; margin-bottom: 1rem; }
.closed-title { font-size: 2rem; margin-bottom: 0.5rem; color: #e8e8ed; }
.closed-text { color: #888890; margin-bottom: 1.5rem; line-height: 1.6; font-size: 15px; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .closed-title,
  body.light .closed-title { color: #1a1a2e; }
  body:not(.dark):not(.light) .closed-text,
  body.light .closed-text { color: #555560; }
}


/* ─── Login required page ─────────────────────────────────────────────────── */
.login-required-card {
  background: #111114;
  border: 1px solid #1e1e26;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
}
.login-required-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; }
.login-required-desc { color: #888890; font-size: 14px; line-height: 1.6; margin-bottom: 2rem; }
.btn-login-outline {
  background: transparent;
  border: 1px solid #333340;
  color: #888890;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: all 0.2s;
}
.btn-login-outline:hover { border-color: #6c63ff; color: #6c63ff; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .login-required-card,
  body.light .login-required-card { background: #ffffff; border-color: #e0e0e8; }
  body:not(.dark):not(.light) .login-required-title,
  body.light .login-required-title { color: #1a1a2e; }
  body:not(.dark):not(.light) .login-required-desc,
  body.light .login-required-desc { color: #9090a0; }
  body:not(.dark):not(.light) .btn-login-outline,
  body.light .btn-login-outline { border-color: #d0d0e0; color: #555560; }
  body:not(.dark):not(.light) .btn-login-outline:hover,
  body.light .btn-login-outline:hover { border-color: #6c63ff; color: #6c63ff; }
}


/* ─── Scan quota exceeded page ────────────────────────────────────────────── */
.quota-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}
.quota-icon {
  width: 80px; height: 80px;
  border-radius: 12px;
  background: rgba(255, 107, 107, 0.1);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
  font-size: 40px;
}
.quota-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.75rem; color: #e8e8ed; }
.quota-message { color: #888890; font-size: 14px; line-height: 1.6; margin-bottom: 1.5rem; }
.quota-stats {
  background: #111114;
  border: 1px solid #2a2a32;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
}
.quota-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #1a1a20;
}
.quota-stat-row:last-child { border-bottom: none; }
.quota-stat-label { color: #888890; font-size: 13px; }
.quota-stat-value { font-weight: 600; color: #e8e8ed; }
.quota-stat-value.exceeded { color: #ff6b6b; }
.quota-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.btn-upgrade-large {
  background: #6c63ff; color: white; border: none;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.2s; text-decoration: none; display: inline-block;
}
.btn-upgrade-large:hover { background: #7d72ff; }
.btn-secondary-large {
  background: transparent; color: #6c63ff;
  border: 1px solid #6c63ff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; text-decoration: none; display: inline-block;
}
.btn-secondary-large:hover { background: rgba(108, 99, 255, 0.1); }
.quota-info { font-size: 12px; color: #666; margin-top: 1rem; }
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .quota-title,
  body.light .quota-title { color: #1a1a2e; }
  body:not(.dark):not(.light) .quota-message,
  body.light .quota-message { color: #555560; }
  body:not(.dark):not(.light) .quota-stats,
  body.light .quota-stats { background: #ffffff; border-color: #e0e0e8; }
  body:not(.dark):not(.light) .quota-stat-row,
  body.light .quota-stat-row { border-color: #e0e0e8; }
  body:not(.dark):not(.light) .quota-stat-label,
  body.light .quota-stat-label { color: #9090a0; }
  body:not(.dark):not(.light) .quota-stat-value,
  body.light .quota-stat-value { color: #1a1a2e; }
  body:not(.dark):not(.light) .quota-info,
  body.light .quota-info { color: #9090a0; }
}


.section-divider {
  border-top: 1px solid #1a1a20;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}
@media (prefers-color-scheme: light) {
  body:not(.dark):not(.light) .section-divider,
  body.light .section-divider { border-top-color: #e0e0e8; }
}



/* ─── Global element defaults (ensures consistent theming on all pages) ─── */
h1, h2, h3, h4, h5, h6 {
  color: #e8e8ed;
}
p {
  color: #888890;
}
a {
  color: #6c63ff;
}
hr {
  border: none;
  border-top: 1px solid #1e1e26;
}
strong {
  color: #e8e8ed;
}

@media (prefers-color-scheme: light) {
@media (prefers-color-scheme: light) {
    body:not(.dark):not(.light) h1,
    body:not(.dark):not(.light) h2,
    body:not(.dark):not(.light) h3,
    body:not(.dark):not(.light) h4,
    body:not(.dark):not(.light) h5,
    body:not(.dark):not(.light) h6 { color: #1a1a2e; }
    body:not(.dark):not(.light) p { color: #555560; }
    body:not(.dark):not(.light) hr { border-top-color: #e0e0e8; }
    body:not(.dark):not(.light) strong { color: #1a1a2e; }
}

}
@media (prefers-color-scheme: light) {
  body.light h1,
  body.light h2,
  body.light h3,
  body.light h4,
  body.light h5,
  body.light h6 { color: #1a1a2e; }
  body.light p { color: #555560; }
  body.light hr { border-top-color: #e0e0e8; }
  body.light strong { color: #1a1a2e; }
}
