:root {
  --paper: #F2F4F1;
  --surface: #FFFFFF;
  --ink: #1B2430;
  --muted: #5E6B78;
  --line: #D8DED8;
  --leaf: #1E7A4F;
  --leaf-soft: #DCF2E3;
  --marigold: #E8A317;
  --marigold-soft: #FCEFD2;
  --brick: #B8432F;
  --brick-soft: #F8E1DC;
  --radius: 10px;
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--leaf); }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 28px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #E9EEF2; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; font-weight: 800; font-size: 17px; }
.brand img { width: 28px; height: 28px; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #C9D2DA; text-decoration: none; font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--marigold); }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.side-foot .who { font-size: 13px; color: #9FB0BE; margin-bottom: 10px; }
.side-foot button { background: none; border: 0; color: #C9D2DA; padding: 0; cursor: pointer; text-decoration: underline; font-size: 13px; }
.main { padding: 32px 40px 80px; max-width: 1040px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin-top: 6px; color: var(--muted); max-width: 62ch; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side, .main, .nav { min-width: 0; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; gap: 2px; overflow-x: auto; width: 100%; }
  .nav a { white-space: nowrap; }
  .nav a.on { box-shadow: inset 0 -3px 0 var(--marigold); }
  .side-foot { display: none; }
  .main { padding: 20px 16px 80px; }
}

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--leaf); color: #fff; border-color: var(--leaf); }
.btn.primary:hover { background: #17633F; }
.btn.danger { color: var(--brick); }
.btn.danger.solid { background: var(--brick); color: #fff; border-color: var(--brick); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(27,36,48,.06); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
label.field > small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=password], input[type=time], input[type=date], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 11px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }
input[type=checkbox] { accent-color: var(--leaf); width: 17px; height: 17px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--leaf); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.grid2 > .panel + .panel { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #E8ECEF; color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--leaf-soft); color: var(--leaf); }
.pill.warn { background: var(--marigold-soft); color: #8A5B00; }
.pill.bad { background: var(--brick-soft); color: var(--brick); }
.note { padding: 12px 14px; border-radius: 8px; background: var(--marigold-soft); color: #5C3F00; font-size: 14px; }
.note.bad { background: var(--brick-soft); color: #7A2414; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 380px; padding: 28px; }
.auth .brand { color: var(--ink); padding: 0 0 18px; }

/* ---------- today ---------- */
.today-head { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.daybadge { width: 84px; height: 84px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; text-align: center; line-height: 1; }
.daybadge b { font-size: 34px; font-weight: 800; display: block; }
.daybadge span { font-size: 12px; color: #B9C6D1; }
.switch { display: flex; align-items: center; gap: 12px; border: 0; background: var(--brick-soft); color: var(--brick); padding: 12px 16px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.switch.on { background: var(--leaf); color: #fff; }
.switch i { width: 38px; height: 22px; border-radius: 99px; background: rgba(0,0,0,.18); position: relative; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on i::after { transform: translateX(16px); }
@media (max-width: 640px) { .today-head { grid-template-columns: auto 1fr; } .today-head .switch { grid-column: 1 / -1; justify-content: center; } }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before { counter-increment: s; content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: #E8ECEF; color: var(--muted); }
.steps li.done::before { content: "✓"; background: var(--leaf); color: #fff; }
.steps li.done .t { color: var(--muted); text-decoration: line-through; }
.runlist { list-style: none; padding: 0; margin: 0; }
.runlist li { display: grid; grid-template-columns: 82px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.runlist li:first-child { border-top: 0; }
.runlist .tm { white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 9px; background: #E8ECEF; overflow: hidden; }
.bar > div { height: 100%; background: var(--leaf); }
.loglist { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.loglist li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.loglist li:first-child { border-top: 0; }
.loglist .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.loglist li.warn .m { color: #8A5B00; }
.loglist li.error .m { color: var(--brick); }
@media (max-width: 640px) { .loglist li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- schedule: the day rail ---------- */
.daytabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.daytabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 16px; font-weight: 700; cursor: pointer; }
.daytabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.daytabs button.today { box-shadow: 0 0 0 2px var(--marigold); }
.daytabs button small { font-weight: 600; opacity: .7; margin-left: 4px; }
.rail { position: relative; padding-left: 108px; }
.rail::before { content: ""; position: absolute; left: 86px; top: 6px; bottom: 40px; width: 2px; background: var(--line); }
.stop { position: relative; padding-bottom: 26px; }
.stop .clock { white-space: nowrap; position: absolute; left: -108px; width: 74px; text-align: right; top: 2px; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.stop::before { content: ""; position: absolute; left: -27px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--leaf); }
.stop.off { opacity: .55; }
.stop.off::before { border-color: var(--muted); }
.stop .gap { position: absolute; left: -108px; width: 74px; text-align: right; top: 26px; font-size: 12px; color: var(--muted); }
.stop-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.bubbles { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.bubble { position: relative; background: var(--leaf-soft); border-radius: 10px 10px 10px 2px; padding: 6px; max-width: 360px; width: 100%; }
.bubble .media { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 7px; background: #CFE5D7; }
.bubble .doc { display: flex; gap: 8px; align-items: center; padding: 10px; background: rgba(255,255,255,.6); border-radius: 7px; font-weight: 600; font-size: 14px; word-break: break-all; }
.bubble .txt { padding: 4px 6px 2px; white-space: pre-wrap; word-break: break-word; font-size: 14px; max-height: 9.6em; overflow: hidden; }
.stop-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.webinar { position: relative; display: flex; align-items: center; gap: 12px; }
.webinar .clock { white-space: nowrap; position: absolute; left: -108px; width: 74px; text-align: right; font-weight: 800; font-size: 17px; color: #8A5B00; font-size: 16px; }
.webinar::before { content: ""; position: absolute; left: -31px; width: 20px; height: 20px; border-radius: 50%; background: var(--marigold); box-shadow: 0 0 0 5px var(--marigold-soft); }
.webinar.mid { padding-bottom: 26px; }
.webinar b { background: var(--marigold-soft); color: #6B4700; padding: 8px 14px; border-radius: 8px; }
@media (max-width: 640px) {
  .rail { padding-left: 22px; }
  .rail::before { left: 5px; }
  .stop .clock, .webinar .clock { position: static; display: block; text-align: left; width: auto; margin-bottom: 6px; }
  .stop .gap { display: none; }
  .stop::before { left: -22px; }
  .webinar::before { left: -26px; }
  .webinar { flex-wrap: wrap; }
}

/* ---------- editor modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(27,36,48,.5); display: grid; place-items: start center; padding: 40px 16px; overflow-y: auto; z-index: 20; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 640px; padding: 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.msg-edit { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.msg-edit + .msg-edit { margin-top: 12px; }
.msg-edit .attach { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.msg-edit .thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: #E8ECEF; display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; overflow: hidden; }
.msg-edit .thumb img, .msg-edit .thumb video { width: 100%; height: 100%; object-fit: cover; }
.progress { height: 4px; background: #E8ECEF; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress div { height: 100%; background: var(--leaf); width: 0; }
.hint { font-size: 13px; color: var(--muted); background: var(--paper); padding: 10px 12px; border-radius: 8px; }
.hint code { background: var(--surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.daypick { display: flex; gap: 6px; flex-wrap: wrap; }
.daypick label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }

/* ---------- groups / numbers ---------- */
.glist { list-style: none; margin: 0; padding: 0; }
.glist li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.glist li:first-child { border-top: 0; }
.glist .meta { font-size: 13px; color: var(--muted); }
.acc { display: grid; grid-template-columns: 40px 1fr auto; gap: 16px; align-items: start; }
.acc .rank { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; }
.qr { margin-top: 14px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr ol { margin: 0; padding-left: 18px; font-size: 14px; }
@media (max-width: 640px) { .acc { grid-template-columns: 1fr; } .acc .rank { display: none; } }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; max-width: 360px; font-weight: 600; font-size: 14px; }
.toast.bad { background: var(--brick); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
