/* Canadian Apparel Import Pressure Monitor — frontend styles */

/* Palette: maroon + baby pink. Status colours stay green/amber/red so they never
   blend into the theme. */
:root {
  --maroon: #6b1d2e;
  --maroon-deep: #4a1220;
  --pink: #f9d9e1;
  --pink-soft: #fdeef2;
  --bg: #fff7f9;
  --surface: #ffffff;
  --border: #f0d3db;
  --text-primary: #2b0f17;
  --text-secondary: #6a4a53;
  --text-muted: #9a7d86;
  --accent: #8a2a40;
  --gold: #c9a227;
  --maroon-line: #4a1220;
  --series-1: #8a2a40;
  --series-2: #d9527a;
  --series-3: #3f8f8a;
  --status-good: #2e9e5b;
  --status-warning: #e0a21b;
  --status-serious: #d9743f;
  --status-critical: #cf2a45;
  --shadow: 0 1px 2px rgba(107, 29, 46, 0.06), 0 8px 24px rgba(107, 29, 46, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pink: #3a1822;
    --pink-soft: #2a1119;
    --bg: #1a0a10;
    --surface: #25101a;
    --border: #43212d;
    --text-primary: #fbeaf0;
    --text-secondary: #d9b5c1;
    --text-muted: #a37f8b;
    --accent: #f0a3b8;
    --gold: #e6c45a;
    --maroon-line: #fbeaf0;
    --series-1: #f0a3b8;
    --series-2: #d9607f;
    --series-3: #5fc0b9;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Segoe UI", "Open Sans", system-ui, -apple-system, sans-serif;
  padding-bottom: 60px;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

header.site {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  margin-bottom: 24px;
}
.eyebrow {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 600; margin: 4px 0 6px; }
.sub { color: var(--text-secondary); font-size: 0.92rem; max-width: 68ch; line-height: 1.5; }

nav.tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
nav.tabs button {
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
nav.tabs button.active {
  color: var(--text-primary);
  border-bottom-color: var(--series-1);
}

section.view { display: none; }
section.view.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.card h2 { font-size: 1.05rem; margin: 0 0 6px; }
.card .desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-label { font-size: 0.74rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.3; }
.stat-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-tag {
  font-family: "Segoe UI", "Open Sans", system-ui, -apple-system, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 100px;
  color: #fff;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.field { margin-bottom: 14px; }
.field label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.field .field-value { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.field input[type="range"] { width: 100%; }
.field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
}
.share-total {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
}
.share-total.warn { color: var(--status-serious); font-weight: 600; }

.chart { width: 100%; height: 280px; min-width: 0; }

details.sql-drawer {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--bg);
}
details.sql-drawer summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}
details.sql-drawer pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-x: auto;
  margin: 10px 0;
  color: var(--text-primary);
}
.result-table-wrap { overflow-x: auto; }
table.result-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.76rem;
}
table.result-table th, table.result-table td {
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}
table.result-table th { color: var(--text-secondary); font-weight: 600; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 100px;
  color: #fff;
}

.loading { color: var(--text-muted); font-size: 0.85rem; padding: 20px 0; }

footer.site {
  margin-top: 30px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.methodology p, .methodology li { font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); }
.methodology h3 { font-size: 0.95rem; margin: 20px 0 6px; color: var(--text-primary); }
.methodology table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 10px 0; }
.methodology table th, .methodology table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}

@media (max-width: 480px) {
  .chart { height: 240px; }
}

/* ---- profile ---- */
.profile-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 6px;
}
.field-title { font-size: 0.82rem; font-weight: 600; margin: 8px 0 10px; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
}
.btn:hover { border-color: var(--series-1); }

