/* ============================================================
   Taki Scraper — stylesheet
   Taki Consulting branding: near-black / dark charcoal surfaces,
   warm gold accent (#E8B547), Russo One headings, Roboto body.
   Dark theme by default. Mobile-first responsive.
   ============================================================ */

:root {
  /* Brand */
  --gold:       #E8B547;
  --gold-bright:#F2C766;
  --gold-dim:   #B8902F;
  --gold-soft:  rgba(232, 181, 71, 0.14);   /* translucent gold for fills */
  --gold-line:  rgba(232, 181, 71, 0.35);

  /* Surfaces (near-black → charcoal layers) */
  --bg:         #0C0C0E;
  --surface-1:  #141417;     /* cards */
  --surface-2:  #1B1B20;     /* raised elements, inputs */
  --surface-3:  #242429;     /* hover */
  --line:       #2A2A31;     /* borders */

  /* Text */
  --text:       #ECEAE4;     /* warm off-white */
  --text-dim:   #A9A69E;
  --text-faint: #6E6C66;

  /* Semantics */
  --green:  #4ade80;
  --red:    #f87171;
  --blue:   #93c5fd;

  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 6px 20px rgba(0,0,0,.35);
  --font-head: 'Russo One', sans-serif;
  --font-body: 'Roboto', -apple-system, "Segoe UI", Arial, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, .brand-text strong, .stat .num {
  font-family: var(--font-head);
  font-weight: 400;            /* Russo One only has 400 */
  letter-spacing: .02em;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: var(--font-body); font-size: 14px; }
a { color: var(--gold); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(232,181,71,.10), transparent 50%),
    radial-gradient(ellipse at 90% 110%, rgba(232,181,71,.06), transparent 50%),
    var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 40px 36px; width: 100%; max-width: 400px; text-align: center;
}
.login-logo {
  width: 60px; height: 60px; border-radius: 14px; margin: 0 auto 16px;
  background: var(--gold); color: #16130a;
  font-family: var(--font-head); font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 26px; color: var(--text); }
.login-sub { color: var(--text-dim); margin: 6px 0 24px; font-size: 14px; }
.login-error { color: var(--red); font-size: 14px; margin-bottom: 12px; }
.login-note { color: var(--text-dim); font-size: 13px; margin-bottom: 14px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px; font-size: 15px;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--line); border-radius: var(--radius);
}
.login-card input:focus { outline: none; border-color: var(--gold); }
.login-card button {
  width: 100%; padding: 12px; font-size: 15px; font-weight: 700;
  background: var(--gold); color: #16130a;
  border: none; border-radius: var(--radius);
}
.login-card button:hover { background: var(--gold-bright); }

/* ---------- Top bar ---------- */
.topbar {
  background: #09090b; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  background: var(--gold); color: #16130a;
  font-family: var(--font-head); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; color: var(--text); }
.brand-text small { color: var(--text-faint); font-size: 11.5px; }

.tabs { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.tab {
  background: none; border: none; color: var(--text-dim);
  padding: 19px 14px; font-size: 14px; font-weight: 500;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.userbox select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font-size: 13px; max-width: 180px;
}
.userbox .logout { color: var(--text-dim); background: none; border: none; font-size: 13px; padding: 8px 4px; }
.userbox .logout:hover { color: var(--gold); }

/* ---------- Layout ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 24px 16px 80px; }
.view { display: none; }
.view.active { display: block; }

h2.view-title { font-size: 20px; color: var(--text); margin-bottom: 4px; }
p.view-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }

.card {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  border-top: 3px solid var(--gold);
}
.stat .num { font-size: 26px; color: var(--text); }
.stat .lbl { font-size: 12.5px; color: var(--text-dim); }
.stat.priority { border-top-color: var(--gold-bright); background: linear-gradient(180deg, var(--gold-soft), var(--surface-1) 55%); }

/* ---------- Forms / controls ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-dim); }
.field input, .field select, .field textarea {
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 700;
  background: var(--gold); color: #16130a;
}
.btn:hover { background: var(--gold-bright); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.secondary:hover { background: var(--surface-3); }
.btn.ghost { background: none; color: var(--gold); font-weight: 500; }
.btn.ghost:hover { background: var(--gold-soft); }
.btn.danger { background: #7f1d1d; color: #fecaca; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }

/* ---------- Filter bar ---------- */
.filterbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.filterbar .field { min-width: 120px; flex: 1; }
.filterbar .field.grow { flex: 2; min-width: 160px; }
.checkline { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-dim); padding-bottom: 9px; }
.checkline input { width: 16px; height: 16px; accent-color: var(--gold); }

