:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --border: #e4e2dc;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e0f2ef;
  --danger: #b42318;
  --warn-soft: #fff4e5;
  --warn: #9a5b00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1e1e21;
    --text: #f2f2f3;
    --muted: #a0a0a8;
    --border: #2e2e33;
    --accent: #2dd4bf;
    --accent-text: #062b27;
    --accent-soft: #123b37;
    --danger: #f97066;
    --warn-soft: #3a2a10;
    --warn: #f5b84d;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#app { max-width: 880px; margin: 0 auto; padding: 16px 16px 64px; }

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0 16px;
}
nav.tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
nav.tabs button { background: transparent; color: var(--muted); border: 1px solid var(--border); }
nav.tabs button.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px;
}
.card.hero { padding: 20px; border-color: var(--accent); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 6px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

button, .btn {
  font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: 8px; text-decoration: none; display: inline-block;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--danger); }
button:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
form.grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { form.grid { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 0; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }

.badge {
  display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px;
  background: var(--accent-soft); color: var(--text); white-space: nowrap;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: transparent; border: 1px solid var(--border); color: var(--muted); }

.login { max-width: 380px; margin: 12vh auto 0; }
.login .card { padding: 24px; }
.code-input { font-size: 22px; letter-spacing: 8px; text-align: center; }

.day-label { font-size: 13px; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
.time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
ul.plain { margin: 4px 0 0; padding-left: 18px; }

.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto;
}
.modal-card {
  background: var(--surface); color: var(--text); border-radius: var(--radius); border: 1px solid var(--border);
  width: 100%; max-width: 760px; padding: 18px 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.modal-card .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.board-text { min-height: 320px; font-size: 17px; line-height: 1.6; }
.board-view { font-size: 17px; line-height: 1.6; white-space: pre-wrap; }
.plan-body p, .plan-body li { margin: 4px 0; }
.label { font-size: 12px; color: var(--muted); border: 1px dashed var(--border); border-radius: 99px; padding: 1px 8px; }
@media print {
  body > #app, #toast { display: none; }
  .modal { position: static; background: none; padding: 0; }
  .modal-card { border: 0; box-shadow: none; max-width: none; }
  .modal-card .actions, .modal-card .head button { display: none; }
}

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