:root { --bg: #f6efe6; --panel: #fff; --ink: #2b211b; --muted: #8a7b70; --line: #e5dbd0; --brand: #3b2a20; --accent: #b86b2b; --ok: #2f9e5f; --warn: #e67e22; --red: #d63031; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; overflow-x: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.error { color: var(--red); min-height: 1.2em; }
.spacer { flex: 1; }
.red { color: var(--red); font-weight: 700; }
.ok { color: var(--ok); }
.warn { color: var(--warn); font-weight: 700; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--brand); }
.login form { background: var(--panel); padding: 32px; border-radius: 16px; width: min(360px, 100%); text-align: center; }
.login h1 { margin: 0; }
.login input { width: 100%; font-size: 1.5rem; text-align: center; padding: 12px; margin: 16px 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.login button { width: 100%; min-height: 54px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 1.1rem; font-weight: 700; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--brand); color: #fff; }
.top h1 { margin: 0; font-size: 1.2rem; }
.btn { min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.datebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px 0; }
.datebar input { min-height: 40px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 0; }
.jump a { padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.jump a b { color: #fff; background: var(--red); border-radius: 10px; padding: 0 7px; margin-left: 4px; font-size: .85rem; }
.jump a .allok { color: var(--ok); margin-left: 4px; }
.legend { margin: 8px 12px 0; font-size: .85rem; color: var(--muted); }

.store { margin: 12px; background: var(--panel); border-radius: 14px; padding: 4px 14px 12px; scroll-margin-top: 64px; }
.store > h2 { margin: 10px 0 4px; font-size: 1.25rem; }
.store > h2 small { font-weight: 400; color: var(--muted); font-size: .9rem; }
.sec { border-top: 1px solid var(--line); padding: 8px 0; }
.sec h3 { margin: 4px 0 6px; font-size: 1rem; }
.sec h3 .n { font-weight: 400; font-size: .85rem; color: var(--muted); }
.sec ul { margin: 0; padding-left: 0; list-style: none; }
.sec li { padding: 5px 0; border-bottom: 1px dashed var(--line); line-height: 1.45; overflow-wrap: anywhere; }
.sec li:last-child { border-bottom: 0; }
.sec li.bad { color: var(--red); }
.sec li.bad .muted { color: #c0605a; }
.tag { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: .8rem; background: #f1e8dd; color: var(--ink); margin-left: 4px; }
.tag.red { background: var(--red); color: #fff; }
.tag.ok { background: #dff3e7; color: var(--ok); }
.log { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.log:last-child { border-bottom: 0; }
.log .row { padding: 2px 0 2px 8px; }
.log .row.alert { color: var(--red); font-weight: 700; }
.empty { color: var(--muted); font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 50; max-width: 90vw; }
.install-btn { position: fixed; left: 12px; bottom: 12px; z-index: 50; padding: 10px 16px; border-radius: 99px; border: 0; background: #3b2a20; color: #fff; font-size: 1rem; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.install-btn[hidden] { display: none; }
#app { padding-bottom: 64px; }

/* 誰上班 */
.crew > h2 { margin: 10px 0 4px; font-size: 1.25rem; }
.crew > h2 small { font-weight: 400; color: var(--muted); font-size: .9rem; }
.crew h3 { margin: 12px 0 6px; font-size: 1rem; border-top: 1px solid var(--line); padding-top: 8px; }
.crew-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.crew-row > b { flex: 0 0 4.5em; padding-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; flex-direction: column; align-items: center; padding: 3px 10px; border-radius: 10px; background: #f1e8dd; font-weight: 700; line-height: 1.25; }
.chip small { font-weight: 400; font-size: .75rem; }
.chip.ok { background: #dff3e7; color: var(--ok); }
.chip.red { background: #fde3e1; color: var(--red); }
.week { width: 100%; border-collapse: collapse; font-size: .9rem; table-layout: fixed; }
.week th, .week td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.week th:first-child, .week td.d { width: 5.8em; white-space: nowrap; }
.week tr.sel td { background: #fff4e6; font-weight: 700; }
.week tr.wkend td.d { color: var(--accent); }
.week tr.now td.d::after { content: ' 今天'; font-size: .7rem; color: var(--ok); }
.month-head { display: flex; align-items: center; gap: 8px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.month-head h3 { flex: 1; text-align: center; margin: 0; border: 0; padding: 0; }

/* 月曆 */
.cal-tabs { display: flex; gap: 6px; margin: 8px 0; }
.cal-tabs .btn { min-height: 34px; padding: 4px 12px; }
.cal-tabs .btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: 3px; vertical-align: middle; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-top: 8px; }
.cal-h { text-align: center; font-size: .78rem; color: var(--muted); padding: 4px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #faf6f0; }
.cal-cell { min-height: 72px; padding: 2px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell.empty { background: #faf8f5; }
.cal-cell.go { cursor: pointer; }
.cal-cell.sel { background: #fff4e6; }
.cal-d { text-align: center; line-height: 1.1; }
.cal-d b { font-size: .95rem; }
.cal-d small { display: block; font-size: .62rem; color: var(--muted); }
.cal-cell.now .cal-d b { background: var(--red); color: #fff; border-radius: 50%; display: inline-block; width: 1.6em; height: 1.6em; line-height: 1.6em; }
.sun, .sun .cal-d b { color: var(--red); }
.sat, .sat .cal-d b { color: #2e6fd6; }
.cal-chip { display: block; color: #fff; font-size: .72rem; font-weight: 700; border-radius: 4px; padding: 1px 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.cal-chip i { font-style: normal; font-weight: 400; opacity: .85; margin-right: 1px; }
.cal-chip small { display: block; font-weight: 400; font-size: .6rem; opacity: .9; }
.cal-chip.off { background: #e9e2d9; color: var(--muted); font-weight: 400; }

/* 📅 我的行程 */
.ag-day { margin: 8px 0; }
.ag-day ul { list-style: none; margin: 4px 0 0; padding: 0; }
.ag-day li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px dashed #e5ddd3; }
.ag-time { min-width: 3.2em; font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ag-acts { display: flex; gap: 4px; flex-shrink: 0; }
.ag-done .ag-main, .ag-done .ag-time { text-decoration: line-through; opacity: .55; }
.tag.kc { background: #fde7d9; color: #a0400f; }
.ag-add { margin-top: 8px; }
.ag-add summary { display: inline-block; list-style: none; cursor: pointer; }
.ag-add summary::-webkit-details-marker { display: none; }
#ag-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
#ag-form label { display: flex; flex-direction: column; font-size: 13px; gap: 2px; min-width: 0; }
#ag-form .wide { grid-column: 1 / -1; }
#ag-form input, #ag-form select { font: inherit; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; min-width: 0; }
#ag-form button { grid-column: 1 / -1; }
.cal-chip.ag { background: #fff3c4 !important; color: #5a4300; border: 1px solid #e8cf6a; white-space: normal; text-align: left; }
.cal-chip.ag.done { opacity: .5; }
/* 115/11/7:手機只顯示「📌 N」(格子窄,字會被切掉、版面跑);電腦寬才多列前 3 件(每件一行、超出以…省略) */
.cal-chip.ag .ag-n { display: block; text-align: center; }
.cal-chip.ag .ag-t { display: none; font-weight: 400; font-size: .68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.ag .ag-t.done { text-decoration: line-through; opacity: .6; }
@media (min-width: 760px) { .cal-chip.ag .ag-t { display: block; } .cal-chip.ag .ag-n { text-align: left; } }
.cal-cell.pick { outline: 3px solid #e8a33d; outline-offset: -3px; }
.cal-pick { margin-top: 10px; padding: 10px 12px; border: 2px solid #e8cf6a; border-radius: 10px; background: #fffbea; }
.cal-pick ul { margin: 6px 0; }
.cal-pick .btn { margin-top: 4px; }
.linkish { background: none; border: 0; padding: 2px 4px; color: #1565c0; text-decoration: underline; font: inherit; cursor: pointer; }
/* 🛒 網購待出貨(115/11/1) */
#shopq ul.plain { list-style: none; padding: 0; margin: 6px 0; }
#shopq ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line, #e5e0d8); line-height: 1.5; }
#shopq ul.plain li.red { font-weight: 400; }
#shopq ul.plain li.red b { color: var(--red); }

/* 115/11/7:過期還沒打勾的行程 */
.cal-chip.ag.late { border: 2px solid #e53935; }
.ag-late { margin: 8px 0; padding: 8px 10px; border: 2px solid #e53935; border-radius: 10px; background: #fff3f2; }
.ag-late > b { color: #c62828; margin-right: 8px; }
.ag-late ul { list-style: none; margin: 4px 0 0; padding: 0; }
.ag-late li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px dashed #f0c4c0; }
.cal-pick li { display: flex; gap: 8px; align-items: flex-start; }