/* ---------- Table ---------- */
.table-wrap {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); overflow-x: auto;
}
table.leads { width: 100%; border-collapse: collapse; min-width: 920px; }
table.leads th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); background: var(--surface-2);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none; white-space: nowrap;
}
table.leads th.sorted { color: var(--gold); }
table.leads td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.leads tbody tr:hover { background: var(--gold-soft); cursor: pointer; }
table.leads .name-cell { font-weight: 500; color: var(--text); }
table.leads .muted { color: var(--text-faint); font-size: 12.5px; }
td.center, th.center { text-align: center; }

/* Badges */
.badge {
  display: inline-block; padding: 2.5px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: .02em;
}
.badge.no-site  { background: var(--gold); color: #16130a; }        /* priority! */
.badge.social   { background: rgba(147,197,253,.15); color: var(--blue); }
.badge.has-site { background: var(--surface-3); color: var(--text-dim); }
.badge.unknown  { background: var(--surface-3); color: var(--text-faint); border: 1px dashed var(--text-faint); }
.badge.score-hi  { background: var(--gold-soft); color: var(--gold-bright); border: 1px solid var(--gold-line); }
.badge.score-mid { background: var(--surface-3); color: var(--text); }
.badge.score-lo  { background: var(--surface-2); color: var(--text-faint); }
.badge.src { background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--line); font-weight: 500; }

/* Status select colours */
select.status-select {
  padding: 5px 8px; border-radius: 7px; border: 1.5px solid var(--line);
  font-size: 12.5px; font-weight: 500; background: var(--surface-2); color: var(--text-dim);
}
select.status-select.st-shortlisted    { color: var(--gold); border-color: var(--gold-dim); }
select.status-select.st-contacted      { color: var(--blue); border-color: var(--blue); }
select.status-select.st-won            { color: var(--green); border-color: var(--green); }
select.status-select.st-not_interested { color: var(--text-faint); }

/* Bulk action bar */
.bulkbar {
  display: none; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--gold-line);
  color: var(--text); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 12px;
}
.bulkbar.visible { display: flex; flex-wrap: wrap; }
.bulkbar span { font-size: 14px; }

/* ---------- Campaign cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.camp-card {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  border-left: 4px solid var(--gold);
}
.camp-card.archived { opacity: .55; border-left-color: var(--text-faint); }
.camp-card h3 { font-size: 16px; color: var(--text); }
.camp-card .meta { font-size: 13px; color: var(--text-dim); }
.camp-card .meta b { color: var(--text); font-weight: 500; }
.camp-card .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* Lead cards (shortlist) */
.lead-card {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  border-left: 4px solid var(--line);
}
.lead-card.no-site { border-left-color: var(--gold); }
.lead-card h3 { font-size: 16px; color: var(--text); }
.lead-card .meta { font-size: 13px; color: var(--text-dim); }
.lead-card .actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* ---------- Wizard ---------- */
.wizard-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.wizard-step-dot {
  flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3);
}
.wizard-step-dot.done { background: var(--gold); }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 10px 0; }
.choice-card {
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; text-align: left;
}
.choice-card:hover { border-color: var(--gold-dim); }
.choice-card.selected { border-color: var(--gold); background: var(--gold-soft); }
.choice-card strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.choice-card span { font-size: 12.5px; color: var(--text-dim); }
.choice-card.disabled { opacity: .5; cursor: not-allowed; }
.wizard-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.wizard-row .field { flex: 1; min-width: 150px; }
.adv-toggle { font-size: 13px; color: var(--gold); background: none; border: none; padding: 6px 0; }
.adv-panel { display: none; margin-top: 8px; }
.adv-panel.open { display: block; }
.weights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }

