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

:root {
  --bg:       #1e3a5f;
  --surface:  #254878;
  --border:   #3a6699;
  --border2:  #4d80b8;
  --accent:   #00ffff;
  --green:    #00ff88;
  --yellow:   #ffee00;
  --red:      #ff4444;
  --text:     #ffffff;
  --muted:    #d0e8ff;
  --dim:      #a0c4e8;
}

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* -- AUTH ---------------------------------------------------- */
body.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #0d1525 0%, var(--bg) 70%);
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}
.auth-logo {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}
.auth-title    { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { color: var(--muted); margin-bottom: 28px; }

/* -- SIDEBAR ------------------------------------------------- */
#sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0 24px;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.logo-icon { font-size: 22px; color: var(--accent); }
.logo-text  { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }
.nav-links  { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  color: var(--dim); font-family: 'Syne', sans-serif;
  font-size: 14px; text-decoration: none;
  transition: all 0.15s;
}
.nav-btn:hover { color: var(--text); background: #ffffff08; }
.nav-btn.active {
  background: #00D4FF12; color: var(--accent);
  font-weight: 600; border-left: 2px solid var(--accent); padding-left: 12px;
}
.nav-icon { font-size: 16px; }
.nav-footer {
  padding: 16px 24px 0; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.esp-pips { display: flex; gap: 6px; align-items: center; }
.esp-pip  { width: 8px; height: 8px; border-radius: 50%; background: var(--border2); transition: background 0.3s; }
.nav-footer-label { color: var(--dim); font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.nav-logout { color: var(--dim); font-size: 12px; text-decoration: none; transition: color 0.15s; }
.nav-logout:hover { color: var(--red); }

/* -- MAIN ---------------------------------------------------- */
#main { margin-left: 230px; flex: 1; padding: 48px 40px; max-width: 1100px; }
.page-header  { margin-bottom: 32px; }
.page-title   { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.page-subtitle{ color: var(--muted); font-size: 14px; }

/* -- CARDS --------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px 26px; margin-bottom: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}

/* -- STATS --------------------------------------------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: linear-gradient(135deg, #0a0e18, #0f1520);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-c);
  border-radius: 12px; padding: 20px 22px;
}
.stat-label { color: var(--dim); font-size: 11px; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent-c); line-height: 1; }

/* -- CHART --------------------------------------------------- */
.chart-wrap { height: 200px; }

/* -- FORMS --------------------------------------------------- */
.field-label {
  display: block; color: var(--dim); font-size: 11px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 8px;
}
.field-group { margin-bottom: 16px; }

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
select,
textarea {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 8px; padding: 11px 14px;
  color: var(--text); font-size: 14px; font-family: 'Syne', sans-serif;
  width: 100%; outline: none; transition: border-color 0.15s;
  appearance: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--dim); }

.input-with-btn { position: relative; }
.input-with-btn input { padding-right: 54px; }
.show-hide-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--dim); cursor: pointer;
  font-size: 12px; font-family: 'JetBrains Mono', monospace; padding: 0;
}

/* -- BUTTONS ------------------------------------------------- */
.btn-primary {
  background: #00D4FF15; border: 1px solid #00D4FF40; color: var(--accent);
  padding: 11px 24px; border-radius: 8px; cursor: pointer;
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 14px;
  transition: all 0.15s; text-decoration: none; display: inline-block;
}
.btn-primary:hover  { background: #00D4FF25; }
.btn-primary.active { border-color: var(--accent); color: var(--accent); }
.btn-full           { width: 100%; text-align: center; padding: 13px; }
.btn-primary[disabled] { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: none; border: 1px solid var(--border2); color: var(--muted);
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 13px;
  transition: all 0.15s; text-decoration: none; display: inline-block;
}
.btn-secondary:hover { border-color: var(--muted); color: var(--text); }

.btn-icon {
  background: none; border: none; color: var(--dim); cursor: pointer;
  font-size: 16px; padding: 4px 8px; border-radius: 6px;
  transition: all 0.15s; font-family: 'JetBrains Mono', monospace;
}
.btn-icon:hover       { color: var(--accent); background: #00D4FF12; }
.btn-icon.danger:hover{ color: var(--red); background: #E8392A12; }

.btn-copy {
  width: 100%; padding: 10px; border-radius: 8px; cursor: pointer;
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 13px;
  transition: all 0.15s; border: 1px solid;
}

/* -- ESP TOGGLES --------------------------------------------- */
.esp-toggle-row { display: flex; flex-wrap: wrap; gap: 10px; }
.esp-toggle-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  border-radius: 8px; cursor: pointer; border: 1px solid var(--border2);
  background: var(--bg); color: var(--dim);
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 600;
  transition: all 0.15s;
}
.esp-toggle-btn.on {
  border-color: var(--esp-color);
  background: color-mix(in srgb, var(--esp-color) 12%, transparent);
  color: var(--esp-color);
}
.esp-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--dim);
  transition: background 0.2s;
}
.esp-toggle-btn.on .esp-dot { background: var(--esp-color); }
.esp-score { font-size: 11px; opacity: 0.7; }

/* -- ESP TAG ------------------------------------------------- */
.esp-tag {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 20px; border: 1px solid; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* -- RESULT CARDS -------------------------------------------- */
.result-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: 12px; padding: 20px 24px; margin-bottom: 12px;
}
.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.result-esp-name { font-weight: 700; font-size: 15px; }
.result-badge {
  font-size: 10px; padding: 2px 10px; border-radius: 20px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.5px;
}
.result-domain { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); margin-bottom: 14px; }

.copy-row {
  display: flex; gap: 10px; align-items: center;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
}
.copy-url {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--code-txt, #A8D8F0); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.copy-url.small { font-size: 11px; color: var(--muted); }

/* -- SETTINGS ------------------------------------------------ */
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: 12px; padding: 20px 24px; margin-bottom: 12px;
}
.settings-header { display: flex; align-items: center; gap: 14px; }
.settings-info   { flex: 1; }
.settings-name   { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.settings-meta   { color: var(--dim); font-size: 11px; }
.configured-badge {
  display: inline-block; font-size: 10px; padding: 2px 8px;
  border-radius: 20px; background: #0FD47A18; color: var(--green);
  font-family: 'JetBrains Mono', monospace; margin-left: 8px;
}

.toggle-switch {
  width: 42px; height: 24px; border-radius: 12px; cursor: pointer;
  position: relative; border: none; outline: none; flex-shrink: 0;
  transition: background 0.2s;
}
.toggle-knob {
  position: absolute; top: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: white;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.settings-form { display: none; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.settings-form.open { display: block; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-actions .btn-primary { flex: 1; }

.howto-box {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 16px;
}
.howto-header {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13px; color: var(--yellow); margin-bottom: 8px;
}
.howto-free { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.howto-steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.howto-steps li {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 13px; color: var(--text); line-height: 1.5;
}
.step-num {
  min-width: 22px; height: 22px; border-radius: 50%;
  background: #00D4FF18; color: var(--accent); font-size: 11px;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; flex-shrink: 0; margin-top: 1px;
}

/* -- TABLES -------------------------------------------------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 10px 14px; color: var(--dim);
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #ffffff04; }
.url-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* -- LIST ROWS ----------------------------------------------- */
.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row-main { font-size: 14px; margin-bottom: 4px; }
.list-row-sub  { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.list-row-stat { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 18px; }

/* -- BAR CHARTS ---------------------------------------------- */
.bar-row   { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 80px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.bar-track { flex: 1; height: 6px; background: var(--border2); border-radius: 3px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.bar-pct   { width: 36px; text-align: right; font-size: 12px; font-family: 'JetBrains Mono', monospace; }

/* -- CAMPAIGNS ----------------------------------------------- */
.campaigns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; }
.campaign-card  {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 2px solid #9B59B6; border-radius: 12px; padding: 20px;
}
.campaign-name  { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.campaign-desc  { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.campaign-stats { display: flex; gap: 24px; margin-bottom: 16px; }
.campaign-stat-val   { font-size: 24px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.campaign-stat-label { color: var(--dim); font-size: 11px; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; }
.campaign-footer { display: flex; justify-content: space-between; align-items: center; }

/* -- ALERTS -------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; border: 1px solid; }
.alert-success { background: #0FD47A12; border-color: #0FD47A33; color: var(--green); }
.alert-error   { background: #E8392A12; border-color: #E8392A33; color: var(--red); }
.alert-warn    { background: #F5C84212; border-color: #F5C84233; color: var(--yellow); }

/* -- MISC ---------------------------------------------------- */
.two-col    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.two-col-sm { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mono       { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.muted      { color: var(--muted); }
.link-code  { color: var(--accent); text-decoration: none; font-family: 'JetBrains Mono', monospace; }
.link-code:hover { text-decoration: underline; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--dim); }
.empty-icon  { font-size: 32px; margin-bottom: 12px; }

#toast {
  position: fixed; bottom: 32px; right: 32px;
  background: var(--green); color: #000;
  padding: 12px 20px; border-radius: 10px; font-weight: 700; font-size: 14px;
  transform: translateY(80px); opacity: 0; transition: all 0.3s; z-index: 999;
}
#toast.show { transform: translateY(0); opacity: 1; }