:root {
  --bg: #f6f4f1;
  --card: #ffffff;
  --text: #1d1b19;
  --muted: #6b665f;
  --line: #e2ddd5;
  --accent: #8a2b1d;          /* redwood */
  --accent-text: #ffffff;
  --ready: #c98a12;
  --claimed: #2f6fb3;
  --claimed-text: #245a92;
  --published: #3d7d2c;
  --published-text: #33692a;
  --error: #b3261e;
  --stale: #d4380d;
  --stale-bg: #fff1eb;
  --late: #c98a12;
  --review: #6b46b8;
  --review-bg: #f1ebfb;
  --review-text: #3f2580;
  --late-bg: #fdf3dc;
  --late-text: #6b4a06;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171514;
    --card: #221f1d;
    --text: #f1ede8;
    --muted: #a59e95;
    --line: #36312d;
    --accent: #c2513e;
    --claimed-text: #7fb0e6;
    --published-text: #8cc77a;
    --error: #f08a80;
    --stale: #ff6a3d;
    --stale-bg: #3a1d14;
    --late: #d9a33a;
    --review: #b39ae8;
    --review-bg: #2a2140;
    --review-text: #ddd0fa;
    --late-bg: #3a2c10;
    --late-text: #f1d48f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
main.narrow { max-width: 420px; padding-top: 12vh; }
[hidden] { display: none !important; }

h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 28px 0 10px; display: flex; align-items: center; gap: 8px; }
.count { color: var(--muted); font-weight: 400; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ready { background: var(--ready); }
.dot.claimed { background: var(--claimed); }
.dot.published { background: var(--published); }
.dot.review { background: var(--review); }

label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 5px; }
.opt { font-size: 12px; }
input, textarea {
  width: 100%; font: inherit; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

button, a.btn {
  font: inherit; font-size: 15px; color: inherit; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 42px;
}
button:active, a.btn:active { transform: scale(0.98); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.wide { width: 100%; justify-content: center; min-height: 50px; font-size: 16px; }
button.ghost { border-color: transparent; background: transparent; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--muted); text-decoration: underline; font-size: 14px; }
button:disabled { opacity: 0.6; cursor: default; }

.top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px; }
.top h1 { margin: 0; }
.me { font-size: 14px; color: var(--muted); }
.pep { margin: 6px 0 14px; font-size: 15px; font-style: italic; color: var(--muted); min-height: 1.45em; transition: opacity .4s; }
.pep.fade { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .pep { transition: none; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
}
.card h3 { font-size: 17px; margin: 0 0 3px; line-height: 1.3; overflow-wrap: anywhere; }
.meta { font-size: 14px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.builder { color: var(--claimed-text); font-weight: 600; }
.note { font-size: 14px; margin: 8px 0 0; padding: 8px 10px; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.row .push { margin-left: auto; }
/* Waiting in Ready for 24+ hours */
.card.stale { border: 2px solid var(--stale); background: var(--stale-bg); animation: wiggle 4s ease-in-out infinite; }
/* A short shake, then a pause: noticeable without being unreadable. */
@keyframes wiggle {
  0%, 82%, 100% { transform: rotate(0); }
  85% { transform: rotate(-1.2deg); }
  88% { transform: rotate(1.2deg); }
  91% { transform: rotate(-0.8deg); }
  94% { transform: rotate(0.8deg); }
  97% { transform: rotate(-0.3deg); }
}
@media (prefers-reduced-motion: reduce) { .card.stale { animation: none; } }
.stale-badge { display: inline-block; margin: 0 0 6px; padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 700; color: #fff; background: var(--stale); }
/* Claimed 3+ school days and not published: the managing editor's smaller fire */
.card.late { border: 2px solid var(--late); }
.late-badge { display: inline-block; margin: 0 0 6px; padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--late-text); background: var(--late-bg); }
.stale-badge { max-width: 100%; }

.alert { border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; font-size: 14px; }
.alert strong { display: block; font-size: 15px; margin-bottom: 4px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert li { margin: 2px 0; overflow-wrap: anywhere; }
.alert.fire { background: var(--stale); color: #fff; }
.alert.warm { background: var(--late-bg); color: var(--late-text); border: 1px solid var(--late); }
.alert.overview, .alert.yours { background: var(--card); border: 1px solid var(--line); }
.admin-row { display: flex; gap: 16px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.admin-row .link { color: var(--error); }
.roles-key { padding-left: 18px; margin: 8px 0 12px; }
.roles-key li { margin: 4px 0; }
.people { display: grid; gap: 8px; }
.person { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.person-top { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.person-name { font-weight: 600; flex: 1 1 160px; }
.person select { font: inherit; font-size: 14px; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; }
.person label.check { margin: 0; }
.person .chips { margin-top: 8px; }
.person .chips button { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.foot { margin-top: 36px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); display: flex; gap: 12px; justify-content: flex-end; }
.foot a { color: inherit; }
.foot .tl-link { margin-right: auto; }
.readypub { border-color: var(--review); color: var(--review); font-weight: 600; }
.card.review { border-left: 4px solid var(--review); }
.alert.go { background: var(--review-bg); color: var(--review-text); border: 1px solid var(--review); }
.claim { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.done { border-color: var(--published); color: var(--published-text); font-weight: 600; }
.small { margin-top: 10px; }

.empty { color: var(--muted); font-size: 14px; margin: 0; padding: 4px 0 0; }

.published { list-style: none; margin: 0; padding: 0; }
.published li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.published li span { overflow-wrap: anywhere; }
.published small { color: var(--muted); display: block; font-size: 13px; }
.published a { color: var(--published-text); white-space: nowrap; font-weight: 600; }

.names { list-style: none; margin: 12px 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.names button { width: 100%; justify-content: flex-start; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 14px; }
.error { color: var(--error); font-size: 14px; min-height: 1em; margin: 10px 0 0; }

.docnote { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.4; }
.docnote b { color: var(--text); font-weight: 600; }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 14px; margin: 10px 0 0; cursor: pointer; }
label.check input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 38px; padding: 6px 12px; }
.filters { display: grid; gap: 10px; margin: 16px 0 -6px; }
.filters .chips { gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.filters .chips::-webkit-scrollbar { display: none; }
.filters .chips button { flex: none; min-height: 44px; padding: 8px 18px; font-size: 16px; border-radius: 10px; }
@media (max-width: 480px) { .filters .chips { gap: 5px; } .filters .chips button { padding: 8px 8px; min-width: 40px; justify-content: center; font-size: 15px; } }
/* "Ready for publication" wraps onto two lines on phones so the row fits. */
@media (max-width: 480px) { #claimFilter button:last-child { white-space: normal; max-width: 92px; line-height: 1.1; font-size: 13px; text-align: center; padding: 4px 8px; } }
.addme { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.addme .hint { margin-top: 0; }
.addme button.wide { margin-top: 10px; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  border: 0; border-radius: var(--radius); padding: 18px 18px 14px;
  background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.me a { color: var(--muted); font-size: 14px; }
.firsttime { display: inline-block; margin-top: 4px; font-weight: 600; color: var(--accent); }
main.help { max-width: 640px; }
.help .lead { font-size: 17px; }
.help h2 { font-size: 17px; margin-top: 28px; }
.help .flow { padding-left: 20px; }
.help details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.help summary { font-weight: 600; cursor: pointer; }
.help details p, .help details ol { margin: 8px 0 2px; }
.help a { color: var(--accent); }
