/* 臨時問卷「聊聊我們的照顧工作」視覺(照制度許願池：院徽桃紅 #E4007F、米白底、淺底上的桃紅字用深一階 #B10063)
 *
 * 同仁看的頁面(.big)字放大：同仁多數 50、60 歲以上、手機為主(內文 19px 以上、題目 22px、輸入框 168px 高、按鈕 64px 高)。
 * 管理畫面只給 Jacky 用電腦看，字級照許願池。
 * 對比(WCAG AA，2026-10-07 重算)：
 *   白字 on #E4007F 主按鈕 4.6:1；#B10063 字 on 白 6.9:1、on #FDEEF6 6.2:1；
 *   內文 #303735 on #F7F7F3 11:1；次要字 #66706D on 白 5.1:1。
 *   桃紅 #E4007F 不拿來當淺底上的小字(on #FDEEF6 只有 4.1:1)，淺底上的字一律用 --primary-ink。
 * 登入頁照人事帳號系統示範站(Jacky 指定的各系統登入範本)。只有亮色。
 */
:root {
  --bg: #F7F7F3;
  --card: #FFFFFF;
  --ink: #303735;
  --muted: #66706D;
  --ph: #929996;
  --primary: #E4007F;        /* 院徽桃紅：主按鈕、題號、焦點 */
  --primary-dark: #B10063;   /* 按鈕滑過 */
  --primary-ink: #B10063;    /* 桃紅系的字(標題、淺底上的字) */
  --primary-soft: #FDEEF6;   /* 淺桃紅底 */
  --primary-line: #F6CBE2;
  --line: #E0E4DF;
  --input-border: #D9DED9;
  --tab-bg: #ECEEEA;
  --danger: #B42318; --danger-soft: #FDECEA;
  --ok: #1B5E33;
  --focus: rgba(228, 0, 127, .16);
  --radius: 16px;
  --font: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  color-scheme: light;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.7; min-height: 100vh;
       -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--primary-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.view { max-width: 640px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
html.admin-wide .view { max-width: 1180px; }

/* ── 頂欄(sticky，整頁照常捲動；iPhone Safari 不做整頁 fixed) ── */
.top { position: sticky; top: 0; z-index: 30; background: rgba(247, 247, 243, .94); border-bottom: 1px solid var(--line);
       -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.top-in { max-width: 640px; margin: 0 auto; height: 56px; display: flex; align-items: center; gap: 12px;
          padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
html.admin-wide .top-in { max-width: 1180px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 17px; text-decoration: none; min-width: 0; }
.brand img { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me { margin-left: auto; position: relative; }
.me-links { display: flex; align-items: center; gap: 16px; font-size: 14px; white-space: nowrap; }
.me-links a, .me-links button { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0;
                                padding: 4px 0; cursor: pointer; font-size: 14px; }
.me-links a:hover, .me-links button:hover { color: var(--primary-ink); }
.me-links a[aria-current="page"] { color: var(--primary-ink); font-weight: 700; }
.me-btn { display: flex; align-items: center; height: 38px; padding: 0 14px; border: 1px solid var(--input-border); background: var(--card);
          border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--ink); max-width: 10em; }
.me-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px; background: var(--card);
        border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(48, 55, 53, .12); padding: 6px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
                        padding: 12px; border-radius: 8px; color: var(--ink); font-size: 16px; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--tab-bg); }
@media (min-width: 720px) { .me-btn, .menu { display: none !important; } }
@media (max-width: 719px) { .me-links { display: none; } }

/* ── 共用按鈕 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer;
       background: var(--primary); color: #fff; font-size: 17px; font-weight: 700; padding: 14px 36px; border-radius: 999px;
       box-shadow: 0 2px 8px rgba(177, 0, 99, .22); transition: transform .1s, background .2s; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.ghost { background: var(--card); color: var(--primary-ink); box-shadow: none; border: 1.5px solid var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.quiet { background: var(--card); color: var(--ink); box-shadow: none; border: 1.5px solid var(--input-border); font-weight: 600; }
.btn.quiet:hover { border-color: var(--primary); }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn.danger:hover { background: #8F1B12; }
.btn.small { font-size: 14px; padding: 7px 16px; }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-row { text-align: center; margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── 頁籤 ── */
.tabs { display: flex; gap: 8px; margin-bottom: 22px; background: var(--tab-bg); border-radius: 999px; padding: 5px; }
.tabs a { flex: 1; text-align: center; text-decoration: none; font-size: 15.5px; font-weight: 600; color: var(--muted);
          padding: 10px 0; border-radius: 999px; }
.tabs a.on { background: var(--card); color: var(--primary-ink); box-shadow: 0 1px 3px rgba(20, 30, 26, .10); }

/* ── 同仁看的頁面(.big)：同仁多數 50、60 歲以上，手機為主。內文 19px、題目 22px、輸入框高、按鈕大 ── */
.big { font-size: 19px; line-height: 1.85; }
.big .logo { width: 76px; height: 76px; border-radius: 50%; display: block; margin: 8px auto 18px; box-shadow: 0 6px 18px rgba(48, 55, 53, .14); }
/* 歡迎頁要一個手機畫面看完，連「開始填寫」都不用往下滑 (Jacky 2026-10-12)：院徽縮小、行距收緊 */
.welcome .logo { width: 48px; height: 48px; margin: 0 auto 4px; }
.btn.huge { font-size: 22px; padding: 18px 48px; min-height: 64px; min-width: 220px; }
.welcome { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 14px; text-align: center; }
.welcome h1 { font-size: 23px; color: var(--primary-ink); margin-bottom: 4px; line-height: 1.4; }
.welcome p { font-size: 20px; line-height: 1.5; margin: 0 0 4px; }
.welcome + .btn-row { margin-top: 10px; }
.welcome p:last-child { margin-bottom: 0; }
.seg { display: inline-block; }
.notice { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 22px 34px; text-align: center; margin-top: 4vh; }
.notice p { font-size: 23px; line-height: 1.8; font-weight: 700; }
.notice.done { border-color: var(--primary-line); background: var(--primary-soft); }
.notice.done p { color: var(--primary-ink); }
.part { margin-bottom: 18px; }
.part h2 { font-size: 23px; color: var(--primary-ink); margin: 18px 4px 14px; padding-left: 12px; border-left: 6px solid var(--primary); line-height: 1.5; }
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px 22px; margin-bottom: 22px; }
.q-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.q-head label { cursor: default; }
.q-num { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; font-size: 19px;
         display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.q-head h3 { font-size: 22px; font-weight: 700; line-height: 1.65; text-wrap: pretty; }
textarea { width: 100%; min-height: 168px; resize: vertical; font-size: 20px; line-height: 1.8; color: var(--ink);
           padding: 14px 16px; border: 2px solid var(--input-border); border-radius: 14px; background: var(--card); outline: none; }
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
#q9Text { min-height: 120px; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.choice { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 18px; border: 2px solid var(--input-border); border-radius: 14px;
          background: var(--card); cursor: pointer; font-size: 21px; font-weight: 600; }
.choice input { width: 26px; height: 26px; accent-color: var(--primary); flex: none; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.note-label { display: block; font-size: 19px; color: var(--muted); margin-bottom: 8px; }
/* 必答：沒寫的題目紅框加提示 */
.q-card.missing { border: 2px solid #C62828; }
.miss-tip { color: #C62828; font-weight: 700; font-size: 18px; margin: 8px 0 0; }
.modal.big-modal { max-width: 420px; padding: 30px 24px 26px; text-align: center; }
.confirm-msg { font-size: 22px; line-height: 1.8; font-weight: 700; margin-bottom: 24px; }
.confirm-actions { display: flex; flex-direction: column; gap: 14px; }
.confirm-actions .btn { width: 100%; }

/* ── 管理畫面的回答呈現 ── */
.stats { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 22px; min-width: 120px; }
.stat b { display: block; font-size: 30px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13.5px; color: var(--muted); }
.stat.ok b { color: var(--ok); }
.stat-line { font-size: 16px; font-weight: 700; color: var(--primary-ink); margin-left: 8px; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 12px; border-radius: 999px; background: var(--tab-bg); color: var(--muted); white-space: nowrap; }
.pill.ok { background: #E6F2EA; color: var(--ok); }
.muted { color: var(--muted); font-size: 13.5px; }
.subtabs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.subtabs button, .qpick button { border: 1.5px solid var(--input-border); background: var(--card); border-radius: 999px; padding: 6px 18px; cursor: pointer; font-size: 14.5px; font-weight: 600; color: var(--muted); }
.subtabs button.on, .qpick button.on { border-color: var(--primary); color: var(--primary-ink); background: var(--primary-soft); }
.subtabs .muted { margin-left: 8px; }
.qpick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.people { display: flex; flex-direction: column; max-height: 75vh; overflow-y: auto; }
.people button { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 16px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; }
.people button span { color: var(--muted); font-size: 13px; }
.people button small { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
.people button.on { background: var(--primary-soft); }
.people button.on b { color: var(--primary-ink); }
.sheet { padding: 4px 22px 18px; }
.sheet-head { padding: 16px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-head h2 { font-size: 19px; color: var(--primary-ink); line-height: 1.6; }
.sheet-head span { font-size: 13.5px; color: var(--muted); }
.part-t { font-size: 15px; color: var(--primary-ink); margin: 16px 0 4px; }
.qa { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.qa:last-child { border-bottom: 0; }
.qa .q { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.ans { white-space: pre-wrap; font-size: 15px; line-height: 1.75; margin-top: 4px; }
.ans.blank { color: var(--ph); }
.qa.by-q { display: grid; grid-template-columns: 150px 1fr; gap: 14px; }
.who b { display: block; }
.who span { font-size: 13px; color: var(--muted); }
.tally { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0 6px; }
.panel-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal.wide-modal { max-width: 560px; }
.pick-tools { display: flex; gap: 10px; }
.pick-tools select { font: inherit; font-size: 15px; padding: 8px 10px; border: 1.5px solid var(--input-border); border-radius: 10px; background: var(--card); }
.pick-tools input { flex: 1; }
.pick-list label.pick-dept { background: #FAFAF7; font-weight: 700; position: sticky; top: 0; z-index: 1; }
.modal textarea { min-height: 100px; font-size: 15px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

footer { text-align: center; margin-top: 40px; font-size: 12.5px; color: var(--muted); }
footer a { color: inherit; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── 管理畫面(只在電腦，720px 以上) ── */
.admin-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 18px; flex-wrap: wrap; }
.admin-head h1 { font-size: 22px; color: var(--primary-ink); }
.admin-head .tabs { margin: 0; flex: 0 0 auto; }
.admin-head .tabs a { padding: 8px 22px; white-space: nowrap; }
.admin-head .spacer { flex: 1; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-note { font-size: 13.5px; color: var(--muted); padding: 12px 18px; border-bottom: 1px solid var(--line); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.grid th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 10px 14px; background: #FAFAF7; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.row { cursor: pointer; }
.grid tr.row:hover td { background: #FCFCFA; }
.grid tr.row.open td { background: var(--primary-soft); }
.grid .num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.grid .t { font-weight: 700; color: var(--ink); }
.grid .legacy { color: var(--muted); }
.grid .act { text-align: right; white-space: nowrap; }
.grid tr.detail td { background: #FCFCFA; padding: 18px 22px 22px; }
.detail-cols { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; align-items: start; }
.detail-cols .orig { margin-top: 0; }
.detail-cols .doc { padding: 20px 22px; box-shadow: none; }
.confirm { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--danger); font-weight: 700; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .knob { width: 40px; height: 24px; border-radius: 999px; background: #CDD2CC; position: relative; transition: background .15s; flex: none; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
                       box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.switch input:checked + .knob { background: var(--primary); }
.switch input:checked + .knob::after { left: 19px; }
.switch input:focus-visible + .knob { outline: 3px solid var(--focus); outline-offset: 2px; }
.narrow { text-align: center; padding: 15vh 12px 0; }
.narrow h2 { font-size: 20px; margin: 10px 0 6px; }
.narrow p { color: var(--muted); font-size: 14.5px; margin-bottom: 20px; }

/* ── 彈窗與提示 ── */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(48, 55, 53, .45); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; background: var(--card); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(48, 55, 53, .25);
         padding: 24px 22px 20px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.modal .sub { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal .actions .btn { font-size: 15px; padding: 10px 24px; }
.modal input[type=text], .modal input[type=search] { width: 100%; font-size: 15px; padding: 9px 12px; border: 1.5px solid var(--input-border);
         border-radius: 10px; background: var(--card); outline: none; }
.modal input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.pick-list { margin-top: 12px; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.pick-list label:last-child { border-bottom: 0; }
.pick-list label.is { color: var(--muted); cursor: default; }
.pick-list .dept { margin-left: auto; font-size: 13px; color: var(--muted); }
.pick-list input { width: 18px; height: 18px; accent-color: var(--primary); }
.reason { background: #FFF4DF; border: 1px solid #F1D9A6; color: #7A4600; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
         background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); }

/* ── 登入頁(照示範站：logo、系統名、一張卡片；帳號、四位碼、登入與臉或指紋兩顆鈕、忘記登入碼) ── */
.gate { max-width: 26rem; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; text-align: center; }
html.gate-mode .view { padding-top: 0; }
.gate .logo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto .7rem;
              box-shadow: 0 6px 18px rgba(48, 55, 53, .16); }
.gate h1 { font-size: 1.6rem; margin-bottom: .25rem; line-height: 1.7; }
.gate .tag { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.1rem; }
.gate .card { --欄寬: 200px; max-width: 16rem; margin: 0 auto; padding: 1.5rem 1.4rem; text-align: left; border-radius: 16px; background: var(--card);
              box-shadow: 0 1px 2px rgba(48, 55, 53, .05), 0 8px 24px rgba(48, 55, 53, .06); }
.gate .field { display: block; width: var(--欄寬); margin: 0 auto 1.1rem; }
.gate .field > span { display: block; font-weight: 600; font-size: 1rem; margin-bottom: .4rem; color: var(--muted); }
.gate input[type=text], .gate input[type=tel] { width: 100%; font-size: 1.15rem; line-height: 1.7; border: 1.5px solid var(--input-border);
              border-radius: 10px; padding: .55em .75em; background: var(--card); outline: none; }
.gate input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.gate #code { font-size: 28px; letter-spacing: 12px; text-align: center; padding: 10px 0 10px 12px; border-width: 2px; border-radius: 12px; }
.gate .login-actions { display: flex; gap: .6rem; width: var(--欄寬); margin: 0 auto; }
.gate .login-actions .btn { flex: 1 1 0; font-size: 1.05rem; padding: .85em 0; font-weight: 600; }
.gate .login-actions .btn svg { width: 30px; height: 30px; }
.gate #passkey[aria-busy="true"] { opacity: .45; }
.gate .forgot { width: var(--欄寬); margin: 1rem auto 0; text-align: right; font-size: .875rem; }
.gate .forgot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.modal.gate-modal { max-width: 19rem; padding: 1.5rem 1.4rem; text-align: center; border-top: 5px solid var(--line); }
.modal.gate-modal.ok { border-top-color: var(--ok); }
.modal.gate-modal.no { border-top-color: var(--danger); }
.modal.gate-modal .modal-msg { font-size: 1rem; line-height: 1.75; margin-bottom: 1.25rem; word-break: break-word; }
.modal.gate-modal .btn { font-size: 1.05rem; padding: .85em 1.6em; }

@media (max-width: 480px) {
  .q-card { padding: 18px 14px 20px; }
  .q-head { gap: 10px; }
  .btn.huge { width: 100%; }
}