/* ---------- Compliance note ---------- */
.compliance {
  background: var(--gold-soft); border: 1px solid var(--gold-line);
  border-radius: var(--radius); padding: 12px 16px; font-size: 13.5px;
  color: var(--gold-bright); margin-bottom: 16px;
}
.compliance strong { display: block; margin-bottom: 2px; color: var(--gold-bright); }
.compliance em { color: var(--text); font-style: normal; font-weight: 500; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: 14px; width: 100%; max-width: 760px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); margin: auto 0;
}
.modal.wide { max-width: 880px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px 0;
}
.modal-head h3 { font-size: 17px; color: var(--text); }
.modal-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--text-faint); }
.modal-close:hover { color: var(--gold); }
.modal-body { padding: 14px 22px 22px; }
.modal-body textarea {
  width: 100%; min-height: 300px; padding: 12px; font-size: 14px; line-height: 1.55;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--line); border-radius: 8px; resize: vertical;
}
.modal-body textarea:focus { outline: none; border-color: var(--gold); }
.modal-body input.subject {
  width: 100%; padding: 10px 12px; margin-bottom: 10px; font-weight: 500;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--line); border-radius: 8px;
}
.modal-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal .detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 18px; margin-bottom: 14px; font-size: 14px;
}
.modal .detail-grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.modal .detail-grid dd { color: var(--text); }
.history { margin-top: 16px; }
.history h4, .modal h4.sect {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); margin: 14px 0 8px;
}
.history-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; font-size: 13.5px; background: var(--surface-2);
}
.history-item .when { color: var(--text-faint); font-size: 12px; }
.history-item pre { white-space: pre-wrap; font-family: var(--font-body); margin-top: 6px; color: var(--text-dim); }

/* Snippet chips */
.snips { display: flex; flex-direction: column; gap: 6px; }
.snip {
  border-left: 3px solid var(--gold-dim); background: var(--surface-2);
  border-radius: 0 8px 8px 0; padding: 8px 10px; font-size: 13px; color: var(--text-dim);
}
.snip b { color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; display: block; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface-3); color: var(--text); border: 1px solid var(--gold-line);
  padding: 11px 20px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow);
  animation: toast-in .25s ease;
}
.toast.error { background: #450a0a; border-color: #7f1d1d; color: #fecaca; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Import ---------- */
.dropzone {
  border: 2px dashed var(--text-faint); border-radius: var(--radius);
  padding: 36px; text-align: center; color: var(--text-dim);
  background: var(--surface-2); cursor: pointer; transition: border-color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: var(--gold-soft); }
.import-help { font-size: 13.5px; color: var(--text-dim); margin-top: 14px; }
.import-help code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; color: var(--gold-bright); }

/* ---------- Progress ---------- */
.progress-note { font-size: 14px; color: var(--text-dim); margin-top: 10px; }
.progress-track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--gold); width: 0%; transition: width .3s; }
.result-summary { margin-top: 14px; font-size: 14px; color: var(--text-dim); }
.result-summary li { margin-left: 20px; }
.result-summary .err { color: var(--red); }

/* ---------- Admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text-dim); }
.admin-table td b { color: var(--text); font-weight: 500; }

/* Candidate rows (manual add) */
.candidate {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-top: 10px; flex-wrap: wrap; background: var(--surface-2);
}
.candidate .info { flex: 1; min-width: 200px; }
.candidate .info strong { color: var(--text); }
.candidate .info .muted { color: var(--text-dim); font-size: 13px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--text-faint); padding: 48px 16px; font-size: 14.5px; }

/* ---------- Mobile tweaks ---------- */
@media (max-width: 640px) {
  .topbar-inner { padding: 0 10px; }
  .brand-text small { display: none; }
  .tab { padding: 14px 10px; font-size: 13px; }
  main { padding: 16px 10px 70px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .modal-body textarea { min-height: 240px; }
  .userbox select { max-width: 120px; }
}