/* ---- hero ---- */
.hero-main { display: grid; gap: 14px; }
.hero-score {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 2.6rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.hero-unit { font-size: 1.2rem; }
.hero-deltas {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.78rem; color: var(--text-secondary);
}
.hero-summary { margin: 0; font-size: 0.95rem; line-height: 1.55; color: var(--text-secondary); max-width: 72ch; }
.stat-note { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; }
.chart.tall { height: 320px; }

/* ---- driver cards ---- */
.driver {
  display: grid;
  grid-template-columns: 28px 1fr 130px auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.driver:last-child { border-bottom: none; }
.driver-rank {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; color: var(--text-muted);
  font-size: 1.1rem;
}
.driver-desc { font-size: 0.8rem; color: var(--text-secondary); margin: 2px 0 4px; line-height: 1.4; }
.driver a { font-size: 0.78rem; color: var(--series-1); text-decoration: none; }
.driver a:hover { text-decoration: underline; }
.driver-spark { height: 44px; width: 130px; }
.driver-value { font-size: 1.1rem; }

@media (max-width: 640px) {
  .driver { grid-template-columns: 24px 1fr; }
  .driver-spark { grid-column: 2; width: 100%; }
  .driver-value { grid-column: 2; }
  .hero-score { font-size: 2.1rem; }
}

/* ===== Facelift ===== */
body {
  background: linear-gradient(180deg, var(--pink-soft) 0, var(--bg) 340px) no-repeat, var(--bg);
}
h1, .card h2, .hero-score, .methodology h3 {
  font-family: "Fraunces", Georgia, serif;
}

.masthead {
  background:
    radial-gradient(circle at 85% -20%, rgba(249, 217, 225, 0.22), transparent 55%),
    linear-gradient(135deg, var(--maroon-deep), var(--maroon));
  color: #fbe9ee;
  padding: 34px 0 40px;
  margin-bottom: 8px;
}
.masthead .eyebrow { color: #f2b6c6; }
.masthead h1 {
  font-size: clamp(1.7rem, 4.6vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 8px 0 10px;
}
.masthead .sub { color: #f3cdd7; max-width: 62ch; margin: 0; }

nav.tabs {
  border-bottom: none;
  gap: 8px;
  margin: 22px 0 24px;
  padding-bottom: 2px;
}
nav.tabs button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
nav.tabs button:hover { border-color: var(--accent); color: var(--accent); }
nav.tabs button.active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #fff;
}

.card {
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2 { font-size: 1.25rem; font-weight: 600; color: var(--maroon); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card h2 { color: var(--accent); }
}

.card.hero {
  background: linear-gradient(135deg, var(--pink), var(--pink-soft));
  border-color: var(--border);
}
.hero-score { font-size: 3.2rem; font-weight: 600; color: var(--maroon); }
.card.hero .stat-label { font-size: 0.78rem; letter-spacing: 0.02em; }
.hero-summary { color: var(--text-primary); }

.stat {
  border-radius: 14px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--pink);
}
.stat-value { color: var(--maroon); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stat-value,
  :root:not([data-theme="light"]) .hero-score { color: var(--accent); }
}

input[type="range"] { accent-color: var(--maroon); }
.field select { border-radius: 10px; background: var(--pink-soft); }
.btn {
  border-radius: 999px;
  background: var(--pink-soft);
  border-color: var(--border);
  color: var(--maroon);
  font-weight: 500;
}
.btn:hover { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.field-title { color: var(--maroon); }

details.sql-drawer { border-radius: 12px; background: var(--pink-soft); }
details.sql-drawer summary { color: var(--accent); font-weight: 600; }

.driver-rank {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--pink); color: var(--maroon);
  display: grid; place-items: center; font-size: 0.9rem;
}
.driver a { color: var(--accent); font-weight: 500; }

.methodology a, footer.site a { color: var(--accent); }
footer.site { border-top-color: var(--border); }

.preset-row .btn {
  background: var(--surface);
  border: 1.5px solid var(--accent);
  color: var(--maroon);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
}
.preset-row .btn:hover { background: var(--maroon); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .preset-row .btn { color: var(--accent); }
  :root:not([data-theme="light"]) .preset-row .btn:hover { color: #fff; }
}

/* ===== Plain-language redesign ===== */
body { font-variant-numeric: tabular-nums; font-size: 16px; line-height: 1.5; }
.stat-value, .hero-score, .hero-deltas, .field-value, .driver-rank { font-family: inherit; }

input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--pink-soft);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
}
.h-sub { font-family: inherit; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-left: 6px; }

.presets { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.presets-label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 8px; }

.glance-summary { margin: 0 0 18px; font-size: 1.05rem; line-height: 1.55; color: var(--text-primary); max-width: 70ch; }
.signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.signal {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--pink-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.signal-head { display: flex; justify-content: space-between; align-items: center; }
.signal-title {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
}
.signal-headline {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem; font-weight: 600; line-height: 1.25; color: var(--maroon);
}
.signal-detail { font-size: 0.88rem; line-height: 1.5; color: var(--text-secondary); }
.signal-spark { height: 46px; width: 100%; }
.signal a { font-size: 0.82rem; color: var(--accent); font-weight: 600; text-decoration: none; margin-top: auto; }
.signal a:hover { text-decoration: underline; }

.consider {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin-top: 4px;
}
.consider-label {
  display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}
.consider .btn { margin-top: 10px; }

.lead { font-size: 1.05rem; margin: 0 0 12px; line-height: 1.5; }
table.kv { border-collapse: collapse; margin: 6px 0 14px; width: 100%; max-width: 640px; }
table.kv th, table.kv td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
table.kv th { color: var(--text-secondary); font-weight: 500; width: 46%; padding-right: 12px; }
table.kv td { font-weight: 600; }

.hero { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signal-headline { color: var(--text-primary); }
}

.eyebrow { font-family: inherit; font-weight: 600; letter-spacing: 0.1em; }

.stat-tag { white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 0.72rem; padding: 3px 10px; }
.signal-head { gap: 8px; flex-wrap: wrap; }

/* ===== Plaid background, gold stars, clearer steps ===== */
body {
  background-color: #fdf2f5;
  background-image:
    repeating-linear-gradient(90deg, rgba(107, 29, 46, 0.055) 0 44px, transparent 44px 132px),
    repeating-linear-gradient(0deg, rgba(107, 29, 46, 0.055) 0 44px, transparent 44px 132px),
    repeating-linear-gradient(90deg, transparent 0 62px, rgba(201, 162, 39, 0.28) 62px 63px, transparent 63px 132px),
    repeating-linear-gradient(0deg, transparent 0 62px, rgba(201, 162, 39, 0.28) 62px 63px, transparent 63px 132px),
    repeating-linear-gradient(90deg, transparent 0 88px, rgba(255, 255, 255, 0.55) 88px 90px, transparent 90px 132px),
    repeating-linear-gradient(0deg, transparent 0 88px, rgba(255, 255, 255, 0.55) 88px 90px, transparent 90px 132px);
  background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    background-color: #1a0a10;
    background-image:
      repeating-linear-gradient(90deg, rgba(240, 163, 184, 0.045) 0 44px, transparent 44px 132px),
      repeating-linear-gradient(0deg, rgba(240, 163, 184, 0.045) 0 44px, transparent 44px 132px),
      repeating-linear-gradient(90deg, transparent 0 62px, rgba(230, 196, 90, 0.18) 62px 63px, transparent 63px 132px),
      repeating-linear-gradient(0deg, transparent 0 62px, rgba(230, 196, 90, 0.18) 62px 63px, transparent 63px 132px);
  }
}
.masthead { border-bottom: 4px solid var(--gold); }
footer.site {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-top: 28px;
}
.loading { background: var(--surface); border-radius: 12px; padding: 14px 18px; }
nav.tabs button { box-shadow: 0 1px 2px rgba(107, 29, 46, 0.08); }

/* gold stars instead of bullets */
.methodology ul { list-style: none; padding-left: 0; }
.methodology li { position: relative; padding-left: 1.7em; margin-bottom: 8px; }
.methodology li::before { content: "★"; position: absolute; left: 0; top: 0; color: var(--gold); }
.consider-label::before { content: "★ "; color: var(--gold); }
.signal-title::before { content: "★ "; color: var(--gold); }

/* numbered steps on the profile card */
.step {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; margin-right: 6px;
  border-radius: 50%; background: var(--maroon); color: #fff;
  font-size: 0.7rem; font-weight: 700;
}
.field label .step, .field-title .step { vertical-align: 1px; }

.legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: 0.8rem; color: var(--text-secondary);
  margin: -6px 0 16px;
}
.legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; background: var(--dot);
}

/* ===== Today-vs-normal scale on each card ===== */
.gauge { margin: 4px 0 2px; }
.gauge-bar {
  position: relative; display: grid; grid-template-columns: 3fr 1fr 2fr;
  height: 10px; border-radius: 999px; overflow: visible; margin-top: 22px;
}
.gz:first-child { border-radius: 999px 0 0 999px; }
.gz:nth-child(3) { border-radius: 0 999px 999px 0; }
.gz.ok { background: var(--status-good); opacity: 0.75; }
.gz.warn { background: var(--status-warning); opacity: 0.85; }
.gz.bad { background: var(--status-critical); opacity: 0.8; }
.gauge-dot {
  position: absolute; top: 50%; width: 18px; height: 18px; margin-left: -9px; margin-top: -9px;
  border-radius: 50%; background: var(--surface); border: 4px solid var(--maroon-line);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.gauge-dot span {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 0.68rem; font-weight: 700; color: var(--maroon-line); white-space: nowrap;
}
.gauge-labels {
  display: grid; grid-template-columns: 3fr 1fr 2fr; margin-top: 5px;
  font-size: 0.68rem; color: var(--text-muted); text-align: center;
}
.signal-detail { font-size: 0.82rem; color: var(--text-muted); }

/* ===== Country picker ===== */
.field[hidden], select[hidden] { display: none; }
.country-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
#add-country {
  padding: 7px 12px; border-radius: 999px; border: 1.5px dashed var(--accent);
  background: var(--surface); color: var(--maroon); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.field label > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.remove {
  border: none; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.72rem; color: var(--text-muted); text-decoration: underline;
}
.remove:hover { color: var(--status-critical); }
.share-total { margin-top: 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #add-country { color: var(--accent); }
}

/* ===== Signal icons in the masthead corner ===== */
.masthead .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px;
}
.masthead .eyebrow, .masthead h1 { grid-column: 1 / -1; }
.masthead .sub { grid-column: 1; grid-row: 3; }
.corner-icons {
  grid-column: 2; grid-row: 3; align-self: center;
  display: flex; gap: 14px;
}
.corner-icons a { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; }
.ci {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pink); border: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.ci svg {
  width: 28px; height: 28px; fill: none; stroke: #6b1d2e;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.ci svg .wave { stroke: #c9a227; }
.cl { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; color: #f6c9d5; }
.corner-icons a:hover .ci { transform: translateY(-3px) rotate(-6deg); }
.corner-icons a:nth-child(2) .ci { animation: bob 3.2s ease-in-out infinite 0.4s; }
.corner-icons a:nth-child(1) .ci { animation: bob 3.2s ease-in-out infinite; }
.corner-icons a:nth-child(3) .ci { animation: bob 3.2s ease-in-out infinite 0.8s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@media (prefers-reduced-motion: reduce) { .ci { animation: none !important; } }
@media (max-width: 760px) {
  .masthead .wrap { display: block; }
  .corner-icons { margin-bottom: 14px; gap: 10px; }
  .ci { width: 40px; height: 40px; }
  .ci svg { width: 22px; height: 22px; }
}

/* ===== Header polish ===== */
.masthead {
  position: relative;
  overflow: hidden;
  padding: 40px 0 46px;
  border-bottom: none;
  background:
    radial-gradient(ellipse at 88% 10%, rgba(249, 217, 225, 0.28), transparent 50%),
    radial-gradient(ellipse at 0% 120%, rgba(201, 162, 39, 0.16), transparent 45%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 30px, transparent 30px 90px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 30px, transparent 30px 90px),
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(201, 162, 39, 0.12) 44px 45px, transparent 45px 90px),
    repeating-linear-gradient(0deg, transparent 0 44px, rgba(201, 162, 39, 0.12) 44px 45px, transparent 45px 90px),
    linear-gradient(135deg, #3d0e1a 0%, var(--maroon) 55%, #7d2a3d 100%);
}
/* gold double rule along the bottom edge */
.masthead::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9px;
  background:
    linear-gradient(var(--gold), var(--gold)) bottom / 100% 4px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top / 100% 1.5px no-repeat;
  opacity: 0.95;
}
.masthead .eyebrow span {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.6);
  background: rgba(255, 255, 255, 0.06);
  color: #f6d7df; font-size: 0.68rem;
}
.masthead .eyebrow span::before { content: "★"; color: var(--gold); font-size: 0.8rem; }
.masthead h1 {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.08;
  margin: 14px 0 14px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}
.masthead h1 em {
  font-style: italic; font-weight: 500;
  color: #f9d0dc;
}
.masthead .sub { font-size: 0.98rem; line-height: 1.6; color: #f3d3dc; max-width: 58ch; }
.corner-icons {
  padding: 14px 18px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(201, 162, 39, 0.45);
  backdrop-filter: blur(4px);
}
@media (max-width: 760px) {
  .corner-icons { display: inline-flex; padding: 10px 12px 8px; }
  .masthead { padding: 28px 0 34px; }
}

/* =====================================================================
   Candy pastel theme (Hope Macaulay–inspired colours).
   Previous looks are kept as git tags: theme-maroon-pink, theme-plaid.
   ===================================================================== */
:root {
  --maroon: #b8236f;
  --maroon-deep: #4a1d5c;
  --maroon-line: #4a1d5c;
  --pink: #ffd6ea;
  --pink-soft: #fff0f7;
  --bg: #fff8fb;
  --surface: #ffffff;
  --border: #f3d2e4;
  --text-primary: #33163f;
  --text-secondary: #654670;
  --text-muted: #957d9c;
  --accent: #c4277a;
  --gold: #f5b700;
  --lilac: #e4d4ff;
  --mint: #c9f2e0;
  --butter: #fff0a6;
  --sky: #d3ebff;
  --series-1: #c4277a;
  --series-2: #8a5cd6;
  --series-3: #1f9e7a;
  --shadow: 0 2px 4px rgba(74, 29, 92, 0.05), 0 10px 28px rgba(184, 35, 111, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --maroon: #ff8cc6;
    --maroon-line: #f7e6ff;
    --pink: #4a2347;
    --pink-soft: #2c1630;
    --bg: #1d1024;
    --surface: #27162e;
    --border: #47294f;
    --text-primary: #fbeefb;
    --text-secondary: #d9bfe0;
    --text-muted: #a68aae;
    --accent: #ff8cc6;
    --gold: #ffd54a;
    --lilac: #3a2a57;
    --mint: #1d3d34;
    --butter: #3d3518;
    --sky: #1d3247;
    --series-1: #ff8cc6;
    --series-2: #b997ff;
    --series-3: #5fd6b0;
  }
}

/* soft pink-and-lilac gingham */
body {
  background-color: #fff6fa;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 143, 199, 0.11) 0 36px, transparent 36px 72px),
    repeating-linear-gradient(0deg, rgba(185, 150, 245, 0.11) 0 36px, transparent 36px 72px);
  background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    background-color: #1d1024;
    background-image:
      repeating-linear-gradient(90deg, rgba(255, 140, 198, 0.05) 0 36px, transparent 36px 72px),
      repeating-linear-gradient(0deg, rgba(185, 150, 245, 0.05) 0 36px, transparent 36px 72px);
  }
}

/* header: candy gradient with a knit-stripe edge */
.masthead {
  background:
    radial-gradient(ellipse at 85% 0%, rgba(255, 255, 255, 0.7), transparent 45%),
    radial-gradient(ellipse at 10% 110%, rgba(255, 240, 166, 0.7), transparent 45%),
    linear-gradient(115deg, #ffbfdd 0%, #e6cfff 42%, #cde9ff 72%, #c9f2e0 100%);
  color: var(--text-primary);
}
.masthead::after {
  height: 8px;
  background: linear-gradient(90deg,
    #ff8fc7 0 20%, #ffd84d 20% 40%, #7fdcb3 40% 60%, #7cc4ff 60% 80%, #b896f5 80% 100%);
  opacity: 1;
}
.masthead .eyebrow span {
  border-color: rgba(74, 29, 92, 0.18);
  background: rgba(255, 255, 255, 0.6);
  color: #4a1d5c;
}
.masthead h1 { color: #33163f; text-shadow: none; }
.masthead h1 em { color: #c4277a; }
.masthead .sub { color: #4d2c57; }
.corner-icons { background: rgba(255, 255, 255, 0.55); border: 1.5px solid #fff; box-shadow: 0 6px 20px rgba(74, 29, 92, 0.1); }
.ci { border: 2.5px solid #fff; box-shadow: 0 3px 10px rgba(74, 29, 92, 0.15); }
.corner-icons a:nth-child(1) .ci { background: var(--mint); }
.corner-icons a:nth-child(2) .ci { background: var(--butter); }
.corner-icons a:nth-child(3) .ci { background: var(--lilac); }
.ci svg { stroke: #4a1d5c; }
.ci svg .wave { stroke: #3d9be0; }
.cl { color: #4a1d5c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .masthead {
    background:
      radial-gradient(ellipse at 85% 0%, rgba(255, 140, 198, 0.25), transparent 45%),
      linear-gradient(115deg, #5a2348 0%, #3d2a5c 50%, #1f3a4f 100%);
  }
  :root:not([data-theme="light"]) .masthead h1,
  :root:not([data-theme="light"]) .masthead .sub,
  :root:not([data-theme="light"]) .masthead .eyebrow span,
  :root:not([data-theme="light"]) .cl { color: #fbeefb; }
  :root:not([data-theme="light"]) .masthead h1 em { color: #ff8cc6; }
  :root:not([data-theme="light"]) .corner-icons,
  :root:not([data-theme="light"]) .masthead .eyebrow span { background: rgba(255, 255, 255, 0.08); }
  :root:not([data-theme="light"]) .ci svg { stroke: #f7e6ff; }
}

/* chunkier, rounder cards */
.card { border-radius: 24px; border-color: var(--border); }
.signal { border-radius: 20px; border: none; }
.signal:nth-child(1) { background: #effbf5; }
.signal:nth-child(2) { background: #fffbe8; }
.signal:nth-child(3) { background: #f6f0ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signal:nth-child(1) { background: #1d3530; }
  :root:not([data-theme="light"]) .signal:nth-child(2) { background: #35301c; }
  :root:not([data-theme="light"]) .signal:nth-child(3) { background: #2e2445; }
}
.consider { border-left-color: var(--accent); border-radius: 12px; }
nav.tabs button { border-color: var(--border); }
nav.tabs button.active { background: var(--accent); border-color: var(--accent); }
.btn:hover, .preset-row .btn:hover { background: var(--accent); border-color: var(--accent); }
.step { background: var(--accent); }
details.sql-drawer { background: var(--pink-soft); }
.field select, input[type="number"] { background: var(--pink-soft); color: var(--text-primary); border-color: var(--border); }
.field select option, .field select optgroup { background: var(--surface); color: var(--text-primary); }

/* small signal icons used on cards, tabs and headings */
.mini-ic {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%; margin-right: 7px; vertical-align: -6px;
  border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(74, 29, 92, 0.15);
}
.mini-ic svg {
  width: 15px; height: 15px; fill: none; stroke: #4a1d5c;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.mini-ic svg .wave { stroke: #3d9be0; }
.ic-freight { background: var(--mint); }
.ic-currency { background: var(--butter); }
.ic-origin { background: var(--lilac); }
.signal-title { display: inline-flex; align-items: center; }
.signal-title::before { content: none; }
.card h2 .mini-ic { width: 30px; height: 30px; vertical-align: -7px; }
.card h2 .mini-ic svg { width: 18px; height: 18px; }
nav.tabs button { display: inline-flex; align-items: center; }
nav.tabs button .mini-ic { width: 20px; height: 20px; margin-right: 6px; }
nav.tabs button .mini-ic svg { width: 13px; height: 13px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mini-ic svg { stroke: #f7e6ff; }
  :root:not([data-theme="light"]) .mini-ic { border-color: rgba(255, 255, 255, 0.3); }
}

.consider.clear { border-left-color: var(--status-good); }
.consider.clear .consider-label { color: var(--status-good); }

/* ===== Time-window controls ===== */
.range {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin: 4px 0 6px;
}
.range-quick { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--pink-soft); border: 1px solid var(--border); }
.chip {
  border: none; background: none; cursor: pointer;
  padding: 5px 12px; border-radius: 999px;
  font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
}
.chip:hover { color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; }
.range-custom { display: inline-flex; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-secondary); }
.range-custom label { display: inline-flex; align-items: center; gap: 6px; }
.range-custom input[type="date"] {
  font: inherit; font-size: 0.8rem; color: var(--text-primary);
  padding: 4px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
}
.range-label { flex-basis: 100%; font-size: 0.76rem; color: var(--text-muted); }

/* link to the README in the header */
.masthead .readme-link {
  grid-column: 1; justify-self: start;
  display: inline-block; margin-top: 16px;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.65); border: 1.5px solid #fff;
  color: #4a1d5c; font-size: 0.85rem; font-weight: 700; text-decoration: none;
  box-shadow: 0 3px 10px rgba(74, 29, 92, 0.1);
}
.masthead .readme-link:hover { background: #fff; color: #c4277a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .masthead .readme-link { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); color: #fbeefb; }
}
