/* 版面：單欄打卡工具。先是打卡鐘，再以分頁切換紀錄、申請與管理。 */
:root {
  --bg: #eef2f0; --surface: #ffffff; --surface-2: #f6f8f7; --ink: #15201b; --muted: #5b6a63; --line: #d8e0dc;
  --accent: #0b6e50; --accent-ink: #ffffff; --accent-soft: #dcefe7;
  --ok: #17803d; --ok-soft: #e1f3e7; --warn: #a15c00; --warn-soft: #fbefd9; --bad: #b93815; --bad-soft: #fbe6de;
  --info: #2d5b9a; --info-soft: #e3ebf7;
  --f-display: "Barlow Condensed", "Noto Sans TC", system-ui, sans-serif;
  --f-body: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0f1613; --surface: #17211d; --surface-2: #1c2823; --ink: #e5eee9; --muted: #95a59e; --line: #2a3832;
  --accent: #3fbf8f; --accent-ink: #06231a; --accent-soft: #173b2e;
  --ok: #56c97c; --ok-soft: #173424; --warn: #e5a54a; --warn-soft: #382a14; --bad: #f08560; --bad-soft: #3d1f16;
  --info: #86aee6; --info-soft: #1b2a3f; color-scheme: dark } }
* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px) }
.wrap { max-width: 960px; margin: 0 auto; padding-inline: 16px; padding-block: 18px 56px; display: flex; flex-direction: column; gap: 18px }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap }
.brand h1 { font-family: var(--f-display); font-size: 26px; font-weight: 700; letter-spacing: .02em; margin: 0 }
.brand .co { color: var(--muted); font-size: 14px }
.who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--accent); flex: none }
.linkbtn { appearance: none; background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 4px; text-decoration: underline; text-underline-offset: 3px }
nav.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none }
nav.tabs button { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap }
nav.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent) }
nav.sub { display: flex; gap: 6px; flex-wrap: wrap }
nav.sub button { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 999px; cursor: pointer }
nav.sub button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink) }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0 }
.stack { display: flex; flex-direction: column; gap: 18px }
h2 { font-size: 17px; margin: 0; font-weight: 700; text-wrap: balance }
h3 { font-size: 15px; margin: 0; font-weight: 700 }
.muted { color: var(--muted) } .small { font-size: 13px }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.spread { justify-content: space-between }
/* 打卡鐘 */
.clock { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center }
.clock .time { font-family: var(--f-display); font-weight: 600; font-size: clamp(44px, 13vw, 76px); line-height: .9; font-variant-numeric: tabular-nums }
.clock .time .sec { font-size: .42em; color: var(--muted); margin-left: 6px }
.clock .date { color: var(--muted); font-size: 13px }
.clockmeta { text-align: right; min-width: 0 }
.shift { text-align: right; font-size: 13px; color: var(--muted) }
.shift b { display: block; font-family: var(--f-display); font-size: 17px; color: var(--ink); font-weight: 600 }
.stamps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.stamp { border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface-2); min-width: 0 }
.stamp .lbl { font-size: 12px; letter-spacing: .08em; color: var(--muted) }
.stamp .v { font-family: var(--f-display); font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1 }
.stamp .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px }
.geo { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 14px; flex-wrap: wrap }
.geo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none }
.geo.ok .dot { background: var(--ok) } .geo.bad .dot { background: var(--bad) } .geo.wait .dot { background: var(--warn) }
.geo .txt { flex: 1; min-width: 180px }
.punch-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; padding: 9px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px }
.btn:hover:not(:disabled) { background: var(--surface-2) }
.btn:disabled { opacity: .5; cursor: not-allowed }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent) }
.btn.big { font-size: 19px; font-weight: 700; padding: 16px; border-radius: 10px }
.btn.sm { padding: 4px 10px; font-size: 13px }
.btn.ok { color: var(--ok); border-color: var(--ok) } .btn.bad { color: var(--bad); border-color: var(--bad) }
.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0 }
label.chk { display: flex; gap: 8px; align-items: center; font-size: 14px }
label.chk input { width: auto }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0 }
textarea { resize: vertical; min-height: 64px }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px }
.full { grid-column: 1 / -1 }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: fit-content; max-width: 100% }
.seg button { white-space: nowrap; appearance: none; border: 0; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; padding: 7px 14px; cursor: pointer }
.seg button + button { border-left: 1px solid var(--line) }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 700 }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line) }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px }
.stat { padding: 8px 12px; border-left: 3px solid var(--line) }
.stat .n { font-family: var(--f-display); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1 }
.stat .n small { font-size: 16px; color: var(--muted); margin-left: 2px }
.stat .l { font-size: 12px; color: var(--muted) }
.stat.warn { border-left-color: var(--warn) } .stat.bad { border-left-color: var(--bad) } .stat.ok { border-left-color: var(--ok) } .stat.info { border-left-color: var(--info) }
.leavecard { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 14px; border-radius: 8px; background: var(--accent-soft) }
.leavecard .big { font-family: var(--f-display); font-size: 48px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums }
.leavecard .big small { font-size: 18px; margin-left: 4px }
.bar { height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; display: flex }
.bar i { display: block; height: 100% } .bar .u { background: var(--accent) } .bar .p { background: var(--warn) }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle }
th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); letter-spacing: .04em; position: sticky; top: 0 }
tr:last-child td { border-bottom: 0 }
td.num { font-family: var(--f-display); font-size: 16px }
tr.group td { background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em }
tr.click { cursor: pointer } tr.click:hover td { background: var(--surface-2) }
tr.inactive td { opacity: .55 }
.list { display: flex; flex-direction: column }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center }
.item:last-child { border-bottom: 0 }
.item .t { font-weight: 500 } .item .d { font-size: 13px; color: var(--muted); white-space: normal }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center }
.item .acts input { width: 150px }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; font-size: 14px }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--info-soft); font-size: 14px }
.notice.warn { background: var(--warn-soft) } .notice.ok { background: var(--ok-soft) }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; letter-spacing: .06em; user-select: all }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px); z-index: 20; box-shadow: 0 6px 20px rgb(0 0 0 / .2) }
.toast.err { background: var(--bad); color: #fff }
.login { max-width: 380px; margin: 8vh auto 0; width: 100% }
.login h1 { font-family: var(--f-display); font-size: 40px; margin: 0 0 4px }
dialog { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); padding: 0; width: min(760px, calc(100% - 24px)); max-height: 86vh }
dialog::backdrop { background: rgb(0 0 0 / .4) }
dialog .dlg { padding: 18px; display: flex; flex-direction: column; gap: 14px }
@media (max-width: 560px) {
  .panel { padding: 14px }
  .item { grid-template-columns: 1fr } .item .acts { justify-content: flex-start }
  .leavecard { grid-template-columns: 1fr }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important } }
