/* ═══════════════════════════════════════════════════════
   JobApp — css/insights.css   REVISION 2  (Edit List 54 v2)

   The analytical panel on map.html and member.html. Uses the tokens already
   defined in style.css :root and the surface language map.css established in
   R2/R3 — same card, same border, same muted/secondary/text ladder — so the
   panel reads as part of the map page rather than as a second product bolted
   underneath it. NOTHING HERE OVERRIDES A SHARED CLASS.

   Two things carry the design weight and both are statistical rather than
   decorative:
     · .ins-ci        the Wilson interval, drawn on a 0–100% axis. A thin cell
                      LOOKS thin. That is the entire argument for publishing n.
     · .ins-odds      odds ratios on a track centred at 1.0, log-scaled, so
                      2.2× and 0.45× are the same size move in opposite
                      directions. A bar from zero would flatten the second.

   ⚠️ Every "no data" state is muted type and an em dash (.ins-absent), never a
   zero and never an empty box. GREY, NEVER ZERO applies to a table cell
   exactly as it applies to a map cell.
   ═══════════════════════════════════════════════════════ */

.ins-wrap {
    max-width: var(--map-max-width, 1400px);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.ins-status {
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.ins-status[hidden] { display: none; }
.ins-status.is-error { border-color: var(--red); color: var(--red-soft); }

/* ── the scope banner ───────────────────────────────── */

.ins-banner {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.ins-banner-fallback { border-color: var(--border-hover); }
.ins-banner-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}
.ins-banner-sub { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }

.ins-scope { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ins-scope-label {
    font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-muted);
}
.ins-scope-select {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-hover);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.42rem 0.7rem;
    font-family: inherit;
    font-size: 0.85rem;
    min-width: 260px;
}
.ins-scope-select:focus { outline: 1px solid var(--accent); outline-offset: 1px; }
.ins-scope-fine { font-size: 0.74rem; color: var(--text-muted); flex: 1 1 320px; }

/* ── the card ───────────────────────────────────────── */

.ins-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 1.2rem 1.4rem 1.35rem;
}
.ins-card-head { margin-bottom: 0.9rem; }
.ins-card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}
.ins-card-sub { font-size: 0.82rem; color: var(--text-secondary); margin: 0; }
.ins-sub-head {
    font-size: 0.85rem; margin: 1.2rem 0 0.6rem;
    text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted);
}

/* The gated cards carry one visual mark and no second one. A member should be
   able to see at a glance which surfaces are the paid layer; a stranger never
   sees these cards at all. */
.ins-gated { border-left: 2px solid var(--accent); }

.ins-note { font-size: 0.82rem; color: var(--text-secondary); margin: 0.7rem 0 0; line-height: 1.6; }
.ins-fine { font-size: 0.75rem; color: var(--text-muted); }
.ins-disclose { color: var(--text-secondary); border-left: 2px solid var(--teal); padding-left: 0.7rem; }
.ins-absent { color: var(--text-muted); font-family: var(--font-mono); }

/* ── the headline ───────────────────────────────────── */

.ins-headline { background: var(--bg-card-hover); }
.ins-big { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.ins-big-v {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 7vw, 4.2rem);
    font-weight: 900;
    line-height: 1;
    color: var(--accent);
}
.ins-big-l { font-size: 1rem; color: var(--text-secondary); max-width: 30ch; }
.ins-big-meta {
    font-family: var(--font-mono); font-size: 0.78rem;
    color: var(--text-muted); margin: 0.6rem 0 0.35rem;
}

/* ── the interval bar ───────────────────────────────── */

.ins-ci { padding: 0.2rem 0; }
.ins-ci-track {
    position: relative; height: 6px; border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
}
.ins-ci-band {
    position: absolute; top: 0; height: 6px; border-radius: 3px;
    background: var(--accent-soft); opacity: 0.45;
}
.ins-ci-dot {
    position: absolute; top: -2px; width: 2px; height: 10px;
    background: var(--accent); transform: translateX(-1px);
}

/* ── the funnel ─────────────────────────────────────── */

