/* Explorer (#1291): /planner/explorer. A map filling the page, the ask box and chips floating over
   it, the answer in a drawer on the right, the document panel sliding over that.

   A global stylesheet linked from App.razor, not scoped .razor.css: the answer is HTML built on the
   server and rendered as markup, and the pins are built by explorer-map.js, so neither carries a
   scope attribute for a scoped rule to match. Everything is prefixed ex- and lives under .ex-page.

   Colours come from app.css (--navy, --red, --green, --amber, --gray-*). */

.ex-page {
    --ex-line: #e3e6eb;
    --ex-line-2: #eef0f3;
    --ex-mute: #5b6472;
    --ex-faint: #8a93a1;
    --ex-ink: #1c2330;
    --ex-quote: #fff8e1;
    --ex-quote-line: #e0b84a;
    --ex-shadow: 0 1px 2px rgba(20,30,50,.06), 0 8px 24px rgba(20,30,50,.08);
    --ex-drawer: 444px;
    position: relative;
    flex: 1;
    min-height: 540px;
    overflow: hidden;
    color: var(--ex-ink);
    background: #eef0f2;
}

/* The page fills what the planner shell leaves between its top bar and its support bar. */
.planner-main:has(.ex-page) {
    max-width: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.ex-page button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }

/* Outcome colours: --c is the solid, --cb the tint. */
.ex-page .o-approved { --c: var(--green); --cb: #ecf6f0; }
.ex-page .o-refused { --c: var(--red); --cb: #fdf0f0; }
.ex-page .o-pending { --c: var(--amber); --cb: #fdf5e4; }
.ex-page .o-withdrawn { --c: #8a8f98; --cb: #f0f1f3; }
.ex-page .o-other { --c: #5b6472; --cb: #eceef2; }

/* ── map ── */
/* z-index 0 makes the map its own stacking context, so Leaflet's panes and controls (up to 1000)
   stay beneath everything that floats over the map. */
.ex-map { position: absolute; inset: 0; z-index: 0; transition: filter .4s; }
.ex-map.leaflet-container { font: 12px/1.4 Inter, sans-serif; background: #eef0f2; }
.ex-page .leaflet-tooltip i { color: var(--ex-mute); }
.ex-veil {
    position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .4s;
    background: radial-gradient(ellipse 60% 55% at 50% 38%, rgba(246,247,249,.94) 0%, rgba(246,247,249,.72) 55%, rgba(246,247,249,.2) 100%);
}
.ex-page.is-hero .ex-map { filter: saturate(.6); }
.ex-page.is-hero .ex-veil { opacity: 1; }
.ex-page.is-hero .leaflet-control-zoom { display: none; }
/* The drawer covers the right edge: move Leaflet's own corners clear of it. */
.ex-page.has-drawer .leaflet-right { right: calc(var(--ex-drawer) + 32px); }

/* pins (built by explorer-map.js) */
.ex-pin {
    display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--c); border: 2.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 2px 5px rgba(0,0,0,.3); transition: transform .12s;
}
/* Pending is hollow and withdrawn is faded: neither is a decision, and neither should read as one. */
.ex-pin.o-pending { background: #fff; border-color: var(--amber); box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 2px 5px rgba(0,0,0,.25); }
.ex-pin.o-withdrawn { opacity: .7; }
.ex-pin.is-appealed { border-radius: 3px; }
.ex-pin.is-hov { transform: scale(1.45); }
.ex-pin.is-sel { transform: scale(1.6); box-shadow: 0 0 0 3px var(--navy), 0 2px 8px rgba(0,0,0,.4); }
.ex-ring-handle { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--navy); box-shadow: 0 2px 6px rgba(0,0,0,.3); cursor: ew-resize; }
.ex-ring-label { font: 700 12px Inter, sans-serif; color: var(--navy); background: rgba(255,255,255,.92); border-radius: 9px; text-align: center; line-height: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.15); white-space: nowrap; }

/* ── the ask box and what floats with it ── */
.ex-top {
    position: absolute; z-index: 21; top: 16px; left: 16px; width: min(760px, calc(100% - 32px));
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.ex-top > * { pointer-events: auto; }
.ex-page.has-drawer .ex-top { width: auto; right: calc(var(--ex-drawer) + 32px); }
.ex-page.has-drawer .ex-ask { max-width: 860px; }

/* The ask box (ExplorerAskBar): the question on top with the whole width, and under it a row for what
   the question is about (the Where pill, the screening a new thread would carry) and Ask. It is a
   size container so the pills can give way by the box's own width, not the window's. */
.ex-ask {
    position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--ex-line);
    border-radius: 14px; padding: 11px 10px 8px 14px; box-shadow: var(--ex-shadow); container-type: inline-size;
}
/* app.css gives every textarea a border, padding, a minimum height and a focus ring; the ask box's own frame is the field here. */
.ex-page .ex-ask textarea.ex-q, .ex-page .ex-ask textarea.ex-q:focus {
    display: block; width: 100%; min-width: 0; resize: none; font: 500 15px/1.42 Inter, sans-serif; border: 0; outline: 0; box-shadow: none;
    background: none; color: var(--ex-ink); padding: 0; border-radius: 0; min-height: 22px; height: 22px; max-height: 150px; overflow-y: auto;
}
.ex-ask .ex-q::placeholder { color: #9aa3b0; opacity: 1; }
.ex-ask:focus-within { border-color: #8fa5c8; box-shadow: 0 0 0 3px rgba(26,54,93,.10), var(--ex-shadow); }

.ex-bar { display: flex; align-items: center; gap: 7px; min-width: 0; margin-top: 9px; padding-top: 8px; border-top: 1px solid #eef1f5; }
.ex-bar-gap { flex: 1 0 4px; }
.ex-pill-ic { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ex-hint { display: none; font-size: 12px; color: var(--ex-faint); white-space: nowrap; }
.ex-ask[data-typed="true"]:focus-within .ex-hint { display: inline; }
.ex-left { font-size: 12px; font-weight: 600; color: var(--amber); white-space: nowrap; }
.ex-left:empty { display: none; }
.ex-left:not(:empty) ~ .ex-hint { display: none; }
/* Ask: a round button with an arrow. Grey until there is something to ask (it still works: an empty ask is ignored). */
.ex-page .ex-ask .ex-go { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: #b9c3d3; }
.ex-page .ex-ask[data-typed="true"] .ex-go { background: var(--navy); }
.ex-page .ex-ask[data-typed="true"] .ex-go:hover { background: var(--navy-light); }
.ex-ask .ex-go svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* The follow-up box's button keeps its word. */
.ex-page .ex-go { background: var(--navy); color: #fff; border-radius: 8px; padding: 7px 14px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.ex-page .ex-go:hover { background: var(--navy-light); }

/* The opening state: the box in the middle of a faded map, until the map is touched or a question asked. */
.ex-page.is-hero .ex-top { left: 50%; top: 18%; transform: translateX(-50%); width: min(720px, 92%); gap: 12px; }
.ex-page.is-hero .ex-ask { padding: 16px 14px 9px 18px; border-radius: 18px; border-color: #c5cfdf; box-shadow: 0 2px 4px rgba(20,30,50,.06), 0 18px 50px rgba(20,30,50,.16); }
.ex-page.is-hero .ex-ask textarea.ex-q, .ex-page.is-hero .ex-ask textarea.ex-q:focus { font-size: 17px; min-height: 48px; height: 48px; }
.ex-page.is-hero .ex-ask .ex-go { width: 36px; height: 36px; }

/* Over the map, with nothing typed and the question not in hand, the box is one row (Where, the
   question, Ask) so an idle box does not cover the map. It opens to the full box when the question is
   clicked into. Open and closed are set by explorer.js (data-open), not by :focus: a box that changed
   shape as the focus moved would take the Where pill, its cross or a suggestion out from under the
   pointer between mouse down and mouse up, and the click would be lost. */
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 8px; padding: 7px 8px;
}
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) .ex-bar { display: contents; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) .ex-where { grid-column: 1; grid-row: 1; max-width: 260px; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) .ex-q { grid-column: 2; grid-row: 1; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) .ex-go { grid-column: 3; grid-row: 1; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) :is(.ex-bar-gap, .ex-hint, .ex-left) { display: none; }
/* A screening the next question would carry stays in sight in the one-row box, as its icon and its
   cross (the name is in the tooltip and the thread head). Hidden, a new question from this box carried
   the screening with nothing on screen saying so and no way to take it off. */
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]):has(.ex-seed) { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) .ex-seed { grid-column: 2; grid-row: 1; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]) .ex-seed b { display: none; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]):has(.ex-seed) .ex-q { grid-column: 3; }
.ex-page:not(.is-hero) .ex-ask:not([data-typed="true"]):not([data-open="true"]):has(.ex-seed) .ex-go { grid-column: 4; }

/* Where pill. Grey for Anywhere; filled once an area is chosen; outlined while an option waits for its name. */
.ex-where { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 0; border-radius: 99px; background: #f4f6f9; color: var(--ex-mute); font-size: 12.5px; }
.ex-where:hover, .ex-where.is-open { background: #e6ebf3; }
.ex-where.is-set { background: #eef2f8; color: var(--navy); }
.ex-where[data-mode="true"] { background: #fff; box-shadow: inset 0 0 0 1.5px var(--navy); }
/* With a screening on the row the Where pill keeps its text and the screening pill gives way. */
.ex-bar:has(.ex-seed) .ex-where { flex: none; max-width: 70%; }
.ex-page .ex-where-main { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 9px 5px 8px; white-space: nowrap; color: inherit; }
.ex-where.is-set .ex-where-main { padding-right: 3px; }
.ex-where-main b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ex-where.is-set .ex-where-main b { font-weight: 600; }
.ex-where-caret { color: var(--ex-faint); font-size: 11px; }
.ex-page .ex-where-clear, .ex-page .ex-seed-clear { flex: none; width: 20px; height: 20px; padding: 0; line-height: 18px; text-align: center; border-radius: 50%; color: var(--ex-mute); font-size: 15px; }
.ex-page .ex-where-clear { margin-right: 4px; }
.ex-page .ex-where-clear:hover { background: #cfd8e6; color: var(--ex-ink); }

/* The screening the next question would carry. */
.ex-seed { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; border-radius: 99px; background: #fdf5e4; color: #6b4a05; font-size: 12.5px; padding: 3px 4px 3px 8px; white-space: nowrap; }
.ex-seed b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ex-page .ex-seed-clear { color: #8a6a1c; }
.ex-page .ex-seed-clear:hover { background: #f1e2bd; color: #4a3303; }
/* A narrow box (a phone, or the drawer open on a small laptop): the name goes and the icon stays, with the cross. */
@container (max-width: 400px) {
    .ex-seed b { display: none; }
    .ex-hint { display: none !important; }
}

.ex-where-menu, .ex-sugg {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; background: #fff; border: 1px solid var(--ex-line);
    border-radius: 12px; box-shadow: 0 12px 40px rgba(20,30,50,.18); padding: 6px;
}
.ex-where-menu { width: 340px; max-width: 100%; }
.ex-menu-head { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ex-faint); padding: 8px 10px 6px; }
.ex-page .ex-where-menu button { display: grid; grid-template-columns: 28px 1fr; column-gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; }
.ex-page .ex-where-menu button:hover { background: #f0f3f8; }
.ex-where-menu b { font-weight: 600; }
.ex-where-menu small, .ex-sugg small { grid-column: 2; display: block; color: var(--ex-faint); font-size: 12px; }
/* One family of line icons, drawn inline in the menu (no icon library). */
.ex-ic { grid-row: span 2; width: 22px; height: 22px; align-self: center; justify-self: center; fill: none; stroke: var(--navy); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ex-ic .ex-ic-node { fill: #fff; }
/* Drawing is for a mouse on a real screen, as in Screening (#390). The same rule as NO_DRAW in explorer-map.js. */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
    .ex-page .ex-where-menu button.ex-where-draw { display: none; }
}

/* Suggestions under the ask box: "Go to" for a postcode, then streets, councils, wards and places. */
.ex-sugg { right: 0; display: flex; flex-direction: column; gap: 4px; }
.ex-sugg-list { display: flex; flex-direction: column; gap: 2px; max-height: min(46vh, 380px); overflow: auto; }
.ex-page .ex-sugg button { display: grid; grid-template-columns: 62px 1fr; column-gap: 10px; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px; }
.ex-page .ex-sugg [data-testid="explorer-goto"] button { background: #f0f3f8; }
.ex-page .ex-sugg button:hover, .ex-page .ex-sugg button.is-active { background: #e9eef6; }
.ex-page .ex-sugg button.is-active { box-shadow: inset 0 0 0 1.5px var(--navy); }
.ex-sugg i { font-style: normal; grid-row: span 2; align-self: center; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); }
.ex-sugg .k-council i, .ex-sugg .k-ward i, .ex-sugg .k-street i { color: var(--navy); }
.ex-sugg .k-place i { color: var(--ex-mute); }
.ex-sugg b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-sugg-note { margin: 0; padding: 8px 12px; font-size: 12.5px; color: var(--ex-mute); }
.ex-sugg-note.is-warn { color: #6b4a05; }

/* A line under the ask box about the area on the chip: what a ward match is, or why a drawn shape was not taken. */
.ex-where-note { align-self: flex-start; max-width: 100%; font-size: 12.5px; color: var(--ex-mute); background: rgba(255,255,255,.94); padding: 5px 10px; border-radius: 6px; box-shadow: 0 1px 3px rgba(20,30,50,.12); }
.ex-where-note.is-warn { color: #6b4a05; background: #fdf5e4; border-left: 3px solid var(--amber); }
.ex-page.is-hero .ex-where-note { align-self: center; }

/* chips and the count */
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ex-page .ex-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; background: #fff; border: 1px solid var(--ex-line);
    border-radius: 99px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 1px 3px rgba(20,30,50,.12); max-width: 100%;
}
.ex-chip.is-label > span { overflow: hidden; text-overflow: ellipsis; }
.ex-chip i { font-style: normal; color: var(--ex-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ex-page .ex-chip.is-toggle { color: var(--ex-faint); background: rgba(255,255,255,.8); border-style: dashed; }
.ex-page .ex-chip.is-toggle.is-on { color: var(--ex-ink); background: #fff; border-style: solid; }
.ex-chip.is-toggle b { font-weight: 600; }
.ex-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .35; }
.ex-chip.is-on .ex-dot { opacity: 1; }
.ex-chip.o-pending .ex-dot { background: #fff; box-shadow: inset 0 0 0 2px var(--amber); }
.ex-count { align-self: flex-start; background: var(--navy); color: #fff; font-weight: 600; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; box-shadow: var(--ex-shadow); }

/* bottom-left: legend, tip, coverage */
.ex-bottom { position: absolute; z-index: 20; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; max-width: calc(100% - 32px); }
.ex-page.has-drawer .ex-bottom { max-width: calc(100% - var(--ex-drawer) - 48px); }
.ex-page.is-hero .ex-bottom { left: 50%; transform: translateX(-50%); align-items: center; text-align: center; }
.ex-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12px; color: var(--ex-mute); background: rgba(255,255,255,.94); padding: 6px 10px; border-radius: 6px; box-shadow: var(--ex-shadow); }
.ex-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.ex-legend .ex-pin { width: 11px; height: 11px; border-width: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.ex-legend-ring { width: 13px; height: 13px; border-radius: 50%; border: 1px dashed var(--navy); }
.ex-tip { background: #10203a; color: #fff; font-size: 13px; padding: 7px 14px; border-radius: 99px; box-shadow: var(--ex-shadow); }
.ex-cov { font-size: 12px; color: var(--ex-faint); background: rgba(255,255,255,.94); padding: 4px 10px; border-radius: 6px; }
.ex-cov b { color: var(--ex-mute); font-weight: 600; }

/* ── drawer ── */
.ex-drawer {
    position: absolute; z-index: 25; top: 16px; right: 16px; bottom: 16px; width: var(--ex-drawer); background: #fff;
    border-radius: 12px; box-shadow: var(--ex-shadow); display: flex; flex-direction: column; overflow: hidden;
}
.ex-tabs { display: flex; border-bottom: 1px solid var(--ex-line); padding: 0 8px; flex: none; }
.ex-page .ex-tabs button { padding: 11px 12px; font-weight: 600; color: var(--ex-mute); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ex-page .ex-tabs button.is-on { color: var(--navy); border-bottom-color: var(--navy); }
.ex-tabs button span { font-weight: 500; color: var(--ex-faint); margin-left: 2px; }
/* Both panes stay in the DOM (the answer's buttons are found by a delegated listener); a class
   picks the one on show. Never the [hidden] attribute, which loses to any display rule. */
.ex-pane { flex: 1; overflow: auto; display: none; min-height: 0; }
.ex-pane.is-on { display: block; }
.ex-pane.is-answer { padding: 14px 18px 18px; }

.ex-spin { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #c5cfdf; border-top-color: var(--navy); animation: ex-spin .7s linear infinite; }
@keyframes ex-spin { to { transform: rotate(360deg); } }

/* steps */
.ex-steps { font-size: 12.5px; color: var(--ex-mute); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--ex-line-2); }
.ex-page .ex-steps-head { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ex-mute); }
.ex-page .ex-steps:not(.is-done) .ex-steps-head { cursor: default; }
.ex-steps-toggle { font-weight: 400; color: var(--ex-faint); font-size: 11.5px; }
.ex-steps.is-done .ex-spin { animation: none; border-color: var(--green); background: var(--green); }
.ex-steps.is-stopped .ex-spin { border-color: var(--red); background: var(--red); }
.ex-steps ol { list-style: none; margin: 8px 0 0; padding: 0 0 0 5px; border-left: 2px solid var(--ex-line); display: none; }
.ex-steps.is-open ol { display: block; }
.ex-steps li { padding: 3px 0 3px 12px; animation: ex-in .3s both; }
.ex-step-what { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.ex-step-tool { color: var(--navy); background: #e9eef6; padding: 0 6px; border-radius: 4px; font-weight: 600; font-size: 11.5px; }
.ex-step-res { display: block; color: var(--ex-ink); font-weight: 500; }
.ex-step-res::before { content: '\2192\00a0'; color: var(--ex-faint); }
.ex-step-res.is-error { color: #9b2c2c; }
.ex-steps li[data-state="running"] .ex-step-what::after { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #c5cfdf; border-top-color: var(--navy); animation: ex-spin .7s linear infinite; align-self: center; }
@keyframes ex-in { from { opacity: 0; transform: translateY(4px); } }

/* failure */
.ex-failed { padding: 12px 14px; border-radius: 8px; background: #fdf0f0; border-left: 3px solid var(--red); color: #63171b; font-size: 13.5px; }
.ex-failed h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; }
.ex-failed p { margin: 0 0 4px; }
.ex-failed-advice { color: #7b3b3b; font-size: 12.5px; }
.ex-failed[data-kind="daily_cap"], .ex-failed[data-kind="round_limit"] { background: #fdf5e4; border-left-color: var(--amber); color: #6b4a05; }
.ex-failed[data-kind="daily_cap"] .ex-failed-advice, .ex-failed[data-kind="round_limit"] .ex-failed-advice { color: #7a5a14; }

/* the answer (HTML from ExplorerAnswerRenderer) */
.ex-answer { font-size: 14.5px; line-height: 1.6; }
.ex-answer h3 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 18px 0 4px; color: var(--ex-ink); }
.ex-answer h3:first-child { margin-top: 0; }
.ex-answer h4 { font-size: 14px; font-weight: 700; margin: 16px 0 4px; color: var(--ex-ink); }
.ex-answer p { margin: 0 0 8px; }
.ex-answer ul, .ex-answer ol { margin: 0 0 8px; padding-left: 20px; }
.ex-answer li { margin-bottom: 6px; }
.ex-answer .ex-tablewrap { overflow-x: auto; margin: 4px 0 12px; border: 1px solid var(--ex-line); border-radius: 8px; }
.ex-answer .ex-table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.45; }
.ex-answer .ex-table th, .ex-answer .ex-table td { text-align: left; vertical-align: top; padding: 6px 10px; border-bottom: 1px solid var(--ex-line); }
.ex-answer .ex-table th { font-weight: 600; color: var(--ex-mute); background: #f7f9fc; white-space: nowrap; }
.ex-answer .ex-table tr:last-child td { border-bottom: 0; }
.ex-answer q.ex-quote { background: var(--ex-quote); box-shadow: 0 0 0 2px var(--ex-quote); border-bottom: 1px solid var(--ex-quote-line); color: #1c2330; }
.ex-page .ex-answer .ex-cite {
    display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin: 0 1px 0 4px;
    border-radius: 5px; background: var(--ex-quote); box-shadow: inset 0 0 0 1px var(--ex-quote-line); color: #7a5a00; font-size: 11px; font-weight: 700; vertical-align: 2px;
}
.ex-page .ex-answer .ex-cite:hover { background: var(--ex-quote-line); color: #fff; }
.ex-page .ex-answer .ex-ref { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--navy); background: #e9eef6; padding: 1px 6px; border-radius: 4px; }
.ex-page .ex-answer .ex-ref:hover { box-shadow: inset 0 0 0 1px var(--navy); }
.ex-answer .ex-unverified { font-size: 11px; font-weight: 600; color: #7a5a14; background: #fdf5e4; border-radius: 4px; padding: 0 5px; white-space: nowrap; }

.ex-note { font-size: 12.5px; padding: 8px 12px; border-radius: 6px; margin: 12px 0 0; }
.ex-note.is-ok { background: #ecf6f0; color: #1f5138; }
.ex-aside { font-size: 12px; color: var(--ex-mute); margin: 10px 0 0; }
.ex-page .ex-aside a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ex-note.is-warn { background: #fdf5e4; color: #6b4a05; border-left: 3px solid var(--amber); }
.ex-about { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ex-line-2); font-size: 12.5px; color: var(--ex-mute); }
.ex-about p { margin: 0 0 4px; }
.ex-about .is-warn { color: #6b4a05; font-weight: 500; }

/* results */
.ex-coverage { margin: 0; padding: 8px 14px; font-size: 12.5px; color: var(--ex-mute); background: #f6f7f9; border-bottom: 1px solid var(--ex-line-2); }
.ex-none { padding: 24px; color: var(--ex-mute); text-align: center; margin: 0; }
.ex-card { padding: 10px 14px; border-bottom: 1px solid var(--ex-line-2); cursor: pointer; border-left: 3px solid transparent; }
.ex-card:hover, .ex-card.is-hov { background: #f3f6fb; }
.ex-card.is-sel { background: #e9eef6; border-left-color: var(--navy); }
/* Not decisions: pending is marked with a dashed amber edge, withdrawn is greyed. */
.ex-card.o-pending:not(.is-sel) { border-left: 3px dashed var(--amber); }
.ex-card.o-withdrawn .ex-card-addr, .ex-card.o-withdrawn .ex-card-prop { color: var(--ex-faint); }
.ex-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.ex-card-ref { font-weight: 600; }
.ex-card-when { margin-left: auto; color: var(--ex-faint); font-size: 12px; white-space: nowrap; }
.ex-pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--c); background: var(--cb); white-space: nowrap; }
.ex-pill.o-pending { background: none; box-shadow: inset 0 0 0 1px var(--c); }
.ex-appeal { color: var(--red); font-weight: 600; font-size: 12px; white-space: nowrap; }
.ex-card-addr { font-weight: 600; margin-top: 3px; }
.ex-card-prop { color: var(--ex-mute); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ex-card-docs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.ex-card-docs span { font-size: 11px; color: var(--ex-mute); background: var(--ex-line-2); padding: 0 6px; border-radius: 4px; }
.ex-card-docs .is-none { background: none; color: var(--ex-faint); padding: 0; }

/* ── threads (#1297) ── */

/* The drawer's header names the thread; the follow-up box is docked at its foot. */
.ex-th-head { flex: none; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--ex-line-2); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: start; }
.ex-th-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--ex-ink); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ex-th-meta { grid-column: 1; font-size: 12px; color: var(--ex-faint); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.ex-th-meta .sep { color: #c9ced6; }
.ex-th-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; align-items: center; }
.ex-page .ex-th-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--navy); background: #f0f3f8; box-shadow: inset 0 0 0 1px #d5dce8; white-space: nowrap; }
.ex-page .ex-th-btn:hover { background: #e6ebf3; box-shadow: inset 0 0 0 1.5px var(--navy); }

/* A thread reopened on a later day says when it was answered. */
.ex-th-stale { margin: 0 0 12px; padding: 8px 12px; border-radius: 6px; background: #fdf5e4; border-left: 3px solid var(--amber); color: #6b4a05; font-size: 12.5px; }
.ex-page .ex-th-stale button { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; margin-left: 4px; }

/* Turns: a numbered spine down the left, earlier turns folded to one line. A folded turn has no body in the DOM. */
.ex-turns { position: relative; }
.ex-turn { position: relative; padding-left: 34px; margin-bottom: 4px; scroll-margin-top: 4px; }
.ex-turn::before { content: ''; position: absolute; left: 11px; top: 28px; bottom: -8px; width: 2px; background: var(--ex-line); }
.ex-turn:last-child::before { display: none; }
.ex-page .ex-turn-head { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; width: 100%; text-align: left; padding: 6px 8px 8px 0; border-radius: 8px; }
.ex-page .ex-turn-head:disabled { cursor: default; }
.ex-turn-n { position: absolute; left: 0; top: 5px; width: 24px; height: 24px; border-radius: 50%; background: #e9eef6; color: var(--navy); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px #fff; }
.ex-turn.is-open .ex-turn-n { background: var(--navy); color: #fff; }
.ex-turn-q { font-size: 14.5px; font-weight: 600; color: var(--ex-ink); line-height: 1.35; }
.ex-turn.is-open .ex-turn-q { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.ex-turn-sum { grid-column: 1; font-size: 12.5px; color: var(--ex-mute); }
.ex-turn-sum b { font-weight: 600; color: var(--ex-ink); }
.ex-turn-chev { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 11.5px; color: var(--ex-faint); white-space: nowrap; }
.ex-page .ex-turn-head:hover .ex-turn-chev { color: var(--navy); }
.ex-turn-when { font-weight: 400; color: var(--ex-faint); font-size: 12px; margin-left: 6px; white-space: nowrap; letter-spacing: 0; }
.ex-turn-body { padding: 4px 0 14px; }
.ex-turn.is-open { margin-bottom: 10px; }
.ex-turn .ex-steps { margin-bottom: 12px; padding-bottom: 10px; }

/* The follow-up box: the one place a follow-up is typed. */
.ex-th-composer { flex: none; border-top: 1px solid var(--ex-line); padding: 10px 12px 12px; background: #fbfcfd; }
.ex-th-box { display: flex; align-items: flex-end; gap: 8px; background: #fff; border: 1px solid #c5cfdf; border-radius: 12px; padding: 8px 8px 8px 12px; box-shadow: 0 1px 2px rgba(20,30,50,.05); }
.ex-th-box:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,54,93,.12); }
.ex-page .ex-th-box textarea, .ex-page .ex-th-box textarea:focus { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; box-shadow: none; background: none; padding: 5px 0; font: 500 14.5px/1.4 Inter, sans-serif; color: var(--ex-ink); height: 30px; min-height: 0; border-radius: 0; }
.ex-th-box textarea::placeholder { color: #9aa3b0; opacity: 1; }
.ex-th-box.is-busy { background: #f3f5f8; border-color: var(--ex-line); }
.ex-page .ex-th-box.is-busy .ex-go { background: #9aa8bd; cursor: default; }

/* Explorer's start page: the planner's own threads, listed under the ask box. */
/* The list takes what height the page has left under the ask box and scrolls inside it: the start
   page's floating column is given a bottom edge (clear of the coverage line) for the list to shrink against. */
.ex-page.is-hero .ex-top { bottom: 56px; }
.ex-page.is-hero .ex-top > * { flex-shrink: 0; }
.ex-page.is-hero .ex-top > .ex-home { flex-shrink: 1; }
.ex-home { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 120px; background: rgba(255,255,255,.96); border: 1px solid var(--ex-line); border-radius: 14px; box-shadow: var(--ex-shadow); padding: 6px; text-align: left; }
.ex-home-head { flex: none; display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px 6px; }
.ex-home-head span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ex-faint); }
.ex-home-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
.ex-page .ex-home-item { display: grid; grid-template-columns: 1fr auto auto; gap: 1px 14px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; align-items: baseline; }
.ex-page .ex-home-item:hover { background: #eef2f8; }
.ex-home-item b { font-weight: 600; font-size: 14.5px; color: var(--ex-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-home-item time { font-size: 12.5px; color: var(--ex-faint); white-space: nowrap; }
.ex-home-item .go { font-size: 12.5px; font-weight: 600; color: var(--navy); opacity: 0; }
.ex-page .ex-home-item:hover .go { opacity: 1; }
.ex-home-item small { grid-column: 1 / -1; font-size: 12.5px; color: var(--ex-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-home-item small i { font-style: normal; display: inline-block; padding: 0 7px; margin-right: 6px; border-radius: 99px; background: #e9eef6; color: var(--navy); font-weight: 600; font-size: 11.5px; }
/* A thread started from a screening: the pill's amber document icon and the site, above the question. */
.ex-home-item .ex-home-scr { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; font-weight: 600; color: #8a5a06; margin-bottom: 1px; }
.ex-home-item .ex-home-scr .ex-pill-ic { flex: none; width: 13px; height: 13px; stroke: #c98a12; }
.ex-home-item .ex-home-scr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-home-foot { flex: none; display: flex; justify-content: space-between; padding: 8px 12px 6px; font-size: 12px; color: var(--ex-faint); border-top: 1px solid var(--ex-line-2); margin-top: 4px; }
.ex-page .ex-home-foot button { color: var(--navy); font-weight: 600; font-size: 12px; }
.ex-page .ex-home-foot button:hover { text-decoration: underline; }

/* A thread id that is not this planner's, or not there: said in place of the ask box. */
.ex-th-missing { background: #fff; border: 1px solid var(--ex-line); border-radius: 14px; box-shadow: var(--ex-shadow); padding: 22px 24px; text-align: center; }
.ex-th-missing p { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--ex-ink); }
.ex-th-missing a { color: var(--navy); font-weight: 600; font-size: 14px; }
.ex-page.is-missing .ex-ask { display: none; }

/* ── document panel ── */
/* Fixed, over the planner top bar (z-index 50). Closed is off-screen AND visibility: hidden, so it
   is out of the tab order and reads as hidden to anything asking. */
.ex-doc {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw); z-index: 2000; background: #fff;
    box-shadow: -12px 0 40px rgba(20,30,50,.18); display: flex; flex-direction: column;
    transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
}
.ex-doc.is-open { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
.ex-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 10px; }
.ex-doc-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ex-faint); font-weight: 600; }
.ex-doc-num { margin-left: 8px; padding: 0 6px; border-radius: 5px; background: var(--ex-quote); box-shadow: inset 0 0 0 1px var(--ex-quote-line); color: #7a5a00; letter-spacing: 0; text-transform: none; }
.ex-doc-ref { font-size: 15px; margin-top: 2px; }
.ex-doc-ref b { margin-right: 6px; }
.ex-page .ex-doc-x { font-size: 24px; color: var(--ex-faint); line-height: 1; padding: 0 4px; }
.ex-page .ex-doc-x:hover { color: var(--ex-ink); }
.ex-doc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 0 20px 12px; border-bottom: 1px solid var(--ex-line); font-size: 12px; color: var(--ex-mute); }
.ex-doc-verbatim { color: var(--green); font-weight: 600; }
.ex-doc-title { line-height: 1.35; }
.ex-doc-title b { margin-right: 0; overflow-wrap: anywhere; }
/* Where a policy document stands. Emerging and draft are amber: not part of the development plan. */
.ex-doc-pill { padding: 1px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--ex-mute); background: var(--ex-line-2); }
.ex-doc-pill.is-adopted { color: #1f5138; background: #ecf6f0; }
.ex-doc-pill.is-emerging { color: #6b4a05; background: #fdf5e4; box-shadow: inset 0 0 0 1px var(--amber); }
.ex-doc-verbatim::before { content: '\2713\00a0'; }
.ex-doc-file { flex-basis: 100%; color: var(--ex-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; overflow-wrap: anywhere; }
.ex-doc-body { flex: 1; overflow: auto; padding: 18px 26px; font: 15px/1.65 Georgia, 'Times New Roman', serif; color: #2a2f38; background: #fbfaf7; border-top: 1px solid var(--ex-line); }
.ex-doc-meta + .ex-doc-body { border-top: 0; }
.ex-doc-ctx { color: #8b8f97; margin: 0 0 12px; }
.ex-doc-body blockquote { margin: 0 0 12px; padding: 10px 14px; background: var(--ex-quote); border-left: 3px solid var(--ex-quote-line); color: #1c2330; border-radius: 0 6px 6px 0; }
/* A citation of the screening report: its section as the report page draws it. The report page's own
   rules (.sr-page ...) do not reach this panel, so the few shapes a section holds are styled here. */
.ex-doc-report { font: 14.5px/1.6 Inter, system-ui, sans-serif; color: #2a2f38; overflow-wrap: anywhere; }
.ex-doc-report h3 { font-size: 17px; font-weight: 700; margin: 0 0 10px; color: var(--ex-ink); }
.ex-doc-report h4, .ex-doc-report h5 { font-size: 14px; font-weight: 700; margin: 16px 0 4px; color: var(--ex-ink); }
.ex-doc-report p { margin: 0 0 10px; }
.ex-doc-report ul, .ex-doc-report ol { margin: 0 0 10px; padding-left: 20px; }
.ex-doc-report li { margin-bottom: 5px; }
.ex-doc-report hr { border: 0; border-top: 1px solid var(--ex-line); margin: 14px 0; }
.ex-doc-body .ex-doc-report blockquote { background: none; border-left: 3px solid var(--ex-line); border-radius: 0; color: inherit; padding: 2px 0 2px 12px; margin: 0 0 10px; }
.ex-doc-report .sr-tablewrap { overflow-x: auto; margin: 0 0 12px; }
.ex-doc-report table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.ex-doc-report th, .ex-doc-report td { text-align: left; vertical-align: top; padding: 5px 9px; border-bottom: 1px solid var(--ex-line); }
.ex-doc-report th { font-weight: 600; color: var(--ex-mute); white-space: nowrap; }
.ex-doc-report .sr-ref { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--navy); background: #e9eef6; padding: 1px 6px; border-radius: 4px; border: 0; cursor: default; }
.ex-doc-report .sr-note { font-size: 13px; color: var(--ex-mute); }
.ex-doc-report mark.ex-mark { background: var(--ex-quote); box-shadow: 0 0 0 2px var(--ex-quote); border-bottom: 1px solid var(--ex-quote-line); color: #1c2330; }
.ex-doc-problem { font: 500 14px/1.5 Inter, sans-serif; color: #6b4a05; background: #fdf5e4; border-left: 3px solid var(--amber); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 0 0 12px; }
.ex-doc-note, .ex-doc-loading { font: 13px/1.5 Inter, sans-serif; color: var(--ex-mute); margin: 0 0 12px; }

/* the application's record, in the same panel */
.ex-app .ex-doc-ref { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ex-app-record { font: 14px/1.5 Inter, sans-serif; background: #fff; color: var(--ex-ink); }
.ex-app-facts { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; margin: 0 0 18px; }
.ex-app-facts dt { color: var(--ex-faint); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding-top: 2px; }
.ex-app-facts dd { margin: 0; overflow-wrap: anywhere; }
.ex-app-docs { display: flex; flex-direction: column; gap: 8px; }
.ex-page .ex-app-doc { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 14px; border-radius: 10px; background: #f0f3f8; box-shadow: inset 0 0 0 1px #d5dce8; }
.ex-page .ex-app-doc:hover { background: #e6ebf3; box-shadow: inset 0 0 0 1.5px var(--navy); }
.ex-app-doc b { font-weight: 600; color: var(--navy); }
.ex-app-doc span { font-size: 12px; color: #7a5a00; background: var(--ex-quote); box-shadow: inset 0 0 0 1px var(--ex-quote-line); padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.ex-app .ex-doc-loading { display: flex; align-items: center; gap: 8px; }
.ex-page .ex-app-back { font-weight: 600; color: var(--navy); font-size: 12.5px; }
.ex-page .ex-app-back:hover { text-decoration: underline; }
.ex-app-ocr { color: #6b4a05; background: #fdf5e4; padding: 0 7px; border-radius: 4px; }
.ex-app-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ex-app-text mark.ex-mark { background: var(--ex-quote); box-shadow: 0 0 0 2px var(--ex-quote); border-bottom: 1px solid var(--ex-quote-line); color: #1c2330; }
/* a card's reference opens its record */
.ex-page .ex-card-ref { font-weight: 600; color: var(--navy); }
.ex-page .ex-card-ref:hover { text-decoration: underline; }

/* ── narrow screens: the drawer becomes a sheet along the bottom ── */
@media (max-width: 900px) {
    .ex-page { min-height: 640px; }
    .ex-page.has-drawer .ex-top { right: 16px; }
    .ex-drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 52%; }
    .ex-page.has-drawer .leaflet-right { right: 0; }
    .ex-page.has-drawer .ex-bottom { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ex-map, .ex-veil, .ex-doc, .ex-pin { transition: none; }
    .ex-steps li { animation: none; }
}
