/* Alerts (public/pages/alerts.js). Tokens only. */

/* Glance: push, email, quiet hours. */
.alerts-glance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.alerts-tile { display: grid; gap: var(--s-3); align-content: start; }
.alerts-tile .eyebrow { margin: 0; }
.alerts-tile-figure { margin: 0; color: var(--text); font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; line-height: var(--lh-xl); font-variant-numeric: tabular-nums; }
.alerts-tile-figure span { color: var(--text-3); font-size: var(--fs-sm); font-weight: 450; letter-spacing: 0; }
.alerts-tile-line { margin: 0; overflow-wrap: anywhere; }
/* Slots: one cell per device (or alert type), filled when on. */
.alerts-slots { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--s-1); }
.alerts-slots.is-types { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.alerts-slots span { height: 16px; border: 1px dashed var(--line-input); border-radius: var(--r-xs); }
.alerts-slots span[data-on] { border: 0; background: var(--chart-1); }

/* The 24-hour band. */
.alerts-band { display: grid; gap: var(--s-1); }
.alerts-band-track { position: relative; height: 16px; overflow: hidden; border-radius: var(--r-xs); background: var(--seq-0); }
.alerts-band-track::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent calc(25% - 0.5px), var(--line) calc(25% - 0.5px), var(--line) calc(25% + 0.5px), transparent calc(25% + 0.5px), transparent calc(50% - 0.5px), var(--line) calc(50% - 0.5px), var(--line) calc(50% + 0.5px), transparent calc(50% + 0.5px), transparent calc(75% - 0.5px), var(--line) calc(75% - 0.5px), var(--line) calc(75% + 0.5px), transparent calc(75% + 0.5px)); }
.alerts-band-quiet { position: absolute; top: 0; bottom: 0; left: calc(var(--from) * 100%); width: calc((var(--to) - var(--from)) * 100%); background: color-mix(in srgb, var(--chart-1) 60%, transparent); }
.alerts-band-now { position: absolute; top: 0; bottom: 0; left: calc(var(--at) * 100%); width: 2px; margin-left: -1px; background: var(--text); }
.alerts-band-axis { display: flex; justify-content: space-between; color: var(--chart-axis); font-size: var(--fs-xs); line-height: var(--lh-xs); font-variant-numeric: tabular-nums; }

/* Settings next to devices and email. */
.alerts-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gutter); align-items: start; }
.alerts-side { display: grid; gap: var(--gutter); min-width: 0; }
.alerts-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-4); }
.alerts-panel-head .ui-panel-title { margin: 0; }
.alerts-settings { display: grid; gap: var(--s-6); }
.alerts-settings .alerts-panel-head { margin: 0; }

/* Types × channels. */
.alerts-matrix { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.alerts-matrix caption { padding-bottom: var(--s-3); color: var(--text-3); text-align: left; }
.alerts-matrix thead th { padding: 0 0 var(--s-2); border-bottom: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; line-height: var(--lh-xs); text-align: center; text-transform: uppercase; white-space: nowrap; }
.alerts-matrix thead th:first-child { text-align: left; }
.alerts-matrix thead .icon { display: inline-block; vertical-align: -3px; }
.alerts-matrix tbody th, .alerts-matrix td { padding: var(--s-3) 0; border-bottom: 1px solid var(--line-subtle); vertical-align: top; }
.alerts-matrix tbody tr:last-child > * { border-bottom: 0; }
.alerts-matrix tbody th { padding-right: var(--s-4); font-weight: 450; text-align: left; }
.alerts-matrix tbody th strong { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); color: var(--text); font-weight: 600; }
.alerts-matrix tbody th .hint { max-width: 56ch; margin: var(--s-1) 0 0; }
.alerts-matrix td { width: 5.5rem; text-align: center; }

