:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1d2330; --sub: #5f6b7a; --line: #e3e6eb;
  --brand: #1f5fbf; --brand-soft: #e7effb;
  --red: #c62f2f; --red-soft: #fdecec; --green: #1f8a4c; --green-soft: #e6f5ec;
  --amber: #b26a00; --amber-soft: #fdf3e2; --violet: #6b46c1; --violet-soft: #f0ebfb;
  --c13: #d9822b; --c14: #2f9e63; --c15: #2f74d0; --c16: #8a55c9; --c12: #7a7f87;
  --r: 12px; --shadow: 0 1px 2px rgba(20,30,50,.06), 0 2px 8px rgba(20,30,50,.05);
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.top { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
.top h1 { font-size: 17px; font-weight: 650; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who { font-size: 13px; color: var(--sub); }
.topnav { display: none; gap: 4px; }
.topnav a { padding: 6px 12px; border-radius: 8px; color: var(--sub); font-size: 14px; }
.topnav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 12px; color: var(--sub); }
.tabbar a .ic { display: block; font-size: 20px; line-height: 24px; }
.tabbar a.on { color: var(--brand); font-weight: 600; }
@media (min-width: 900px) {
body { padding-bottom: 24px; }
.tabbar { display: none; }
.topnav { display: flex; }
}
main { max-width: 1180px; margin: 0 auto; padding: 14px; }
.narrow { max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin-bottom: 10px; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.danger { color: var(--red); border-color: #f0c8c8; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--sub); }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
select.sm, input.sm { padding: 6px 8px; font-size: 14px; border-radius: 8px; }
.err { color: var(--red); font-size: 14px; min-height: 20px; }
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .logo { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login .tag { text-align: center; color: var(--sub); margin-bottom: 22px; font-size: 14px; }
.login .btn { width: 100%; padding: 12px; font-size: 16px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef0f3; color: var(--sub); white-space: nowrap; }
.chip.c13 { background: #fbeedd; color: var(--c13); }
.chip.c14 { background: #e2f3ea; color: var(--c14); }
.chip.c15 { background: #e3edfa; color: var(--c15); }
.chip.c16 { background: #efe6f8; color: var(--c16); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 6px; margin-right: 4px; font-weight: 600; }
.tag.cancel, .tag.none { background: var(--red-soft); color: var(--red); }
.tag.moved, .tag.insert { background: var(--green-soft); color: var(--green); }
.tag.time { background: var(--violet-soft); color: var(--violet); }
.tag.room { background: var(--amber-soft); color: var(--amber); }
.tag.moved-from { background: #eef0f3; color: var(--sub); }
.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.weeknav .lbl { flex: 1; text-align: center; font-weight: 650; }
.weeknav .lbl small { display: block; font-weight: 400; color: var(--sub); font-size: 12px; }
.day { margin-bottom: 14px; }
.day-h { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 6px; }
.day-h b { font-size: 15px; }
.day-h.today b { color: var(--brand); }
.day-h .sp { font-size: 12px; color: #a8326b; background: #fbe9f2; padding: 1px 7px; border-radius: 6px; }
.ev { display: flex; gap: 12px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 8px; border-left: 4px solid var(--brand); }
.ev .t { width: 52px; flex: none; font-variant-numeric: tabular-nums; font-weight: 650; line-height: 1.25; }
.ev .t small { display: block; color: var(--sub); font-weight: 400; }
.ev .b { flex: 1; min-width: 0; }
.ev .ttl { font-weight: 650; font-size: 16px; }
.ev .meta { font-size: 13px; color: var(--sub); margin-top: 2px; }
.ev .tags { margin-top: 5px; }
.ev.cancelled { border-left-color: var(--red); opacity: .8; }
.ev.cancelled .ttl { text-decoration: line-through; }
.ev.ghost { border-left-color: #c5cad2; background: #fafbfc; box-shadow: none; border: 1px dashed #d5d9df; border-left-width: 4px; }
.ev.ghost .ttl { color: var(--sub); }
.ev.changed { border-left-color: var(--green); }
.ev.next { outline: 2px solid var(--brand); }
.empty { text-align: center; color: var(--sub); padding: 30px 10px; }
.sc { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.sc .big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; line-height: 1; }
.sc .big.low { color: var(--red); }
.sc .stats { grid-column: 1 / -1; display: flex; gap: 14px; font-size: 13px; color: var(--sub); flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
.sc .stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; background: #e9ecf0; border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 14px; color: var(--sub); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.trend { width: 100%; height: 120px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--sub); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.week { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 900px) {
.week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
}
.banner { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; font-size: 14px; cursor: pointer; }
.banner.info { background: var(--brand-soft); color: var(--brand); cursor: default; }
.scroll { overflow-x: auto; }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222a36; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; max-width: 90vw; }
@media print {
.top, .tabbar { display: none !important; }
body { background: #fff; padding: 0; }
main { max-width: none; padding: 0; }
.card { box-shadow: none; padding: 0; }
}
.field input, .field select { width: 100%; }
.tag.asis { background: var(--violet-soft); color: var(--violet); }
.cbe h2 { font-size: 16px; margin: 6px 0 10px; }
.cbe-t { border-collapse: collapse; width: 100%; margin-bottom: 12px; background: #fff; font-size: 12.5px; table-layout: fixed; }
.cbe-t th, .cbe-t td { border: 1px solid #c9ced6; padding: 4px; text-align: center; vertical-align: middle; word-break: break-word; }
.cbe-t th { background: #f4f6f9; font-weight: 600; }
.cbe-t tr:first-child th, .cbe-t tr.wkh th { background: #fff7cc; }
.cbe-t tr.mth th { background: #3d4b5c; color: #fff; text-align: left; padding: 5px 8px; font-size: 13px; }
.cbe-t tr.wkh th { border-top: 2px solid #8a94a3; }
.cbe-t th.wk { width: 56px; }
.cbe-t caption { text-align: left; font-weight: 600; padding: 4px 0; }
.cbe-t tr.sp td { background: #fde8ef; color: #a8326b; }
.cbe-t td small { color: var(--sub); }
.cbe-t td > div + div { border-top: 1px dashed #d5d9df; margin-top: 3px; padding-top: 3px; }
.cbe-t .c-off { text-decoration: line-through; color: var(--red); }
.cbe-t .c-ghost { color: var(--sub); }
.cbe-t .c-chg { color: var(--green); font-weight: 600; }
.cbe-t hr { border: 0; border-top: 1px dashed #d5d9df; margin: 3px 0; }
.menr input.sm { width: 100%; min-width: 90px; }
.menr th input[type=date] { min-width: 130px; }
@media print {
.cbe-t { font-size: 10.5px; }
.cbe-t { break-inside: avoid; }
main { max-width: none !important; }
}
