/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --border:   #2a2d3e;
  --text:     #e2e4f0;
  --muted:    #6b7280;
  --accent:   #4f8ef7;
  --new:      #f59e0b;
  --success:  #22c55e;
  --danger:   #ef4444;
  --radius:   6px;
  --font:     'Segoe UI', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 12px; }

h1 { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }

.badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.idle    { background: var(--muted); }
.status-dot.running { background: var(--new); animation: pulse 1.2s infinite; }
.status-dot.error   { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Nav tabs ────────────────────────────────────────────────────────────── */
nav {
  display: flex;
  gap: 2px;
  padding: 8px 24px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 8px 14px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button {
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
  padding: 6px 14px;
  transition: opacity 0.15s;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }

#btn-scan {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
}
#btn-scan:hover:not(:disabled) { opacity: 0.85; }

.btn-secondary {
  background: var(--surface);
  color: var(--muted);
}
.btn-secondary:hover { color: var(--text); }

.btn-ack {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 3px 10px;
}
.btn-ack:hover { color: var(--text); }

/* ── Main layout ─────────────────────────────────────────────────────────── */
main { padding: 20px 24px; max-width: 1100px; margin: 0 auto; }

#status-bar {
  display: flex;
  gap: 24px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

.tab-content         { display: none; }
.tab-content.active  { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

h2 { font-size: 15px; font-weight: 600; }

.count { color: var(--muted); font-size: 13px; margin-left: 6px; }

.results-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input[type="search"],
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 5px 12px;
  outline: none;
}
input[type="search"] { width: 220px; }
select { cursor: pointer; }
input[type="search"]:focus,
select:focus { border-color: var(--accent); }

.tag.query { color: #a78bfa; border-color: #a78bfa; }
.tag-btn-filter {
  background: none;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}
.tag-btn-filter:hover { background: var(--bg); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card.is-new { border-left: 3px solid var(--new); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.card-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  flex: 1;
}

.card-url {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.card-url:hover { text-decoration: underline; }

.card-snippet { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  align-items: center;
}

.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
}
.tag.engine { color: var(--accent); border-color: var(--accent); }
.tag.new    { color: var(--new);    border-color: var(--new); }
.tag.severity-critical { color: #ef4444; border-color: #ef4444; background: #450a0a; }
.tag.severity-high     { color: #f97316; border-color: #f97316; background: #451a03; }
.tag.severity-medium   { color: #eab308; border-color: #eab308; background: #1c1a06; }
.tag.severity-low      { color: #22c55e; border-color: #22c55e; background: #14532d; }
.tag.category          { color: #a78bfa; border-color: #a78bfa; }

.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn-ignore {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 10px;
}
.btn-ignore:hover { color: var(--text); border-color: var(--accent); }

.saved-hint {
  color: var(--success);
  font-size: 12px;
  margin-left: 8px;
}

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

/* ── Table ───────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

.status-pill {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-pill.completed { background: #14532d; color: var(--success); }
.status-pill.running   { background: #451a03; color: var(--new); }
.status-pill.failed    { background: #450a0a; color: var(--danger); }

/* ── Config grid ──────────────────────────────────────────────────────────── */
.config-grid { display: flex; flex-direction: column; gap: 12px; }

.config-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.config-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.config-value { font-size: 13px; }
.engine-list  { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.pagination button {
  background: var(--surface);
  color: var(--text);
  padding: 5px 12px;
}
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Helpers ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}

.auth-card h1 { font-size: 20px; margin-bottom: 4px; }

.auth-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  width: 100%;
}
.form-group input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 16px;
  width: 100%;
  transition: opacity 0.15s;
}
.btn-primary:hover:not(:disabled) { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.auth-error {
  background: #450a0a;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
}

.auth-link { color: var(--muted); font-size: 13px; margin-top: 16px; text-align: center; }
.auth-link a { color: var(--accent); text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

/* ── Header extras ────────────────────────────────────────────────────────── */
.user-email { color: var(--muted); font-size: 12px; }

/* ── Upgrade banner ──────────────────────────────────────────────────────── */
.upgrade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #1c1a06;
  border: 1px solid #f59e0b55;
  border-radius: var(--radius);
  color: var(--new);
  font-size: 13px;
  margin-bottom: 16px;
  padding: 10px 16px;
}

.btn-upgrade {
  background: var(--new);
  border: none;
  border-radius: var(--radius);
  color: #000;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-upgrade:hover { opacity: 0.85; }

/* ── PII management ──────────────────────────────────────────────────────── */
.section-desc { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.pii-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
}

.pii-section h3 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }

.pii-hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; }

.pii-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.pii-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  padding: 6px 10px;
}

.pii-empty { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }

.pii-add { display: flex; gap: 8px; }

.pii-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  flex: 1;
  font-size: 13px;
  outline: none;
  padding: 6px 10px;
}
.pii-input:focus { border-color: var(--accent); }

.btn-add {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  white-space: nowrap;
}
.btn-add:hover { opacity: 0.85; }

.btn-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.btn-remove:hover { color: var(--danger); }

/* ── Nav back link ───────────────────────────────────────────────────────── */
.nav-back {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.nav-back:hover { color: var(--text); }

/* ── Pricing page layout ─────────────────────────────────────────────────── */
.pricing-main {
  max-width: 480px;
  margin: 40px auto;
  padding: 0 24px;
}

.pricing-intro {
  text-align: center;
  margin-bottom: 32px;
}
.pricing-intro h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.pricing-intro p { color: var(--muted); }

.pricing-fine-print {
  color: var(--muted);
  font-size: 11px;
  margin-top: 12px;
  text-align: center;
}

.btn-large {
  font-size: 15px;
  padding: 10px 16px;
}

/* ── Pricing card ────────────────────────────────────────────────────────── */
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
}

.pricing-header { text-align: center; margin-bottom: 24px; }
.pricing-name   { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.pricing-price  { font-size: 40px; font-weight: 700; color: var(--text); }
.pricing-period { font-size: 16px; font-weight: 400; color: var(--muted); }

.pricing-features {
  list-style: none;
  margin-bottom: 24px;
}
.pricing-features li {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 9px 0;
}
.pricing-features li::before { content: '✓ '; color: var(--success); font-weight: 700; }
.pricing-features li:last-child { border-bottom: none; }

/* ── Upgrade modal ───────────────────────────────────────────────────────── */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
  bottom: 0;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  left: 50%;
  max-width: 400px;
  padding: 28px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  z-index: 101;
}

.modal-box h2 { font-size: 17px; margin-bottom: 10px; }
.modal-box p  { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 10px; }
.modal-box p strong { color: var(--text); }

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

/* ── Billing tab ─────────────────────────────────────────────────────────── */
.billing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
  padding: 24px;
}

.billing-card .config-row { background: var(--bg); }

.billing-plan {
  align-items: center;
  display: flex;
  gap: 10px;
}

.billing-plan-name { font-size: 20px; font-weight: 700; }

.billing-actions { margin-top: 8px; }

.billing-actions .btn-primary {
  display: block;
  padding: 10px 16px;
  text-align: center;
  width: 100%;
}

.status-pill.active    { background: #14532d; color: var(--success); }
.status-pill.past_due  { background: #451a03; color: var(--new); }
.status-pill.canceled  { background: #450a0a; color: var(--danger); }
.status-pill.inactive  { background: var(--border); color: var(--muted); }

/* ── Removals tab ────────────────────────────────────────────────────────── */
.status-pill.pending   { background: #451a03; color: var(--new); }
.status-pill.submitted { background: #172554; color: var(--accent); }
.status-pill.removed   { background: #14532d; color: var(--success); }

.removal-steps {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 10px;
  padding: 10px 0 0 22px;
}

/* ── Admin panel ─────────────────────────────────────────────────────────── */
.admin-badge {
  background: #172554;
  border-radius: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  text-transform: uppercase;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  padding: 6px 14px;
}

.admin-section { margin-bottom: 28px; }
.admin-section h2 { font-size: 16px; margin-bottom: 10px; }
.admin-section h3 { font-size: 13px; margin: 12px 0 6px; }

.admin-actions { white-space: nowrap; }
.admin-actions button { margin-right: 4px; }

.admin-detail-cell { background: var(--bg); }
.admin-detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.admin-kv { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.admin-list { color: var(--muted); font-size: 13px; list-style: none; }
.admin-list li { margin-bottom: 4px; word-break: break-all; }

.admin-scans-table { margin-top: 6px; }

@media (max-width: 700px) {
  .admin-detail-grid { grid-template-columns: 1fr; }
}

/* ── Legal pages & footers ───────────────────────────────────────────────── */
.legal-main { max-width: 640px; }
.legal-main h2 { font-size: 20px; margin-bottom: 4px; }
.legal-main h3 { font-size: 15px; margin: 22px 0 8px; }
.legal-main p, .legal-main li { color: var(--muted); font-size: 13px; line-height: 1.7; }
.legal-main ul { padding-left: 20px; }
.legal-main li { margin-bottom: 6px; }
.legal-main a { color: var(--accent); }
.legal-updated { font-size: 12px; margin-bottom: 8px; }

.legal-footer {
  color: var(--muted);
  font-size: 12px;
  margin-top: 16px;
  text-align: center;
}
.legal-footer a { color: var(--muted); }
.legal-footer a:hover { color: var(--text); }
footer.legal-footer { padding: 20px 0 30px; }

/* ── Danger button ───────────────────────────────────────────────────────── */
.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  padding: 7px 14px;
}
.btn-danger:hover { background: #450a0a; }
