/* 線上同意書簽署 — 前台樣式（行動裝置優先） */

:root{
  --blue:#1f5f8b;
  --blue-d:#174a6d;
  --ink:#1a1a1a;
  --ink-2:#4a4a4a;
  --line:#c9d2d9;
  --bg:#eceff2;
  --ok:#1e7d43;
  --err:#b3261e;
  --warn:#8a5a00;
  --radius:10px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
[hidden]{display:none!important}   /* 避免下方 .busy/.toast 的 display 蓋掉 hidden */
body.bg{
  background:var(--bg);
  color:var(--ink);
  font-family:"Microsoft JhengHei","PingFang TC","Noto Sans TC","Heiti TC",Arial,sans-serif;
  font-size:17px;
  line-height:1.6;
  -webkit-text-size-adjust:100%;
}

/* ---------- 頁首 / 頁尾 ---------- */
.topbar{background:var(--blue);color:#fff;position:sticky;top:0;z-index:20;box-shadow:0 1px 6px rgba(0,0,0,.18)}
.topbar-in{max-width:820px;margin:auto;padding:10px 14px;display:flex;align-items:center;gap:12px}
.hpt{flex:1;min-width:0}
.hptname{font-size:19px;font-weight:700;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hptid{font-size:13px;opacity:.85}
.who{text-align:right;flex:0 0 auto}
.whoname{font-size:17px;font-weight:700}
.whoid{font-size:12px;opacity:.85}

.wrap{max-width:820px;margin:auto;padding:12px 10px 28px}
.foot{max-width:820px;margin:auto;padding:14px;color:#6b7680;font-size:13px;text-align:center}
.foot-sm{font-size:12px;margin-top:4px}

/* ---------- 卡片 ---------- */
.card{background:#fff;border-radius:var(--radius);padding:16px 14px;margin:0 0 12px;box-shadow:0 1px 8px rgba(0,0,0,.08)}
.h1{font-size:21px;margin:0 0 10px;line-height:1.35}
.h2{font-size:17px;margin:14px 0 4px;color:var(--blue-d)}
.hint{color:var(--ink-2);font-size:15px;margin:6px 0 12px}
.hint.center{text-align:center}
.sub{display:block;color:#71797f;font-size:13px;margin-top:5px;line-height:1.5}
.declare p{margin:6px 0}
.declare ol{margin:4px 0;padding-left:22px}
.declare li{margin:4px 0}

/* ---------- 表單 ---------- */
.fld{display:block;margin:0 0 14px}
.lb{display:block;font-weight:700;margin-bottom:5px;font-size:16px}
.lb2{color:#71797f;font-size:13px;margin-right:6px}
input[type=text],input[type=tel]{
  width:100%;font:inherit;font-size:20px;padding:11px 10px;border:1px solid var(--line);
  border-radius:8px;background:#fff;color:var(--ink);min-height:48px
}
input:focus{outline:2px solid #7fb2d4;outline-offset:1px;border-color:var(--blue)}
.bday{display:flex;align-items:center;gap:6px}
.bday input{text-align:center;flex:1 1 0;min-width:0}
.bd{flex:0 0 auto;font-size:16px;color:var(--ink-2)}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  border:0;border-radius:8px;padding:12px 18px;font:inherit;font-size:17px;
  cursor:pointer;text-decoration:none;min-height:50px
}
.btn.primary{background:var(--blue);color:#fff;font-weight:700}
.btn.primary:active{background:var(--blue-d)}
.btn.ghost{background:#eef2f5;color:var(--blue-d);border:1px solid var(--line)}
.btn.big{width:100%;font-size:19px;margin-top:6px}
.btn[disabled]{opacity:.55}
.actions{display:flex;gap:10px;margin-top:12px}
.actions .btn{flex:1}

.err{background:#fdecea;color:var(--err);border:1px solid #f3c5c1;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:15px}
.warn{background:#fff6e5;color:var(--warn);border:1px solid #f0dcb0;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:15px}

/* ---------- 錯誤頁 ---------- */
.msgbox{max-width:520px;margin:40px auto;text-align:center}
.msgicon{width:52px;height:52px;line-height:52px;border-radius:50%;background:#fdecea;color:var(--err);font-size:30px;font-weight:700;margin:0 auto 10px}

/* ---------- 選單 ---------- */
.patbar{display:flex;gap:18px;flex-wrap:wrap;background:#f4f7f9;border-radius:8px;padding:8px 12px;margin-bottom:10px}
.formlist{list-style:none;margin:0;padding:0}
.formlist li{margin:0 0 10px}
.formbtn{
  display:flex;align-items:center;gap:10px;width:100%;
  background:#fff;border:1px solid var(--line);border-left:5px solid var(--blue);
  border-radius:8px;padding:14px 12px;text-decoration:none;color:var(--ink);min-height:60px
}
.formbtn:active{background:#f2f7fb}
.formbtn .no{flex:0 0 auto;width:28px;height:28px;line-height:28px;text-align:center;border-radius:50%;background:var(--blue);color:#fff;font-size:15px;font-weight:700}
.formbtn .nm{flex:1;font-size:18px;font-weight:700;line-height:1.3}
.formbtn .arrow{flex:0 0 auto;color:#9aa5ad;font-size:24px;line-height:1}
.tag{display:inline-block;font-size:13px;padding:2px 8px;border-radius:20px;white-space:nowrap}
.tag.done{background:#e6f4ea;color:var(--ok);border:1px solid #b6ddc3}
.st .tag{margin-left:2px}
.st .dt{display:block;font-size:11px;color:#8a949c;text-align:right;margin-top:2px}

/* ---------- 簽署頁 ---------- */
.signhead{display:flex;align-items:center;gap:10px;margin:0 0 8px}
.back{color:var(--blue-d);text-decoration:none;font-size:16px;background:#fff;border:1px solid var(--line);border-radius:8px;padding:8px 12px;min-height:40px;display:inline-flex;align-items:center}
.signtitle{font-size:18px;font-weight:700;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.paperwrap{background:#fff;border-radius:var(--radius);box-shadow:0 1px 8px rgba(0,0,0,.08);margin-bottom:12px}
.paper{background:#fff;color:#111;padding:16px 14px;font-size:16px;line-height:1.7;border-radius:var(--radius)}
/* 轉圖時固定成 A4 版面寬度，讓不同手機產生一致的 PDF */
.paper.capturing{width:760px;max-width:none;padding:26px 30px;font-size:17px;border-radius:0}
.paper h1{font-size:21px;text-align:center;margin:0 0 12px;line-height:1.35}
.paper h2{font-size:17px;margin:14px 0 4px}
.paper p{margin:6px 0}
.paper ol,.paper ul{margin:4px 0;padding-left:22px}
.paper li{margin:4px 0}
.paper table{width:100%;border-collapse:collapse;margin:8px 0;font-size:15px}
.paper th,.paper td{border:1px solid #aaa;padding:6px 8px;text-align:left}
.paper .meta{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;font-size:15px;background:#f4f7f9;border-radius:8px;padding:10px 12px;margin-bottom:10px}
.paper .meta b{font-weight:700}
.paper .opt{border:1px solid #b9c4cc;border-radius:8px;padding:10px 12px;margin:10px 0;background:#fcfdfe}
.paper .opt .q{font-weight:700;margin-bottom:6px}
.paper .opt label{display:flex;align-items:center;gap:8px;padding:9px 8px;border:1px solid var(--line);border-radius:8px;margin:6px 0;background:#fff;min-height:46px;font-size:16px}
.paper .opt input[type=radio],.paper .opt input[type=checkbox]{width:20px;height:20px;flex:0 0 auto;margin:0}
.paper .fill{border:0;border-bottom:1px solid #666;border-radius:0;font-size:16px;padding:4px 2px;min-height:36px;width:auto;min-width:120px}
.paper .box{display:inline-block;width:1.1em;text-align:center}

/* 凍結（轉圖）後的靜態呈現 */
.paper .frozen-line{display:inline-block;min-width:120px;border-bottom:1px solid #666;padding:0 4px}
.paper .cbx{
  display:inline-block;width:18px;height:18px;line-height:16px;text-align:center;
  border:1.5px solid #444;border-radius:3px;font-size:15px;font-weight:700;
  color:#111;vertical-align:-3px;flex:0 0 auto;background:#fff
}
.paper .cbx.on{border-color:#111}

.sigslot{border:1px solid #b9c4cc;border-radius:8px;padding:10px;margin:14px 0 4px;background:#fff}
.sigslot .sigtitle{font-weight:700;margin-bottom:6px;font-size:16px}
.sigslot canvas{display:block;width:100%;height:220px;border:1px dashed #8a949c;border-radius:6px;background:#eeeeee;touch-action:none}
.sigslot .sigtip{font-size:13px;color:#71797f;margin-top:6px}
.sigslot .sigstamp{font-size:13px;color:#333;text-align:right;margin-top:6px;min-height:1px}
.sigslot .sigstamp:empty{margin-top:0}
.sigslot img.sigimg{display:block;width:100%;height:220px;object-fit:contain;background:#eeeeee;border:1px dashed #8a949c;border-radius:6px}
/* 送出列隨頁面捲動，不固定在畫面下方：
   手機上固定列會吃掉一大塊版面，且病患捲到最後才看到按鈕，
   也比較符合「讀完整份同意書再簽送」的順序。 */
.submitbar{margin-top:14px}

/* ---------- 提示 / 忙碌 ---------- */
.toast{position:fixed;left:50%;bottom:86px;transform:translateX(-50%);background:rgba(20,20,20,.92);color:#fff;padding:11px 18px;border-radius:24px;font-size:16px;z-index:60;max-width:88%;text-align:center}
.busy{position:fixed;inset:0;background:rgba(255,255,255,.82);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:70;font-size:17px;color:var(--blue-d)}
.spinner{width:42px;height:42px;border:4px solid #cfe0ec;border-top-color:var(--blue);border-radius:50%;animation:spin .9s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

@media(min-width:760px){
  .paper{padding:26px 30px;font-size:17px}
  .wrap{padding:16px 12px 32px}
}

/* ---------- 公佈欄 QRCode ---------- */
.qrbtn{
  flex:0 0 auto;display:inline-flex;flex-direction:column;align-items:center;gap:1px;
  color:#fff;text-decoration:none;padding:5px 9px;border-radius:8px;
  background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.35);line-height:1
}
.qrbtn:active{background:rgba(255,255,255,.28)}
.qrbtn-tx{font-size:11px;letter-spacing:.5px}

.qrtip{
  background:#fff6e5;border:1px solid #f0dcb0;border-radius:8px;
  padding:9px 12px;margin:0 0 10px;font-size:14px;line-height:1.6;color:var(--warn)
}
.qrstage{
  display:flex;justify-content:center;padding:12px 0 4px;
  background:#f2f5f8;border:1px solid var(--line);border-radius:10px;margin:10px 0 14px
}
.qrstage canvas{max-width:100%;height:auto;background:#fff;box-shadow:0 1px 6px rgba(0,0,0,.14)}
.qractions{display:flex;gap:10px;flex-wrap:wrap}
.qractions .btn{flex:1 1 180px}
.qrmeta{margin:14px 0 0;font-size:14px;color:var(--ink-2)}
.qrurl{word-break:break-all}

@media print{
  /* 只印那張圖，其餘一律不印 */
  .topbar,.foot,.hint,.h1,.qractions,.qrmeta,.actions,.toast,.busy{display:none!important}
  body,.bg{background:#fff}
  .wrap{padding:0;max-width:none}
  .card{box-shadow:none;margin:0;padding:0}
  .qrstage{background:#fff;border:0;padding:0;margin:0}
  .qrstage canvas{box-shadow:none}
}

/* ---------- 更正姓名 ---------- */
.patname-cell{display:flex;align-items:center;gap:8px}
.namefix{
  border:1px solid var(--line);background:#fff;color:var(--blue-d);
  font:inherit;font-size:13px;line-height:1;padding:4px 9px;border-radius:14px;
  cursor:pointer;white-space:nowrap;min-height:0
}
.namefix:active{background:#e8eef3}

.modal{
  position:fixed;inset:0;z-index:80;background:rgba(20,28,34,.55);
  display:flex;align-items:center;justify-content:center;padding:14px;overflow:auto
}
.modal-in{
  background:#fff;border-radius:var(--radius);padding:16px 14px;
  width:100%;max-width:460px;box-shadow:0 6px 28px rgba(0,0,0,.3);margin:auto
}
.modal-in .h1{margin-bottom:12px}
.modal-in .actions{margin-top:14px}
.modal-in .actions .btn{flex:1}
.err.strong{font-weight:700;font-size:16px;line-height:1.6}



/* ---------- 簽名區改滿版 ---------- */
/* 橫向提示：僅窄螢幕(帶 no-land)且直向時顯示；平板(帶 off)一律隱藏 */
.sigovl-hint.off{ display:none !important; }
@media (orientation:landscape){
  .sigovl-hint.no-land{ display:none; }
}

/* ===== 簽名區（主頁縮圖 + 開啟鈕） ===== */
.sigshow{
  position:relative;
  width:100%;
  min-height:120px;
  border:1px dashed #b9b9b9;
  border-radius:6px;
  background:#f7f7f7;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  cursor:pointer;
}
.sigshow.has{ border-style:solid; border-color:#8fb0d8; background:#fff; }
.sigshow .sigimg{ display:block; max-width:100%; height:auto; }
.sigshow .sigph{ color:#9a9a9a; font-size:15px; }

.sigopen{
  display:block;
  width:100%;
  margin-top:10px;
  padding:14px 0;
  font-size:17px;
  font-weight:700;
  color:#fff;
  background:#2f6db0;
  border:none;
  border-radius:6px;
  cursor:pointer;
}
.sigopen:active{ background:#255a92; }






/* ===== 全螢幕簽名板 ===== */
/* ============================================================
 * 線上同意書 — 簽名功能樣式
 * 內容：主頁簽名縮圖區＋開啟鈕、全螢幕簽名板（直向／橫向）
 * ============================================================ */

/* ===== 主頁：簽名縮圖區 + 開啟鈕 ===== */
.sigshow{
  position:relative;
  width:100%;
  min-height:120px;
  border:1px dashed #b9b9b9;
  border-radius:6px;
  background:#f7f7f7;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  cursor:pointer;
}
.sigshow.has{ border-style:solid; border-color:#8fb0d8; background:#fff; }
.sigshow .sigimg{ display:block; max-width:100%; height:auto; }
.sigshow .sigph{ color:#9a9a9a; font-size:15px; }

.sigopen{
  display:block;
  width:100%;
  margin-top:10px;
  padding:14px 0;
  font-size:17px;
  font-weight:700;
  color:#fff;
  background:#2f6db0;
  border:none;
  border-radius:6px;
  cursor:pointer;
}
.sigopen:active{ background:#255a92; }

/* ===== 全螢幕簽名板（直向基準版面） ===== */
.sigovl{
  position:fixed;
  inset:0;
  z-index:9999;
  background:#ffffff;
  display:flex;
  flex-direction:column;
  /* iPad/iOS Safari：簽名時提筆換字易把標題文字當「選字手勢」→反白＋彈拷貝/查詢選單、打斷簽名。
     整個 overlay 一律禁止文字選取與長按 callout（子元素含標題會繼承）。 */
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}
.sigovl-bar{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 14px;
}
.sigovl-top{
  border-bottom:1px solid #e2e2e2;
  justify-content:space-between;
}
.sigovl-title{ font-size:16px; font-weight:700; color:#222; }
.sigovl-hint{ font-size:13px; color:#c0392b; }
.sigovl-canvas{
  flex:1 1 auto;
  /* 四周各留 8px，否則畫布貼齊視窗邊緣時，畫在元素外側的 outline 會被裁掉 */
  width:calc(100% - 16px);
  align-self:center;            /* 直向：水平置中 */
  min-height:0;
  background:#eeeeee;
  touch-action:none;            /* 簽名時不觸發捲動／縮放 */
  -webkit-user-select:none; user-select:none; -webkit-touch-callout:none;   /* 雙保險：畫布本身也不選字/不彈 callout */
  /* 黑框讓病患一眼認出「要簽在這一格裡」。
     用 outline 而不是 border：border 會算進 box-sizing 的寬高，
     畫布的點座標與位元圖尺寸就會差幾個像素，筆跡位置會偏。
     outline 不佔版面，不影響 getBoundingClientRect 的量測。 */
  outline:2px solid #111111;
  outline-offset:0;
}
.sigovl-bot{
  border-top:1px solid #e2e2e2;
  justify-content:flex-end;
  gap:10px;
}
.sigovl-btn{
  padding:12px 26px;
  font-size:16px;
  font-weight:700;
  border-radius:6px;
  border:1px solid #cfcfcf;
  background:#f2f2f2;
  color:#333;
  cursor:pointer;
}
.sigovl-btn.clear{ background:#fff; }
.sigovl-btn.ok{
  background:#2f6db0;
  border-color:#2f6db0;
  color:#fff;
}
.sigovl-btn:active{ opacity:.85; }

/* ===== 橫放提示：僅窄螢幕(手機)且直向時顯示；平板(off)一律隱藏 ===== */
.sigovl-hint.off{ display:none !important; }
@media (orientation:landscape){
  .sigovl-hint.no-land{ display:none; }
}

/* ===== 直向：簽名框壓成「寬 ≥ 高」，高度由 sign.js 依輸出比例算出 =====
   直握手機時原本畫布是滿版細長條，病患會把字寫得又高又大，
   等比縮放進 3:1 的輸出框後只佔三分之一寬，PDF 上的簽名就很小。
   這裡改為不撐滿高度、上下置中，實際高度交給 fitCanvasBox() 決定。 */
@media (orientation:portrait){
  .sigovl-canvas{
    flex:0 0 auto;
    /* 上下至少留 8px（剩餘空間通常遠大於此，auto 會把它平均分到上下） */
    margin:8px 0;
    margin-top:auto;
    margin-bottom:auto;
    min-height:250px;             /* 與 sign.js 的 SIG_MIN_H 對應 */
  }
}

/* ===== 橫向：標題移到右側按鈕欄頂端，按鈕直排，canvas 佔滿左側 ===== */
@media (orientation:landscape){
  .sigovl{
    display:grid;
    grid-template-columns:1fr auto;   /* 左：簽名區　右：按鈕欄 */
    grid-template-rows:1fr;            /* 單列，標題併入右欄 */
    grid-template-areas:"pad side";
  }
  /* 橫向不需要頂部標題列，隱藏 */
  .sigovl-top{ display:none; }

  .sigovl-canvas{
    grid-area:pad;
    /* 橫向時上下左右也各留 8px，四邊的黑框才都看得到 */
    height:calc(100% - 16px);
    align-self:center;            /* grid：垂直置中 */
    justify-self:center;          /* grid：水平置中 */
  }
  /* 右側欄：頂端放標題，其下三顆按鈕直排 */
  .sigovl-bot{
    grid-area:side;
    flex-direction:column;
    justify-content:flex-start;
    align-items:center;
    gap:16px;
    border-top:none;
    border-left:1px solid #e2e2e2;
    padding:16px;
  }
  /* 用偽元素當作右欄標題（取消鈕上方） */
  .sigovl-bot::before{
    content:"請於左側空白處簽名";
    display:block;
    font-size:15px;
    font-weight:700;
    color:#222;
    text-align:center;
    line-height:1.3;
    margin-bottom:8px;
  }
  .sigovl-bot .sigovl-btn{
    width:120px;
    text-align:center;
  }
}

/* ==================== v2.0 診前線上服務 ==================== */
.inp{width:100%;border:1px solid var(--line);border-radius:var(--radius);
  background:#fff;padding:9px 11px;font-size:16px;color:var(--ink);font-family:inherit}
.inp:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 2px rgba(31,95,139,.15)}

.todo-box{border:2px solid #ffa94d;background:#fff4e6;border-radius:var(--radius);
  padding:12px 14px;margin:10px 0;box-shadow:0 2px 10px rgba(232,89,12,.15)}
.todo-title{font-size:18px;font-weight:800;color:#e8590c;margin-bottom:9px;letter-spacing:.5px}
.todo-list{list-style:none;margin:0;padding:0}
.todo-list li{margin:6px 0}
.todo-list a{display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--ink);
  background:#fff;border:1.5px solid #ffc078;border-radius:var(--radius);padding:12px 14px;font-size:17px;font-weight:600}
.todo-list a:active{background:#fff0e0}
.todo-chk{color:#e8590c;font-weight:800}
.todo-nm{flex:1}
.todo-list .arrow{color:#e8590c}

/* 視訊看診（KTOmni）：主畫面最上方導流區塊 */
.video-box{border:2px solid #38b000;background:#ebfbee;border-radius:var(--radius);
  padding:12px 14px;margin:10px 0;box-shadow:0 2px 10px rgba(30,125,67,.15)}
.video-box.none{border-color:var(--line);background:#f4f7f9;box-shadow:none}
.video-title{font-size:18px;font-weight:800;color:#1e7d43;margin-bottom:9px;letter-spacing:.5px}
.video-box.none .video-title{color:#5a6b78}
.video-enter{display:flex;align-items:center;gap:8px;text-decoration:none;color:#fff;
  background:#1e7d43;border:1.5px solid #1a6e3b;border-radius:var(--radius);
  padding:14px 16px;font-size:18px;font-weight:700;margin:6px 0}
.video-enter:active{background:#19653a}
.video-enter .ve-nm{flex:1}
.video-enter .ve-live{flex:0 0 auto;background:#ffec99;color:#8a5a00;font-size:13px;
  font-weight:800;border-radius:999px;padding:2px 10px}
.video-enter .arrow{flex:0 0 auto;color:#d7f0df;font-size:24px;line-height:1}
.video-hint{font-size:13px;color:#5a6b78;margin-top:6px}

.cc-sec{font-size:15px;font-weight:600;color:var(--blue-d);
  margin:16px 0 8px;padding-bottom:4px;border-bottom:1px solid var(--line)}
.cc-fld{margin-bottom:12px}
.cc-lbl{display:block;font-size:14px;color:var(--ink-2);margin-bottom:5px}
.cc-inrow{display:flex;gap:8px;align-items:stretch}
.cc-inrow .inp{flex:1}
.cc-two{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.cc-ta{min-height:110px;resize:vertical;line-height:1.6}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.chip{font-size:14px;padding:5px 12px;border:1px solid var(--line);border-radius:16px;
  background:#f4f7fa;color:var(--ink-2);cursor:pointer;user-select:none}
.chip:active{background:#e3edf5;border-color:var(--blue)}
.chip.on{background:var(--blue);border-color:var(--blue);color:#fff;font-weight:600}
.mic-btn{flex:0 0 auto;width:44px;border:1px solid var(--blue);border-radius:var(--radius);
  background:#eaf2f8;color:var(--blue);font-size:20px;display:flex;align-items:center;justify-content:center}
.mic-btn.on{background:var(--err);border-color:var(--err);color:#fff;animation:micpulse 1s infinite}
@keyframes micpulse{50%{opacity:.55}}

.consent{border:1px solid var(--line);border-radius:var(--radius);background:#fafcfe;
  padding:0 12px;margin:8px 0}
.consent>summary{cursor:pointer;padding:11px 0;font-size:15px;font-weight:600;color:var(--blue-d)}
.consent-body{font-size:14px;color:var(--ink-2);line-height:1.7;padding-bottom:10px}
.consent-body p{margin:6px 0}
.consent-gate{margin:12px 0}
.agree{display:flex;align-items:center;gap:8px;font-size:15px;color:var(--ink)}
.agree input{width:20px;height:20px}
.formlist.gated{opacity:.45;pointer-events:auto}
.formlist.gated.ok{opacity:1}

.cc-ask{background:#eef5fb;border:1px solid #cfe0ef;border-radius:var(--radius);padding:10px 12px;margin:8px 0}
.cc-q{font-size:15px;color:var(--blue-d);margin:5px 0;display:flex;gap:6px;align-items:flex-start}
.cc-intro{font-size:15px;font-weight:700;color:var(--blue-d);margin:2px 0 8px}
.cc-refs{background:#f4f7f9;border:1px solid #dbe4ea;border-radius:var(--radius);padding:9px 12px;margin:8px 0}
.cc-refs-t{font-size:13px;font-weight:700;color:var(--ink-2);margin-bottom:4px}
.cc-ref{font-size:14px;color:var(--ink);line-height:1.75}
.cc-ref-lb{font-weight:700;color:var(--blue-d)}
.cc-ref-t{color:#8a949c;font-size:12px}
.ph-fld .unit{color:var(--ink-2);font-weight:400;font-size:13px}

/* ================= v2.1 主畫面 / 抽屜 / 浮現選單 ================= */
/* 頁首漢堡 + 小按鈕 + 頂端登出 */
.hmb{flex:0 0 auto;width:40px;height:40px;border:0;background:transparent;padding:9px 8px;cursor:pointer;
  display:flex;flex-direction:column;justify-content:space-between}
.hmb span{display:block;height:2.5px;background:#fff;border-radius:2px}
.btn.ghost.sm,.btn.sm{min-height:38px;padding:7px 12px;font-size:15px}
.topout{flex:0 0 auto;background:rgba(255,255,255,.16);color:#fff;border:1px solid rgba(255,255,255,.5)}
.topout:active{background:rgba(255,255,255,.28)}

/* 左上☰ 功能選單抽屜 */
.drawer{position:fixed;inset:0;z-index:90}
.drawer-mask{position:absolute;inset:0;background:rgba(20,28,34,.5);opacity:0;transition:opacity .2s}
.drawer.on .drawer-mask{opacity:1}
.drawer-panel{position:absolute;top:0;left:0;bottom:0;width:82%;max-width:330px;background:#fff;
  box-shadow:2px 0 24px rgba(0,0,0,.28);transform:translateX(-100%);transition:transform .2s;overflow:auto;padding-bottom:16px}
.drawer.on .drawer-panel{transform:none}
.drawer-head{display:flex;align-items:center;justify-content:space-between;background:var(--blue);color:#fff;
  padding:14px;font-size:18px;font-weight:700;position:sticky;top:0}
.drawer-x{background:transparent;border:0;color:#fff;font-size:26px;line-height:1;cursor:pointer;padding:0 4px}
.drawer-cat{padding:14px 14px 4px;color:var(--ink-2);font-size:14px;font-weight:700;letter-spacing:.5px}
.drawer-list{list-style:none;margin:0;padding:0}
.drawer-list li a{display:flex;align-items:center;gap:10px;padding:12px 16px;color:var(--ink);text-decoration:none;border-top:1px solid #eef1f4}
.drawer-list li a:active{background:#f2f7fb}
.drawer-list .dl-nm{flex:1;font-size:17px}
.drawer-list .dl-st{flex:0 0 auto;font-size:12px;color:#9aa5ad;font-weight:400}
.drawer-list .arrow{color:#9aa5ad;font-size:22px}
.drawer-foot{padding:16px 14px 4px}
.drawer-foot .btn{width:100%}

/* 主畫面三大類按鈕 */
.cats{display:flex;flex-direction:column;gap:10px;margin-top:6px}
.catbtn{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:#fff;
  border:1px solid var(--line);border-radius:var(--radius);padding:16px 14px;cursor:pointer;min-height:58px}
.catbtn:active{background:#f2f7fb}
.cat-nm{flex:1;font-size:19px;font-weight:700;color:var(--blue-d)}
.cat-sub{flex:0 0 auto;font-size:13px;color:var(--ink-2)}
.catbtn .arrow{flex:0 0 auto;color:#9aa5ad;font-size:24px;line-height:1}

/* 圖文廣告版位（v2.1 先留空） */
.promo{margin-top:12px;border:1px dashed #cdd6dd;border-radius:var(--radius);min-height:88px;
  background:repeating-linear-gradient(45deg,#f6f8fa,#f6f8fa 12px,#f1f4f7 12px,#f1f4f7 24px)}

/* 浮現式分類選單 */
.cmodal{position:fixed;inset:0;z-index:85;display:flex;align-items:flex-end;justify-content:center}
.cmodal-mask{position:absolute;inset:0;background:rgba(20,28,34,.55);opacity:0;transition:opacity .18s}
.cmodal.on .cmodal-mask{opacity:1}
.cmodal-panel{position:relative;width:100%;max-width:520px;background:#fff;border-radius:16px 16px 0 0;
  box-shadow:0 -6px 28px rgba(0,0,0,.3);transform:translateY(100%);transition:transform .18s;max-height:86vh;overflow:auto;padding-bottom:12px}
.cmodal.on .cmodal-panel{transform:none}
.cmodal-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;font-size:18px;font-weight:700;
  border-bottom:1px solid #eef1f4;position:sticky;top:0;background:#fff}
.cmodal-x{background:transparent;border:0;font-size:26px;line-height:1;color:#9aa5ad;cursor:pointer;padding:0 4px}
.mitems{list-style:none;margin:0;padding:0}
.mitems li a{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;padding:15px 16px;color:var(--ink);text-decoration:none;border-top:1px solid #f0f3f5}
.mitems li:first-child a{border-top:0}
.mitems li a:active{background:#f2f7fb}
.mi-nm{flex:1;font-size:18px;font-weight:700}
.mi-st{flex:0 0 auto;font-size:13px;color:#9aa5ad;font-weight:400}
.mi-plan{flex:0 0 100%;white-space:normal;font-size:13px;color:#2b8a3e;font-weight:700;background:#eafaf1;border:1px solid #b2f2bb;border-radius:8px;padding:5px 10px;margin-top:2px;line-height:1.5}
.ph-plan{background:#eef4fb;border:1px solid #cfe0f5;border-radius:12px;padding:9px 12px;margin:0 0 10px}
.ph-goal{font-size:14px;color:#2c5aa0}.ph-goal b{color:#1f5f8b}
.ph-docmsg{font-size:13px;color:#2c5aa0;margin-top:4px}
.mitems .arrow{flex:0 0 auto;color:#c2ccd3;font-size:22px}
@media(min-width:560px){ .cmodal{align-items:center} .cmodal-panel{border-radius:16px} }

/* 記住我（登入頁） */
.remembered{background:#f4f7f9;border:1px solid var(--line);border-radius:8px;padding:12px;display:flex;flex-direction:column;gap:10px}
.rm-note{font-size:16px;color:var(--ink);display:flex;align-items:center;gap:8px}
.agree-fld{margin-bottom:6px}

/* v2.1：家族史兩欄各自帶麥克風；小尺寸麥克風 */
.mic-btn.sm{width:40px;font-size:18px}
.cc-two .cc-inrow{min-width:0}
.cc-two .cc-inrow .inp{min-width:0}
.cc-last{opacity:.85}

/* v2.1：LINE 內建瀏覽器提示條（語音不支援時建議改用預設瀏覽器） */
.linebar{position:fixed;left:0;right:0;bottom:0;z-index:75;background:#2b2f33;color:#fff;
  display:flex;flex-direction:column;gap:8px;padding:10px 12px;font-size:12px;line-height:1.4;
  -webkit-text-size-adjust:100%;text-size-adjust:100%;box-shadow:0 -2px 12px rgba(0,0,0,.28)}
.linebar-row1{display:flex;align-items:flex-start;gap:8px}
.linebar-tx{flex:1;min-width:0;line-height:1.4}
.linebar-btn{align-self:flex-start;background:#fff;color:#12405f;border:0;font-size:12px;
  padding:7px 14px;min-height:0;white-space:normal;line-height:1.3}
.linebar-x{flex:0 0 auto;background:transparent;border:0;color:#fff;font-size:20px;line-height:1;cursor:pointer;padding:0 4px}

/* v2.1：到期模組變灰不可點 + 抽屜到期樣式 */
.catbtn.is-expired{opacity:.55;cursor:not-allowed;background:#f4f6f8}
.catbtn.is-expired .cat-nm{color:var(--ink-2)}
.cat-sub.exp{color:var(--err);font-weight:700}
.exp-note{margin-top:4px}
.drawer-cat .dl-exp{color:var(--err);font-weight:400;font-size:12px}
.drawer-list .dl-dis{display:flex;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid #eef1f4;color:#b0b8bf;cursor:not-allowed}
.drawer-list .dl-dis .dl-nm{flex:1}

/* v2.1：家族史「…」單選浮現視窗 */
.pick-btn{font-size:22px;font-weight:700;line-height:1;color:var(--blue)}
.pick-opts{display:flex;flex-wrap:wrap;gap:8px;padding:14px 16px}
.pick-opt{font-size:16px;padding:10px 16px;border:1px solid var(--line);border-radius:20px;
  background:#f4f7fa;color:var(--ink);cursor:pointer}
.pick-opt:active{background:#e3edf5;border-color:var(--blue)}

/* v2.1：三大類改為就地展開（手風琴），取代浮現視窗 */
.catwrap{border:1px solid var(--line);border-radius:var(--radius);background:#fff;overflow:hidden}
.catwrap .catbtn{border:0;border-radius:0;width:100%}
.catbtn.open{background:#eef5fb}
.acc-caret{display:inline-block;transition:transform .2s}
.catbtn.open .acc-caret{transform:rotate(90deg)}
.acc-list{border-top:1px solid #eef1f4;background:#eef2f6;padding:10px 9px 12px}
/* 每個子項目各自獨立圓角卡片（對齊醫師端 hub，分隔更明顯）：陰影加深、間距拉大更凸顯 */
.acc-list .mitems li{margin:12px 0}
.acc-list .mitems li:first-child{margin-top:3px}
.acc-list .mitems li a{padding:13px 14px;background:#fff;border:1px solid #dfe6ec;border-radius:12px;box-shadow:0 3px 9px rgba(0,0,0,.13)}
.acc-list .mitems li a:active{background:#f5f9fd}
.acc-list .warn{margin:12px 6px}

/* v2.1：手風琴子項目名稱不用粗體，與粗體分類名稱做出層次區隔 */
.acc-list .mi-nm{font-weight:400}

/* ===== 登入頁：未完成提示與摺疊（v2.1 修正） ===== */
/* 尚未勾選同意／身分證或生日未填或格式不正確 → 紅色方框提示 */
.need{outline:2px solid #e2342f;outline-offset:2px;border-radius:8px}
.agree-fld.need{background:#fdecea;padding:8px 10px}
.bday.need{padding:4px}
/* 告知聲明預設收合，提示可點開 */
.consent>summary::after{content:"（點此詳閱）";color:#8a97a3;font-weight:400;font-size:13px}
.consent[open]>summary::after{content:"（收合）";color:#8a97a3;font-weight:400;font-size:13px}
/* 「清除登入資訊」縮小、靠左，避免誤按到「確認」 */
.btn.ghost.xs{display:inline-block;width:auto;min-height:30px;padding:4px 12px;font-size:13px;align-self:flex-start}

/* 健康紀錄：合理範圍提示 + 自算欄位（Phase 0） */
.ph-warn{display:block;color:#b45309;font-size:.82em;margin-top:2px;line-height:1.3;}
.ph-warn.bf-low{color:#2563eb;font-weight:bold;}
.ph-warn.vf-ok{color:#15803d;font-weight:bold;}
.ph-warn.vf-warn{color:#c47a00;font-weight:bold;}
.ph-warn.vf-danger{color:#dc2626;font-weight:bold;}
.ph-auto{background:#f3f4f6;color:#374151;}

/* 返回改到頁首右上角，隱藏頁內舊的「返回主畫面」連結 */
.back{display:none!important;}
