:root {
  --brand: #7E1822;
  --bg: #f4f3f0;
  --card: #fff;
  --text: #222;
  --muted: #777;
  --line: #e4e1db;
  --ok: #2e7d4f;
  --danger: #b3261e;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 12px 18px; font-size: 16px; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; width: 100%; text-align: center; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); border-radius: 16px; padding: 32px 24px; width: 100%; max-width: 360px; text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login-card h1 { font-size: 22px; margin: 12px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
.brand-mark { width: 112px; height: 112px; }
.error-text { color: var(--danger); min-height: 1.4em; margin-bottom: 12px; font-size: 15px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.page { max-width: 720px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 18px; margin: 0 0 6px; }
.status-list { list-style: none; padding: 0; margin: 12px 0 0; }
.status-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.status-list li.ok { color: var(--ok); }
.status-list li.todo { color: var(--muted); }
.nav { display: flex; gap: 4px; overflow-x: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 15px; }
.nav a.active { color: var(--brand); background: #f6eced; font-weight: 600; }
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; }
}
.btn.primary-inline { background: var(--brand); border-color: var(--brand); color: #fff; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.list { display: flex; flex-direction: column; margin-top: 8px; }
.list-item { all: unset; display: block; padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.list-item:active { background: #faf8f5; }
.list-item.dim { opacity: .55; }
.li-sub { font-size: 14px; margin-top: 2px; }
.tag { display: inline-block; font-size: 12px; background: #eee; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 14px; color: var(--muted); }
input, select { font: inherit; font-size: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); max-width: 100%; }
select[multiple] { min-height: 90px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.check input { width: 18px; height: 18px; }
.history h3, .special h4 { font-size: 15px; margin: 18px 0 6px; }
.timeline, .plain { list-style: none; padding: 0; margin: 0; }
.timeline li, .plain li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inline-form input:not([type=checkbox]) { flex: 1 1 120px; }
.unit-card { border-top: 1px solid var(--line); padding: 10px 0; }
.unit-card summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.unit { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.hours { border-collapse: collapse; }
.hours th { text-align: left; font-weight: normal; color: var(--muted); padding-right: 8px; white-space: nowrap; }
.hours td { padding: 3px 2px; }
.hours input[type=time] { padding: 6px; }
.dept { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.link-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; margin-left: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 10; max-width: 90vw; }
.toast.bad { background: var(--danger); }
h2 { font-size: 18px; }
.hours { width: 100%; table-layout: auto; }
.hours td:nth-child(2), .hours td:nth-child(4) { width: 40%; }
.hours input[type=time] { width: 100%; min-width: 0; font-size: 15px; }
.hours .check { white-space: nowrap; font-size: 14px; }
.hours th { padding-right: 4px; }
