:root {
  color-scheme: light dark;
  --ink: #172944;
  --muted: #4c627b;
  --background: #eaf1f9;
  --paper: #f4f8fd;
  --panel: #fff;
  --line: #cbd9e8;
  --blue: #224e80;
  --on-blue: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7effc;
    --muted: #b3c5df;
    --background: #090f1d;
    --paper: #0e182b;
    --panel: #192638;
    --line: #3b4c65;
    --blue: #bbd5ff;
    --on-blue: #122442;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; padding: 18px 12px 30px; color: var(--ink); background: var(--background); font: 15px/1.5 system-ui, sans-serif; }
.shell { width: min(100%, 400px); margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; }
.brand-header { display: flex; align-items: center; gap: 9px; padding: 16px 19px; font-size: 17px; font-weight: 700; }
.brand-mark { font-size: 19px; line-height: 1; }
.app-brand { font-size: 21px; }
.app-brand .brand-mark { font-size: 24px; }
.view { padding: 18px; }
h1, h2, p { margin: 0; }
a { color: var(--blue); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.forecast {
  --blue: #224e80;
  --muted: #3d4b60;
  --line: #17294433;
  color: #172944;
  background: #ffda68 linear-gradient(135deg, #f8e59c 0%, #ffdc63 40%, #ffc14b 72%, #eda02e 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.forecast-body { padding: 16px; }
.forecast-heading { color: var(--muted); font-size: 14px; font-weight: 550; }
.date { font-size: 19px; font-weight: 700; }
.date:empty { display: none; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.metric + .metric { border-left: 1px solid var(--line); padding-left: 11px; }
.label, .note, .forecast-meta { color: var(--muted); font-size: 13px; }
.forecast .label, .forecast-meta { font-size: 14px; }
.forecast .quality-label.has-rating { color: inherit; font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.value { display: block; font-size: clamp(29px, 8.8vw, 35px); font-weight: 660; line-height: 1.2; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.scale { font-size: clamp(13px, 3.8vw, 15px); font-weight: 600; letter-spacing: 0; }
.forecast-notes { border-top: 1px solid var(--line); margin-top: 11px; padding-top: 9px; }

.alerts-summary { margin-top: 20px; }
.alert-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.alert-heading h2 { font-size: 17px; }
.alert-state { color: var(--blue); font-size: 13px; font-weight: 650; }
.alert-details { display: grid; grid-template-columns: minmax(max-content, .8fr) minmax(0, 1.35fr); gap: 6px 8px; align-items: baseline; margin: 9px 0; padding: 9px 0; border-block: 1px solid var(--line); }
.alert-details dt { color: var(--muted); font-size: 13px; }
.alert-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 570; }
.alerts-summary .note { margin: 6px 0 9px; }
.note:empty { display: none; }

button, .button { display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: 600 14px/1.25 system-ui, sans-serif; text-decoration: none; cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
.primary { color: var(--on-blue); background: var(--blue); border-color: var(--blue); }
.quiet { padding-inline: 0; background: transparent; border-color: transparent; color: var(--blue); }
.quiet:hover { text-decoration: underline; }
.settings-title { margin: 3px 0 15px; font-size: 23px; letter-spacing: -.025em; }
.fields, .days { border: 0; padding: 0; margin: 0; min-width: 0; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: baseline; gap: 4px 8px; }
.choices label, .days legend { font-size: 13px; font-weight: 600; }
.choices select, .choices input { display: block; align-self: start; width: 100%; height: 44px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--panel); color: var(--ink); font: 16px/1.25 system-ui, sans-serif; }
.lead-control { position: relative; align-self: start; }
.lead-control select { appearance: none; padding-inline-end: 18px; }
.lead-control::after { content: ''; position: absolute; top: 50%; inset-inline-end: 8px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.days { margin-top: 13px; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.weekdays label { min-height: 44px; display: grid; place-content: center; justify-items: center; gap: 3px; font-size: 12px; cursor: pointer; }
.weekdays input { margin: 0; accent-color: var(--blue); }
.alert-actions { display: flex; gap: 8px; margin-top: 10px; }
.notification-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.notification-links > button { justify-content: center; text-align: center; }
.notification-links > a { justify-self: start; }
.alert-actions > button { flex: 1; min-width: 0; justify-content: center; }
.alert-view .note { margin-top: 7px; }
.notification-tools { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 10px; }
.notification-tools h2 { font-size: 16px; }
.notification-tools .notification-links { margin-top: 3px; }

.guide { width: min(100%, 560px); }
.guide .view { padding: 20px; }
.guide h1 { font-size: 25px; letter-spacing: -.03em; }
.guide h2 { margin: 24px 0 8px; font-size: 18px; }
.guide p { margin: 10px 0; }
.guide details { padding: 8px 0; border-bottom: 1px solid var(--line); }
.guide summary { padding: 8px 0; font-weight: 600; cursor: pointer; }
.guide ol { padding-left: 24px; }
.guide li { margin: 8px 0; }
.guide code { overflow-wrap: anywhere; }

@media (max-width: 350px) {
  .view { padding: 13px; }
  .forecast-body { padding: 12px; }
  .weekdays label { font-size: 11px; }
}
