/* Demand Forecaster.
 *
 * Calculator batch. Written for this service on the shell's own tokens (`--hs-*`); the monolith's page
 * styled itself with a 700-line inline <style> block and 23 style attributes, none of which this
 * service's Content Security Policy admits. Metric colours are the monolith's, in two forms: the chart
 * lines (demand_forecaster.v1.js) keep its exact hues, and the text colours below are the same hues
 * darkened to at least 4.5:1 on white, because three of the originals (orange, teal, cyan) are too
 * pale to read as text. Nothing here sizes anything with a style attribute; every height is a class.
 */
:root {
  --df-border: var(--hs-border, #dfe4ec);
  --df-ink: var(--hs-ink, #1f2937);
  --df-mut: var(--hs-ink-muted, #55637a);
  --df-surface: var(--hs-surface, #fff);
  --df-ground: var(--hs-ground, #f4f6fa);
  --df-accent: var(--hs-aqua, #0d5bb8);
  --df-good: #15803d;
  --df-good-bg: #e8f6ec;
  --df-bad: #b91c1c;
  --df-bad-bg: #fdeaea;
  --df-warn-bg: #fff8e6;
  --df-warn-ink: #6b5200;
  --df-flat: #55637a;
  --df-flat-bg: #eef1f6;
  --df-radius: 12px;
}

.df-wrap { max-width: 1520px; margin: 0 auto; padding: 0 0 48px; position: relative; }
.df-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.df-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--df-accent); margin: 0 0 3px; }
.df-title { font-size: 1.75rem; font-weight: 800; color: var(--df-ink); margin: 0 0 6px; line-height: 1.2; }
.df-lead { color: var(--df-mut); font-size: 15px; margin: 0 0 22px; max-width: 760px; }
.df-quiet { color: var(--df-mut); font-size: 13px; margin: 0 0 12px; }
.df-back { margin: 0 0 8px; font-size: 13px; }
.df-back a { color: var(--df-accent); text-decoration: none; font-weight: 600; }
.df-back a:hover, .df-back a:focus-visible { text-decoration: underline; }
.df-ico { width: 1em; height: 1em; vertical-align: -.125em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.df-ico-lg { width: 2.4rem; height: 2.4rem; color: #94a3b8; margin-bottom: 8px; }
.df-ico-flip { transform: scaleX(-1); }

.df-card { position: relative; background: var(--df-surface); border: 1px solid var(--df-border); border-radius: var(--df-radius); padding: 20px 22px; margin-bottom: 18px; }
.df-h { font-size: 16px; font-weight: 800; color: var(--df-ink); margin: 0 0 6px; }
.df-h2 { font-size: 14px; font-weight: 800; color: var(--df-ink); margin: 14px 0 6px; }
.df-h-out { margin: 26px 0 8px; }
.df-notice { background: var(--df-warn-bg); color: var(--df-warn-ink); border: 1px solid #e6c34a; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 14px 0 0; }

/* controls */
.df-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.df-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.df-field-grow { flex: 1 1 280px; }
.df-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--df-mut); }
.df-chipwrap { display: block; max-width: 460px; }
.df-select, .df-input { font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid #c8d0dd; border-radius: 8px; background: #fff; color: var(--df-ink); min-height: 44px; }
.df-select { font-weight: 700; cursor: pointer; }
.df-btn { font: inherit; font-size: 14px; font-weight: 700; color: #fff; background: var(--df-accent); border: 1px solid var(--df-accent); border-radius: 8px; padding: 10px 20px; min-height: 44px; cursor: pointer; }
.df-btn:hover { background: #0a4a96; }
.df-select:focus-visible, .df-input:focus-visible, .df-btn:focus-visible, .df-metric:focus-visible, .df-match:focus-visible { outline: 3px solid #7fb3ff; outline-offset: 2px; }
.df-matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.df-match { width: 100%; text-align: left; font: inherit; padding: 10px 14px; border: 1px solid var(--df-border); border-radius: 8px; background: #fff; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.df-match-code { color: var(--df-mut); font-variant-numeric: tabular-nums; }

/* states */
.df-empty { text-align: center; padding: 44px 24px; color: var(--df-mut); }
.df-empty p { max-width: 640px; margin: 8px auto 0; }
.df-problem { border-color: #e6c34a; background: var(--df-warn-bg); }
.df-problem p { margin: 0 0 8px; }

/* context + share */
.df-context { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.df-practice { font-size: 22px; font-weight: 800; color: var(--df-ink); margin: 0 0 2px; }
.df-share { display: flex; flex-direction: column; gap: 6px; flex: 1 1 320px; max-width: 520px; }
.df-share-input { width: 100%; font-size: 12.5px; }

/* insights */
.df-insights { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.df-insight { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.45; }
.df-insight .df-ico { margin-top: 3px; }
.df-insight-good { background: var(--df-good-bg); color: #14532d; }
.df-insight-bad { background: var(--df-bad-bg); color: #7f1d1d; }
.df-insight-warn { background: var(--df-warn-bg); color: var(--df-warn-ink); }
.df-insight-neutral { background: var(--df-flat-bg); color: var(--df-ink); }

/* metric cards */
.df-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.df-metric { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--df-border); border-left: 4px solid var(--df-flat); border-radius: 11px; padding: 15px 17px; text-decoration: none; color: var(--df-ink); }
.df-metric:hover { box-shadow: 0 2px 10px rgba(18, 35, 63, .1); }
.df-metric.df-tone-good { border-left-color: var(--df-good); }
.df-metric.df-tone-bad { border-left-color: var(--df-bad); }
.df-metric-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.df-metric-label { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--df-mut); }
.df-metric-value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.df-metric-value small { font-size: .9rem; font-weight: 700; color: var(--df-mut); margin-left: 3px; }
.df-metric-line { font-size: 12.5px; color: var(--df-mut); }
.df-metric-trend { font-size: 13px; font-weight: 700; }
.df-tone-good .df-metric-trend, .df-kpi-sub.df-tone-good { color: var(--df-good); }
.df-tone-bad .df-metric-trend, .df-kpi-sub.df-tone-bad { color: var(--df-bad); }
.df-tone-flat .df-metric-trend, .df-kpi-sub.df-tone-flat { color: var(--df-flat); }
.df-metric-dive { margin-top: auto; font-size: 12.5px; font-weight: 700; color: var(--df-accent); }
.df-conf { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border-radius: 20px; padding: 2px 9px; white-space: nowrap; }
.df-conf-high { background: var(--df-good-bg); color: #14532d; }
.df-conf-medium { background: var(--df-warn-bg); color: var(--df-warn-ink); }
.df-conf-low { background: var(--df-bad-bg); color: #7f1d1d; }

/* metric text colours: the monolith's hues, darkened to 4.5:1 on white */
.df-c-gp_day_pct { color: #0d5bb8; }
.df-c-gp_oc_day_pct { color: #6d28d9; }
.df-c-missed_pct { color: #b45309; }
.df-c-oc_rate_1000 { color: #0f766e; }
.df-c-dna_pct { color: #b91c1c; }
.df-c-same_day_pct { color: #0e7490; }

/* charts */
.df-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr)); gap: 18px; margin-top: 10px; }
.df-chart-card { margin-bottom: 0; min-width: 0; }
.df-chart-title { font-size: 14px; font-weight: 800; color: var(--df-ink); margin: 0 0 8px; }
.df-chart { margin: 0; }
.df-chart-box { position: relative; height: 270px; }
.df-chart-short { height: 220px; }
.df-disclosure { margin-top: 10px; }
.df-disclosure > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--df-accent); padding: 4px 0; }
.df-disclosure > summary:focus-visible { outline: 3px solid #7fb3ff; outline-offset: 2px; }

/* tables */
.df-scroll { position: relative; overflow-x: auto; }
.df-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.df-table th, .df-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #eef2f7; white-space: nowrap; }
.df-table thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--df-mut); font-weight: 800; }
.df-table tbody th { font-weight: 600; color: var(--df-ink); }
.df-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.df-table td.num { font-weight: 700; }
.df-row-forecast th, .df-row-forecast td { background: #f6f8fc; }
.df-yoy-up { color: var(--df-good); }
.df-yoy-down { color: var(--df-bad); }

/* deep dive */
.df-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; margin-bottom: 18px; }
.df-kpi { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--df-border); border-radius: 11px; padding: 15px 17px; }
.df-kpi-label { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--df-mut); }
.df-kpi-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.df-kpi-value small { font-size: .9rem; color: var(--df-mut); margin-left: 3px; }
.df-kpi-sub { font-size: 12px; font-weight: 700; color: var(--df-mut); }
.df-kpi .df-conf { align-self: flex-start; }

/* notes + method */
.df-notes { margin: 8px 0 0; padding-left: 20px; font-size: 13.5px; line-height: 1.5; }
.df-notes li { margin-bottom: 6px; }
.df-method > summary { cursor: pointer; margin: 0; }
.df-method-body { margin-top: 12px; font-size: 13.5px; line-height: 1.55; color: var(--df-ink); max-width: 820px; }
.df-method-body ul { padding-left: 20px; }
.df-method-body li { margin-bottom: 6px; }

@media (max-width: 600px) {
  .df-title { font-size: 1.4rem; }
  .df-card { padding: 16px 14px; }
  .df-chart-box { height: 240px; }
  .df-metric-value { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .df-metric { transition: box-shadow .15s; }
}
