/* ════════════════════════════════════════════════════════════════════
   CANVASS PRO · alerts.css   (window.Alerts · the daily digest)
   The Fuel surface: a topbar bell with an unread badge and a right-docked,
   hairline-ruled digest panel. Catastrophic-weather rows lead, then the
   money + retention nudges.

   TOKENS ONLY. Every color, space, radius, and motion value is a CSS
   variable from /assets/tokens.css. The field-language colors (disposition
   and storm/type) are NEVER written here; they arrive inline from alerts.js
   via style="--c:..." / style="color:..." and are read with var(--c). Ember
   touches money, weather-money, trust, and earned progress only. No
   em-dashes anywhere.
   ════════════════════════════════════════════════════════════════════ */

/* ── the topbar bell + unread badge ──────────────────────────────── */
.al-bell {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--graphite);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  color: var(--plat-dim);
  cursor: pointer;
  box-shadow: var(--e1), var(--e-inset);
  transition: color var(--m-fast) var(--ease), border-color var(--m-fast) var(--ease),
    background var(--m-fast) var(--ease), box-shadow var(--m-fast) var(--ease), transform var(--m-press) var(--ease-spring);
}
.al-bell:hover { color: var(--platinum); border-color: var(--line-hi); background: var(--graphite-3); box-shadow: var(--e2), var(--e-inset); }
.al-bell:active { transform: translateY(1px) scale(.99); box-shadow: var(--e-press); }
.al-bell:focus-visible { outline: none; box-shadow: var(--ring-ember), var(--e-inset); }
.al-bell svg { display: block; }
@media (prefers-reduced-motion: reduce) { .al-bell:active { transform: none; } }

/* the count badge: ember only because an unread alert is money or weather
   waiting (the daily-open trigger). Tabular mono so two digits sit square. */
.al-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 500; line-height: 1;
  letter-spacing: .02em;
  color: var(--ember-ink);
  background: var(--grad-ember);
  border: 1px solid var(--obsidian);
  border-radius: var(--r-pill);
  box-shadow: var(--e1);
}

/* ── the digest panel · right-docked, ruled, milled ──────────────── */
.al-panel {
  position: fixed; right: 22px; top: 64px;
  width: min(400px, calc(100vw - 32px));
  max-height: min(78vh, 660px); overflow-y: auto;
  background: var(--graphite);
  border: 1px solid var(--line-hi);
  border-radius: var(--r-card-lg);
  z-index: 1200;
  padding: 16px 18px max(16px, env(safe-area-inset-bottom));
  box-shadow: var(--e3), var(--e-inset);
  animation: sheetUp 240ms var(--ease-exit);
}
@media (max-width: 720px) {
  .al-panel {
    left: 0; right: 0; top: auto; bottom: 0;
    width: 100%;
    border-radius: var(--r-card-lg) var(--r-card-lg) 0 0;
    max-height: 82dvh;
  }
}

/* the panel header carries the catastrophic-weather headline (the reason to
   open it at 7am): a real figure read, not a title bar. */
.al-panel-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding-bottom: 14px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.al-ico-bell {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: var(--ember);
  background: var(--tint-ember);
  border: 1px solid color-mix(in srgb, var(--ember) 40%, var(--line));
  border-radius: var(--r-control);
}
.al-panel-head .grow { min-width: 0; }
.al-panel-head strong {
  display: block;
  font-size: 14.5px; font-weight: 650; letter-spacing: -.01em;
  line-height: 1.3;
  color: var(--platinum);
}
.al-headsub { margin-top: 5px; color: var(--plat-faint); }

/* close affordance reuses the sheet-x footprint already in app.css; this only
   tightens the glyph stroke if alerts.css loads standalone */
.al-panel .sheet-x { display: inline-flex; align-items: center; justify-content: center; }

