/* 顧問前台（手機優先）：明亮、留白、單手好按 */
body { background: var(--bg); }
.m-shell { max-width: 680px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.m-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 6px;
  padding: 10px 10px 10px 18px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(246, 247, 250, .86); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.m-top h1 { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* 底部頁籤 */
.m-tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
.m-tabs .inner { display: flex; width: 100%; max-width: 680px; }
.m-tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px;
  font-size: 11.5px; color: #6b7588; text-decoration: none; position: relative; transition: color .15s;
}
.m-tabs a svg { width: 22px; height: 22px; }
.m-tabs a.on { color: var(--brand); font-weight: 600; }
.m-tabs a.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--brand); }
.m-tabs a .dot {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px;
  background: #ef5a5e; color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; font-weight: 600;
  box-shadow: 0 0 0 2px #fff;
}
.fab {
  position: fixed; right: max(18px, calc(50% - 322px)); bottom: calc(90px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 18px; background: var(--brand); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(46, 107, 230, .32); border: 0; z-index: 31; cursor: pointer; text-decoration: none !important;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 14px 28px rgba(46, 107, 230, .36); }
.fab svg { width: 26px; height: 26px; }

/* 卡片 */
.m-card { background: #fff; border-radius: 18px; border: 1px solid var(--line); padding: 16px; box-shadow: var(--shadow); }
.m-card.tap { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.m-card.tap:hover { border-color: var(--brand-200); }
.m-card.tap:active { background: var(--hover); }
.m-card .t { font-weight: 600; font-size: 15.5px; color: var(--ink); }
.m-card .meta { font-size: 13px; color: var(--muted); display: flex; gap: 4px 14px; flex-wrap: wrap; margin-top: 5px; }
.m-card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.m-card .meta svg { width: 14px; height: 14px; }
.m-card .acts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.m-card .acts .btn { flex: 1; }

/* 首頁數字 */
.m-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.m-stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-decoration: none !important; color: inherit; display: block; transition: border-color .15s; }
.m-stat:hover { border-color: var(--brand-200); color: inherit; }
.m-stat .v { font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.35; }
.m-stat .l { font-size: 12px; color: var(--muted); }
.m-stat.warn .v { color: var(--amber); }
.m-stat.danger .v { color: var(--red); }

.m-hero {
  grid-column: 1 / -1; border-radius: 20px; padding: 18px 20px; display: flex; gap: 16px; align-items: flex-end;
  background: linear-gradient(135deg, #eaf1ff 0%, #f4f8ff 55%, #f2fbf7 100%);
  border: 1px solid var(--brand-100); color: var(--ink);
}
.m-hero .l { color: var(--ink-2); font-size: 12.5px; }
.m-hero .v { font-size: 32px; font-weight: 600; line-height: 1.15; color: var(--brand); font-variant-numeric: tabular-nums; margin-top: 2px; }
.m-hero .v small { font-size: 14px; font-weight: 500; margin-left: 4px; color: var(--ink-2); }
.m-hero .side { text-align: right; padding-left: 16px; border-left: 1px solid rgba(46, 107, 230, .15); }
.m-hero .s { font-size: 20px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.m-hero .s small { font-size: 12.5px; font-weight: 500; color: var(--muted); }

.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 8px 2px -4px; display: flex; align-items: center; gap: 6px; letter-spacing: .04em; }
.time-col { min-width: 62px; text-align: center; padding-right: 12px; border-right: 2px solid var(--brand-100); margin-right: 14px; }
.time-col b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.time-col span { font-size: 12px; color: var(--muted); }
.m-seg { display: flex; background: #edf0f5; border-radius: 12px; padding: 3px; }
.m-seg button { flex: 1; border: 0; background: transparent; font: inherit; font-size: 13.5px; padding: 7px 4px; border-radius: 9px; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.m-seg button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(24, 39, 75, .1); }
.hours-preview { display: flex; align-items: center; justify-content: space-between; background: var(--brand-50); color: var(--brand); border-radius: 12px; padding: 11px 14px; font-weight: 600; }
.hours-preview b { font-size: 22px; font-variant-numeric: tabular-nums; }

/* 客戶簽名全螢幕 */
.sign-sheet { position: fixed; inset: 0; z-index: 120; background: var(--bg); display: flex; flex-direction: column; animation: fade-in .15s ease-out; }
.sign-sheet .sh { padding: 12px 14px 12px 18px; padding-top: calc(12px + env(safe-area-inset-top)); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.sign-sheet .sh h3 { flex: 1; }
.sign-sheet .sb { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.sign-sheet .sf { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sign-sheet .sf > * { max-width: 760px; }
.summary-box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 14px; }
.summary-box .big { font-size: 20px; font-weight: 600; color: var(--brand); }

/* 連結清單（我的帳號、結案資料頁） */
.m-links { padding: 4px 0; }
.m-links a, .m-linkcard { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink); text-decoration: none !important; }
.m-links a + a { border-top: 1px solid var(--line-2); }
.m-links a:active { background: var(--hover); }
.m-links a > svg:first-child, .m-linkcard > svg:first-child { color: var(--brand); flex: none; width: 20px; height: 20px; }
.m-links a > svg:last-child, .m-linkcard > svg:last-child { color: #b3bccb; flex: none; }
.m-links span, .m-linkcard span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-links b, .m-linkcard b { font-size: 15px; }
.m-links small, .m-linkcard small { font-size: 12.5px; color: var(--muted); }
.m-linkcard { padding: 12px 16px; }
.m-linkcard:hover { color: var(--ink); }

/* 專案工具按鈕 */
.tool-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tool-row .btn { flex: 1; }

/* 行事曆訂閱 */
.cal-links { display: flex; flex-direction: column; gap: 8px; }
.cal-links .btn { justify-content: flex-start; padding-left: 14px; min-height: 44px; }

/* 請假 */
.pick-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pick {
  font: inherit; font-size: 13.5px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.pick:hover { border-color: var(--brand-200); }
.pick.on { background: var(--brand-50); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.leave-item { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; }
.leave-item .meta .chip { padding: 0 8px; }
.leave-item.past { opacity: .65; box-shadow: none; }

/* 薪資：應發／代扣／實發 */
.pay-sum { padding: 6px 16px; }
.pay-sum .r { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; font-size: 14.5px; }
.pay-sum .r + .r { border-top: 1px dashed var(--line); }
.pay-sum .r small { font-size: 12px; color: var(--muted); margin-left: 4px; }
.pay-sum .r b { font-variant-numeric: tabular-nums; }
.pay-sum .r.neg b { color: var(--red); }
.pay-sum .r.total { border-top: 1px solid var(--line); font-size: 16px; }
.pay-sum .r.total b { font-size: 19px; color: var(--brand); }
.chip.chip-red { background: var(--red-bg); color: var(--red); }
.table tr.tax-line td { background: #fffafa; }

/* 準備度檢核（共用元件）在手機上的調整 */
.m-assess .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-assess .stat { padding: 12px 14px; }
.m-assess .stat .value { font-size: 22px; }
.m-assess .assess-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.m-assess .card-h { flex-wrap: wrap; padding: 13px 14px; }
/* .page-head 只在後台樣式表定義，這裡補上手機版排法：返回＋名稱一行，日期＋報告一行 */
.m-assess .page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.m-assess .page-head .grow { flex: 1 1 calc(100% - 50px); min-width: 0; }
.m-assess .page-head .icon-btn { flex: none; }
.m-assess .page-head > input[type=date] { flex: 1 1 0; min-width: 0; width: auto; }
.m-assess .page-head > .btn:not(.icon-btn) { flex: none; }
/* 檢核清單表格改成卡片列：名稱｜日期、顧問｜分享、準備度 */
.m-assess .table-wrap .table thead { display: none; }
.m-assess .table-wrap .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.m-assess .table-wrap .table tr:last-child { border-bottom: 0; }
.m-assess .table-wrap .table td { padding: 0; border: 0; background: none !important; }
.m-assess .table-wrap .table td:nth-child(1) { grid-column: 1; grid-row: 1; }
.m-assess .table-wrap .table td:nth-child(2) { grid-column: 2; grid-row: 1; color: var(--muted); }
.m-assess .table-wrap .table td:nth-child(3) { grid-column: 1; grid-row: 2; color: var(--muted); }
.m-assess .table-wrap .table td:nth-child(5) { grid-column: 2; grid-row: 2; text-align: right; }
.m-assess .table-wrap .table td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; margin-top: 6px; }
.m-assess .table-wrap .table tr.clickable:active { background: var(--hover); }
.m-assess .assess-title { min-width: 0; }
.m-assess .card-h:has(.seg) h3 { flex-basis: 100%; }
