:root {
  color-scheme: dark;
  --page: #0d1110; --panel: #181e1b; --panel-high: #202722; --line: #343d37; --ink: #f5f7f4; --muted: #a8b1aa;
  --green: #b9f35c; --green-dark: #18260b; --blue: #79bfff; --red: #ff8680; --red-dark: #321414; --amber: #ffc46b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--ink); }
a { color: var(--blue); }
button, input, select { font: inherit; }
button { cursor: pointer; min-height: 40px; border-radius: 6px; border: 1px solid #72923b; background: var(--green-dark); color: var(--green); font-weight: 700; padding: 0 16px; }
button.secondary { border-color: var(--line); background: var(--panel-high); color: var(--ink); font-weight: 600; }
button.danger { border-color: #7a3834; background: var(--red-dark); color: var(--red); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input, select { width: 100%; min-height: 42px; border-radius: 6px; border: 1px solid var(--line); background: var(--page); color: var(--ink); padding: 0 12px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
label { display: grid; gap: 6px; font-size: 0.9rem; color: var(--muted); }
[hidden] { display: none !important; }
.shell { width: min(1100px, 100%); margin: 0 auto; padding: 0 16px 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #72923b; border-radius: 6px; background: var(--green-dark); color: var(--green); font-size: 0.77rem; font-weight: 800; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.narrow { width: min(420px, 100%); margin: 8vh auto 0; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > button { flex: 0 0 auto; }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p.muted, .muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; margin: 0; }
.notice { border: 1px solid #72923b; background: var(--green-dark); color: var(--green); border-radius: 8px; padding: 12px; }
.notice code { font-size: 1.1rem; color: var(--ink); }
.grid2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
td select { min-height: 36px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.pill.on { border-color: #72923b; color: var(--green); }
.table-wrap { overflow-x: auto; }
/* R38 shipping page */
.ship-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.ship-list { display: grid; gap: 10px; }
.ship-row { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--panel-high); }
.ship-row.has-problem { border-color: #7a5a24; }
.ship-main { display: grid; gap: 4px; min-width: 260px; flex: 1 1 360px; }
.ship-main strong { font-size: 1.02rem; }
.ship-main span { font-size: 0.88rem; }
.ship-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ship-actions input { width: 200px; min-height: 40px; }
.ship-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; vertical-align: 2px; color: var(--muted, #9aa); }
.ship-main span a { color: inherit; text-decoration: underline; }
/* R41: status pill (orange to print, blue printed, green shipped) + printed papers grey out */
.ship-main .ship-status { display: inline-block; margin-left: 10px; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; vertical-align: 2px; }
.ship-main .status-to_print { background: #f59e0b; color: #1a1200; }
.ship-main .status-printed { background: #3b82f6; color: #fff; }
.ship-main .status-shipped { background: #22a35a; color: #fff; }
.ship-main .status-waiting { background: #b91c1c; color: #fff; }
.ship-main .status-pickup { background: #6b6b6b; color: #fff; }
.ship-actions .btn-link.done { opacity: 0.55; background: transparent; border-style: dashed; }
.ship-actions .btn-link.reprint { background: #7c2d12; border-color: #f59e0b; color: #fde68a; opacity: 1; }
.ship-actions .ship-go { background: #22a35a; border-color: #22a35a; color: #fff; }
/* R42: which printer — full page vs the 4×6 label printer */
.ship-actions .ship-paper { display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; vertical-align: 1px; }
.ship-actions .paper-page { background: #334155; color: #e2e8f0; }
.ship-actions .paper-label { background: #f59e0b; color: #1a1200; }
/* R40c: carrier badge — USPS navy, UPS brown/gold, pickup grey */
.ship-main .ship-carrier { display: inline-block; margin-right: 10px; padding: 3px 10px; border-radius: 6px; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.06em; vertical-align: 1px; color: #fff; background: #555; }
.ship-main .carrier-usps { background: #1f3a93; color: #fff; }
.ship-main .carrier-ups { background: #6b3f1d; color: #ffb500; }
.ship-main .carrier-rl { background: #0f6b45; color: #fff; }
.ship-main .carrier-pickup { background: #6b6b6b; color: #fff; }
.ship-upload { cursor: pointer; display: inline-flex; font-size: inherit; color: var(--ink); gap: 0; }
.ship-coming { padding: 8px 14px; }
.btn-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 600; }
.warn { color: var(--amber); }
/* R47: training page + study guide */
.guide-link { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid #72923b; border-radius: 10px; background: var(--green-dark); color: var(--ink); text-decoration: none; }
.guide-link strong { display: block; color: var(--green); }
.guide-link small { color: var(--muted); }
.guide-icon { font-size: 1.6rem; }
#video { width: 100%; max-height: 70vh; background: #000; border-radius: 8px; }
.video-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.video-tile { display: grid; gap: 4px; text-align: left; min-height: 72px; padding: 12px 14px; }
.video-tile strong { font-weight: 700; }
.video-tile small { color: var(--muted); font-weight: 500; }
.video-tile.playing { border-color: #72923b; background: var(--green-dark); color: var(--green); }
.guide { line-height: 1.55; }
.guide h1 { font-size: 1.6rem; margin-bottom: 12px; }
.guide h2 { font-size: 1.2rem; margin: 28px 0 10px; color: var(--green); }
.guide blockquote { margin: 10px 0; padding: 10px 16px; border-left: 4px solid var(--green); background: var(--panel-high); border-radius: 6px; font-size: 1.05rem; }
.guide table { margin: 10px 0 16px; }
.guide td, .guide th { vertical-align: top; }
.guide li { margin: 4px 0; }
/* listening center */
a.live-watch { display: inline-block; padding: 12px 18px; border-radius: 12px; background: #b9f35a; color: #10140f; text-decoration: none; }
/* R56 listening center: line cards, the 🎤 note box, and whether the last note was read */
.live-card { border-left: 6px solid #8a8f98; }
.live-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.live-top h2 { margin: 0; }
.live-state { margin: 4px 0 0; }
.live-small { margin: 2px 0 0; }
a.live-watch { font-weight: 700; }
.live-msg { margin-top: 12px; }
.live-msg-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.live-msg textarea { flex: 1 1 220px; min-height: 52px; resize: vertical; font: inherit; font-size: 1rem; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0d1117; color: inherit; }
.live-mic { min-width: 104px; padding: 0 16px; border-radius: 12px; border: 2px solid #4a8cff; background: #10233d; color: #fff; font-weight: 800; font-size: 1rem; cursor: pointer; }
.live-mic.on { background: #c0392b; border-color: #ff7b6b; animation: live-mic-pulse 1.2s ease-in-out infinite; }
.live-mic:disabled { opacity: 0.7; cursor: default; }
.live-send { padding: 0 20px; border-radius: 12px; font-weight: 800; }
.live-heard { margin: 6px 0 0; font-size: 0.9rem; color: #9aa4b2; }
.live-seen { margin: 8px 0 0; font-size: 0.95rem; }
.live-seen.ok { color: #7fd99a; }
.live-seen.wait { color: #e0b43c; }
@keyframes live-mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 123, 107, 0.6); } 50% { box-shadow: 0 0 0 8px rgba(255, 123, 107, 0); } }
@media (max-width: 600px) { .live-msg textarea { flex-basis: 100%; min-height: 110px; } .live-mic, .live-send { min-height: 48px; } }
/* R126: Melissa on the lines (autopilot panel) */
.ap-card { border-left: 6px solid #3fbf6f; }
.ap-lines { display: grid; gap: 8px; margin: 10px 0; }
.ap-line { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.ap-line.off { opacity: .55; cursor: default; }
.ap-line input { transform: scale(1.3); margin-right: 6px; }
.ap-state { font-size: .85rem; opacity: .85; }
.ap-sched { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.ap-days { display: flex; flex-wrap: wrap; gap: 4px; }
.ap-day { padding: 6px 9px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: inherit; cursor: pointer; }
.ap-day.on { background: #3fbf6f; color: #0b1a10; border-color: #3fbf6f; font-weight: 700; }
.ap-sched input[type="time"] { padding: 6px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: inherit; }
.ap-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ap-btns button { padding: 10px 18px; border-radius: 8px; border: 0; font-weight: 700; cursor: pointer; }
.ap-go { background: #3fbf6f; color: #0b1a10; }
.ap-stop { background: #e2582a; color: #fff; }
.ap-save { background: transparent; color: inherit; border: 1px solid var(--line) !important; }
.ap-line input[type="checkbox"] { width: auto; min-height: 0; }
.ap-sched label { display: flex; align-items: center; gap: 6px; }
.ap-sched input[type="time"] { width: auto; min-height: 38px; }
.ap-day { min-height: 34px; font-weight: 600; }

/* R160: line health from the watchdog */
.live-health { margin: 8px 0; font-size: 14px; }
.live-health.warn { background: #fff6d6; border: 1px solid #e9c46a; border-radius: 10px; padding: 8px 12px; color: #5a4300; }
.live-health.warn ul { margin: 4px 0 0 18px; padding: 0; }
.live-health.ok { color: #2e6b3a; }