/* ── the window control (kept consistent with the Storm Finder) ──── */
.al-controls { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.al-date { display: flex; align-items: center; gap: 10px; }
.al-date .mono-cap { flex-shrink: 0; }
.al-date input[type="date"] {
  flex: 1; min-width: 0;
  color-scheme: dark;
  background: var(--graphite-2);
  border: 1px solid var(--line-hi);
  border-radius: var(--r-control);
  color: var(--platinum);
  font: 500 14px var(--body);
  padding: 9px 11px;
  box-shadow: var(--e1), var(--e-inset);
  transition: border-color var(--m-fast) var(--ease), box-shadow var(--m-fast) var(--ease);
}
@media (prefers-color-scheme: light) { .al-date input[type="date"] { color-scheme: light; } }
.al-date input[type="date"]:focus { outline: none; border-color: var(--ember); box-shadow: var(--ring-ember), var(--e-inset); }
.al-winchips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── the alert rows · each a liftable digest card ─────────────────── */
.al-list { display: flex; flex-direction: column; gap: var(--s-2); }
.al-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  grid-template-areas: "ico body act" "ico when act";
  align-items: center;
  column-gap: 11px; row-gap: 1px;
  padding: 12px 14px;
  background: var(--graphite);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--e2), var(--e-inset);
  transition: background var(--m-fast) var(--ease), border-color var(--m-fast) var(--ease), box-shadow var(--m-fast) var(--ease);
}
.al-row:hover { border-color: var(--line-hi); box-shadow: var(--e2), var(--e-inset); }

/* the state dot/glyph wears the row color (storm type, disposition, ember) */
.al-ico {
  grid-area: ico;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
}
.al-ico svg { display: block; }

.al-body { grid-area: body; min-width: 0; align-self: center; }
.al-row .al-when { grid-area: when; }
/* when there is no "when" line, let the body span both rows */
.al-row:not(:has(.al-when:not(:empty))) .al-body { grid-row: 1 / 3; }

.al-head {
  display: block;
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
  color: var(--platinum);
  letter-spacing: -.005em;
}
.al-sub { display: block; margin-top: 3px; color: var(--plat-dim); letter-spacing: .04em; }
.al-when {
  align-self: start;
  font-size: 10px; letter-spacing: .04em;
  color: var(--plat-faint);
  margin-top: 2px;
}
.al-when:empty { display: none; }

/* the row action sits right; gold only when it moves money or weather-money
   (route the storm, open the set, hit the hot door, close the rank gap). */
.al-act {
  grid-area: act; align-self: center;
  white-space: nowrap;
  min-height: 32px; padding: 0 12px;
  font: 600 12px var(--body);
  color: var(--plat-dim);
  background: var(--graphite-2);
  border: 1px solid var(--line-hi);
  border-radius: var(--r-control);
  cursor: pointer;
  box-shadow: var(--e1), var(--e-inset);
  transition: color var(--m-fast) var(--ease), border-color var(--m-fast) var(--ease),
    background var(--m-fast) var(--ease), box-shadow var(--m-fast) var(--ease), transform var(--m-press) var(--ease-spring);
}
.al-act:hover { color: var(--platinum); background: var(--graphite-3); box-shadow: var(--e2), var(--e-inset); }
.al-act:active { transform: translateY(1px) scale(.99); box-shadow: var(--e-press); }
.al-act.gold {
  color: var(--ember-ink);
  background: var(--grad-ember);
  border: none;
  font-weight: 700;
  box-shadow: var(--e2);
}
.al-act.gold:hover { background: var(--ember-hi); box-shadow: var(--e3); }
.al-act:focus-visible { outline: none; box-shadow: var(--ring-ember), var(--e-inset); }
@media (prefers-reduced-motion: reduce) { .al-act:active { transform: none; } }

/* a hairline accent on the left edge of each card, in the card's own color,
   so the digest reads as a colored ledger at a glance (field-language read) */
.al-row { position: relative; }
.al-row::before {
  content: "";
  position: absolute; left: 5px; top: 10px; bottom: 10px;
  width: 2px; border-radius: var(--r-pill);
  background: var(--c, var(--line-hi));
  opacity: .7;
}

/* ── empty + foot ────────────────────────────────────────────────── */
.al-empty {
  padding: 22px 2px;
  font-size: 13px; line-height: 1.55;
  color: var(--plat-dim);
}
.al-foot {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--plat-faint); line-height: 1.5;
}

/* the one scripted moment is the panel entrance (sheetUp, already in app.css).
   honor reduced motion: drop the slide. */
@media (prefers-reduced-motion: reduce) {
  .al-panel { animation: none; }
}
