/* ============================================================
   OAP "See how it works" interactive demo
   The surrounding site is navy + cyan. The demo sandbox itself
   mirrors the real product: dark navy + GREEN accent.
   Everything below is scoped to .demo-frame so it cannot leak
   into the marketing chrome.
   ============================================================ */

/* ---------- Intro strip (sits in site theme) ---------- */
.demo-intro { padding-block: clamp(2.5rem, 6vw, 4.5rem) 1.5rem; }
.demo-intro h1 { font-size: var(--text-2xl); margin-bottom: var(--space-4); max-width: 20ch; }
.demo-intro p { font-size: var(--text-lg); max-width: 64ch; line-height: 1.55; }

.demo-wrap { padding-block: 0 clamp(3rem, 6vw, 5rem); }

/* ============================================================
   The app frame: a self-contained dark-navy + green surface
   ============================================================ */
.demo-frame {
  /* In-app tokens (do NOT inherit the site cyan) */
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --line: #30363d;
  --ink: #e6edf3;
  --t-muted: #8b949e;
  --faint: #6e7681;
  --grn: #3fb950;
  --grn-soft: rgba(63, 185, 80, 0.12);
  --grn-border: rgba(63, 185, 80, 0.42);
  --hi: #3fb950;   /* High confidence */
  --md: #e3b341;   /* Med confidence */
  --lo: #f85149;   /* Low confidence */
  --app-mono: 'JetBrains Mono', ui-monospace, monospace;
  --app-body: 'Satoshi', 'Inter', system-ui, sans-serif;
  --app-display: 'Cabinet Grotesk', 'General Sans', system-ui, sans-serif;

  position: relative;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 760px;
  box-shadow: 0 30px 80px rgba(2, 8, 24, 0.55);
  font-family: var(--app-body);
  line-height: 1.55;
}
.demo-boot { padding: 4rem; text-align: center; color: var(--t-muted); font-family: var(--app-mono); }

.demo-frame *, .demo-frame *::before, .demo-frame *::after { box-sizing: border-box; }
/* Safety net: an inline icon must never balloon if a specific size rule is missing. */
.demo-frame svg:not([width]) { width: 1em; height: 1em; }
.demo-frame h1, .demo-frame h2, .demo-frame h3, .demo-frame h4 {
  font-family: var(--app-display); letter-spacing: -0.01em; line-height: 1.15; color: var(--ink);
}
.demo-frame a { color: var(--grn); }
.demo-frame ::selection { background: var(--grn-soft); color: var(--grn); }

