/* Scheduled reports — FR-REP-06.
 *
 * Plain CSS, no framework, matching the other apps in this tree. Dark
 * mode follows the operator's system setting: this screen is used at a
 * desk late in the evening more often than at midday.
 */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --bad: #b91c1c;
  --good: #0a7d32;
  --panel: #f8fafc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --fg: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
    --panel: #111b2e;
  }
}

* { box-sizing: border-box; }

body {
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0 auto;
  max-width: 68rem;
  padding: 1.5rem 1rem 4rem;
}

h1 { font-size: 1.35rem; margin: 0 0 0.2rem; }
h2 { font-size: 1rem; margin: 0 0 0.6rem; }
.lede, .note { color: var(--muted); font-size: 13px; }
.lede { margin-top: 0; }
.note { margin: 0.5rem 0 0; }
code { font-size: 12px; }

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

label { display: block; margin: 0.35rem 0; font-size: 13px; }
/* `display: block` above beats the `hidden` attribute's own
   `display: none`, so the weekday and day-of-month fields stayed on
   screen for every frequency. Caught by looking at the page rather than
   by reading the JavaScript, which was setting `hidden` correctly. */
[hidden] { display: none !important; }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}

.form {
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.form .wide { grid-column: 1 / -1; }

button {
  font: inherit;
  padding: 0.3rem 0.7rem;
  margin: 0.5rem 0.4rem 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }

.status { font-size: 13px; color: var(--muted); margin: 0.5rem 0; }
.status.bad { color: var(--bad); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
/* A disabled schedule is dimmed, never hidden: a report that is not
   going out should be visible as a decision rather than as an absence. */
.list li.off { opacity: 0.55; }
.list .kind { font-weight: 600; }
.list .subject { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.list .rule, .list .next, .list .who { color: var(--muted); font-size: 12px; }
.list .err { color: var(--bad); font-size: 12px; flex-basis: 100%; }
.list .actions { margin-left: auto; }
.empty { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--line);
}
th { color: var(--muted); font-weight: 600; }
tr.delivered td:nth-child(2) { color: var(--good); }
tr.failed td:nth-child(2) { color: var(--bad); }
tr.skipped td:nth-child(2) { color: var(--muted); }
