:root {
  --bg: #12151a;
  --card: #1b1f27;
  --line: #2c323d;
  --text: #e8ecf1;
  --muted: #98a2b3;
  --accent: #2f6fd0;   /* white text on this passes AA */
  --danger: #ff6b6b;
  --warn: #ffc046;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fa; --card: #fff; --line: #dde3ec;
    --text: #16191f; --muted: #5c6779; --accent: #1f6feb;
    /* Must be redefined: the dark values are ~1.6:1 on white, so the "system
       is down" warning was invisible in daylight — on a phone, outdoors,
       which is exactly when it matters. */
    --warn: #8a5a00;
    --danger: #c02626;
  }
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win. Any author `display:` rule (.active-banner
   is flex, label is flex) silently beats the UA's [hidden]{display:none},
   which shipped an empty "override active" banner on every page load and left
   the Amps field visible for Pause. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  margin: 0;
  padding: 1rem;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 46rem;
  margin-inline: auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 { font-size: 1.3rem; margin: 0.5rem 0; }
h2 { font-size: 1rem; margin: 0 0 0.5rem; text-transform: uppercase;
     letter-spacing: 0.05em; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
}
.label { display: block; font-size: 0.8rem; color: var(--muted); }
.big { font-size: 1.4rem; font-variant-numeric: tabular-nums; }

.row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}
label { display: flex; flex-direction: column; gap: 0.25rem;
        font-size: 0.8rem; color: var(--muted); }

select, input {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  min-width: 7rem;
}

button {
  font: inherit;
  min-height: 44px;        /* touch target floor; .small shrinks padding only */
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent);
                 color: #fff; font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--line); }
button.small { padding: 0.25rem 0.7rem; font-size: 0.85rem; }

.active-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.6rem 0.8rem; margin-bottom: 0.75rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid var(--accent);
  font-weight: 600;
}

.list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.5rem 0; border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

/* Marks a list row the page cannot act on — a config-declared scheduled load.
   It sits where the Release button would be, so the rows still line up. */
.badge {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted);
}

.head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; flex-wrap: wrap;
}
h3.sub { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
         color: var(--muted); margin: 1.25rem 0 0.25rem; }

.search { width: 100%; margin: 0.5rem 0 0.75rem; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.6rem;
}
.preset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.preset.adjusting { border-color: var(--accent); }
.preset-name { font-weight: 600; }
.preset-meta { font-size: 0.8rem; color: var(--muted);
               font-variant-numeric: tabular-nums; }
.preset-actions { display: flex; gap: 0.4rem; margin-top: auto; }
.preset-actions button { flex: 1; }
.preset-edit { display: flex; gap: 0.4rem; }
.preset-edit label { flex: 1; font-size: 0.7rem; }
.preset-edit input { min-width: 0; width: 100%; padding: 0.3rem 0.4rem; }

#oneoff { margin-top: 1rem; }
#oneoff summary { cursor: pointer; padding: 0.35rem 0; }
#oneoff .row { margin-top: 0.5rem; }

.list.editor li { flex-wrap: wrap; }
.list.editor input[type="text"] { min-width: 6rem; }
.list.editor input[type="number"] { width: 5.5rem; min-width: 0; }
.list.editor .grow { flex: 1; }
label.check { flex-direction: row; align-items: center; gap: 0.4rem; }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.warn  { color: var(--warn); }
footer { margin: 2rem 0 1rem; font-size: 0.8rem; }
code { background: var(--card); padding: 0.1em 0.35em; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