/* ---------- App buttons ---------- */
.dbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--app-body); font-size: 0.9rem; font-weight: 600;
  padding: 0.62rem 1.15rem; border-radius: 8px; border: 1px solid transparent;
  white-space: nowrap; cursor: pointer; transition: all 0.16s ease; color: var(--ink);
}
.dbtn--primary { background: var(--grn); color: #06210d; }
.dbtn--primary:hover { background: #4cc961; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(63,185,80,0.28); }
.dbtn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.dbtn--ghost:hover { border-color: var(--grn-border); color: var(--grn); }
.dbtn--sm { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.dbtn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.dbtn svg { width: 1.05em; height: 1.05em; }

/* ============================================================
   GATE SCREENS (lead / passphrase / acknowledge / login)
   ============================================================ */
.gate {
  display: flex; align-items: center; justify-content: center;
  min-height: 760px; padding: 2.5rem 1.5rem;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(63,185,80,0.08) 0%, transparent 55%),
    var(--bg);
}
.gate-card {
  width: 100%; max-width: 440px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; padding: 2.2rem 2rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.gate-card--wide { max-width: 540px; }
.gate-lock {
  width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--grn-soft); border: 1px solid var(--grn-border); color: var(--grn); margin-bottom: 1.25rem;
}
.gate-lock svg { width: 26px; height: 26px; }

/* Real OSINT App Platform logo in a glowing green ring (mirrors the desktop app). */
.logo-ring {
  border-radius: 50%;
  border: 1px solid var(--grn-dim, #238636);
  box-shadow: 0 0 18px rgba(63, 185, 80, 0.35);
  background: radial-gradient(circle at 50% 40%, #0c3a22, #06140d);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logo-ring img { display: block; border-radius: 50%; }
.gate-ring { width: 84px; height: 84px; margin: 0 auto 1.25rem; }
.gate-ring img { width: 72px; height: 72px; }
.shell-brand .logo-ring { width: 34px; height: 34px; }
.shell-brand .logo-ring img { width: 28px; height: 28px; }
.gate-eyebrow {
  font-family: var(--app-mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--grn); margin-bottom: 0.55rem; display: block;
}
.gate-card h2 { font-size: 1.5rem; margin-bottom: 0.6rem; }
.gate-card p { color: var(--t-muted); font-size: 0.92rem; margin-bottom: 1.25rem; }
.gate-field { display: grid; gap: 0.4rem; margin-bottom: 1rem; }
.gate-field label { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.gate-field input, .gate-field textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.65rem 0.8rem; font-size: 0.92rem; color: var(--ink); font-family: var(--app-body);
}
.gate-field input:focus, .gate-field textarea:focus { outline: none; border-color: var(--grn); box-shadow: 0 0 0 3px var(--grn-soft); }
.gate-hint {
  font-family: var(--app-mono); font-size: 0.78rem; color: var(--faint);
  background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
  padding: 0.6rem 0.75rem; margin-bottom: 1rem;
}
.gate-hint b { color: var(--grn); }
.gate-err { color: var(--lo); font-size: 0.82rem; margin-top: -0.4rem; margin-bottom: 0.8rem; min-height: 1.1em; }
.gate-card .dbtn { width: 100%; }
.gate-foot { font-size: 0.78rem; color: var(--faint); margin-top: 1rem; text-align: center; }

.shake { animation: dshake 0.4s ease; }
@keyframes dshake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }

.ack-list { display: grid; gap: 0.7rem; margin-bottom: 1.25rem; }
.ack-list li { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start; font-size: 0.88rem; color: var(--t-muted); list-style: none; }
.ack-list svg { color: var(--grn); margin-top: 0.15rem; width: 16px; height: 16px; flex-shrink: 0; }
.ack-check { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; font-size: 0.9rem; cursor: pointer; }
.ack-check input { width: 18px; height: 18px; accent-color: var(--grn); }

/* ============================================================
   PLATFORM SHELL
   ============================================================ */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 760px; }
.shell-nav {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1rem 0.75rem;
}
.shell-brand {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.6rem 1rem;
  border-bottom: 1px solid var(--line); margin-bottom: 0.75rem;
}
.shell-brand .dot { width: 28px; height: 28px; border-radius: 7px; background: var(--grn-soft); border: 1px solid var(--grn-border); display: flex; align-items: center; justify-content: center; color: var(--grn); }
.shell-brand .dot svg { width: 16px; height: 16px; }
.shell-brand .nm { font-family: var(--app-display); font-weight: 700; font-size: 0.95rem; }
.shell-brand .sub { font-family: var(--app-mono); font-size: 0.62rem; letter-spacing: 0.12em; color: var(--faint); text-transform: uppercase; }
.nav-group-label { font-family: var(--app-mono); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); padding: 0.7rem 0.6rem 0.35rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem; width: 100%;
  padding: 0.55rem 0.65rem; border-radius: 8px; font-size: 0.88rem; font-weight: 500;
  color: var(--t-muted); text-align: left; position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover:not(.is-active) { background: var(--panel-2); color: var(--ink); }
.nav-item.is-active { background: var(--grn-soft); color: var(--grn); }
.nav-item.is-active::before { content: ''; position: absolute; left: -0.75rem; top: 18%; bottom: 18%; width: 3px; background: var(--grn); border-radius: 0 3px 3px 0; }
.nav-item.is-disabled { color: var(--faint); cursor: pointer; }
.nav-item.is-locked { color: var(--faint); cursor: pointer; }
.nav-item .lock-ico { margin-left: auto; opacity: 0.7; }
.nav-item .lock-ico svg { width: 13px; height: 13px; }
.nav-spacer { flex: 1; }

/* main column */
.shell-main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--line); background: var(--panel); min-height: 54px;
}
.topbar .case-name { font-family: var(--app-display); font-weight: 700; font-size: 0.98rem; }
.topbar .case-sub { font-family: var(--app-mono); font-size: 0.66rem; color: var(--faint); letter-spacing: 0.04em; }
.demo-pill {
  font-family: var(--app-mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--grn-soft); color: var(--grn); border: 1px solid var(--grn-border);
  padding: 0.18rem 0.5rem; border-radius: 999px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.9rem; }
.topbar .user-chip { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; color: var(--t-muted); }
.topbar .user-chip .avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--grn); color: #06210d; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.72rem; }
.topbar .link-btn { font-size: 0.82rem; color: var(--t-muted); cursor: pointer; background: none; border: none; }
.topbar .link-btn:hover { color: var(--grn); }

.stage { flex: 1; overflow-y: auto; padding: 1.5rem 1.6rem; min-width: 0; }
.stage-head { margin-bottom: 1.35rem; }
.stage-head .eyebrow-a { font-family: var(--app-mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--grn); display: block; margin-bottom: 0.4rem; }
.stage-head h2 { font-size: 1.45rem; margin-bottom: 0.4rem; }
.stage-head p { color: var(--t-muted); font-size: 0.92rem; max-width: 70ch; }

/* ---------- Case setup form ---------- */
.case-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 980px) { .case-grid { grid-template-columns: 1fr; } }
.case-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; }
.case-panel h3 { font-size: 1.02rem; margin-bottom: 1rem; }
.df { display: grid; gap: 0.42rem; margin-bottom: 1.1rem; }
.df label { font-size: 0.82rem; font-weight: 600; }
.df .sub { font-size: 0.74rem; color: var(--faint); font-weight: 400; }
.df input, .df textarea, .df select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.62rem 0.78rem; font-size: 0.9rem; color: var(--ink); font-family: var(--app-body); width: 100%;
}
.df textarea { resize: vertical; line-height: 1.55; }
.df input:focus, .df textarea:focus, .df select:focus { outline: none; border-color: var(--grn); box-shadow: 0 0 0 3px var(--grn-soft); }
.df-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .df-row { grid-template-columns: 1fr; } }
.src-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 560px) { .src-grid { grid-template-columns: 1fr; } }
.src-toggle {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.6rem 0.7rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; font-size: 0.84rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.src-toggle:hover { border-color: var(--grn-border); }
.src-toggle input { width: 16px; height: 16px; accent-color: var(--grn); }
.src-toggle.on { border-color: var(--grn-border); background: var(--grn-soft); }
.case-side .meta-row { display: flex; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.84rem; }
.case-side .meta-row:last-child { border-bottom: none; }
.case-side .meta-row span:first-child { color: var(--t-muted); }
.case-side .meta-row span:last-child { font-weight: 600; }
.case-actions { display: flex; gap: 0.7rem; margin-top: 0.4rem; }

/* ---------- Collection ---------- */
.collect-wrap { display: grid; gap: 1.2rem; }
.progress-shell { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.3rem; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.7rem; }
.progress-top .lbl { font-family: var(--app-mono); font-size: 0.8rem; color: var(--t-muted); }
.progress-top .pct { font-family: var(--app-mono); font-size: 1.05rem; color: var(--grn); font-weight: 500; }
.progress-bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #2ea043, var(--grn)); border-radius: 999px; transition: width 0.3s ease; }
.log-panel {
  background: #0a0e14; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem;
  font-family: var(--app-mono); font-size: 0.8rem; line-height: 1.85; height: 320px; overflow-y: auto; color: #b5e8c0;
}
.log-line { white-space: pre-wrap; word-break: break-word; }
.log-line .ts { color: var(--faint); }
.log-line .ok { color: var(--grn); }
.log-line .warn { color: var(--md); }
.log-line .flag { color: var(--lo); }
.stats-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.8rem; }
@media (max-width: 860px) { .stats-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .stats-strip { grid-template-columns: repeat(2, 1fr); } }
.stat-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem; text-align: center; }
.stat-cell .num { font-family: var(--app-display); font-size: 1.35rem; font-weight: 700; color: var(--grn); line-height: 1; }
.stat-cell .lab { font-size: 0.68rem; color: var(--t-muted); margin-top: 0.35rem; text-transform: uppercase; letter-spacing: 0.06em; }
.done-banner {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.95rem 1.2rem;
  background: var(--grn-soft); border: 1px solid var(--grn-border); border-radius: 12px;
}
.done-banner svg { color: var(--grn); flex-shrink: 0; width: 22px; height: 22px; }
.done-banner .t { font-weight: 700; }
.done-banner .d { font-size: 0.84rem; color: var(--t-muted); }
.done-banner .dbtn { margin-left: auto; }

