/* ---------- UnseenFront editorial palette ----------
     Cream paper, near-black ink, restrained teal accent,
     muted brass for historical estimation. No rounded corners.
     No glow, no neon, no shadows. */
  :root {
    --paper:        #f4f1ea;   /* page cream */
    --paper-soft:   #ece8df;   /* sub-sections */
    --paper-line:   #d8d2c4;   /* hairline rule */
    --ink:          #1a1a1a;
    --ink-soft:     #3a3a3a;
    --ink-mute:     #6b6b6b;
    --ink-faint:    #9a958a;

    --accent:       #2f5a6b;   /* teal-blue CTA, matches Become a Member */
    --accent-soft:  #4a7889;
    --accent-faint: #cfdde2;

    --brass:        #8a6a2c;   /* muted gold, matches "CUBA" title */
    --brass-soft:   #b18a47;
    --brass-faint:  rgba(177, 138, 71, 0.18);

    /* Functional status colors — flat, no glow */
    --severe:       #8a1f1f;
    --critical:     #a14418;
    --high:         #b56a14;
    --elevated:     #8c6b1a;
    --concerning:   #4f6b22;
    --low:          #2c5566;

    --line-tracked: var(--accent);
    --line-backcast: var(--brass);
    --band-uncertainty: rgba(138, 106, 44, 0.14);
  }

  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'EB Garamond', 'Garamond', Georgia, serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  body { padding: 20px; }

  .mdi-widget {
    background: var(--paper);
    border: 1px solid var(--paper-line);
    padding: 26px 28px 20px;
    max-width: 1200px;
    margin: 0 auto;
  }

  /* ---------- Header ---------- */
  .mdi-header {
    display: flex; flex-wrap: wrap;
    justify-content: space-between; align-items: flex-end;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ink);
    margin-bottom: 18px;
  }
  .mdi-title-block { display: flex; flex-direction: column; gap: 4px; }
  .mdi-eyebrow {
    font-family: 'Inter', sans-serif;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--ink-mute);
  }
  .mdi-title {
    font-family: 'Cormorant Garamond', 'Garamond', Georgia, serif;
    font-size: 30px; font-weight: 600;
    letter-spacing: 0.005em;
    color: var(--ink);
    line-height: 1.1;
  }
  .mdi-subtitle {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 14px; font-style: italic;
    color: var(--ink-mute);
    margin-top: 2px;
  }

  .mdi-readout {
    display: flex; align-items: baseline; gap: 12px;
    text-align: right;
  }
  .mdi-readout .val {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 44px; font-weight: 600;
    line-height: 1; color: var(--ink);
    letter-spacing: -0.01em;
  }
  .mdi-readout .val .unit {
    font-size: 16px; color: var(--ink-mute);
    margin-left: 2px;
  }
  .mdi-readout .band-pill {
    font-family: 'Inter', sans-serif;
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase;
    padding: 4px 9px;
    border: 1px solid currentColor;
    color: var(--high);
    background: transparent;
  }
  .mdi-readout .delta {
    font-family: 'Inter', sans-serif;
    font-size: 11px; color: var(--ink-mute);
    letter-spacing: 0.04em;
  }
  .mdi-readout .delta.up   { color: var(--severe); }
  .mdi-readout .delta.down { color: var(--concerning); }

  /* ---------- Controls ---------- */
  .mdi-controls {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 0;
  }
  .mdi-control-label {
    font-family: 'Inter', sans-serif;
    font-size: 9px; font-weight: 600;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--ink-mute);
    margin-right: 4px;
  }
  .mdi-range-group {
    display: inline-flex;
    border: 1px solid var(--ink);
  }
  .mdi-range-btn {
    background: transparent; color: var(--ink-soft);
    border: none; border-right: 1px solid var(--ink);
    padding: 6px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    cursor: pointer;
    transition: background 100ms, color 100ms;
  }
  .mdi-range-btn:last-child { border-right: none; }
  .mdi-range-btn:hover { background: var(--paper-soft); color: var(--ink); }
  .mdi-range-btn.is-active { background: var(--ink); color: var(--paper); }

  .mdi-sub-toggles {
    display: flex; flex-wrap: wrap; gap: 6px;
    align-items: center;
  }
  .mdi-sub-btn {
    background: transparent; color: var(--ink-mute);
    border: 1px solid var(--paper-line);
    padding: 4px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 10px; font-weight: 500;
    letter-spacing: 0.10em; text-transform: uppercase;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: all 120ms;
  }
  .mdi-sub-btn::before {
    content: ''; width: 9px; height: 2px;
    background: currentColor; opacity: 0.5;
  }
  .mdi-sub-btn:hover { color: var(--ink); border-color: var(--ink-mute); }
  .mdi-sub-btn.is-active {
    color: var(--ink); background: var(--paper-soft);
    border-color: currentColor;
  }
  .mdi-sub-btn.is-active::before { opacity: 1; height: 3px; }

  /* ---------- Chart canvas ---------- */
  .mdi-canvas-wrap {
    position: relative;
    background: var(--paper);
    border-top: 1px solid var(--paper-line);
    border-bottom: 1px solid var(--paper-line);
    padding: 14px 4px 8px;
    margin-top: 8px;
    height: 640px;
  }
  @media (max-width: 720px) {
    .mdi-canvas-wrap { height: 480px; }
    .mdi-title { font-size: 22px; }
    .mdi-readout .val { font-size: 32px; }
    .mdi-widget { padding: 18px 16px 14px; }
  }

  /* ---------- Footer / legend ---------- */
  .mdi-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between;
    gap: 14px; margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--paper-line);
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: var(--ink-mute);
    letter-spacing: 0.04em;
  }
  .mdi-legend { display: flex; flex-wrap: wrap; gap: 18px; }
  .mdi-legend .item { display: inline-flex; align-items: center; gap: 7px; }
  .mdi-legend .swatch-line { width: 16px; height: 2px; }
  .mdi-legend .swatch-line.dashed {
    height: 0; border-top: 2px dashed currentColor;
    width: 18px;
  }
  .mdi-legend .swatch-band {
    width: 16px; height: 10px;
    background: var(--band-uncertainty);
    border: 1px solid var(--paper-line);
  }
  .mdi-bands {
    font-family: 'Inter', sans-serif;
    font-size: 9.5px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .mdi-bands span { color: var(--ink-mute); }
  .mdi-source {
    margin-top: 8px;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 11px; font-style: italic;
    color: var(--ink-faint);
    text-align: right;
  }

  /* Scope-notes block (left-aligned override of italic .mdi-source) */
  .mdi-scope-notes {
    text-align: left;
    font-style: normal;
    font-size: 10px;
    line-height: 1.5;
    color: var(--ink-mute);
    max-width: 920px;
  }