.ins-funnel { display: flex; flex-direction: column; gap: 0.55rem; }
.ins-funnel-row {
    display: grid;
    grid-template-columns: 12rem 1fr 5rem;
    grid-template-areas: "label track value" ". sub sub";
    align-items: center;
    gap: 0.2rem 0.8rem;
}
.ins-funnel-label { grid-area: label; font-size: 0.85rem; color: var(--text-secondary); }
.ins-funnel-track {
    grid-area: track; height: 20px; border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05); overflow: hidden;
}
.ins-funnel-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--accent));
    border-radius: var(--radius-sm);
}
.ins-funnel-v {
    grid-area: value; font-family: var(--font-mono); font-size: 0.86rem;
    text-align: right; font-weight: 700;
}
.ins-funnel-sub {
    grid-area: sub; font-family: var(--font-mono);
    font-size: 0.72rem; color: var(--text-muted);
}
@media (max-width: 640px) {
    .ins-funnel-row { grid-template-columns: 8rem 1fr 4.2rem; }
}

/* ── stat grid ──────────────────────────────────────── */

.ins-stat-grid {
    display: grid; gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.ins-stat {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card-hover);
    padding: 0.9rem 1rem;
    display: flex; flex-direction: column; gap: 0.15rem;
}
.ins-stat-accent { border-color: var(--accent); }
.ins-stat-v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; line-height: 1.05; }
.ins-stat-u { font-size: 0.78rem; color: var(--text-muted); }
.ins-stat-l { font-size: 0.82rem; color: var(--text-secondary); }
.ins-stat-n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }

/* ── tables ─────────────────────────────────────────── */