/* ---------- Synth (analysis loading) ---------- */
.synth { display: grid; gap: 1rem; place-items: center; padding: 4rem 1rem; text-align: center; }
.synth .ring { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--grn); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.synth .step-line { font-family: var(--app-mono); font-size: 0.85rem; color: var(--t-muted); min-height: 1.4em; }

/* ============================================================
   ANALYSIS REPORT
   ============================================================ */
.report { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.report-hd { padding: 1.5rem 1.8rem 1.4rem; border-bottom: 1px solid var(--line); position: relative; }
.report-class {
  display: inline-block; font-family: var(--app-mono); font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase;
  background: repeating-linear-gradient(45deg, rgba(227,179,65,0.16) 0 10px, rgba(227,179,65,0.06) 10px 20px);
  color: var(--md); border: 1px solid rgba(227,179,65,0.45); padding: 0.25rem 0.7rem; border-radius: 6px; margin-bottom: 0.9rem;
}
.report-hd h2 { font-size: 1.55rem; margin-bottom: 0.5rem; }
.report-meta { display: flex; flex-wrap: wrap; gap: 1.2rem; font-family: var(--app-mono); font-size: 0.74rem; color: var(--faint); }
.report-meta b { color: var(--t-muted); font-weight: 500; }
.report-req { margin-top: 0.95rem; padding: 0.85rem 1rem; background: var(--bg); border-left: 3px solid var(--grn); border-radius: 0 8px 8px 0; font-size: 0.86rem; color: var(--t-muted); }
.report-req b { color: var(--ink); }
.report-body { padding: 1.6rem 1.8rem 1.8rem; }
.rsec { margin-bottom: 1.9rem; }
.rsec:last-child { margin-bottom: 0; }
.rsec-title { display: flex; align-items: center; gap: 0.6rem; font-family: var(--app-display); font-size: 1.05rem; font-weight: 700; margin-bottom: 0.9rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.rsec-title .ix { font-family: var(--app-mono); font-size: 0.78rem; color: var(--grn); }
.rsec p { color: var(--t-muted); font-size: 0.9rem; margin-bottom: 0.75rem; line-height: 1.65; }
.rsec p:last-child { margin-bottom: 0; }
.rsec p b, .rsec p strong { color: var(--ink); }

.conf-pill { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--app-mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; padding: 0.15rem 0.55rem; border-radius: 999px; text-transform: uppercase; }
.conf-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.conf-high { background: rgba(63,185,80,0.14); color: var(--hi); border: 1px solid rgba(63,185,80,0.4); }
.conf-high::before { background: var(--hi); }
.conf-med { background: rgba(227,179,65,0.14); color: var(--md); border: 1px solid rgba(227,179,65,0.4); }
.conf-med::before { background: var(--md); }
.conf-low { background: rgba(248,81,73,0.14); color: var(--lo); border: 1px solid rgba(248,81,73,0.4); }
.conf-low::before { background: var(--lo); }

.src-tag { display: inline-block; font-family: var(--app-mono); font-size: 0.66rem; color: var(--t-muted); background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.1rem 0.45rem; margin-right: 0.3rem; }

.finding { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 0.8rem; }
.finding-top { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.finding-num { font-family: var(--app-mono); font-size: 0.78rem; color: var(--grn); font-weight: 600; }
.finding h4 { font-size: 0.98rem; font-weight: 700; flex: 1; min-width: 50%; }
.finding p { font-size: 0.86rem; color: var(--t-muted); margin-bottom: 0.55rem; line-height: 1.6; }
.finding-srcs { margin-top: 0.3rem; }

.rtable-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.rtable { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 560px; }
.rtable th { text-align: left; font-family: var(--app-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.rtable td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); color: var(--t-muted); }
.rtable tr:last-child td { border-bottom: none; }
.rtable td b { color: var(--ink); }
.rel-bar { display: inline-flex; align-items: center; gap: 0.5rem; }
.rel-track { width: 64px; height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.rel-fill { height: 100%; background: var(--grn); }
.type-dot { display: inline-flex; align-items: center; gap: 0.4rem; }
.type-dot::before { content: ''; width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--grn)); }

.gaps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .gaps-grid { grid-template-columns: 1fr; } }
.gap-col { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; }
.gap-col h5 { font-size: 0.84rem; margin-bottom: 0.7rem; color: var(--ink); font-family: var(--app-display); }
.gap-col ul { display: grid; gap: 0.5rem; }
.gap-col li { list-style: none; font-size: 0.83rem; color: var(--t-muted); display: grid; grid-template-columns: auto 1fr; gap: 0.5rem; }
.gap-col li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; margin-top: 0.5rem; }
.gap-known li::before { background: var(--hi); }
.gap-unk li::before { background: var(--md); }

