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

:root {
  --bg:       #080808;
  --surface:  #111111;
  --border:   #1e1e1e;
  --text:     #f0f0f0;
  --muted:    #555555;
  --accent:   #1880c0;
  --green:    #22c55e;
  --purple:   #8b5cf6;
  --orange:   #f59e0b;
  --red:      #ef4444;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Login ── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-box h1 { font-size: 22px; font-weight: 900; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.login-box input {
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: 'Cairo', sans-serif;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--accent); }

.login-box button {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s;
}
.login-box button:hover { opacity: 0.85; }

#login-error { color: var(--red); font-size: 12px; min-height: 18px; }

/* ── Dashboard ── */
#dashboard {
  display: none;
  padding: 32px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-header h1 { font-size: 20px; font-weight: 900; }
.dash-actions { display: flex; gap: 8px; align-items: center; }
.refresh-time { font-size: 11px; color: var(--muted); }

.btn-sm {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  font-size: 12px;
  transition: color 0.2s, border-color 0.2s;
}
.btn-sm:hover { border-color: #444; color: var(--text); }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  text-align: center;
}
.stat-card .num { font-size: 28px; font-weight: 900; color: var(--accent); line-height: 1.1; }
.stat-card .num.green   { color: var(--green); }
.stat-card .num.purple  { color: var(--purple); }
.stat-card .num.orange  { color: var(--orange); }
.stat-card .num.pink    { color: #ec4899; }
.stat-card .num.teal    { color: #14b8a6; }
.stat-card .label { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media(max-width: 900px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media(max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Section ── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.section h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ── Row ── */
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 8px;
}
.row:last-child { border: none; }
.row-label { color: #bebebe; direction: ltr; text-align: left; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-val { color: var(--accent); font-weight: 700; min-width: 36px; text-align: center; }
.row-sub { font-size: 11px; color: var(--muted); }

/* ── Bar ── */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.bar-bg { flex: 1; height: 5px; background: #1a1a1a; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s; }
.bar-emoji { font-size: 17px; }
.bar-label { font-size: 12px; color: #888; min-width: 80px; }
.bar-count { font-size: 12px; color: var(--muted); min-width: 32px; text-align: left; direction: ltr; }

/* ── Trend Chart ── */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
  margin-top: 8px;
}
.trend-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.trend-bar { width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.7; min-height: 2px; transition: opacity 0.2s; }
.trend-bar:hover { opacity: 1; }
.trend-label { font-size: 9px; color: var(--muted); }

/* ── Sub ── */
.sub-item { padding: 9px 0; border-bottom: 1px solid var(--border); }
.sub-item:last-child { border: none; }
.sub-email { font-size: 13px; color: var(--text); direction: ltr; }
.sub-meta { font-size: 11px; color: var(--muted); margin-top: 2px; direction: ltr; }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(24,128,192,0.12);
  color: var(--accent);
  border: 1px solid rgba(24,128,192,0.2);
}

/* ── Country flag ── */
.country-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.country-row:last-child { border: none; }
.country-code { color: var(--muted); min-width: 36px; direction: ltr; font-weight: 600; }
.country-count { color: var(--accent); font-weight: 700; margin-right: auto; }

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }
