/* Graphs (/graphs). Same tokens as app.css: near-black surfaces, hairlines, champagne gold for the
   controls; the series colors live only on the marks (graphs-data.js PALETTE). */

.gr-page { padding: 34px 0 72px; }
.gr-head { max-width: 760px; }
.gr-h1 { margin: 10px 0 0; font-size: clamp(28px, 3.6vw, 40px); font-weight: 720; letter-spacing: -0.03em; line-height: 1.1; }
.gr-lede { margin: 12px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; }

/* ---------- Builder: add places and data points ---------- */
.gr-builder { margin-top: 26px; padding: 16px; border-radius: 20px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012)); }
.gr-add { display: flex; gap: 10px; align-items: flex-start; }
.gr-search { position: relative; flex: 1; min-width: 0; order: 0 !important; flex-basis: auto !important; }   /* not the map topbar's phone order */
.gr-search .search-results { z-index: 30; background: var(--glass-strong); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.gr-search .result:disabled { opacity: 0.45; cursor: default; }
.gr-picker { position: relative; flex: none; }
.gr-picker .btn { height: 42px; }
.gr-pop { position: absolute; z-index: 30; right: 0; top: calc(100% + 8px); width: min(360px, calc(100vw - 32px)); padding: 10px;
  border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.gr-pop .field-xs { width: 100%; }
.gr-pop-list { max-height: 360px; overflow-y: auto; margin-top: 8px; scrollbar-width: thin; scrollbar-color: #2a2b30 transparent; }
.gr-pop-cat { padding: 10px 8px 4px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.gr-pop-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px; border: 0; border-radius: 9px; background: none;
  color: var(--ink-2); text-align: left; cursor: pointer; }
.gr-pop-item:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.gr-pop-item[aria-pressed="true"] { color: var(--gold-2); }
.gr-pop-item span { flex: 1; } .gr-pop-item mark { background: none; color: var(--gold-2); font-weight: 600; }
.gr-pop-item:disabled { opacity: 0.4; cursor: default; }
.gr-pop-item svg { width: 16px; height: 16px; stroke: var(--gold); stroke-width: 2.4; }
.gr-pop-note { padding: 10px 8px 4px; font-size: 12px; color: var(--ink-3); }

.gr-label { flex: none; min-width: 58px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.gr-popular { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.gr-chips { margin-top: 10px; display: grid; gap: 8px; }
.gr-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gr-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 4px 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font-size: 12.5px; }
.gr-chip.is-hidden { color: var(--ink-3); background: transparent; border-style: dashed; }
.gr-chip.is-hidden .gr-dot { opacity: 0.35; }
.gr-chip em { font-style: normal; font-size: 10px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.gr-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.gr-chip-metric { padding-left: 10px; }
.gr-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
.gr-chip-btn { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); cursor: pointer; }
.gr-chip-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.gr-chip-btn:disabled { opacity: 0.3; cursor: default; }
.gr-chip-btn svg { width: 15px; height: 15px; }
.gr-msg { margin-top: 8px; min-height: 0; font-size: 12.5px; color: var(--warning); }
.gr-msg:empty { display: none; }

/* ---------- One row of controls above the graph ---------- */
.gr-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 12px; }
.gr-controls .seg button:disabled { opacity: 0.35; cursor: default; }
.gr-controls .chip-btn[hidden] { display: none; }

/* ---------- The graph card ---------- */
.gr-card { position: relative; padding: 22px 22px 16px; border-radius: 22px; border: 1px solid var(--line-2);
  background: radial-gradient(120% 90% at 0% 0%, rgba(214, 179, 106, 0.06), transparent 50%), linear-gradient(180deg, #131418, #101114);
  transition: opacity 0.2s; }
.gr-card.gr-loading .gr-stage, .gr-card.gr-loading .gr-keys { opacity: 0.5; }
.gr-card:fullscreen { overflow: auto; padding: 28px 32px; border-radius: 0; background: #101114; }
.gr-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.gr-titles { min-width: 0; }
.gr-title { margin: 0; font-size: clamp(20px, 2.3vw, 26px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.gr-insights p { margin: 6px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.gr-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; max-width: 52%; }
.gr-actions .btn-sm { height: 32px; margin: 0; gap: 6px; padding: 0 11px; font-size: 12.5px; }
.gr-actions .btn-sm svg { width: 15px; height: 15px; }
.gr-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12.5px; color: var(--ink-2); }
.gr-keyitem { display: inline-flex; align-items: center; gap: 7px; }
.gr-keyitem.is-hidden { opacity: 0.4; text-decoration: line-through; }
.gr-key { width: 18px; height: 6px; stroke: none; fill: none; }
.gr-band { display: inline-block; width: 18px; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); }

.gr-stage { position: relative; margin-top: 10px; border-radius: 12px; }
.gr-stage:focus-visible { outline-offset: 4px; }
.gr-panel + .gr-panel { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.gr-panel-title { margin: 0 0 2px 56px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.gr-plot { position: relative; }
.gr-svg { display: block; width: 100%; height: auto; overflow: visible; stroke: none; fill: none; }   /* opt out of the icon defaults on svg */
.gr-svg .gr-hit { cursor: crosshair; }
.gr-error { padding: 70px 0; text-align: center; color: var(--ink-3); }
.gr-error .btn { margin-left: 8px; }

.gr-tip { position: absolute; z-index: 5; top: 8px; min-width: 190px; max-width: 340px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: rgba(8, 9, 11, 0.95); border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); font-size: 12px; }
.gr-tip-when { margin-bottom: 6px; font-weight: 650; color: var(--ink); }
.gr-tip-head { margin: 8px 0 3px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.gr-tip-row { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; }
.gr-tip-row .gr-key { align-self: center; }
.gr-tip-row b { font-weight: 650; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gr-tip-row span { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The date range: two thumbs on one track. */
.gr-range { margin: 14px 56px 0; }
.gr-range-track { position: relative; height: 22px; }
.gr-range-track::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); }
.gr-range-track i { position: absolute; top: 9px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.gr-range-track input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.gr-range-track input::-webkit-slider-runnable-track { background: none; border: 0; }
.gr-range-track input::-moz-range-track { background: none; border: 0; }
.gr-range-track input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  background: #f4f3ef; border: 3px solid var(--gold); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); cursor: grab; }
.gr-range-track input::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: #f4f3ef;
  border: 3px solid var(--gold); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); cursor: grab; }
.gr-range-track input:focus-visible { outline: none; }
.gr-range-track input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(214, 179, 106, 0.35); }
.gr-range-labels { position: relative; height: 18px; margin-top: 4px; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.gr-range-labels span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }

.gr-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3); }
.gr-mark { flex: none; color: var(--gold); font-weight: 700; letter-spacing: 0.02em; }
.gr-notes p { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }

/* ---------- Summary and the full table ---------- */
.gr-summary, .gr-data { margin-top: 28px; }
.gr-h3 { margin: 0 0 12px; font-size: 17px; font-weight: 680; letter-spacing: -0.01em; }
.gr-h3 span { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.gr-table-wrap { overflow: auto; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); }
.gr-table-tall { max-height: 520px; }
.gr-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.gr-table th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; text-align: left; white-space: nowrap; font-size: 11px; font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); background: #16171b; border-bottom: 1px solid var(--line-2); }
.gr-table th .gr-key { margin-right: 6px; vertical-align: middle; }
.gr-table th small { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; }
.gr-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.gr-table tr:last-child td { border-bottom: 0; }
.gr-table td b { color: var(--ink); font-weight: 650; }
.gr-table td small { display: block; margin-top: 1px; font-size: 11px; color: var(--ink-3); }
.gr-td-name { color: var(--ink) !important; }
.gr-td-name .gr-key { margin-right: 8px; vertical-align: middle; }
.gr-page .page-foot { margin-top: 40px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .gr-card-head { flex-direction: column; }
  .gr-actions { max-width: none; justify-content: flex-start; }
  .gr-range { margin: 14px 8px 0; }
  .gr-panel-title { margin-left: 8px; }
}
@media (max-width: 560px) {
  .gr-page { padding-top: 22px; }
  .gr-add { flex-direction: column; align-items: stretch; }
  .gr-picker .btn { width: 100%; justify-content: center; }
  .gr-pop { left: 0; right: auto; width: 100%; }
  .gr-card { padding: 16px 12px 12px; border-radius: 18px; }
  .gr-actions .btn-sm span { display: none; }   /* icons only; each keeps its title and label */
  .gr-label { min-width: 0; width: 100%; }
  .gr-chip-name { max-width: 180px; }
}
@media print {
  .gr-builder, .gr-controls, .gr-actions, .gr-range, .page-foot { display: none !important; }
}
