:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --line: #deded8;
  --accent: #2557a7;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ea;
  --ok-text: #1e5b2f;
  --err-bg: #fbe9e7;
  --err-text: #8a1c11;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --card: #20201f;
    --text: #ececea;
    --muted: #a3a39d;
    --line: #3a3a37;
    --accent: #7aa7f0;
    --accent-text: #0d1a30;
    --ok-bg: #173622;
    --ok-text: #a8dcb5;
    --err-bg: #3d1a15;
    --err-text: #f3b4aa;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.top .brand { font-weight: 600; color: var(--text); text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.top nav form { margin: 0; }
main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
.muted { color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.narrow { max-width: 420px; margin: 2rem auto; }
form.stack { display: grid; gap: 0.9rem; }
.grid2 { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: grid; gap: 0.3rem; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; margin: 0; }
fieldset label { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1rem; font-weight: 400; }
legend { font-weight: 500; padding: 0 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
button {
  font: inherit;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  justify-self: start;
}
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 0.9rem; }
td form { margin: 0; }
.badge { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 99px; background: var(--line); }
.badge.paused { background: var(--err-bg); color: var(--err-text); }
.flash { padding: 0.75rem 1rem; border-radius: 8px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.error { background: var(--err-bg); color: var(--err-text); }
.secret { font: 600 1.2rem ui-monospace, Menlo, monospace; letter-spacing: 0.05em; }

/* Operator page */
h2.first { margin-top: 0; }
.meter { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 1rem 0 0.75rem; }
.meter div { height: 100%; width: 0; background: var(--muted); transition: width 60ms linear; }
.meter div.good { background: #2e9d4f; }
.meter div.hot { background: #d0402b; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1rem; }
.timer { font: 600 1.1rem ui-monospace, Menlo, monospace; margin: 0 0.5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; margin-left: 0.5rem; }
.dot.ok { background: #2e9d4f; }
.dot.wait { background: #e0a526; }
.dot.down { background: #d0402b; }
.preview { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 1rem; }
.pane-title { font-weight: 600; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.4rem; }
.pane-text { height: 14rem; overflow-y: auto; white-space: pre-wrap; font-size: 1.05rem; }
.pane-text .pending { color: var(--muted); }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.95em; }
.level-note { min-height: 1.5em; margin: 0 0 0.5rem; color: var(--err-text); font-weight: 500; }
.card.links { display: flex; gap: 1.5rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.card.links p { margin: 0 0 0.6rem; }
.qr-small { width: 150px; flex: none; background: #fff; border-radius: 8px; }
.qr-small svg { display: block; width: 100%; height: auto; }
textarea { font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); width: 100%; }
details.sermon { margin-top: 1rem; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 1rem; }
details.sermon summary { cursor: pointer; font-weight: 500; }
details.sermon[open] summary { margin-bottom: 0.8rem; }
details.sermon > label { margin-top: 0.9rem; }
.history-text { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.history-text h3 { margin: 0 0 0.6rem; font-size: 1rem; color: var(--muted); }
.transcript { white-space: pre-wrap; line-height: 1.6; max-height: 70vh; overflow-y: auto; }
input[readonly], textarea[readonly] { opacity: 0.8; }
.keeping { color: #d0402b; font-weight: 600; margin-left: 0.8rem; }
.no-sound { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.5rem 0 0; padding: 0.5rem 0.8rem; border-radius: 6px; background: #c0392b; color: #fff; font-weight: 600; }
.no-sound button.small { padding: 0.3rem 0.8rem; background: #fff; color: #c0392b; font-weight: 600; }
