/* ── Reset & Variables ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:      #0f1420;
  --bg2:     #161d2e;
  --bg3:     #1e2840;
  --border:  #2a3550;
  --accent:  #0078d4;
  --accent2: #50b0ff;
  --green:   #4ade80;
  --red:     #f87171;
  --yellow:  #facc15;
  --text:    #e2e8f0;
  --muted:   #8899bb;
  --radius:  10px;
  --shadow:  0 4px 20px rgba(0,0,0,.4);
}
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
a { color: var(--accent2); text-decoration: none; }

/* ── Pages ───────────────────────────────────────────────── */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* ── LANDING PAGE ───────────────────────────────────────── */
.hero-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 48px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.hero-logo { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; color: var(--text); }

.hero-body {
  max-width: 1100px; margin: 0 auto; padding: 72px 32px 48px;
  text-align: center;
}
.hero-title { font-size: 48px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; }
.hero-title .accent { color: var(--accent); }
.hero-sub { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 40px; line-height: 1.6; }

.hero-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 64px; }
.btn-primary {
  background: var(--accent); color: white; border: none;
  padding: 12px 28px; border-radius: var(--radius); font-size: 15px;
  font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: #005ea6; }
.btn-ghost {
  background: transparent; color: var(--accent2); border: 1px solid var(--accent2);
  padding: 12px 28px; border-radius: var(--radius); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn-ghost:hover { background: rgba(80,176,255,.1); }
.btn-outline {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  padding: 8px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: border-color .15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent2); }

.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  margin-bottom: 48px;
}
@media (max-width: 768px) { .features { grid-template-columns: 1fr 1fr; } }
.feature-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; text-align: left;
  transition: border-color .15s;
}
.feature-card:hover { border-color: var(--accent); }
.feat-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.feature-card p { color: var(--muted); font-size: 13px; }

.hero-stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stat-pill {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 6px 16px; border-radius: 20px; font-size: 13px; color: var(--muted);
}

/* ── APP PAGE ─────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.acct-picker { display: flex; align-items: center; gap: 10px; }
.acct-picker label { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; }
.btn-xs {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
  transition: border-color .12s;
}
.btn-xs:hover { border-color: var(--accent); }

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-off { background: #555; }
.dot-on  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-err { background: var(--red); }

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex; overflow-x: auto; background: var(--bg2);
  border-bottom: 1px solid var(--border); padding: 0 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 12px 18px; font-size: 13px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* ── TAB CONTENT ─────────────────────────────────────────── */
.tab-pane { display: none; padding: 20px 24px; max-width: 900px; }
.tab-pane.active { display: block; }