/* Switches (checkbox role=switch). */
.alerts-switch { display: inline-flex; align-items: center; gap: var(--s-3); margin: 0; cursor: pointer; }
.alerts-switch input {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: var(--sunken);
  appearance: none;
  transition: background var(--t-micro) var(--ease-move), border-color var(--t-micro) var(--ease-move);
}
.alerts-switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--r-full);
  background: var(--text-2);
  transition: transform var(--t-micro) var(--ease-move), background var(--t-micro) var(--ease-move);
}
.alerts-switch input:checked { border-color: var(--accent); background: var(--accent); }
.alerts-switch input:checked::after { background: var(--accent-ink); transform: translateX(16px); }
.alerts-switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.alerts-switch input:disabled { cursor: not-allowed; opacity: 0.5; }
.alerts-matrix .alerts-switch { min-height: 32px; }
.alerts-switch-text { font-weight: 500; }

/* Quiet hours. */
.alerts-quiet { display: grid; gap: var(--s-4); min-width: 0; margin: 0; padding: var(--s-5) 0 0; border: 0; border-top: 1px solid var(--line); }
.alerts-quiet legend { float: left; width: 100%; margin-bottom: var(--s-4); padding: 0; color: var(--text); font-size: var(--fs-md); font-weight: 600; }
.alerts-quiet legend + * { clear: both; }
.alerts-quiet-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 var(--s-4); }
.alerts-quiet-grid label { margin-top: 0; }
.alerts-quiet .hint { margin: 0; }
.alerts-settings > .button-row, .alerts-settings > .field-error { margin: 0; }

/* Device and workspace rows. */
.alerts-list { display: grid; margin: 0; padding: 0; list-style: none; }
.alerts-list.ui-panel { padding-block: var(--s-1); }
.alerts-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: 1px solid var(--line-subtle); }
.alerts-row:first-child { border-top: 0; }
.alerts-row[data-off="true"] { color: var(--text-2); }
.alerts-row-glyph { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text-2); }
.alerts-row-glyph.is-ring { border: 0; }
.alerts-row-text { display: grid; gap: 2px; min-width: 0; }
.alerts-row-text strong { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.alerts-row-text .small { overflow-wrap: anywhere; }
.alerts-here-tag { padding: 0 var(--s-2); border-radius: var(--r-xs); background: var(--neutral-soft); color: var(--text-2); font-size: var(--fs-xs); font-weight: 550; line-height: 20px; }
.alerts-row-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.alerts-here > p { margin: 0 0 var(--s-3); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.alerts-here > label { margin-top: 0; }
.alerts-inline { display: flex; gap: var(--s-2); align-items: center; }
.alerts-inline input { flex: 1 1 auto; }
.alerts-inline button { flex: none; }
.alerts-email > p, .alerts-verify > p { margin: 0 0 var(--s-3); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.alerts-verify ol { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.alerts-email > .button-row { margin-top: var(--s-2); }
.alerts-email .callout { margin: 0 0 var(--s-3); }
.alerts-verify ol { margin: 0 0 var(--s-3); padding-left: var(--s-5); color: var(--text-2); }
.alerts-failure { color: var(--danger); overflow-wrap: anywhere; }
.alerts-side .ui-disclosure { margin: 0; }
.alerts-ios { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }

@media (max-width: 1199px) {
  .alerts-layout { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .alerts-glance { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .alerts-quiet-grid { grid-template-columns: 1fr 1fr; }
  .alerts-quiet-grid > :first-child { grid-column: 1 / -1; margin-bottom: var(--s-3); }
  .alerts-matrix td { width: 4rem; }
  .alerts-inline { flex-direction: column; align-items: stretch; }
  .alerts-row { grid-template-columns: 32px minmax(0, 1fr); }
  .alerts-row-end { grid-column: 2; justify-content: flex-start; }
}
/* Touch: switches grow to a 44×28 target; the thumb scales with the track (22px, travels 16px). */
@media (pointer: coarse) {
  .alerts-switch input { width: 44px; height: 28px; }
  .alerts-switch input::after { width: 22px; height: 22px; }
  .alerts-switch input:checked::after { transform: translateX(16px); }
  /* The label is what a finger lands on, so the row, not just the track, reaches 44px. */
  .alerts-switch, .alerts-matrix .alerts-switch { min-height: 44px; }
}