.ins-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.ins-table th {
    text-align: left; font-weight: 600; font-size: 0.72rem;
    letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted);
    padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.ins-table td {
    padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.ins-table tbody tr:last-child td { border-bottom: none; }
.ins-table tbody tr:hover { background: var(--bg-card-hover); }
.ins-th-n, .ins-td-n { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.ins-td-name { color: var(--text); }
.ins-td-rate { min-width: 8.5rem; }
.ins-rate-v { display: block; font-family: var(--font-mono); font-weight: 700; }
.ins-rate-n { display: block; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
.ins-th-conf, .ins-td-conf { text-align: right; }

.ins-chip {
    display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px;
    font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase;
    border: 1px solid var(--border-hover); color: var(--text-secondary);
}
.ins-chip-high   { border-color: var(--green); color: var(--green); }
.ins-chip-medium { border-color: var(--teal);  color: var(--teal); }
.ins-chip-low    { border-color: var(--border-hover); color: var(--text-muted); }

@media (max-width: 780px) {
    .ins-card { padding: 1rem; }
    .ins-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ── metro detail ───────────────────────────────────── */

/* Edit List 54 v2. Six markets today; the survey's metro vocabulary is a
   33-code enum, so this block has a hard ceiling of 33 cards and will roughly
   quintuple as contributors arrive. A grid that grows without bound pushes the
   model window and the narrative off the screen, so it scrolls at roughly two
   rows and says so with a visible edge. ⛔ The ceiling is the VOCABULARY, not a
   guess: no metro can exist here that METRO_IS_PLACE does not name. */
.ins-detail-grid {
    display: grid; gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    max-height: 30rem;
    overflow-y: auto;
    padding-right: 0.35rem;
    scrollbar-width: thin;
}
.ins-detail-grid::-webkit-scrollbar { width: 8px; }
.ins-detail-grid::-webkit-scrollbar-thumb {
    background: var(--border-hover); border-radius: 4px;
}
.ins-detail {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.85rem 1rem; background: var(--bg-card-hover);
}
.ins-detail h4 { font-size: 0.92rem; margin: 0 0 0.5rem; }
.ins-detail-line { font-size: 0.76rem; color: var(--text-muted); margin: 0.5rem 0 0; line-height: 1.55; }

.ins-dl { display: grid; grid-template-columns: 1fr auto; gap: 0.28rem 0.8rem; margin: 0; }
.ins-dl dt { font-size: 0.79rem; color: var(--text-secondary); }
.ins-dl dd { font-family: var(--font-mono); font-size: 0.81rem; text-align: right; margin: 0; }

/* ── the model window ───────────────────────────────── */

.ins-model-head { display: flex; gap: 1.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ins-kpi { display: flex; flex-direction: column; }
.ins-kpi-v { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; }
.ins-kpi-l { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }

.ins-odds { display: flex; flex-direction: column; gap: 0.4rem; }
.ins-odds-row {
    display: grid; grid-template-columns: 12rem 1fr 4rem;
    align-items: center; gap: 0.7rem;
}
.ins-odds-name { font-size: 0.8rem; color: var(--text-secondary); }
.ins-odds-track { position: relative; height: 16px; background: rgba(255, 255, 255, 0.04); border-radius: 3px; }
.ins-odds-axis {
    position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
    background: var(--border-hover);
}
.ins-odds-bar { position: absolute; top: 3px; height: 10px; border-radius: 2px; }
.ins-odds-bar.is-up   { background: var(--accent); }
.ins-odds-bar.is-down { background: var(--text-muted); }
.ins-odds-v { font-family: var(--font-mono); font-size: 0.8rem; text-align: right; }
@media (max-width: 640px) {
    .ins-odds-row { grid-template-columns: 8rem 1fr 3.4rem; }
}

/* ── movers ─────────────────────────────────────────── */

.ins-mover-grid {
    display: grid; gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.ins-mover-box {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.85rem 1rem; background: var(--bg-card-hover);
}
.ins-mover-box h4 { font-size: 0.9rem; margin: 0; }
.ins-mover-unit {
    display: block; font-size: 0.7rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem;
}
.ins-mover {
    display: grid; grid-template-columns: 1fr auto;
    gap: 0.1rem 0.6rem; padding: 0.4rem 0;
    border-top: 1px solid var(--border);
}
.ins-mover-name { font-size: 0.79rem; color: var(--text-secondary); }
.ins-mover-d { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; text-align: right; }
.ins-mover-d.is-good { color: var(--green); }
.ins-mover-d.is-bad  { color: var(--red-soft); }
.ins-mover-v {
    grid-column: 1 / -1; font-family: var(--font-mono);
    font-size: 0.7rem; color: var(--text-muted);
}

/* ── the narrative ──────────────────────────────────── */

.ins-line {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.ins-line:last-of-type { border-bottom: none; }
.ins-line-text { font-size: 0.94rem; line-height: 1.7; margin: 0; }
.ins-line-meta { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.4rem; }
.ins-cite-btn {
    background: none; border: 1px solid var(--border-hover);
    color: var(--text-muted); border-radius: 999px;
    padding: 0.12rem 0.6rem; font-size: 0.7rem; cursor: pointer;
    font-family: inherit;
    transition: color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.ins-cite-btn:hover, .ins-cite-btn.is-open { color: var(--accent); border-color: var(--accent); }
.ins-cites {
    margin-top: 0.5rem; padding: 0.6rem 0.8rem;
    border: 1px dashed var(--border-hover); border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.18);
}
.ins-cites[hidden] { display: none; }
.ins-cite { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); padding: 0.1rem 0; }

/* ── the members' panel on the public page ──────────── */

.ins-locked { border-style: dashed; }
.ins-locked-list { margin: 0 0 0.9rem; padding-left: 1.1rem; }
.ins-locked-list li { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 0.35rem; }
.ins-cta {
    display: inline-block; padding: 0.5rem 1rem;
    border-radius: var(--radius-sm); background: var(--accent);
    color: #08111F; font-size: 0.85rem; font-weight: 700; text-decoration: none;
}
.ins-cta:hover { filter: brightness(1.12); }

/* ── the hook inside map.js's contributor popup ─────── */

/* Lives here, not in map.css: map.css owns .pop-* and .side-*, this file owns
   .ins-*, and this button is an insights affordance that happens to be rendered
   inside a Leaflet popup. map.css stays untouched by Edit List 54. */
.ins-pop-cta {
    display: block;
    width: 100%;
    margin-top: 0.7rem;
    padding: 0.42rem 0.6rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.ins-pop-cta:hover { background: var(--accent); color: #08111F; }