/* 教會簽到系統 — 手機優先，平板／電腦切換為側邊欄版型 */
:root {
  --brand: #2563eb; --brand-d: #1d4ed8; --brand-l: #eff6ff;
  --ink: #0f172a; --ink2: #334155; --mute: #64748b; --line: #e2e8f0;
  --bg: #f1f5f9; --card: #fff;
  --teal: #0d9488; --amber: #d97706; --rose: #e11d48; --violet: #7c3aed; --slate: #475569;
  --r: 16px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h3 { font-size: 16px; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.ic { width: 20px; height: 20px; flex: none; }
.ic-lg { width: 40px; height: 40px; }
.ic-xl { width: 48px; height: 48px; color: #cbd5e1; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.pad { padding: 16px; margin: 0; }

/* ---------- 按鈕／表單 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: #fff; color: var(--ink2); transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--brand-d); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: #fff1f2; color: var(--rose); border-color: #fecdd3; }
.btn-danger:hover { background: #ffe4e6; }
.btn.danger { color: var(--rose); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 13px 18px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink2); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: var(--r-sm);
  padding: 10px 12px; min-height: 44px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
input[disabled] { background: #f8fafc; color: var(--mute); }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.form-inline { grid-template-columns: 1fr 1fr; align-items: end; }
.form-inline .btn { grid-column: 1 / -1; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.chk input { width: 18px; height: 18px; accent-color: var(--brand); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #f1f5f9; border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--mute); }
.seg input:checked + span { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input:disabled + span { opacity: .4; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 8px; }
.quick { display: flex; gap: 8px; margin-top: -4px; }

.alert { padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.alert-success { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-error { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; margin: 1px 2px 1px 0; white-space: nowrap; }
.b-gray { background: #f1f5f9; color: var(--slate); }
.b-blue { background: #dbeafe; color: #1d4ed8; }
.b-teal { background: #ccfbf1; color: #0f766e; }
.b-amber { background: #fef3c7; color: #b45309; }
.b-rose { background: #ffe4e6; color: #be123c; }
.b-violet { background: #ede9fe; color: #6d28d9; }
.badge-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--amber); color: #fff; font-size: 12px; font-style: normal; font-weight: 700; margin-left: auto; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 640px; }
.empty { text-align: center; padding: 40px 18px; color: var(--mute); }
.hint { margin-top: 18px; padding: 14px 16px; background: var(--brand-l); border-radius: var(--r-sm); font-size: 13px; color: #1e3a8a; }
.hint ul { margin: 6px 0 0; padding-left: 18px; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #60a5fa, #2563eb); color: #fff; font-weight: 700; }
.avatar.sm { width: 32px; height: 32px; font-size: 14px; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }

/* ---------- 表格（手機時轉為卡片） ---------- */
.table-card { padding: 0; overflow: hidden; overflow: clip; }
@supports not (overflow: clip) { .bulkbar { position: static !important; } }
.table-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--mute); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mute); background: #f8fafc; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.card:not(.table-card) .table th, .card:not(.table-card) .table td { padding-left: 4px; padding-right: 4px; }
.row-on { background: var(--brand-l) !important; }
.w-chk { width: 44px; }
.perm-tags { display: flex; flex-wrap: wrap; gap: 2px; }
.pager { display: flex; gap: 4px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--ink2); }
.pager a.on { background: var(--brand); color: #fff; }
.pager span { margin-left: auto; color: var(--mute); font-size: 13px; }

@media (max-width: 767px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .rtable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .rtable td[data-label]::before { content: attr(data-label); color: var(--mute); font-size: 13px; text-align: left; flex: none; }
  .rtable td.num { justify-content: space-between; }
  .rtable td.actions { justify-content: flex-end; padding-top: 6px; }
  .rtable td.w-chk { position: absolute; right: 10px; top: 10px; width: auto; padding: 0; }
  .rtable td.w-chk ~ td:nth-child(2) { padding-right: 36px; }
}

/* ---------- 登入／註冊 ---------- */
body.auth { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, #3b82f6 0%, #1d4ed8 45%, #1e3a8a 100%) fixed; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 18px; }
.auth-brand { text-align: center; color: #fff; margin-bottom: 22px; }
.auth-brand .logo { width: 68px; height: 68px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(255,255,255,.15); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.3); }
.auth-brand .logo .ic { width: 36px; height: 36px; }
.auth-brand h1 { font-size: 26px; letter-spacing: 2px; }
.auth-brand p { margin: 4px 0 0; opacity: .85; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 26px 22px; box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.auth-card h2 { font-size: 20px; margin-bottom: 18px; }
.auth-switch { text-align: center; margin: 18px 0 0; color: var(--mute); }

/* ---------- 前台 ---------- */
.side, .aside { display: none; }
.side-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 4px 6px 18px; }
.side-brand .logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: #fff; }
.side-brand b, .side-user b { display: block; font-size: 16px; }
.side-brand small, .side-user small { display: block; color: var(--mute); font-size: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px; background: #f8fafc; border-radius: 12px; margin-bottom: 16px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--ink2); font-weight: 500; }
.side-nav a:hover { background: #f1f5f9; }
.side-nav a.on { background: var(--brand-l); color: var(--brand); font-weight: 700; }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-foot form { margin: 0; }
.side-logout { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; font: inherit; color: var(--mute); border-radius: 10px; cursor: pointer; }
.side-logout:hover { background: #f1f5f9; color: var(--ink); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px;
  background: var(--brand); color: #fff; }
.topbar h1 { flex: 1; text-align: center; font-size: 18px; letter-spacing: 1px; }
.tb-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: inherit; background: none; border: 0; cursor: pointer; }
.topbar .avatar { background: rgba(255,255,255,.22); }
.content { padding: 16px 16px calc(84px + var(--safe-b)); max-width: 1100px; margin: 0 auto; }
.page-title { display: none; font-size: 22px; margin-bottom: 16px; }
.page-home .content { padding-top: 0; }

.hero { margin: 0 -16px 16px; padding: 18px 20px 26px; color: #fff; border-radius: 0 0 28px 28px;
  background: linear-gradient(160deg, #2563eb 0%, #1e40af 100%); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.hero-date { font-size: 14px; opacity: .9; }
.hero-date b { font-size: 22px; margin: 0 1px; }
.hero-date small { margin-right: 4px; }
.hero-name { font-size: 18px; font-weight: 700; margin-top: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.18); }
.chip .ic { width: 14px; height: 14px; }
.hero-clock { font-size: 44px; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: 1px; }
.hero-clock small { font-size: 18px; opacity: .7; }
.hero-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px auto 0; padding: 6px 14px;
  width: fit-content; max-width: 100%; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 14px; }
.hero-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.state-on .dot { background: #fbbf24; box-shadow: 0 0 0 4px rgba(251,191,36,.25); animation: pulse 1.6s infinite; }
.state-done .dot { background: #93c5fd; }
.elapsed { font-variant-numeric: tabular-nums; font-weight: 700; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(251,191,36,0); } }
.punch-dock { display: flex; justify-content: center; margin-top: 18px; }
.punch-btn { width: 168px; height: 168px; border-radius: 50%; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 20px; font-weight: 700; letter-spacing: 2px; color: var(--brand); background: #fff;
  box-shadow: 0 0 0 10px rgba(255,255,255,.14), 0 0 0 22px rgba(255,255,255,.07), 0 14px 30px rgba(0,0,0,.25); transition: transform .12s; }
.punch-btn:active { transform: scale(.96); }
.punch-btn.is-out { color: #b45309; }
.punch-btn[disabled] { opacity: .7; }

.notice { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--r-sm);
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stat-row > div + div { border-left: 1px solid var(--line); }
.stat-row b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-row small { color: var(--mute); font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.timeline li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8fafc; border-radius: 10px; font-variant-numeric: tabular-nums; }
.t-in, .t-out { font-weight: 700; }
.t-sep { flex: 0 0 24px; height: 2px; background: #cbd5e1; }
.t-dur { margin-left: auto; color: var(--mute); font-size: 13px; white-space: nowrap; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-height: 108px; padding: 16px; border-radius: var(--r);
  background: #fff; box-shadow: var(--shadow); color: var(--ink); font-weight: 700; transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.1); }
.tile span { display: flex; align-items: center; gap: 6px; }
.ti { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; align-self: flex-end; }
.ti .ic { width: 24px; height: 24px; }
.ti-blue { background: #dbeafe; color: #2563eb; } .ti-teal { background: #ccfbf1; color: #0d9488; }
.ti-amber { background: #fef3c7; color: #d97706; } .ti-violet { background: #ede9fe; color: #7c3aed; }
.ti-slate { background: #e2e8f0; color: #475569; } .ti-rose { background: #ffe4e6; color: #e11d48; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: #94a3b8; font-size: 11px; font-weight: 600; }
.tabbar a.on { color: var(--brand); }
.tabbar .ic { width: 24px; height: 24px; }

.month-bar { display: flex; align-items: center; gap: 8px; padding: 10px; }
.month-bar form { flex: 1; }
.month-bar input { text-align: center; font-weight: 700; }
.req-list { list-style: none; margin: 0; padding: 0; }
.req-list li { padding: 12px 0; border-bottom: 1px solid #f1f5f9; display: grid; gap: 4px; }
.req-list li:last-child { border: 0; }
.req-main { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.req-main b { margin-right: 4px; }
.req-time, .req-note { font-size: 13px; color: var(--mute); }
.req-list form { justify-self: start; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-head b { display: block; font-size: 20px; }
.profile-head small { color: var(--mute); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0 0 12px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; font-weight: 600; }
.only-mobile { margin-top: 12px; }

/* ---------- 打卡頁 ---------- */
.punch-page { max-width: 640px; margin: 0 auto; padding-bottom: 150px; }
.punch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ph-date { font-size: 15px; }
.ph-date b { font-size: 26px; font-weight: 600; margin: 0 2px; }
.ph-name { font-size: 18px; font-weight: 600; margin-top: 4px; }
.ph-clock { font-size: 30px; font-weight: 300; color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ph-clock small { font-size: 14px; color: var(--mute); }
.gps-notice { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: start; margin-bottom: 16px;
  padding: 12px 40px 12px 14px; border-radius: var(--r-sm); background: #fff7ed; border: 1px solid #fdba74; color: #7c2d12; font-size: 14px; }
.gps-notice > .ic { color: var(--brand); margin-top: 1px; }
.gps-notice p { margin: 0; }
.gn-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: #9a3412; cursor: pointer; border-radius: 6px; }
.punch-opts { padding: 0 18px; }
.rate-pick { padding: 16px 18px; }
.rp-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.rp-readonly .rp-title { margin-bottom: 0; }
.rp-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.rp-opt { cursor: pointer; }
.rp-opt input { position: absolute; opacity: 0; pointer-events: none; }
.rp-opt span { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-size: 16px; font-weight: 600; color: var(--ink2); background: #fff; transition: border-color .15s, background .15s; }
.rp-opt i { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid #94a3b8; background: #fff; transition: border-color .15s, box-shadow .15s; }
.rp-opt input:checked + span { border-color: var(--brand); background: var(--brand-l); color: var(--brand); }
.rp-opt input:checked + span i { border-color: var(--brand); box-shadow: inset 0 0 0 4px #fff; background: var(--brand); }
.rp-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.rate-pick.need .rp-opt span { border-color: #fb923c; }
.po-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.po-row:last-child { border-bottom: 0; }
.po-row > label:first-child { display: grid; cursor: pointer; }
.gps-status { font-size: 12px; color: var(--mute); font-weight: 400; }
.gps-status.ok { color: var(--brand); }
.gps-status.warn { color: #c2410c; }
.switch { position: relative; width: 50px; height: 30px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: #cbd5e1; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(37,99,235,.3); }
.po-photos { flex-wrap: wrap; }
.po-label { display: flex; align-items: baseline; gap: 6px; width: 100%; }
.po-count { margin-left: auto; color: var(--mute); font-size: 13px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: #f1f5f9; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15,23,42,.65); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.thumb button .ic { width: 14px; height: 14px; }
.add-photo { position: relative; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; cursor: pointer; padding: 6px 4px; }
.add-photo input[type=file] { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }
.add-photo:focus-within { outline: 2px solid rgba(37,99,235,.4); outline-offset: 2px; border-radius: 6px; }
.add-photo.disabled { opacity: .4; pointer-events: none; }
.po-note { cursor: text; }
.note-input { display: flex; align-items: center; gap: 6px; flex: 1; color: var(--brand); }
.note-input input { border: 0 !important; box-shadow: none !important; text-align: right; padding: 6px 0 !important; min-height: 0 !important; background: transparent !important; }
.punch-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 14px 16px calc(14px + var(--safe-b));
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); text-align: center; }
.punch-actions p { margin: 8px 0 0; }
.punch-submit { min-height: 56px; font-size: 20px; letter-spacing: 3px; color: #fff; border-radius: 14px; }
.punch-submit.is-in { background: var(--brand); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.punch-submit.is-out { background: #c2410c; box-shadow: 0 4px 14px rgba(194,65,12,.3); }
.punch-submit[disabled] { opacity: .7; }
.remember-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.remember-hint { margin: -4px 0 0; text-align: center; }
.punch-detail .pd-grid { display: grid; gap: 16px; }
.pd-col { display: grid; gap: 6px; font-size: 14px; }
.pd-col .thumb { width: 96px; height: 96px; }
@media (min-width: 640px) { .punch-detail .pd-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- 後台 ---------- */
body.admin { background: #f5f7fb; }
.atop { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 12px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.atop h1 { flex: 1; font-size: 18px; }
.atop-user { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink2); }
.acontent { padding: 16px; max-width: 1400px; }
.aside.open { display: flex; position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; }
.scrim { display: none; }
.aside.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 40; }
.side-nav .badge-count { margin-left: auto; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); color: var(--ink); }
.kpi .ti { align-self: center; }
.kpi b { display: block; font-size: 26px; line-height: 1.1; }
.kpi small { color: var(--mute); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.filter-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; overflow-x: auto; flex-wrap: wrap; }
.tabs > a { padding: 8px 14px; border-radius: 999px; color: var(--ink2); font-weight: 600; white-space: nowrap; }
.tabs > a.on { background: var(--brand); color: #fff; }
.tabs > a em { font-style: normal; font-size: 12px; opacity: .8; }
.tabs-filter { margin-left: auto; }
.tabs-filter select { min-height: 38px; padding: 6px 10px; }
.bulkbar { position: sticky; top: 60px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px;
  background: #fff; border-bottom: 1px solid var(--line); }
.bulkbar input[name=review_note] { flex: 1 1 200px; min-height: 38px; padding: 7px 10px; }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); }

.two-col { display: grid; gap: 16px; align-items: start; }
.two-col > .card { margin-bottom: 0; }

/* 平板（直式 768 以上）：前台改左側欄、隱藏底部分頁列 */
@media (min-width: 768px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: #fff; border-right: 1px solid var(--line); }
  .topbar, .tabbar, .only-mobile { display: none; }
  .content { padding: 28px 28px 40px; }
  .page-title { display: block; }
  .page-home .content { padding-top: 28px; }
  .punch-page { padding-bottom: 0; }
  .punch-actions { position: static; background: none; border: 0; padding: 4px 0 0; backdrop-filter: none; }
  .hero { margin: 0 0 20px; border-radius: 24px; padding: 28px 32px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "top dock" "status dock"; align-items: center; gap: 0 24px; }
  .hero-top { grid-area: top; display: block; }
  .hero-clock { margin-top: 10px; font-size: 64px; }
  .hero-status { grid-area: status; margin: 14px 0 0; justify-content: flex-start; }
  .punch-dock { grid-area: dock; margin: 0; }
  .home-grid, .two-col { grid-template-columns: 1fr 1fr; gap: 20px; display: grid; }
  .home-grid .card { margin-bottom: 0; height: 100%; }
  .home-grid { margin-bottom: 20px; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .form-inline { grid-template-columns: 1fr 1fr auto; }
  .form-inline .btn { grid-column: auto; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .acontent { padding: 24px; }
}
@media (max-width: 767px) { .hide-sm { display: none; } }

/* 電腦（1024 以上）：後台固定側欄 */
@media (min-width: 1024px) {
  .ashell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
  .aside { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: #fff; border-right: 1px solid var(--line); }
  .only-mobile { display: none; }
  .atop { padding: 0 24px; }
  .two-col.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); }
  .two-col.wide-left > .card:last-child { position: sticky; top: 80px; }
  .filters { grid-template-columns: repeat(5, 1fr) ; }
  .filter-actions { grid-column: auto / span 5; }
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .tile { min-height: 120px; }
}
@media (min-width: 1024px) and (max-width: 1279px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1023px) { .aside .side-brand { padding-top: 4px; } .aside.open { background: #fff; flex-direction: column; padding: 20px 14px; } }