/* ── CARD ─────────────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--muted); }

/* ── INPUTS ───────────────────────────────────────────────── */
input, textarea, select {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 12px; font-size: 13px;
  width: 100%; outline: none; transition: border-color .12s;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
label { color: var(--muted); font-size: 12px; display: block; margin-bottom: 4px; margin-top: 10px; }
label input[type=checkbox] { width: auto; margin-right: 6px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-row  { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

.btn-secondary {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: border-color .12s, background .12s;
}
.btn-secondary:hover { border-color: var(--accent); background: rgba(0,120,212,.1); }
.btn-danger {
  background: rgba(248,113,113,.1); border: 1px solid var(--red); color: var(--red);
  padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.btn-danger:hover { background: rgba(248,113,113,.2); }

.hint { color: var(--muted); font-size: 12px; }
code { background: var(--bg3); padding: 1px 5px; border-radius: 3px; font-family: monospace; }

/* ── RESULT BOXES ─────────────────────────────────────────── */
.result {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 13px; white-space: pre-wrap; font-family: monospace;
  display: none;
}
.result.ok   { border-color: var(--green); color: var(--green); }
.result.err  { border-color: var(--red);   color: var(--red); }
.result.info { border-color: var(--accent); color: var(--accent2); }

/* ── ACCOUNT CARDS ─────────────────────────────────────────── */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.account-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; position: relative;
}
.account-card.valid  { border-left: 3px solid var(--green); }
.account-card.failed { border-left: 3px solid var(--red); }
.acct-email { font-weight: 600; font-size: 13px; margin-bottom: 4px; word-break: break-all; }
.acct-org   { color: var(--muted); font-size: 11px; }
.acct-tags  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 10px; padding: 2px 7px; border-radius: 10px;
  background: rgba(0,120,212,.2); color: var(--accent2); border: 1px solid rgba(0,120,212,.3);
}
.tag.ok  { background: rgba(74,222,128,.1); color: var(--green); border-color: rgba(74,222,128,.3); }
.tag.err { background: rgba(248,113,113,.1); color: var(--red);   border-color: rgba(248,113,113,.3); }

/* ── MULTI-ACCOUNT SELECT ─────────────────────────────────── */
.multi-acct-select {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
}
.acct-checkbox-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; transition: border-color .12s;
}
.acct-checkbox-item input { width: auto; margin: 0; }
.acct-checkbox-item:has(input:checked) { border-color: var(--accent); background: rgba(0,120,212,.1); }

/* ── CAMPAIGN GRID ─────────────────────────────────────────── */
.campaign-grid { display: grid; gap: 16px; margin-top: 16px; }
.campaign-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.campaign-card.running { border-color: var(--accent); }
.campaign-card.done    { border-color: var(--green); }
.campaign-card.failed  { border-color: var(--red); }
.camp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.camp-email  { font-weight: 600; font-size: 14px; }
.camp-badge  { font-size: 11px; padding: 3px 10px; border-radius: 10px; }
.badge-run   { background: rgba(0,120,212,.2); color: var(--accent2); }
.badge-done  { background: rgba(74,222,128,.1); color: var(--green); }
.badge-wait  { background: rgba(180,180,180,.1); color: var(--muted); }
.badge-fail  { background: rgba(248,113,113,.1); color: var(--red); }

.progress-bar-wrap { background: var(--bg3); border-radius: 4px; height: 8px; margin-bottom: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.progress-bar.done { background: var(--green); }

.camp-stats { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.camp-stats span b { color: var(--text); }

.dl-breakdown { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; margin-top: 10px; }
.dl-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 11px; }
.dl-item .dl-name { color: var(--muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-item .dl-stat { color: var(--text); font-weight: 600; }

/* ── HISTORY TABLE ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: var(--bg3); padding: 8px 12px; text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 7px 12px; border-bottom: 1px solid rgba(42,53,80,.5); vertical-align: top; }
tr:hover td { background: rgba(255,255,255,.02); }
.status-ok   { color: var(--green); }
.status-fail { color: var(--red); }
.status-pend { color: var(--yellow); }
.badge { background: var(--bg3); color: var(--muted); font-size: 11px; padding: 1px 8px; border-radius: 10px; }

/* ── ADMIN PAGE ───────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 600px) { .stats-row { grid-template-columns: 1fr 1fr; } }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-num { font-size: 36px; font-weight: 800; color: var(--accent2); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn-del {
  background: none; border: 1px solid var(--red); color: var(--red);
  padding: 3px 10px; border-radius: 5px; cursor: pointer; font-size: 11px;
}
.btn-del:hover { background: rgba(248,113,113,.15); }

/* ── LOG PANEL ────────────────────────────────────────────── */
.log-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1px solid var(--border);
  max-height: 160px; z-index: 100;
}
.log-header {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 16px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.log-lines { height: 120px; overflow-y: auto; padding: 6px 16px; font-size: 11px; font-family: monospace; }
.log-line { padding: 1px 0; color: var(--muted); }
.log-line.OK   { color: var(--green); }
.log-line.FAIL { color: var(--red); }
.log-line.WARN { color: var(--yellow); }
.log-line.INFO { color: var(--accent2); }
main { padding-bottom: 170px; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
