/* FLUXNET Data viewer — visual chrome.
   Dash auto-serves any *.css under /assets/.  Keep the rules minimal
   so we don't fight Plotly's defaults inside the map. */

:root {
    --header-h:    72px;
    --footer-h:    56px;
    --brand:       #3768B8;     /* header / footer background */
    --brand-fg:    #ffffff;     /* text on the brand colour */
    --brand-fg-soft: #d8e3f4;   /* secondary text on brand bg (less prominent) */
    --muted:       #555;
    --bg-strip:    #f4f6f9;
}

html, body, .app-root {
    margin: 0;
    padding: 0;
    background: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Oxygen, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    color: #222;
}

.app-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    padding: 8px 16px;
}

/* ── Header ─────────────────────────────────────────────────────── */

.app-header {
    height: var(--header-h);
    background: var(--brand);
    color: var(--brand-fg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    height: 58px;       /* +20 % over the original 48 px */
    width: auto;
    display: block;
    /* The bundled FLUXNET PNG (cropped-Fluxnet_logo_trans.png) ships
       with its own colour palette designed to read on a dark
       backdrop, so no white inset needed. */
}

.brand-title {
    margin: 0;
    font-size: 18px;
    color: var(--brand-fg);
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Single-line, fits the header bar; ellipsis if too long.  Hovering
   the truncated text shows the full string via the `title` attr set
   in app.py header_bar(). */
.latest-strip {
    font-size: 13px;
    color: var(--brand-fg);
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1;
    min-width: 0;          /* allow shrink inside flex */
    justify-content: flex-end;
    line-height: 1.3;
}

.latest-label {
    font-weight: 500;
    color: var(--brand-fg-soft);
    flex: 0 0 auto;
    white-space: nowrap;
}

.latest-value {
    color: var(--brand-fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

/* The site_id + name in the latest-update banner is a link that opens
   the same landing page as clicking the marker on the map. */
.latest-link {
    color: var(--brand-fg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.5);
    text-underline-offset: 2px;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.latest-link:hover { text-decoration-color: var(--brand-fg); }

/* ── First-use consent modal ───────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 50, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: white;
    border-radius: 8px;
    padding: 24px 26px 20px;
    max-width: 540px;
    width: 90vw;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    color: #222;
}

.modal-title {
    margin: 0 0 6px;
    color: var(--brand);
    font-size: 18px;
}

.modal-intro { margin: 0 0 12px; color: #444; font-size: 14px; }

.consent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 18px;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 13.5px;
    color: #222;
    line-height: 1.4;
}

.consent-checkbox {
    margin-top: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.consent-label a {
    color: var(--brand);
    text-decoration: underline;
}

.modal .dl-button:disabled {
    background: #b6c6df;
    color: #f4f6f9;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Load-error banner ─────────────────────────────────────────── */

.load-error-banner {
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #664d03;
    line-height: 1.4;
}

.load-error-banner strong { color: #5b3d00; }

/* ── Controls strip ────────────────────────────────────────────── */

.controls-strip {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 4px;
    background: var(--bg-strip);
    border-radius: 6px;
    margin-bottom: 6px;
}

.ctrl-label    { font-weight: 500; }
.counts        { font-size: 13px; color: var(--muted); }
.counts-extra  { font-size: 13px; color: var(--brand); font-weight: 600; }
.store-cfg     { margin-left: auto; font-size: 12px; color: #888;
                 font-family: ui-monospace, SFMono-Regular, Menlo,
                              Consolas, monospace; }

/* ── Map area + right-rail network legend ──────────────────────── */

.map-area {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.map-graph { flex: 1; min-width: 0; }   /* let the map shrink */

/* Rail that stacks the three filter widgets (networks / years /
   ecosystems) on the right side of the map. */
.legend-rail {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 720px;
    overflow-y: auto;
}

.network-legend,
.year-filter,
.ecosystem-legend {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
}

/* Networks now sits inside the rail; bound it to the rail's width. */
.network-legend { flex: 0 0 auto; }

.year-filter   { flex: 0 0 auto; }
.ecosystem-legend { flex: 1 1 auto; min-height: 0; }

/* The on-toggle sits in the year header (small, like a chip). */
.year-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--brand);
    cursor: pointer;
    user-select: none;
}

/* Year filter: two compact number inputs (from / until) side by
   side; replaces the RangeSlider that didn't fit the rail's width.
   Layout uses display:flex set by the toggle callback so the on
   state lays the row out and the off state hides it entirely. */
.year-inputs-wrap {
    padding: 6px 0 0;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.year-input {
    width: 54px;
    padding: 3px 5px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #222;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;       /* hide Firefox spinner — too cramped */
}
.year-input::-webkit-outer-spin-button,
.year-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.year-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(55, 104, 184, 0.18);
}

.year-input-label {
    font-size: 11px;
    color: #666;
}

/* Ecosystem list: max-height ≈ seven rows tall, then scroll the
   rest.  Each row is ~24 px; 7 * 24 = 168 px plus a little
   breathing room. */
.ecosystem-list-wrap {
    max-height: 185px;
    overflow-y: auto;
    padding-right: 4px;          /* breathing room next to the scrollbar */
}

/* One-line ecosystem row: label first, count flush-right, ellipsis on
   the label when the network name + label collide with the count. */
.eco-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}
.eco-row .legend-text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.eco-count {
    flex: 0 0 auto;
    font-size: 11px;
    color: #666;
    font-variant-numeric: tabular-nums;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.legend-title {
    font-weight: 600;
    color: var(--brand);
    font-size: 13px;
}

.legend-bulk { display: inline-flex; gap: 4px; }

.legend-btn {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--brand);
    cursor: pointer;
    line-height: 1.3;
}

.legend-btn:hover { background: #f0f4fa; border-color: #aac; }
.legend-btn:active { background: #e0eaf5; }

.legend-list { display: flex; flex-direction: column; gap: 2px; }

.legend-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 2px 0;
    user-select: none;
}

.legend-checkbox { margin-right: 0; cursor: pointer; }

.legend-row { display: inline-flex; align-items: center; gap: 6px; }

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #1f1f1f;
}

.legend-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: #222;
}

/* When the checkbox is OFF, fade the swatch + line-through the text.
   Two selectors for robustness across browsers:
   - :has() — modern Chromium / Firefox 121+ / Safari 15.4+
   - adjacent-sibling — universal CSS-3 fallback (works since IE7)
   Dash's Checklist renders <input ...> as a sibling of the option-
   label <span>, so the ~ combinator catches both layouts.            */
.legend-label:has(.legend-checkbox:not(:checked)) .legend-swatch,
.legend-checkbox:not(:checked) ~ * .legend-swatch {
    background: #cccccc !important;
    border-color: #aaa;
}
.legend-label:has(.legend-checkbox:not(:checked)) .legend-text,
.legend-checkbox:not(:checked) ~ * .legend-text {
    color: #999;
    text-decoration: line-through;
}

/* ── Site landing page ─────────────────────────────────────────── */

.nee-preview {
    margin: 12px 0 16px;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 4px 4px 0;
    background: white;
}

.nee-preview-empty {
    padding: 16px;
    text-align: center;
}
.nee-preview-empty .muted { color: #777; margin: 0; }

/* ── Code snippet "harmonica" ──────────────────────────────────── */

.code-acc {
    margin: 4px 0 14px;
}

.code-acc summary {
    cursor: pointer;
    padding: 6px 10px;
    color: var(--brand);
    background: #f0f4fb;
    border: 1px solid #cdd9ec;
    border-radius: 4px;
    font-size: 13px;
    user-select: none;
}

.code-acc summary:hover { background: #e7eef9; }

.code-block {
    margin: 6px 0 0;
    padding: 10px 12px;
    background: #1f2733;
    color: #e3eaf3;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
}

/* ── Citation / license / download ─────────────────────────────── */

.citation-block {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.citation-row {
    font-size: 13px;
    line-height: 1.45;
    color: #222;
    background: #f6f9fd;
    border-left: 3px solid var(--brand);
    padding: 8px 12px;
    border-radius: 0 4px 4px 0;
}
.citation-row .cite-text { color: #222; }
.citation-row .doi-link {
    color: var(--brand);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    word-break: break-all;
}
.citation-row .doi-link:hover { text-decoration: underline; }

.download-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.dl-button {
    display: inline-block;
    background: var(--brand);     /* #3768B8 */
    color: var(--brand-fg);       /* white */
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    transition: background 120ms ease;
}
.dl-button:hover  { background: #2b5499; color: white; }
.dl-button:active { background: #234582; }

.dl-filename {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: #555;
    word-break: break-all;
}

.license-row { font-size: 13px; color: #333; }
.license-row .muted { color: #777; }

.ack-acc summary {
    cursor: pointer;
    padding: 4px 8px;
    color: var(--brand);
    font-size: 12.5px;
    user-select: none;
    border-radius: 3px;
}
.ack-acc summary:hover { background: #f0f4fb; }

.ack-text {
    font-size: 12px;
    color: #444;
    line-height: 1.5;
    padding: 6px 8px;
    background: #f8f9fb;
    border-left: 3px solid var(--brand);
    margin: 6px 0;
}

/* ── Full BADM viewer ──────────────────────────────────────────── */

.badm-section { margin-top: 18px; }
.badm-section h3 { margin-bottom: 2px; color: var(--brand); }
.badm-section .small { font-size: 12px; }

.badm-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }

.badm-acc {
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    background: white;
}

.badm-acc summary {
    cursor: pointer;
    padding: 6px 10px;
    font-size: 13px;
    user-select: none;
}
.badm-acc summary:hover { background: #f7f8fa; }
.badm-acc summary strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #1f2733;
}
.badm-acc[open] { background: #fbfcfe; }
.badm-acc .muted { color: #777; }

.badm-body {
    margin: 0;
    padding: 8px 12px 12px;
    background: #1f2733;
    color: #d8e0ec;
    border-radius: 0 0 4px 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    max-height: 360px;
    overflow: auto;
    white-space: pre;
}


.page-site {
    max-width: 820px;
    margin: 24px auto;
    padding: 0 8px;
}

.page-site h2 {
    color: var(--brand);
    margin-bottom: 4px;
}

.back-link {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--brand);
    text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.kv-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

.kv-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.kv-label  { color: var(--muted); width: 170px; }
.kv-value  { color: #222; }

.page-site-error h2 { color: #a33; }

/* ── Footer ────────────────────────────────────────────────────── */

.app-footer {
    height: var(--footer-h);
    background: var(--brand);
    color: var(--brand-fg);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 0 16px;
    font-size: 13px;
}

.footer-logo-link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.footer-text {
    flex: 1 1 auto;
    line-height: 1.4;
    color: var(--brand-fg);
}

.footer-logo {
    height: 36px;
    width: auto;
    display: block;
    /* No background inset — the SVG's grey was recoloured to light
       grey at copy-time so it reads cleanly directly on the brand
       blue.  Cyan + magenta accents stay vivid as-is. */
}

/* ── SOCAT viewer layout ───────────────────────────────────────────── */
.socat-main { display: flex; gap: 16px; align-items: stretch; padding: 12px 16px; }
.control-rail { flex: 0 0 320px; display: flex; flex-direction: column; gap: 10px;
  background: #f5f7fa; border: 1px solid #e0e6ee; border-radius: 8px; padding: 14px; }
.control-rail .ctl-label { font-weight: 600; font-size: 13px; margin-top: 6px; color: #2d3a4a; }
.control-rail .ctl-check label { display: block; font-size: 13px; margin: 2px 0; }
.bbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bbox-grid label { font-size: 11px; color: #667; display: block; }
.bbox-grid input { width: 100%; box-sizing: border-box; }
.map-wrap { flex: 1 1 auto; min-width: 0; border: 1px solid #e0e6ee; border-radius: 8px;
  overflow: hidden; background: #fff; }
.dl-button { background: #3768B8; color: #fff; border: none; border-radius: 6px;
  padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.dl-button:hover { background: #2c539a; }
.summary-readout { margin-top: 10px; padding: 10px; background: #fff;
  border: 1px solid #e0e6ee; border-radius: 6px; }
.summary-readout .stat-big { font-size: 18px; font-weight: 700; color: #14406b; }
.summary-readout .stat-row { font-size: 13px; color: #335; margin-top: 3px; }
.summary-readout .stat-note { font-size: 12px; color: #778; margin-top: 4px; }
.summary-readout .err { color: #b00; font-size: 13px; }
.citation-panel { margin-top: 10px; font-size: 12px; color: #334; line-height: 1.35; }
.citation-panel .cite-h { font-size: 13px; margin: 4px 0; color: #2d3a4a; }
.citation-panel p { margin: 4px 0; }
.citation-panel ul { margin: 2px 0 2px 16px; padding: 0; }
.citation-panel a { color: #3768B8; word-break: break-all; }

/* ── Full-viewport, map-fills-canvas overrides ───────────────────────── */
.app-root { display: flex; flex-direction: column; min-height: 100vh; }
.app-main.socat-main { flex: 1 1 auto; min-height: 0; align-items: stretch; }
.control-rail { flex: 0 0 300px; overflow: auto; }
.map-wrap { height: auto; }
.map-loading, .map-wrap > div, .map-wrap .js-plotly-plot, .map-wrap .plot-container,
.map-wrap .svg-container { height: 100% !important; }

/* ── Inline data-layer label + year edit boxes ───────────────────────── */
.inline-ctl { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.inline-ctl .ctl-label.inline { margin: 0; }
.inline-ctl .inline-radio label { display: inline-flex; margin-right: 10px; font-size: 13px; }
.years-row { display: flex; align-items: center; gap: 8px; }
.years-row .year-slider { flex: 1 1 auto; min-width: 0; padding: 0 4px; }
.years-row .year-box { width: 58px; box-sizing: border-box; text-align: center; }

/* ── Years: full-width slider above, boxes below; small anchor dots ───── */
.year-slider-full { padding: 4px 6px 0; }
.years-boxes { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.years-boxes .year-box { width: 64px; box-sizing: border-box; text-align: center; }
.rc-slider-dot { width: 4px; height: 4px; bottom: -1px; margin-left: -2px; border-width: 1px; }
.rc-slider-mark-text { font-size: 10px; color: #889; }

/* ── Tabs + globe animation ──────────────────────────────────────────── */
.view-tabs { flex: 1 1 auto; min-width: 0; }
.view-tabs .tab-parent, .view-tabs > div { min-width: 0; }
.map-wrap, .anim-wrap { height: calc(100vh - 175px); border: 1px solid #e0e6ee;
  border-radius: 8px; overflow: hidden; background: #fff; }
.anim-wrap { display: flex; flex-direction: column; padding: 8px; gap: 6px; background: #f5f7fa; }
.anim-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.anim-controls .play-btn { padding: 6px 12px; }
.anim-slider { flex: 1 1 auto; min-width: 160px; }
.anim-label { font-size: 13px; color: #234; min-width: 130px; font-variant-numeric: tabular-nums; }
.deck-loading, .deck-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
.deck-wrap { background: #0b1222; border-radius: 6px; overflow: hidden; }
.view-tab { padding: 6px 14px !important; }
.view-tab--sel { border-top: 2px solid #3768B8 !important; color: #14406b; font-weight: 600; }

/* ── Tabs must fill the remaining width next to the control rail ──────── */
.app-main.socat-main > .view-tabs { flex: 1 1 auto; min-width: 0; }
.view-tabs { display: flex; flex-direction: column; width: 100%; }
.view-tabs > div { width: 100%; min-width: 0; box-sizing: border-box; }
.map-wrap, .anim-wrap { width: 100%; box-sizing: border-box; }

/* ── deck.gl globe iframe ─────────────────────────────────────────────── */
.deck-loading { flex: 1 1 auto; min-height: 0; }
.deck-iframe { width: 100%; height: 100%; border: 0; display: block; border-radius: 6px; }

/* ── View area (custom tabs: radio bar + flex panes that fill) ────────── */
.app-main.socat-main > .view-area { flex: 1 1 auto; min-width: 0; }
.view-area { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.view-tabbar { display: flex; gap: 16px; }
.view-tabbar label { font-weight: 600; font-size: 14px; color: #2d3a4a; cursor: pointer; }
.view-area .map-wrap, .view-area .anim-wrap {
  flex: 1 1 auto; min-height: 0; width: 100%; height: auto; box-sizing: border-box;
  border: 1px solid #e0e6ee; border-radius: 8px; overflow: hidden; background: #fff; }
.view-area .anim-wrap { display: flex; flex-direction: column; padding: 8px; gap: 6px; background: #f5f7fa; }
.deck-loading { flex: 1 1 auto; min-height: 0; }

/* ── Animation graph fills the pane (flex, not capped) ───────────────── */
.anim-graph { flex: 1 1 auto; min-height: 0; width: 100%; }
.anim-graph .js-plotly-plot, .anim-graph .plot-container,
.anim-graph .svg-container, .anim-graph .main-svg { height: 100% !important; }

/* ── Collapsible / responsive control rail ───────────────────────────── */
.rail-toggle { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55);
  border-radius: 5px; font-size: 18px; line-height: 1; padding: 3px 10px; margin-right: 10px;
  cursor: pointer; }
.rail-toggle:hover { background: rgba(255,255,255,.12); }

@media (max-width: 820px) {
  /* stack vertically; control rail floats below the plot */
  .app-main.socat-main { flex-direction: column-reverse; }
  .control-rail { flex: 0 0 auto; width: 100%; max-height: 44vh; overflow: auto; }
  .view-area { flex: 1 1 auto; min-height: 60vh; }
}

/* ── Map area never taller than wide: height = min(width, available) ─── */
.view-area .map-wrap, .view-area .anim-wrap {
  flex: 0 0 auto; aspect-ratio: 1 / 1; max-height: calc(100vh - 170px); min-height: 0; }
@media (max-width: 820px) { .view-area { min-height: 0; } }

/* ── Wide/landscape: fill full width (width may exceed height) ─────────── */
.view-area .map-wrap, .view-area .anim-wrap {
  flex: 1 1 auto; min-height: 0; aspect-ratio: auto; max-height: calc(100vh - 170px); }
/* Portrait/narrow only: never taller than wide (cap height to width) */
@media (max-aspect-ratio: 1/1) {
  .view-area .map-wrap, .view-area .anim-wrap {
    flex: 0 0 auto; aspect-ratio: 1 / 1; max-height: calc(100vh - 170px); }
}

/* ── Download row ─────────────────────────────────────────────────────── */
.dl-row { display: flex; gap: 8px; align-items: center; }
.dl-row > div:first-child { flex: 0 0 auto; }

/* ── "Show Python code" button + pop-up ───────────────────────────────── */
.code-btn { display: block; width: 100%; margin-top: 8px; }
.code-modal-box { max-width: 680px; width: min(680px, 92vw); }
.code-snippet {
  background: #f6f8fa; border: 1px solid #d7dde3; border-radius: 6px; padding: 2px 14px;
  max-height: 52vh; overflow: auto; font-size: 12.5px; }
.code-snippet pre, .code-snippet code, .code-snippet .hljs {
  background: transparent !important; color: #24292e !important; white-space: pre;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.code-snippet .hljs-string, .code-snippet .hljs-meta { color: #032f62 !important; }
.code-snippet .hljs-keyword, .code-snippet .hljs-built_in { color: #d73a49 !important; }
.code-snippet .hljs-comment { color: #6a737d !important; font-style: italic; }
.code-snippet .hljs-number { color: #005cc5 !important; }
.code-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.dl-button.ghost { background: #e8eaed; color: #333; }