.r { text-align: right } .paygrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px } .paysum td, .paysum th { white-space: normal } .netline { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 8px } .netline b { font-family: var(--f-display); font-size: 28px }
/* 排班表 */
.brushbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px }
.brush { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px }
.brush[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; font-weight: 700 }
.brush .sw { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 12px; font-weight: 700 }
.roster-wrap { max-height: 70vh }
table.roster { border-collapse: separate; border-spacing: 0; font-size: 12px; user-select: none; -webkit-user-select: none; min-width: 100% }
table.roster th, table.roster td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; white-space: nowrap }
table.roster thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 500; padding: 4px 0; min-width: 30px; line-height: 1.25 }
table.roster thead th small { display: block; color: var(--muted); font-weight: 400 }
table.roster thead th.we { color: var(--bad) }
table.roster thead th.nat { background: var(--warn-soft); color: var(--warn) }
table.roster .rw { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 4px 8px; min-width: 128px; max-width: 160px; white-space: normal }
table.roster thead .rw { z-index: 3; background: var(--surface-2) }
table.roster .rw .nm { font-weight: 600; font-size: 13px }
table.roster td.c { height: 34px; cursor: pointer; font-weight: 700; font-size: 13px }
table.roster td.c:hover { box-shadow: inset 0 0 0 2px var(--ink) }
table.roster td.c.dirty { box-shadow: inset 0 0 0 2px var(--accent) }
table.roster td.c.na { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px); cursor: not-allowed }
table.roster td.c.streak { color: var(--bad); text-decoration: underline wavy }
table.roster tfoot td { background: var(--surface-2); font-size: 11px; color: var(--muted); padding: 3px 0; line-height: 1.3 }
.k-s0 { background: var(--info-soft); color: var(--info) }
.k-s1 { background: #efe6fb; color: #6a3fb0 }
.k-s2 { background: #fde8f1; color: #a23468 }
.k-s3 { background: #e3f4f6; color: #1f7380 }
.k-rest { background: var(--ok-soft); color: var(--ok) }
.k-regular { background: #e7efe9; color: #2f5a3d }
.k-holiday { background: var(--warn-soft); color: var(--warn) }
@media (prefers-color-scheme: dark) {
  .k-s1 { background: #2c2140; color: #c3a6f2 } .k-s2 { background: #3a1d2b; color: #f0a0c4 } .k-s3 { background: #173338; color: #8fd6e0 }
  .k-regular { background: #1d2c22; color: #9cc9aa }
}
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px }
.cal .h { text-align: center; font-size: 12px; color: var(--muted) }
.cal .d { border: 1px solid var(--line); border-radius: 6px; padding: 4px 5px; min-height: 52px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0 }
.cal .d .n { font-weight: 700 }
.cal .d.today { outline: 2px solid var(--accent) }
.cal .d .t { border-radius: 4px; padding: 1px 3px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
table.roster td.c.two { font-size: 11px; letter-spacing: -.02em }
.brush .sw { min-width: 22px; width: auto; padding: 0 3px }
.notice.rule { border-left: 4px solid var(--warn); color: var(--ink); font-size: 14px }

/* 員工手冊 */
.md { line-height: 1.75; font-size: 15px; min-width: 0 }
.md h1 { font-size: 24px; margin: 0 0 12px } .md h2 { font-size: 18px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line) } .md h3 { margin: 16px 0 6px }
.md p { margin: 8px 0 } .md ul, .md ol { margin: 6px 0; padding-left: 1.4em } .md li { margin: 3px 0 }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 4px solid var(--line); color: var(--muted) }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 } .md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top } .md th { background: var(--surface-2) }
.md .tw { overflow-x: auto }
.hbedit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px } .hbedit textarea { min-height: 520px; font: 13px/1.6 ui-monospace, monospace; width: 100% }
.hbedit .md { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; max-height: 560px; overflow: auto }
@media (max-width: 760px) { .hbedit { grid-template-columns: 1fr } }
.dotbadge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-left: 5px; vertical-align: top }
@media print { body.printing-hb * { visibility: hidden } body.printing-hb #hbDoc, body.printing-hb #hbDoc * { visibility: visible } body.printing-hb #hbDoc { position: absolute; left: 0; top: 0; width: 100% } }

/* 調班標示、排休規則提醒 */
table.roster td.c.swapped { position: relative; outline: 2px dashed #d0730f; outline-offset: -3px }
table.roster td.c.swapped::after { content: '⇄'; position: absolute; top: 0; right: 1px; font-size: 9px; line-height: 1; color: #d0730f; font-weight: 700 }
table.roster td.c.rulebad { position: relative; background-image: linear-gradient(135deg, var(--bad) 0 6px, transparent 6px) }
.chip.sw { background: #fdebd6; color: #a5560a; border-color: transparent }
.lg { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; white-space: nowrap }
.lg .c-sw, .lg .c-rb { display: inline-block; width: 22px; height: 18px; line-height: 18px; text-align: center; font-weight: 700; font-size: 11px; border-radius: 3px; background: var(--ok-soft); color: var(--ok) }
.lg .c-sw { outline: 2px dashed #d0730f; outline-offset: -2px }
.lg .c-rb { background-image: linear-gradient(135deg, var(--bad) 0 5px, transparent 5px) }
.swm { color: #d0730f; font-weight: 700; font-size: 11px }
.xbox { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 12px 0 }
.xbox h3 { margin: 0 0 6px; font-size: 15px }
@media (prefers-color-scheme: dark) { .chip.sw { background: #3d2a12; color: #f0b26a } }
.cal .d.swd { outline: 2px dashed #d0730f; outline-offset: -3px }
.panel.danger { border-color: var(--bad) }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad) }
.notice.bad { background: var(--bad-soft); color: var(--bad) }
.signbox { position: relative; border: 1.5px dashed var(--line-strong, #9aa8a1); border-radius: 10px; background: #fff; height: 170px; touch-action: none }
.signbox canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: 10px }
.signhint { position: absolute; inset: 0; display: grid; place-items: center; color: #b5beb9; font-size: 18px; pointer-events: none }
.cashbox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px }
.cashline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: space-between }
table.cashtbl th, table.cashtbl td { white-space: nowrap }
.hoitem { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px }
.hoitem.todo { border-color: var(--bad); background: var(--bad-soft) }
.hotext { white-space: pre-wrap; line-height: 1.6 }
.hoitem input { flex: 1; min-width: 120px }
/* 現場事件回報 */
.incitem { cursor: pointer }
.incitem:hover { border-color: var(--info) }
.catpick { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 14px }
.catpick:has(input:checked) { border-color: var(--info); background: var(--info-soft) }
.incbox { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px }
.incbox.ok { border-color: var(--ok, #2e7d32) }
.kvgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px }
.kvgrid span { display: block; font-size: 13px; color: var(--muted) }
.timeline { display: grid; gap: 6px; margin-top: 6px; border-left: 2px solid var(--line); padding-left: 10px }
tr.rowbad td { background: var(--bad-soft) }
.incbox.warn { border-color: var(--bad); background: var(--bad-soft) }
.memrow input { flex: 1; min-width: 0 }
.memrow input[data-mphone] { flex: 0 0 38% }

/* 精簡首頁：帳號選單、梵帝仕表頭、可收合區塊 */
header.top { flex-wrap: nowrap }
.who { min-width: 0; font-size: 14px }
.whotxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3 }
.whotxt b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.whotxt .co { font-size: 12px; color: var(--muted) }
.menu { position: relative; flex: none }
.menu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 18px; line-height: 1; color: var(--muted); background: var(--surface) }
.menu summary::-webkit-details-marker { display: none }
.menupop { position: absolute; right: 0; top: 42px; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: grid; gap: 2px; min-width: 120px; box-shadow: 0 6px 20px rgb(0 0 0 / .12) }
.menupop .linkbtn { text-decoration: none; text-align: left; padding: 8px 10px; font-size: 14px; color: var(--ink); border-radius: 6px }
.menupop .linkbtn:hover { background: var(--surface-2) }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px }
.qbtn { appearance: none; font: inherit; text-align: left; cursor: pointer; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); color: var(--ink); display: grid; gap: 2px; min-width: 0 }
.qbtn b { font-size: 16px }
.qbtn small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.qbtn.warn { border-color: var(--warn); background: var(--warn-soft) } .qbtn.warn small { color: var(--warn) }
.qbtn.bad { border-color: var(--bad); background: var(--bad-soft) } .qbtn.bad small { color: var(--bad) }
.qbtn.ok small { color: var(--ok) } .qbtn.info small { color: var(--info) }
.fold summary { cursor: pointer; font-size: 14px; color: var(--muted); padding: 4px 0 }
.fold summary.alert { color: var(--bad); font-weight: 600 }
.fold textarea { margin-top: 6px; width: 100% }
.geo { padding: 8px 10px; font-size: 13px }
.geo .txt { min-width: 150px }
.btn.big { padding: 14px }
.shift b { white-space: nowrap; font-size: 16px }
.shift { white-space: nowrap }
#modeSeg button { font-size: 13px; padding: 5px 12px }
.clock { grid-template-columns: 1fr; gap: 6px }
.clockmeta { text-align: left; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline }
.clockmeta .date { font-size: 14px }
.clockmeta .shift { text-align: left; font-size: 13px } .clockmeta .shift b { display: inline; font-size: 15px; margin-left: 4px }
/* 首頁按鍵式選單 */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(5, 1fr) } }
.tile { position: relative; appearance: none; font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 14px; padding: 14px 6px 10px; display: grid; justify-items: center; gap: 6px; font-size: 14px }
.tile svg { color: var(--accent) }
.tile:active { transform: scale(.97) }
.tbadge { position: absolute; top: 6px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center }
.backbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 6px 0 }
.backbar b { font-size: 17px }

/* ===== 滿版、隨手機／平板自動縮放（v17） ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100% }
#appView { min-height: 100dvh; padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)) }
#appView .panel { gap: clamp(10px, 1.8vh, 16px) }
section[data-view="clock"] .clock .time { font-size: clamp(48px, min(16vw, 9vh), 112px) }
section[data-view="clock"] .btn.big { min-height: clamp(56px, 8vh, 88px); font-size: clamp(18px, 4.6vw, 24px) }
.tile { padding: clamp(10px, 2vh, 18px) 6px clamp(8px, 1.6vh, 14px); font-size: clamp(13px, 3.6vw, 16px) }
.tile svg { width: clamp(24px, 7vw, 34px); height: clamp(24px, 7vw, 34px) }
.qbtn b { font-size: clamp(15px, 4.2vw, 19px) }

/* 手機：滿版，不要外框卡片 */
@media (max-width: 699px) {
  body { background: var(--surface) }
  #appView { max-width: none; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); gap: 12px }
  #appView .panel { border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none }
  #appView .stack > .panel + .panel, #appView [data-view] > .panel + .panel { border-top: 1px solid var(--line); padding-top: 16px }
  .backbar { background: var(--surface); margin-inline: -14px; padding-inline: 14px; border-bottom: 1px solid var(--line) }
  .tiles { gap: 8px }
  .geo { font-size: 12.5px }
}

/* 平板（iPad 直向）：版面放大、按鍵 4 欄 */
@media (min-width: 700px) {
  #appView { max-width: 1180px; padding-inline: 24px; padding-top: 20px }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 14px }
  .tile { border-radius: 16px }
}
/* 平板橫向／大螢幕：左邊打卡，右邊功能按鍵 */
@media (min-width: 980px) {
  section[data-view="clock"] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; align-items: start; padding: 28px }
  section[data-view="clock"] > * { grid-column: 1 }
  section[data-view="clock"] > #homeTiles { grid-column: 2; grid-row: 1 / span 12; grid-template-columns: repeat(3, 1fr); margin-top: 0 }
  section[data-view="clock"] > #quickBar { grid-column: 2; grid-row: 1 }
  section[data-view="clock"]:has(#quickBar:not([hidden])) > #homeTiles { grid-row: 2 / span 12 }
}

/* ===== v17b：所有尺寸都滿版，功能按鍵自動撐滿剩下的高度 ===== */
body:has(#appView:not([hidden])) { background: var(--surface) }
#appView { max-width: none; display: flex; flex-direction: column }
#appView .panel { border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none }
#appView .stack > .panel + .panel, #appView [data-view] > .panel + .panel { border-top: 1px solid var(--line); padding-top: 16px }
section[data-view="clock"]:not([hidden]) { flex: 1; display: flex; flex-direction: column }
#homeTiles { flex: 1; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(clamp(76px, 11vh, 96px), clamp(90px, 16vh, 190px)); align-content: start }
.tile { align-content: center }
@media (min-width: 700px) {
  #appView { padding-inline: clamp(24px, 4vw, 56px) }
  #homeTiles { grid-template-columns: repeat(4, 1fr) }
  .tile { font-size: clamp(15px, 2vw, 19px) }
  .tile svg { width: clamp(30px, 4vw, 44px); height: clamp(30px, 4vw, 44px) }
}
@media (min-width: 980px) {
  section[data-view="clock"]:not([hidden]) { display: grid; padding: 8px 0 0 }
  section[data-view="clock"] > #homeTiles { grid-template-columns: repeat(3, 1fr) }
}
@media (max-height: 700px) and (max-width: 699px) {
  section[data-view="clock"] .clock .time { font-size: clamp(44px, 13vw, 60px) }
  #appView .panel { gap: 9px }
  #homeTiles { grid-auto-rows: 72px }
}
.backbar { background: var(--surface) }
.rulelist { margin: 6px 0 4px; padding-left: 1.4em; display: grid; gap: 2px }
.exbox { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px }
.exbox h3 { margin-top: 6px }
.exrow { display: grid; grid-template-columns: 2fr 1.4fr 1.4fr 1fr auto; gap: 6px; align-items: center }
.exrow[data-exrow="edu"] { grid-template-columns: 2fr 1.4fr 1.4fr .9fr .7fr auto }
@media (max-width: 699px) { .exrow, .exrow[data-exrow="edu"] { grid-template-columns: 1fr 1fr } .exrow [data-exdel] { justify-self: start } }
.hrphoto { width: 96px; height: 120px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; overflow: hidden; background: var(--surface-2) }
.hrphoto img { width: 100%; height: 100%; object-fit: cover }
.slipgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 640px) { .slipgrid { grid-template-columns: 1fr; } }
.slipgrid table { width: 100%; }
.imphead { display: flex; align-items: center; gap: 10px; justify-content: flex-start; flex-wrap: wrap; font-size: 16px; }
.imphead input[type=checkbox] { width: 20px !important; min-width: 0; height: 20px; flex: 0 0 20px; margin: 0; padding: 0; }
#rosTable td.c { position: relative; }
#rosTable .cmk { position: absolute; right: 1px; bottom: 0; font-style: normal; font-size: 9px; line-height: 1; color: #fff; background: var(--ok, #1a7f45); border-radius: 3px; padding: 1px 2px; }
/* 公司公告 */
.annitem { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; color: inherit; cursor: pointer; }
.annitem.new { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.annitem:hover { background: var(--soft, #f4f6f5); }
.annimg { max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--line); }
/* 浮水印 */
#wm { position: fixed; inset: 0; pointer-events: none; z-index: 2147483000; background-repeat: repeat; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#wm { background-image: var(--wm, none); }
#dlg { background-image: var(--wm, none); background-repeat: repeat; }
/* 不提供列印：用瀏覽器選單列印也只會印出提示 */
@media print { body > * { display: none !important; } body::after { content: '本系統不提供列印'; display: block; padding: 40px; font-size: 20px; } }
.cashdet { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); padding: 0 0 6px 4px; font-variant-numeric: tabular-nums; }
/* 申購／維修 */
.ordgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ordbig { display: grid; gap: 4px; text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.ordbig b { font-size: 18px; color: var(--accent); } .ordbig span { font-size: 13px; color: var(--muted); }
.ordbig:hover { border-color: var(--accent); }
.oitem { display: grid; grid-template-columns: 2fr 1.4fr .8fr .7fr 1fr auto; gap: 6px; align-items: center; }
@media (max-width: 640px) { .oitem { grid-template-columns: 1fr .8fr 1fr auto; padding-bottom: 6px; border-bottom: 1px dashed var(--line); } .oitem .oiName, .oitem .oiSpec { grid-column: 1 / -1; } .ordgrid { grid-template-columns: 1fr; } }
.ordlog { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }

/* 收銀紀錄：每天一張卡片 */
.cashlist { display: grid; gap: 10px }
.cday { border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--r); padding: 10px 14px; background: var(--surface); display: grid; gap: 8px }
.cday.warn { border-left-color: var(--warn) }
.cday.bad { border-left-color: var(--bad) }
.cdh { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap }
.cdd { font-family: var(--f-display); font-size: 22px; line-height: 1 }
.cdtot { font-family: var(--f-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap }
.cdgrid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px }
.cds { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; align-content: start; min-width: 0 }
.cdk { font-size: 14px }
.cdn { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 4px 10px; margin: 0 }
.cdn dt { font-size: 12px; color: var(--muted) }
.cdn dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums }
.cdn dd.bad { color: var(--bad) } .cdn dd.ok { color: var(--ok) }
.cdnote { color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px }
.cdact { justify-content: flex-end; gap: 6px }
@media (max-width: 699px) { .cdgrid { grid-template-columns: 1fr } .cday { padding: 10px } }

/* 管理選單（分組）：電腦固定在左側；手機按「管理選單」打開 */
#adminNav { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 12px }
#adminNav .ngroup { display: flex; flex-direction: column; gap: 4px }
#adminNav .nglabel { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .05em; padding: 0 4px }
#adminNav button { text-align: left; border-radius: 8px; border: 0; background: transparent; color: var(--ink); padding: 5px 12px; font-size: 15px; line-height: 1.5 }
#adminNav button:hover { background: var(--surface-2) }
#adminNav button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700 }
.adminbar { display: none }
@media (min-width: 980px) {
  section[data-view="admin"] { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px 22px; align-items: start }
  section[data-view="admin"] > * { grid-column: 2; min-width: 0 }
  section[data-view="admin"] > .adminside { grid-column: 1; grid-row: 1 / span 60; position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 10px }
}
@media (max-width: 979px) {
  .adminbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; background: var(--surface); padding: 8px 0; border-bottom: 1px solid var(--line) }
  .adminbar b { font-size: 17px }
  .adminside { display: none }
  section[data-view="admin"].menu-open > :not(.adminside):not(#adminLockNote) { display: none !important }
  section[data-view="admin"].menu-open > .adminside { display: block }
  #adminNav { gap: 18px }
  #adminNav .ngroup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px }
  #adminNav .nglabel { grid-column: 1 / -1; font-size: 13px }
  #adminNav button { border: 1px solid var(--line); background: var(--surface); padding: 14px 12px; font-size: 16px; font-weight: 600; border-radius: 12px; text-align: left }
  #adminNav button[aria-selected="true"] { border-color: var(--accent) }
}

/* 手機：下方導覽列＋右下「＋」（像 App） */
.bnav, .fab { display: none }
@media (max-width: 699px) {
  body.bn .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 0 max(6px, env(safe-area-inset-bottom)) }
  body.bn .bnav button { appearance: none; border: 0; background: none; font: inherit; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; position: relative; cursor: pointer; font-size: 12px }
  body.bn .bnav button svg { width: 24px; height: 24px }
  body.bn .bnav button.on { color: var(--accent); font-weight: 700 }
  body.bn .bnav .tbadge { position: absolute; top: 0; left: calc(50% + 6px); right: auto }
  body.bn .fab:not([hidden]) { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 21; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(0,0,0,.22); cursor: pointer }
  body.bn #appView { padding-bottom: calc(96px + env(safe-area-inset-bottom)) }
  body.bn section[data-view="clock"] #homeTiles { display: none }
  body.bn #tabs { display: none }
  .fabgrid { grid-template-columns: repeat(3, 1fr) }
}
@media (max-width: 699px) { body.bn #annList > h2 { display: none } }
.updbar { position: fixed; left: 50%; transform: translateX(-50%); top: max(8px, env(safe-area-inset-top)); z-index: 50; border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.2); cursor: pointer }