.appendix { display: grid; gap: 0.5rem; }
.appx-row { display: grid; grid-template-columns: 130px 1fr auto auto; gap: 0.8rem; align-items: center; padding: 0.6rem 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 0.82rem; }
@media (max-width: 640px) { .appx-row { grid-template-columns: 1fr; gap: 0.3rem; } }
.appx-row .atype { font-family: var(--app-mono); font-size: 0.68rem; color: var(--grn); }
.appx-row .atitle { color: var(--ink); }
.appx-row .adate { font-family: var(--app-mono); font-size: 0.72rem; color: var(--faint); }
.stars { color: var(--md); letter-spacing: 1px; font-size: 0.8rem; white-space: nowrap; }
.stars .off { color: var(--line); }

.download-row { display: flex; gap: 0.7rem; flex-wrap: wrap; padding: 1.1rem 1.3rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; align-items: center; margin-top: 1.3rem; }
.download-row .dl-label { font-size: 0.84rem; color: var(--t-muted); margin-right: auto; }

/* ============================================================
   MODALS / TOASTS / LIGHTBOX
   ============================================================ */
.modal-veil {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 7, 14, 0.72); backdrop-filter: blur(3px); padding: 1.5rem;
}
.modal-card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem; box-shadow: 0 30px 70px rgba(0,0,0,0.5); }
.modal-card .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--grn-soft); border: 1px solid var(--grn-border); color: var(--grn); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.modal-card h3 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.modal-card p { color: var(--t-muted); font-size: 0.9rem; margin-bottom: 1.3rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }

