/* ===================== NETWORK — luxury analytics theme ===================== */
:root {
  --bg: #0b0c10;
  --bg-2: #101218;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-2: rgba(255, 255, 255, 0.16);
  --ink: #f4f1ea;
  --ink-2: #b9b4a9;
  --ink-3: #7d7a72;
  --gold: #d9b777;
  --gold-2: #c79e54;
  --teal: #5fc6c0;
  --violet: #9b8cff;
  --rose: #e08aa0;
  --good: #6fcf97;
  --warn: #e6b566;
  --radius: 16px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.75);
  --serif: "Cormorant Garamond", "Hoefler Text", Garamond, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 600px at 78% -8%, rgba(217, 183, 119, 0.10), transparent 60%),
    radial-gradient(900px 600px at 8% 108%, rgba(155, 140, 255, 0.10), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(217, 183, 119, 0.3); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- top bar -------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 22px;
  padding: 14px 26px;
  background: rgba(11, 12, 16, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--gold), #8a6b2e);
  display: grid; place-items: center; color: #1a1407; font-weight: 800;
  box-shadow: 0 0 0 1px rgba(217, 183, 119, 0.4), 0 6px 18px -6px rgba(217, 183, 119, 0.6);
}
.brand .name { font-weight: 700; letter-spacing: 0.32em; font-size: 13px; }
.brand .sub { color: var(--ink-3); font-size: 11px; letter-spacing: 0.18em; margin-left: 2px; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button {
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em; transition: all 0.16s ease;
}
.nav button:hover { color: var(--ink); background: var(--panel); }
.nav button.active { color: var(--ink); background: var(--panel-2); border-color: var(--stroke-2); }
.topbar .spacer { flex: 1; }
.db-pill {
  display: flex; align-items: center; gap: 8px; color: var(--ink-2);
  font-size: 12px; padding: 7px 13px; border: 1px solid var(--stroke);
  border-radius: 999px; background: var(--panel);
}
.db-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.db-pill { cursor: pointer; user-select: none; }
.db-pill:hover { border-color: var(--stroke-2); }
.db-pill .caret { color: var(--ink-3); font-size: 10px; margin-left: 2px; }

.db-menu {
  position: absolute; top: 56px; right: 18px; z-index: 50; width: 290px;
  background: linear-gradient(180deg, #15161d, #0e0f14); border: 1px solid var(--stroke-2);
  border-radius: 14px; box-shadow: var(--shadow); padding: 8px; overflow: hidden;
}
.dbm-head { color: var(--ink-3); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 8px 8px; }
.dbm-off { color: var(--warn); text-transform: none; letter-spacing: 0; }
.dbm-empty { color: var(--ink-3); font-size: 12.5px; padding: 4px 8px 10px; }
.dbm-item { display: flex; align-items: center; gap: 4px; border-radius: 9px; }
.dbm-item.on { background: var(--panel-2); }
.dbm-item:hover { background: var(--panel); }
.dbm-load { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: none; border: none; color: var(--ink); padding: 9px 10px; font-size: 13px; text-align: left; }
.dbm-load .dbm-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbm-load .dbm-ct { color: var(--ink-3); font-size: 12px; flex: none; }
.dbm-del { background: none; border: none; color: var(--ink-3); font-size: 15px; width: 26px; height: 30px; border-radius: 8px; flex: none; }
.dbm-del:hover { color: var(--rose); background: rgba(224, 138, 160, 0.12); }
.dbm-demo { width: 100%; text-align: left; background: none; border: none; color: var(--ink-2); padding: 9px 10px; font-size: 13px; border-radius: 9px; margin-top: 2px; }
.dbm-demo:hover { background: var(--panel); color: var(--ink); }
.dbm-demo.on { background: var(--panel-2); color: var(--ink); }
.dbm-tag { color: var(--ink-3); font-size: 10.5px; border: 1px solid var(--stroke); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.dbm-foot { border-top: 1px solid var(--stroke); margin-top: 8px; padding: 10px 8px 4px; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dbm-foot b { color: var(--warn); }
.dbm-tools { border-top: 1px solid var(--stroke); margin-top: 8px; padding: 8px 8px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.dbm-enrich { background: none; border: 1px solid var(--stroke-2); color: var(--teal); border-radius: 8px; padding: 5px 9px; font-size: 11.5px; font-weight: 600; }
.dbm-enrich:hover { background: rgba(95, 198, 192, 0.1); }
.dbm-msg { color: var(--ink-2); font-size: 11.5px; line-height: 1.45; }

/* ---- match all/any toggle (landing) ---- */
.match-mode { width: min(760px, 92vw); display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.mm-label { color: var(--ink-3); font-size: 12.5px; }
.mm-seg { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 11px; padding: 3px; }
.mm-seg button { background: transparent; border: none; color: var(--ink-2); padding: 7px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.mm-seg button b { color: var(--ink-3); font-weight: 700; }
.mm-seg button.active { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--stroke-2); }
.mm-seg button.active b { color: var(--gold); }

/* ---- import-driven empty state (landing) ---- */
.landing-empty { display: none; width: min(640px, 92vw); margin: 30px auto 0; text-align: center;
  border: 1px solid var(--stroke); border-radius: var(--radius); padding: 48px 32px;
  background: var(--panel); }
.landing-empty .le-mark { font-size: 34px; color: var(--gold); margin-bottom: 12px; }
.landing-empty h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.landing-empty p { margin: 0 0 22px; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
/* when the active dataset is empty, hide the audience builder and show the prompt */
body.no-data .search-shell, body.no-data .match-mode, body.no-data .builder { display: none; }
body.no-data .landing-empty { display: block; }

/* ---- rank-by segmented (discovery) ---- */
.rank-seg { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 11px; padding: 3px; flex-wrap: wrap; }
.rank-seg button { background: transparent; border: none; color: var(--ink-2); padding: 8px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.rank-seg button:hover { color: var(--ink); }
.rank-seg button.active { background: rgba(217, 183, 119, 0.16); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(217, 183, 119, 0.4); }

/* ---- topbar 'create your network' CTA ---- */
.net-cta { background: var(--panel); border: 1px solid var(--stroke-2); color: var(--ink); padding: 8px 13px; border-radius: 10px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.net-cta:hover { border-color: var(--gold); color: var(--gold); }
.net-cta-ct { background: var(--gold); color: #1a1407; font-weight: 800; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-grid; place-items: center; padding: 0 5px; }
.net-cta.is-empty .net-cta-ct { display: none; }

/* ---- card rank no + shortlist star ---- */
.card .rank-no { font-family: var(--serif); font-size: 17px; color: var(--ink-3); font-weight: 600; flex: none; width: 16px; text-align: center; align-self: center; }
.shortlist-btn { flex: none !important; width: 40px; background: var(--panel); border: 1px solid var(--stroke); color: var(--ink-3); border-radius: 10px; font-size: 15px; }
.shortlist-btn:hover { border-color: var(--gold); color: var(--gold); }
.shortlist-btn.on { background: rgba(217, 183, 119, 0.18); border-color: var(--gold); color: var(--gold); }

/* ---- community / your network ---- */
.community-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; padding: 12px 14px; margin-bottom: 20px; }
.community-bar input { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); color: var(--ink); padding: 9px 12px; border-radius: 10px; font-size: 13px; min-width: 220px; }
.community-bar input:focus { outline: none; border-color: var(--stroke-2); }
.community-bar .cb-spacer { flex: 1; }
.community-empty { text-align: center; color: var(--ink-3); padding: 70px 20px; line-height: 1.6; }
.community-empty .big { font-size: 30px; color: var(--gold); margin-bottom: 10px; }

/* --------------------------------- views -------------------------------- */
.view { display: none; }
.view.active { display: block; animation: fade 0.32s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------- landing -------------------------------- */
.landing-wrap {
  min-height: calc(100vh - 60px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px 80px;
}
.eyebrow {
  color: var(--gold); letter-spacing: 0.34em; font-size: 11px; font-weight: 700;
  text-transform: uppercase; margin-bottom: 18px;
}
.hero-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(34px, 5.4vw, 62px); line-height: 1.04; text-align: center;
  letter-spacing: 0.5px; margin: 0 0 14px; max-width: 16ch;
}
.hero-title em { font-style: italic; color: var(--gold); }
.hero-sub { color: var(--ink-2); text-align: center; max-width: 56ch; margin-bottom: 34px; font-size: 15px; }

.search-shell {
  width: min(760px, 92vw);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--stroke-2);
  border-radius: 20px; padding: 10px 10px 10px 18px;
  box-shadow: var(--shadow), 0 0 0 6px rgba(217, 183, 119, 0.04);
  display: flex; align-items: center; gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-shell:focus-within { border-color: rgba(217, 183, 119, 0.55); box-shadow: var(--shadow), 0 0 0 6px rgba(217, 183, 119, 0.10); }
.search-shell .glass { color: var(--ink-3); font-size: 18px; }
.search-shell input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 16px; padding: 12px 0;
}
.search-shell input::placeholder { color: var(--ink-3); }
.btn-go {
  background: linear-gradient(140deg, var(--gold), var(--gold-2));
  color: #1a1407; border: none; font-weight: 700; font-size: 14px;
  padding: 13px 22px; border-radius: 13px; white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(217, 183, 119, 0.8);
  transition: transform 0.12s, filter 0.12s;
}
.btn-go:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-go:active { transform: translateY(0); }

/* selected condition tokens */
.tokens { width: min(760px, 92vw); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; min-height: 4px; }
.token {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--stroke-2);
  padding: 6px 8px 6px 12px; border-radius: 999px; font-size: 12.5px; color: var(--ink);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.token .k { color: var(--ink-3); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.token .x {
  border: none; background: rgba(255, 255, 255, 0.08); color: var(--ink-2);
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; line-height: 1;
}
.token .x:hover { background: var(--rose); color: #1a0a0e; }

/* condition builder */
.builder { width: min(900px, 94vw); margin-top: 38px; }
.builder-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.builder-head h3 { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin: 0; font-weight: 700; }
.builder-head .hint { color: var(--ink-3); font-size: 12px; }
.cond-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cond-card {
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 14px 16px;
}
.cond-card h4 { margin: 0 0 11px; font-size: 12px; color: var(--gold); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke);
  color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  transition: all 0.14s ease;
}
.chip:hover { border-color: var(--stroke-2); color: var(--ink); }
.chip.on { background: rgba(217, 183, 119, 0.16); border-color: rgba(217, 183, 119, 0.55); color: var(--gold); }

/* ------------------------------ discovery ------------------------------- */
.page { max-width: 1280px; margin: 0 auto; padding: 26px 26px 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 4px; }
.page-head p { color: var(--ink-2); margin: 0; font-size: 13.5px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.disc-search {
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font-size: 13px; width: 220px; outline: none;
}
.disc-search::placeholder { color: var(--ink-3); }
.disc-search:focus { border-color: var(--gold); }
.filterbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; padding: 11px 14px; margin-bottom: 20px;
}
.filterbar .lbl { color: var(--ink-3); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 2px; }
.mini-token { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); border: 1px solid var(--stroke-2); border-radius: 999px; padding: 5px 7px 5px 11px; font-size: 12px; }
.mini-token .x { border: none; background: transparent; color: var(--ink-3); font-size: 13px; }
.mini-token .x:hover { color: var(--rose); }
.select, .ghost-btn {
  background: var(--panel); border: 1px solid var(--stroke); color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font-size: 13px;
}
.ghost-btn:hover { border-color: var(--stroke-2); background: var(--panel-2); }
.ghost-btn:disabled { cursor: default; color: var(--ink-3); background: rgba(255, 255, 255, 0.025); border-color: var(--stroke); }
.toolbar-status { color: var(--ink-3); font-size: 12px; max-width: 260px; }
.select { appearance: none; padding-right: 26px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }

/* profile card */
.card {
  position: relative; background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--stroke); border-radius: var(--radius); padding: 16px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--stroke-2); box-shadow: var(--shadow); }
.card .match {
  position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700; color: var(--gold);
  background: rgba(217, 183, 119, 0.12); border: 1px solid rgba(217, 183, 119, 0.4); padding: 4px 9px; border-radius: 999px;
}
.card-head { display: flex; gap: 13px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 14px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 17px; letter-spacing: 0.02em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar.lg { width: 76px; height: 76px; border-radius: 20px; font-size: 25px; }
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.avatar.xs { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; }
.who .nm { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.who .hd { color: var(--ink-3); font-size: 12.5px; }
.tick { color: var(--teal); font-size: 12px; }
.tag { display: inline-block; font-size: 10.5px; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--stroke); color: var(--ink-2); }
.tag.cat { color: var(--gold); border-color: rgba(217, 183, 119, 0.3); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); border-radius: 11px; padding: 9px 10px; }
.stat .v { font-weight: 700; font-size: 15px; }
.stat .l { color: var(--ink-3); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 1px; }

.lovebar { margin-top: 14px; }
.lovebar .cap { color: var(--ink-3); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 7px; }
.brandchips { display: flex; flex-wrap: wrap; gap: 6px; }
.brandchip { font-size: 11.5px; padding: 4px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); }
.brandchip.propose { color: var(--teal); border-color: rgba(95, 198, 192, 0.4); background: rgba(95, 198, 192, 0.08); }
.brandchip.muted { color: var(--ink-3); }

.card-actions { display: flex; gap: 8px; margin-top: 15px; }
.card-actions button { flex: 1; padding: 9px; border-radius: 10px; font-size: 12.5px; font-weight: 600; }
.btn-primary { background: rgba(217, 183, 119, 0.16); border: 1px solid rgba(217, 183, 119, 0.5); color: var(--gold); }
.btn-primary:hover { background: rgba(217, 183, 119, 0.26); }
.btn-soft { background: var(--panel); border: 1px solid var(--stroke); color: var(--ink-2); }
.btn-soft:hover { color: var(--ink); border-color: var(--stroke-2); }

.empty { text-align: center; color: var(--ink-3); padding: 80px 20px; }

/* ------------------------- instagram scraper ---------------------------- */
.scraper-shell {
  min-height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  background: #0a0b0f;
}
.scraper-side {
  border-right: 1px solid var(--stroke);
  background: #101116;
  padding: 24px;
  overflow-y: auto;
}
.scraper-logo {
  margin: 0 0 24px;
  text-transform: uppercase;
}
.scraper-logo b {
  display: block;
  font-family: var(--serif);
  color: var(--gold);
  letter-spacing: 0.16em;
  font-size: 17px;
}
.scraper-logo span {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.22em;
  margin-top: 5px;
}
.scraper-card,
.scraper-log-panel {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  padding: 16px;
}
.scraper-card h2,
.scraper-log-panel h2,
.scraper-history-head h2,
.scraper-section-head h2 {
  margin: 0;
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.scraper-run-card h2 { margin-bottom: 14px; }
.scraper-card label span,
.ig-options label > span {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.scraper-card textarea,
.scraper-card input,
.ig-cookie textarea,
.ig-import-panel input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke);
  color: var(--ink);
  padding: 10px 11px;
  border-radius: 6px;
  font-size: 13px;
}
.scraper-card textarea:focus,
.scraper-card input:focus,
.ig-cookie textarea:focus,
.ig-import-panel input:focus {
  outline: none;
  border-color: rgba(217, 183, 119, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 183, 119, 0.08);
}
.scraper-card textarea { resize: vertical; min-height: 112px; }
.scraper-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.scraper-actions button,
.scraper-handoff button,
.ig-import-panel button {
  border-radius: 6px;
  min-height: 40px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.scraper-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 9px;
}
.scraper-history-head span {
  color: var(--gold);
  border: 1px solid rgba(217, 183, 119, 0.28);
  border-radius: 999px;
  min-width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}
.scraper-log-panel { margin-top: 18px; }
.scraper-log { display: grid; gap: 8px; margin-top: 12px; }
.scraper-log-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  color: var(--ink-2);
  font-size: 12px;
}
.scraper-log-row span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.scraper-log-row b { font-weight: 500; }
.scraper-log-row.ok b { color: var(--good); }
.scraper-log-row.err b { color: var(--rose); }
.scraper-log-row.working b { color: var(--warn); }
.scraper-main {
  min-width: 0;
  padding: 28px clamp(20px, 3vw, 44px) 56px;
  overflow-y: auto;
}
.scraper-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  border-bottom: 1px solid rgba(217, 183, 119, 0.22);
  padding-bottom: 18px;
  margin-bottom: 16px;
}
.scraper-topline h1 {
  font-family: var(--serif);
  color: var(--ink);
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 600;
  line-height: 1.05;
  margin: 4px 0 8px;
}
.scraper-topline p {
  color: var(--ink-2);
  margin: 0;
  font-size: 13px;
}
.scraper-kpis {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 8px;
}
.scraper-kpis div,
.scraper-metric,
.scraper-wide,
.scraper-profile,
.scrape-post {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.scraper-kpis div { padding: 12px; }
.scraper-kpis b,
.scraper-metric b {
  display: block;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.scraper-kpis span,
.scraper-metric span {
  display: block;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 6px;
}
.scraper-handoff {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}
.scraper-handoff button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.scraper-profile {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
}
.scraper-profile-img {
  width: 120px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}
.scraper-profile-img.blank {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 12px;
}
.scraper-profile-copy h2 {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 28px;
  line-height: 1.05;
  margin: 4px 0 6px;
}
.scraper-profile-copy p {
  color: var(--ink-2);
  margin: 0;
}
.scraper-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.scraper-profile-meta span {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--ink-2);
  padding: 4px 9px;
  font-size: 11px;
}
.scraper-profile-meta .ok { color: var(--good); border-color: rgba(111, 207, 151, 0.35); }
.scraper-profile-meta .err { color: var(--rose); border-color: rgba(224, 138, 160, 0.35); }
.scraper-profile-meta .working { color: var(--warn); border-color: rgba(230, 181, 102, 0.35); }
.scraper-error {
  grid-column: 1 / -1;
  color: var(--rose);
  margin: 0;
  font-size: 12px;
}
.scraper-empty {
  grid-column: 1 / -1;
  min-height: 140px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  color: var(--ink-3);
}
.scraper-empty h2 {
  color: var(--ink-2);
  font-size: 16px;
  margin: 0 0 6px;
}
.scraper-empty p { margin: 0; }
.scraper-empty.compact {
  min-height: 54px;
  border: 1px dashed var(--stroke);
  border-radius: 8px;
  font-size: 12px;
}
.scraper-insights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.scraper-metric,
.scraper-wide { padding: 14px; }
.scraper-wide {
  grid-column: span 2;
  min-height: 110px;
}
.scraper-wide h3 {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.scraper-wide p {
  color: var(--ink-2);
  margin: 0;
  line-height: 1.6;
}
.scraper-wide.warning {
  border-color: rgba(230, 181, 102, 0.38);
  background: rgba(230, 181, 102, 0.06);
}
.scraper-wide.warning h3 { color: var(--warn); }
.scraper-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 12px;
}
.scraper-section-head span {
  color: var(--ink-3);
  font-size: 12px;
}
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.scrape-post {
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.scrape-post:hover {
  border-color: rgba(217, 183, 119, 0.32);
  background: rgba(255, 255, 255, 0.035);
}
.scrape-post img,
.scrape-post-empty {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.scrape-post-empty {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  background: rgba(0, 0, 0, 0.24);
}
.scrape-post-body { padding: 14px; }
.scrape-post-loc {
  color: var(--gold-2);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 8px;
}
.scrape-post-body p {
  color: var(--ink-2);
  min-height: 58px;
  max-height: 78px;
  overflow: hidden;
  margin: 0 0 12px;
  line-height: 1.5;
}

/* ------------------------------- network -------------------------------- */
.net-layout { display: grid; grid-template-columns: 232px 1fr 286px; gap: 16px; height: calc(100vh - 60px); padding: 16px 18px; }
.net-panel { background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 16px; overflow-y: auto; }
.net-panel h3 { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 12px; font-weight: 700; }
.net-panel h3:not(:first-child) { margin-top: 22px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 5px; letter-spacing: 0.05em; }
.field select, .field input { width: 100%; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); color: var(--ink); padding: 8px 10px; border-radius: 9px; font-size: 13px; }
.seg-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 10px; cursor: pointer; transition: background 0.12s; }
.seg-item:hover { background: var(--panel); }
.seg-item.active { background: var(--panel-2); }
.seg-item .sw { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.seg-item .nm { flex: 1; font-size: 12.5px; }
.seg-item .ct { color: var(--ink-3); font-size: 12px; }

.canvas-wrap { position: relative; background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.03), transparent 70%); border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden; }
#net-svg { width: 100%; height: 100%; display: block; cursor: grab; }
#net-svg:active { cursor: grabbing; }
.net-edge { stroke: rgba(255, 255, 255, 0.10); stroke-width: 1; transition: stroke 0.15s, stroke-opacity 0.15s; }
.net-edge.hot { stroke: var(--gold); stroke-opacity: 0.9; stroke-width: 1.6; }
.net-node circle { cursor: pointer; transition: stroke 0.12s; stroke: rgba(0, 0, 0, 0.4); stroke-width: 1.5; }
.net-node text { fill: #0b0c10; font-size: 9px; font-weight: 700; pointer-events: none; text-anchor: middle; dominant-baseline: central; }
.net-node.dim { opacity: 0.16; }
.net-node.hot circle { stroke: #fff; stroke-width: 2.5; }
.net-hud { position: absolute; left: 14px; top: 12px; font-size: 12px; color: var(--ink-3); pointer-events: none; }
.net-legend-note { color: var(--ink-3); font-size: 11px; margin-top: 8px; line-height: 1.5; }

.node-detail .mini-stat { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--stroke); }
.node-detail .mini-stat .l { color: var(--ink-3); }

/* -------------------------- ego (per-person) network --------------------- */
.net-mode-toggle { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 11px; padding: 3px; margin-bottom: 16px; }
.net-mode-toggle button { flex: 1; background: transparent; border: none; color: var(--ink-2); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.net-mode-toggle button.active { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--stroke-2); }

#net-svg[hidden], #ego-svg[hidden], #ego-overlay[hidden] { display: none; }
#ego-svg { width: 100%; height: 100%; display: block; }
/* Centre avatar is an HTML <img> laid over the SVG core — SVG <image> + clipPath
   mis-renders at the core size in this engine. viewBox == container px, so JS
   positions it in 1:1 pixel coords. */
#ego-overlay { position: absolute; inset: 0; pointer-events: none; }
#ego-overlay .ego-core-av { position: absolute; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--gold); cursor: pointer; pointer-events: auto; }

.ego-results { margin-top: 6px; max-height: 300px; overflow-y: auto; }
.ego-opt { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.ego-opt:hover, .ego-opt.active { background: var(--panel-2); }
.ego-opt img, .ego-opt .av { width: 26px; height: 26px; border-radius: 50%; flex: none; object-fit: cover; background: linear-gradient(140deg, var(--gold), #8a6b2e); }
.ego-opt .nm { flex: 1; font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ego-opt .hd { font-size: 11px; color: var(--ink-3); flex: none; }

/* curved connectors — coloured by spoke type */
.ego-link { fill: none; stroke: rgba(255, 255, 255, 0.10); stroke-width: 1.4; transition: stroke 0.15s, stroke-opacity 0.15s, opacity 0.15s; }
.ego-link.t-creator { stroke: rgba(217, 183, 119, 0.45); stroke-width: 1.9; }
.ego-link.t-brand { stroke: rgba(217, 183, 119, 0.22); }
.ego-link.t-external { stroke: rgba(122, 152, 194, 0.20); }
.ego-link.t-similar { stroke: rgba(155, 140, 255, 0.24); stroke-dasharray: 3 4; }
.ego-link.faded { opacity: 0.12; }

/* spoke nodes */
.ego-node { cursor: pointer; }
.ego-node .ring { fill: rgba(0, 0, 0, 0.35); stroke-width: 1.5; transition: stroke 0.12s; }
.ego-node.t-creator .ring { stroke: var(--gold); }
.ego-node.t-brand .ring { stroke: var(--gold-2); fill: rgba(217, 183, 119, 0.10); }
.ego-node.t-external .ring { stroke: rgba(140, 165, 205, 0.65); }
.ego-node.t-similar .ring { stroke: #9b8cff; }
.ego-node .ini { fill: var(--ink); font-size: 10.5px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.ego-node .lbl { fill: var(--ink-2); font-size: 11px; font-weight: 600; dominant-baseline: middle; }
.ego-node.t-creator .lbl { fill: var(--ink); }
.ego-node .cnt { fill: var(--gold); font-size: 9.5px; font-weight: 800; dominant-baseline: middle; }
.ego-node:hover .ring, .ego-node.hot .ring { stroke: #fff; stroke-width: 2.4; }
.ego-node.faded { opacity: 0.26; }

/* glowing centre core */
.ego-core .halo { fill: none; stroke: var(--gold); opacity: 0.45; }
.ego-core .halo2 { fill: none; stroke: rgba(217, 183, 119, 0.22); }
.ego-core .disc { stroke: var(--gold); stroke-width: 2; }
.ego-core .ini { fill: var(--ink); font-size: 26px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.ego-core .nm { fill: var(--ink); font-family: var(--serif); font-weight: 600; text-anchor: middle; }
.ego-core .hd { fill: var(--gold); text-anchor: middle; font-size: 12px; }

/* selected-creator side card */
#ego-card .ec-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
#ego-card .ec-av { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); flex: none; background: linear-gradient(140deg, var(--gold), #8a6b2e); }
#ego-card .ec-nm { font-family: var(--serif); font-size: 18px; line-height: 1.15; }
#ego-card .ec-hd { color: var(--ink-3); font-size: 12px; }
.ec-stats { display: flex; gap: 8px; margin-bottom: 14px; }
.ec-stat { flex: 1; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 6px; text-align: center; }
.ec-stat b { display: block; font-size: 14px; color: var(--ink); }
.ec-stat span { font-size: 10px; color: var(--ink-3); letter-spacing: 0.04em; }
.ec-fallback { background: rgba(217, 183, 119, 0.08); border: 1px solid rgba(217, 183, 119, 0.3); color: var(--ink-2); font-size: 11.5px; border-radius: 9px; padding: 8px 10px; margin-bottom: 12px; line-height: 1.45; }
.ec-legend { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; }
.ec-leg { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.ec-leg .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ec-leg .ct { margin-left: auto; color: var(--ink-3); font-size: 11.5px; }
#ego-card h4 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 16px 0 9px; font-weight: 700; }
.ec-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ec-chip { font-size: 11px; color: var(--ink-2); border: 1px solid var(--stroke); background: var(--panel); border-radius: 999px; padding: 3px 9px; }
.ec-note { color: var(--ink-3); font-size: 11px; line-height: 1.5; margin-top: 12px; }

/* legend swatches share palette set in JS */
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------------------- Global Topology (mention mode) ------------------- */
.tier-pill { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; margin-bottom: 6px; padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; cursor: pointer; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); color: var(--ink); transition: opacity 0.12s, border-color 0.12s; }
.tier-pill .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.tier-pill .tp-nm { flex: 1; }
.tier-pill .tp-ct { color: var(--ink-3); font-weight: 700; font-size: 11.5px; }
.tier-pill.active { border-color: var(--stroke-2); }
.tier-pill:not(.active) { opacity: 0.42; border-style: dashed; }
.tier-pill:not(.active) .dot { box-shadow: none; }
.topo-actions { display: flex; gap: 6px; margin: 10px 0 4px; }
.dock-btn { flex: 1; background: var(--panel); border: 1px solid var(--stroke-2); color: var(--ink-2); padding: 7px 10px; border-radius: 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.dock-btn:hover { color: var(--gold); border-color: var(--gold); }
/* isolated "stealth wealth" hubs — dashed gold ring */
.net-node.isolated circle { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 3 2.5; }
/* topology legend dock — icon + title + description */
.legend-row.topo-legend { align-items: flex-start; gap: 10px; padding: 7px 0; }
.legend-row.topo-legend .sw { width: 11px; height: 11px; border-radius: 50%; margin-top: 3px; flex: none; }
.legend-row.topo-legend .tl-txt { display: flex; flex-direction: column; gap: 2px; }
.legend-row.topo-legend .tl-txt strong { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.legend-row.topo-legend .tl-txt span { font-size: 11px; color: var(--ink-3); line-height: 1.4; }
.legend-row.topo-legend.iso .sw { border-radius: 50%; background: transparent !important; border: 1.5px dashed var(--gold); }

/* -------------------------- profile drawer ------------------------------ */
.scrim { position: fixed; inset: 0; background: rgba(4, 5, 8, 0.6); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 60; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(560px, 100vw);
  background: linear-gradient(180deg, #14151c, #0d0e13);
  border-left: 1px solid var(--stroke-2); box-shadow: -30px 0 60px -30px rgba(0, 0, 0, 0.8);
  transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 61; overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-hero { padding: 24px 26px 18px; border-bottom: 1px solid var(--stroke); position: relative; }
.drawer-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 10px; background: var(--panel); border: 1px solid var(--stroke); color: var(--ink-2); font-size: 17px; }
.drawer-close:hover { color: var(--ink); border-color: var(--stroke-2); }
.drawer-hero .row { display: flex; gap: 16px; align-items: center; }
.drawer-hero .nm { font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.1; }
.drawer-hero .hd { color: var(--ink-3); font-size: 13px; }
.drawer-hero .tags { margin-top: 8px; }
.drawer-body { padding: 8px 26px 40px; }
.section { padding: 20px 0; border-bottom: 1px solid var(--stroke); }
.section:last-child { border-bottom: none; }
.section h4 { margin: 0 0 14px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.section h4 .meta { color: var(--ink-3); text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 8px; font-size: 11px; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.kpi { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; text-align: center; }
.kpi .v { font-size: 18px; font-weight: 700; }
.kpi .l { color: var(--ink-3); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 3px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-row .nm { width: 132px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.bar-row .pct { width: 34px; text-align: right; font-size: 12px; color: var(--ink-2); }

.propose-item { display: flex; gap: 12px; align-items: center; padding: 11px; border: 1px solid rgba(95, 198, 192, 0.28); background: rgba(95, 198, 192, 0.06); border-radius: 12px; margin-bottom: 9px; }
.propose-item .fit { width: 44px; height: 44px; border-radius: 11px; flex: none; display: grid; place-items: center; font-weight: 700; color: var(--teal); border: 1px solid rgba(95, 198, 192, 0.4); font-size: 13px; }
.propose-item .nm { font-weight: 700; font-size: 13.5px; }
.propose-item .rsn { color: var(--ink-2); font-size: 12px; margin-top: 2px; }

.people-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.person { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 10px; border: 1px solid var(--stroke); background: var(--panel); cursor: pointer; transition: border-color 0.12s; }
.person:hover { border-color: var(--stroke-2); }
.person .nm { font-size: 12.5px; font-weight: 600; line-height: 1.15; }
.person .sc { font-size: 10.5px; color: var(--teal); }

.hotel-item { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--stroke); }
.hotel-item:last-child { border: none; }
.hotel-item .rank { width: 22px; color: var(--ink-3); font-family: var(--serif); font-size: 17px; }
.hotel-item .nm { flex: 1; font-size: 13px; font-weight: 600; }
.hotel-item .ct { color: var(--ink-3); font-size: 12px; }
.hotel-item .ci { color: var(--gold); font-size: 12px; font-weight: 600; }

.loc-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-pill { display: flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--panel); font-size: 12.5px; }
.loc-pill .v { color: var(--ink-3); font-size: 11px; }
.loc-pill.home { border-color: rgba(217, 183, 119, 0.5); color: var(--gold); }

.drawer-cta { display: flex; gap: 10px; margin-top: 6px; }
.drawer-cta button { flex: 1; padding: 12px; border-radius: 12px; font-weight: 700; font-size: 13px; }

/* look-alike inline result inside drawer */
.lookalike-list .person { width: 100%; }
.section .ld { color: var(--ink-2); font-size: 12.5px; margin: -6px 0 12px; }

/* ----------------------------- import ----------------------------------- */
.import-btn {
  background: linear-gradient(140deg, var(--gold), var(--gold-2)); color: #1a1407;
  border: none; font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 10px;
  box-shadow: 0 8px 20px -10px rgba(217, 183, 119, 0.8);
}
.import-btn:hover { filter: brightness(1.06); }
.db-pill { cursor: default; }

.modal-scrim {
  position: fixed; inset: 0; background: rgba(4, 5, 8, 0.66); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 0.22s; z-index: 70;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(680px, 100%); max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, #15161d, #0e0f14); border: 1px solid var(--stroke-2);
  border-radius: 20px; box-shadow: var(--shadow); transform: translateY(10px); transition: transform 0.24s;
}
.modal-scrim.open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--stroke); position: relative; }
.modal-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; margin: 0 0 5px; }
.modal-head p { color: var(--ink-2); font-size: 13px; margin: 0; max-width: 52ch; }
.modal-tabs { display: flex; gap: 6px; padding: 14px 24px 0; }
.mtab { background: transparent; border: 1px solid transparent; color: var(--ink-2); padding: 9px 16px; border-radius: 10px 10px 0 0; font-weight: 600; font-size: 13px; }
.mtab.active { color: var(--ink); background: var(--panel-2); border-color: var(--stroke); border-bottom-color: transparent; }
.mpane { display: none; padding: 20px 24px 24px; }
.mpane.active { display: block; }
.mpane-hint { color: var(--ink-2); font-size: 13px; margin: 0 0 14px; }
.mpane-hint b { color: var(--gold); }

.dropzone {
  display: block; text-align: center; padding: 34px 20px; border: 1.5px dashed var(--stroke-2);
  border-radius: 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s; background: rgba(255, 255, 255, 0.02);
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: rgba(217, 183, 119, 0.06); }
.dz-icon { font-size: 30px; color: var(--gold); }
.dz-title { font-weight: 600; margin-top: 8px; }
.dz-sub { color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.sample-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; color: var(--ink-3); font-size: 12.5px; }
.import-mode { display: flex; gap: 18px; margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.import-mode label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.import-mode input { accent-color: var(--gold); }
.import-status { margin-top: 14px; font-size: 13px; min-height: 18px; }
.import-status .ok { color: var(--good); }
.import-status .err { color: var(--rose); }
.import-status .warn { color: var(--warn); display: block; margin-top: 4px; }
.import-status .working { color: var(--ink-2); }

.manual-grid-head, .manual-row { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr 2fr; gap: 8px; }
.manual-grid-head { color: var(--ink-3); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 7px; padding: 0 2px; }
.manual-row { margin-bottom: 8px; }
.manual-row input { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); color: var(--ink); padding: 9px 10px; border-radius: 9px; font-size: 13px; width: 100%; }
.manual-row input:focus { outline: none; border-color: var(--stroke-2); }
.modal-cta { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-cta button { padding: 10px 18px; border-radius: 11px; font-weight: 700; font-size: 13px; }

.ig-form { display: grid; gap: 12px; }
.ig-form label span, .ig-options label > span { display: block; color: var(--ink-3); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.ig-form textarea, .ig-form input, .ig-cookie textarea, .ig-import-panel input {
  width: 100%; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke);
  color: var(--ink); padding: 10px 11px; border-radius: 10px; font-size: 13px;
}
.ig-form textarea:focus, .ig-form input:focus, .ig-cookie textarea:focus, .ig-import-panel input:focus { outline: none; border-color: var(--stroke-2); }
.ig-form textarea, .ig-cookie textarea { resize: vertical; min-height: 84px; }
.ig-options { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.ig-options label:first-child { width: 120px; }
.ig-check { display: flex; align-items: center; gap: 8px; color: var(--ink-2); padding-bottom: 10px; cursor: pointer; }
.ig-check span { margin: 0 !important; color: var(--ink-2) !important; letter-spacing: 0 !important; text-transform: none !important; font-size: 13px !important; }
.ig-check input { width: auto; accent-color: var(--gold); }
.ig-cookie { margin-top: 14px; border: 1px solid var(--stroke); border-radius: 12px; background: rgba(255, 255, 255, 0.02); padding: 10px 12px; }
.ig-cookie summary { color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.ig-cookie textarea { margin-top: 10px; min-height: 70px; }
.ig-cookie-actions { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.ig-cookie-actions button { padding: 8px 12px; border-radius: 9px; font-weight: 700; font-size: 12px; }
.ig-cookie-actions span { font-size: 12.5px; }
.ig-results { display: grid; gap: 8px; margin-top: 12px; }
.ig-job {
  display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 6px; align-items: stretch;
  border: 1px solid var(--stroke); border-radius: 8px; background: rgba(255, 255, 255, 0.025); padding: 4px;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.ig-job:hover, .ig-job.active { background: rgba(217, 183, 119, 0.06); border-color: rgba(217, 183, 119, 0.34); }
.ig-job.active { box-shadow: inset 3px 0 0 var(--gold); }
.ig-job-select {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  width: 100%; min-width: 0; text-align: left; background: transparent; border: none; color: inherit; padding: 8px;
}
.ig-job-remove {
  width: 32px; border: none; border-radius: 6px; background: transparent; color: var(--ink-3); font-size: 16px;
}
.ig-job-remove:hover { color: var(--rose); background: rgba(224, 138, 160, 0.1); }
.ig-job-main { min-width: 0; }
.ig-job-main b { display: block; font-size: 13px; color: var(--ink); }
.ig-job-main span { display: block; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-job-main em { display: block; color: var(--rose); font-size: 12px; font-style: normal; margin-top: 2px; }
.ig-job-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ig-job-side span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; }
.ig-job-side small { color: var(--ink-3); font-size: 11.5px; }
.ig-job-side .ok, #ig-cookie-status .ok { color: var(--good); }
.ig-job-side .err, #ig-cookie-status .err { color: var(--rose); }
.ig-job-side .working, #ig-cookie-status .working { color: var(--ink-2); }
.ig-import-panel {
  display: grid; grid-template-columns: 1fr minmax(180px, 230px) auto; align-items: center; gap: 12px;
  margin-top: 0; margin-bottom: 18px; padding: 12px; border: 1px solid rgba(217, 183, 119, 0.28);
  border-radius: 13px; background: rgba(217, 183, 119, 0.06);
}
.ig-import-panel[hidden] { display: none; }
.ig-import-panel b { color: var(--gold); font-size: 13px; }
.ig-import-panel p { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; }
.ig-import-panel button { padding: 10px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; }

/* column mapping */
.map-panel { margin-top: 4px; }
.map-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.map-head h4 { margin: 0; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.linkbtn { background: none; border: none; color: var(--ink-2); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--ink); }
.map-grid { max-height: 300px; overflow-y: auto; border: 1px solid var(--stroke); border-radius: 12px; padding: 4px 12px; }
.map-row { display: grid; grid-template-columns: 1fr 168px; gap: 12px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--stroke); }
.map-row:last-child { border-bottom: none; }
.map-row .src .h { font-weight: 600; font-size: 13px; }
.map-row .src .smp { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-row select { width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); color: var(--ink); padding: 7px 9px; border-radius: 9px; font-size: 12.5px; }
.map-row select.assigned { border-color: rgba(217, 183, 119, 0.5); color: var(--gold); }
.map-row select.brand { border-color: rgba(95, 198, 192, 0.45); color: var(--teal); }

.est-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.04em; color: var(--warn); border: 1px solid rgba(230, 181, 102, 0.45); background: rgba(230, 181, 102, 0.1); padding: 1px 5px; border-radius: 5px; vertical-align: middle; margin-left: 5px; }
.nodata { color: var(--ink-3); font-size: 12.5px; background: rgba(255, 255, 255, 0.03); border: 1px dashed var(--stroke); border-radius: 10px; padding: 12px 14px; line-height: 1.5; }

@media (max-width: 1180px) {
  .topbar { gap: 10px; padding-inline: 16px; }
  .db-pill { display: none; }
  .nav button { padding-inline: 10px; }
  .net-cta { padding-inline: 10px; }
}

@media (max-width: 920px) {
  .cond-groups { grid-template-columns: 1fr; }
  .manual-grid-head { display: none; }
  .manual-row { grid-template-columns: 1fr 1fr; }
  .scraper-shell { grid-template-columns: 1fr; min-height: auto; }
  .scraper-side { border-right: none; border-bottom: 1px solid var(--stroke); padding: 22px 16px; }
  .scraper-logo { margin-bottom: 18px; }
  .scraper-main { padding: 24px 16px 50px; }
  .scraper-topline { grid-template-columns: 1fr; align-items: start; }
  .scraper-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .scraper-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scraper-wide { grid-column: span 2; }
  .ig-import-panel { grid-template-columns: 1fr; }
  .net-layout { grid-template-columns: 1fr; height: auto; }
  .canvas-wrap { height: 60vh; }
  .db-pill { display: none; }
  .topbar { gap: 8px; padding: 12px 12px; }
  .brand .sub { display: none; }
  .brand .name { letter-spacing: 0.12em; font-size: 12px; }
  .nav { margin-left: 0; gap: 2px; }
  .nav button { padding: 7px 8px; font-size: 12px; }
}

@media (max-width: 560px) {
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
    gap: 7px;
  }
  .topbar .spacer { display: none; }
  .brand { flex: 1 1 120px; min-width: 0; }
  .brand .name { letter-spacing: 0.1em; }
  .nav {
    order: 5;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }
  .nav button {
    width: 100%;
    min-height: 40px;
    padding: 6px 4px;
    font-size: 11px;
    line-height: 1.15;
  }
  .net-cta {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }
  .net-cta::before { content: "✦"; font-size: 14px; }
  .import-btn {
    min-height: 40px;
    padding: 7px 10px;
    font-size: 11px;
    line-height: 1.15;
  }
  .scraper-actions,
  .scraper-insights,
  .scraper-kpis,
  .post-grid { grid-template-columns: 1fr; }
  .scraper-profile { grid-template-columns: 1fr; }
  .scraper-profile-img { width: 100%; aspect-ratio: 16 / 9; }
  .scraper-handoff { justify-content: stretch; flex-direction: column; }
  .scraper-wide { grid-column: span 1; }
  .scrape-post-body p { min-height: 0; }
}