.toast-host { position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 0.5rem; pointer-events: none; }
.toast {
  background: var(--panel); border: 1px solid var(--grn-border); color: var(--ink);
  padding: 0.65rem 1.1rem; border-radius: 10px; font-size: 0.86rem; box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  display: flex; align-items: center; gap: 0.55rem; animation: toastin 0.3s ease;
}
.toast svg { color: var(--grn); width: 16px; height: 16px; flex-shrink: 0; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Lightbox (PDF / Excel previews) */
.lightbox { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; background: rgba(3,7,14,0.85); backdrop-filter: blur(4px); }
.lb-bar { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.lb-bar .lb-title { font-weight: 600; font-size: 0.92rem; }
.lb-bar .lb-sub { font-family: var(--app-mono); font-size: 0.7rem; color: var(--faint); }
.lb-bar .spacer { flex: 1; }
.lb-pager { display: flex; align-items: center; gap: 0.5rem; font-family: var(--app-mono); font-size: 0.78rem; color: var(--t-muted); }
.lb-close { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); color: var(--t-muted); display: flex; align-items: center; justify-content: center; }
.lb-close:hover { color: var(--lo); border-color: var(--lo); }
.lb-stage { flex: 1; overflow: auto; padding: 1.6rem; display: flex; justify-content: center; }

/* Fake PDF page */
.pdf-page {
  width: 100%; max-width: 720px; background: #fbfbf9; color: #1a1a1a; border-radius: 4px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5); padding: 2.4rem 2.6rem; font-family: Georgia, 'Times New Roman', serif;
  align-self: flex-start; min-height: 600px;
}
.pdf-page .pdf-head { display: flex; justify-content: space-between; border-bottom: 2px solid #0d1117; padding-bottom: 0.7rem; margin-bottom: 1.4rem; }
.pdf-page .pdf-brand { font-family: var(--app-display); font-weight: 800; font-size: 1.1rem; color: #0d1117; }
.pdf-page .pdf-class { font-family: var(--app-mono); font-size: 0.62rem; letter-spacing: 0.14em; color: #8a6d00; border: 1px solid #c9a227; padding: 0.15rem 0.45rem; border-radius: 4px; height: max-content; }
.pdf-page h1 { font-family: var(--app-display); font-size: 1.5rem; color: #0d1117; margin-bottom: 0.4rem; }
.pdf-page h2 { font-family: var(--app-display); font-size: 1.05rem; color: #0d1117; margin: 1.3rem 0 0.5rem; border-bottom: 1px solid #ccc; padding-bottom: 0.25rem; }
.pdf-page p { font-size: 0.86rem; line-height: 1.6; color: #2a2a2a; margin-bottom: 0.7rem; }
.pdf-page .pdf-meta { font-family: var(--app-mono); font-size: 0.68rem; color: #666; margin-bottom: 1rem; }
.pdf-page ul { margin: 0 0 0.8rem 1.1rem; }
.pdf-page li { font-size: 0.85rem; line-height: 1.55; margin-bottom: 0.35rem; }
.pdf-page .pdf-foot { margin-top: 2rem; padding-top: 0.6rem; border-top: 1px solid #ccc; font-family: var(--app-mono); font-size: 0.62rem; color: #888; display: flex; justify-content: space-between; }
.pdf-pill { font-family: var(--app-mono); font-size: 0.6rem; padding: 0.08rem 0.4rem; border-radius: 4px; }
.pdf-pill.h { background: #e3f5e8; color: #1a7d32; }
.pdf-pill.m { background: #fdf3d6; color: #8a6d00; }
.pdf-pill.l { background: #fbe1df; color: #b3261e; }

/* Fake Excel sheet */
.xl-page { width: 100%; max-width: 860px; background: #fff; border-radius: 4px; box-shadow: 0 18px 50px rgba(0,0,0,0.5); overflow: hidden; align-self: flex-start; }
.xl-ribbon { background: #217346; color: #fff; padding: 0.5rem 0.9rem; font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 0.6rem; font-family: var(--app-body); }
.xl-ribbon .x-ic { width: 18px; height: 18px; background: #fff; color: #217346; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.7rem; }
.xl-grid { width: 100%; border-collapse: collapse; font-family: 'Segoe UI', Arial, sans-serif; font-size: 0.78rem; color: #222; }
.xl-grid th, .xl-grid td { border: 1px solid #d4d4d4; padding: 0.4rem 0.6rem; text-align: left; }
.xl-grid thead th { background: #f3f3f3; color: #444; font-weight: 600; }
.xl-grid .col-hd { background: #f9f9f9; text-align: center; color: #888; font-weight: 600; width: 30px; }
.xl-grid .row-num { background: #f9f9f9; text-align: center; color: #888; font-weight: 600; width: 34px; }
.xl-tabs { display: flex; gap: 0; background: #f3f3f3; border-top: 1px solid #d4d4d4; }
.xl-tab { padding: 0.4rem 0.9rem; font-size: 0.74rem; font-family: 'Segoe UI', Arial, sans-serif; color: #555; border-right: 1px solid #d4d4d4; cursor: pointer; }
.xl-tab.on { background: #fff; color: #217346; font-weight: 700; border-top: 2px solid #217346; }

/* ============================================================
   INVESTIGATE
   ============================================================ */
.inv { display: grid; grid-template-columns: 248px 1fr 312px; height: 706px; }
@media (max-width: 1100px) { .inv { grid-template-columns: 220px 1fr 280px; } }
.inv-rail { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 1rem; }
.inv-rail.right { border-right: none; border-left: 1px solid var(--line); }
.inv-rail h4 { font-family: var(--app-mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.7rem; }
.inv-block { margin-bottom: 1.4rem; }
.inv-search { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; font-size: 0.84rem; color: var(--ink); font-family: var(--app-body); }
.inv-search:focus { outline: none; border-color: var(--grn); box-shadow: 0 0 0 3px var(--grn-soft); }
.legend-item { display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.5rem; border-radius: 7px; cursor: pointer; font-size: 0.82rem; color: var(--t-muted); }
.legend-item:hover { background: var(--panel-2); }
.legend-item.off { opacity: 0.4; }
.legend-swatch { width: 16px; height: 16px; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,0.25); }
.legend-swatch.ellipse { border-radius: 50%; }
.legend-swatch.roundrect { border-radius: 4px; }
.legend-swatch.diamond { transform: rotate(45deg); border-radius: 2px; }
.legend-swatch.tag { border-radius: 3px 8px 8px 3px; }
.legend-swatch.pentagon { clip-path: polygon(50% 0,100% 38%,82% 100%,18% 100%,0 38%); border: none; }
.legend-swatch.hexagon { clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); border: none; }
.legend-swatch.star { clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); border: none; }
.legend-cnt { margin-left: auto; font-family: var(--app-mono); font-size: 0.68rem; color: var(--faint); }
.slider-row { display: flex; align-items: center; gap: 0.7rem; }
.slider-row input[type=range] { flex: 1; accent-color: var(--grn); }
.conf-num { width: 56px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.35rem 0.4rem; font-size: 0.8rem; color: var(--ink); text-align: center; font-family: var(--app-mono); }
.conf-num:focus { outline: none; border-color: var(--grn); }
.inv-note { font-size: 0.72rem; color: var(--faint); margin-top: 0.5rem; line-height: 1.5; }

.inv-canvas-wrap { position: relative; background: #0d1117; min-width: 0; }
#cy { position: absolute; inset: 0; }
.cy-grid { position: absolute; inset: 0; background-image: radial-gradient(rgba(120,160,220,0.05) 1px, transparent 1px); background-size: 26px 26px; pointer-events: none; }
.cy-toolbar { position: absolute; top: 0.8rem; right: 0.8rem; z-index: 5; display: flex; gap: 0.35rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem; }
.cy-tool { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--t-muted); }
.cy-tool:hover { background: var(--panel-2); color: var(--grn); }
.cy-tool svg { width: 16px; height: 16px; }
.cy-hint { position: absolute; bottom: 0.8rem; left: 0.8rem; z-index: 5; font-family: var(--app-mono); font-size: 0.68rem; color: var(--faint); background: rgba(13,17,23,0.7); padding: 0.3rem 0.6rem; border-radius: 6px; border: 1px solid var(--line); }

/* detail panel */
.detail-empty { color: var(--faint); font-size: 0.85rem; text-align: center; padding: 3rem 0.5rem; }
.detail-empty svg { width: 40px; height: 40px; margin: 0 auto 0.8rem; opacity: 0.4; }
.detail-type { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--app-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.55rem; border-radius: 999px; margin-bottom: 0.7rem; }
.detail-type::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--grn)); }
.detail h3 { font-size: 1.15rem; margin-bottom: 0.3rem; }
.detail .aliases { font-size: 0.78rem; color: var(--faint); margin-bottom: 0.9rem; }
.detail .iroc { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.detail .iroc .ring { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.detail .iroc .ring svg { transform: rotate(-90deg); }
.detail .iroc .ring .v { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--app-mono); font-size: 0.74rem; font-weight: 600; color: var(--grn); }
.detail .iroc .ilab { font-size: 0.78rem; color: var(--t-muted); }
.detail .desc { font-size: 0.85rem; color: var(--t-muted); line-height: 1.6; margin-bottom: 1rem; }
.detail-sub { font-family: var(--app-mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 1.1rem 0 0.55rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.attr-row { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.42rem 0; border-bottom: 1px solid var(--line); font-size: 0.82rem; }
.attr-row:last-child { border-bottom: none; }
.attr-row .k { color: var(--t-muted); }
.attr-row .v { color: var(--ink); text-align: right; font-weight: 500; }
.src-card { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.65rem 0.75rem; margin-bottom: 0.55rem; }
.src-card .st { font-family: var(--app-mono); font-size: 0.64rem; color: var(--grn); margin-bottom: 0.2rem; }
.src-card .sn { font-size: 0.82rem; color: var(--ink); margin-bottom: 0.3rem; line-height: 1.4; }
.src-card .sm { display: flex; justify-content: space-between; align-items: center; }
.src-card .sd { font-family: var(--app-mono); font-size: 0.68rem; color: var(--faint); }
.edge-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--app-mono); font-size: 0.68rem; padding: 0.25rem 0.6rem; border-radius: 6px; background: rgba(248,81,73,0.14); color: var(--lo); border: 1px solid rgba(248,81,73,0.4); margin-bottom: 0.9rem; }
.edge-badge svg { width: 13px; height: 13px; }

/* ============================================================
   INFO OVERLAY
   ============================================================ */
.info-veil { position: absolute; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(3,7,14,0.78); backdrop-filter: blur(4px); padding: 1.5rem; }
.info-card { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.8rem; max-height: 88%; overflow-y: auto; box-shadow: 0 30px 70px rgba(0,0,0,0.55); }
.info-card .info-hd { display: flex; align-items: flex-start; gap: 0.8rem; margin-bottom: 1.3rem; }
.info-card .info-ic { width: 44px; height: 44px; border-radius: 11px; background: var(--grn-soft); border: 1px solid var(--grn-border); color: var(--grn); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-card h3 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.info-card .info-hd p { font-size: 0.86rem; color: var(--t-muted); }
.info-feat { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-bottom: 1.4rem; }
@media (max-width: 560px) { .info-feat { grid-template-columns: 1fr; } }
.info-tile { background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 1rem; }
.info-tile .ti { color: var(--grn); margin-bottom: 0.55rem; }
.info-tile .ti svg { width: 20px; height: 20px; }
.info-tile h4 { font-size: 0.92rem; margin-bottom: 0.3rem; }
.info-tile p { font-size: 0.8rem; color: var(--t-muted); line-height: 1.5; }
.info-card .info-foot { display: flex; justify-content: flex-end; }

/* ============================================================
   Light-mode adjustment: the surrounding site can be light,
   but the app frame stays dark (it is "the product"). Keep
   intro text readable in both site themes via site vars.
   ============================================================ */
[data-theme='light'] .demo-frame { box-shadow: 0 24px 60px rgba(12,26,64,0.18); }
