:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --line: #e4dfd5;
  --text: #22201c;
  --muted: #6d675d;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e3ece8;
  --danger: #a33a2c;
  --danger-soft: #f6e4e1;
  --warn: #8a5a00;
  --warn-soft: #fbefd6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121311; --surface: #2a2b27; --surface-2: #34352f; --line: #54554d;
    --text: #f4f1ea; --muted: #c8c3b8; --accent: #7fb3a2; --accent-ink: #10201b;
    --accent-soft: #24332e; --danger: #e48a7c; --danger-soft: #3a2420;
    --warn: #e2b660; --warn-soft: #3a3020; --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121311; --surface: #2a2b27; --surface-2: #34352f; --line: #54554d;
  --text: #f4f1ea; --muted: #c8c3b8; --accent: #7fb3a2; --accent-ink: #10201b;
  --accent-soft: #24332e; --danger: #e48a7c; --danger-soft: #3a2420;
  --warn: #e2b660; --warn-soft: #3a3020; --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 教會圖示：台灣基督長老教會會徽（焚而不毀），取自教會網站；pct-64.png 給一般畫面，pct-128.png 給高解析度螢幕 */
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: url("pct-64.png") center / contain no-repeat;
  background-image: image-set(url("pct-64.png") 1x, url("pct-128.png") 2x);
}
.login-card > .brand-mark { width: 64px; height: 64px; justify-self: center; background-image: image-set(url("pct-128.png") 1x, url("pct-192.png") 2x); }
.login-card > .brand-mark + h1 { text-align: center; }

/* 登入 */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 16px; }
.err { color: var(--danger); margin: 0; min-height: 1.5em; font-size: 14px; }

/* 上方列 */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.search { flex: 1; min-width: 0; }
.search input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); font-size: 16px;
}
.top-actions { display: flex; gap: 8px; position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); min-width: 220px; padding: 6px; display: grid; z-index: 30;
}
.menu button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-user { padding: 6px 10px; color: var(--muted); font-size: 13px; }

/* 三欄 */
.layout {
  display: grid; grid-template-columns: 240px minmax(0, 1fr) minmax(0, 1.1fr);
  height: calc(100vh - 57px); height: calc(100dvh - 57px);
}
.filters { border-right: 1px solid var(--line); overflow: auto; padding: 12px 14px; }
.filters-toggle { display: none; }
.fgroup { margin-bottom: 14px; }
.fgroup h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 0 6px; display: flex; justify-content: space-between; }
.fgroup h3 button { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px;
  font-size: 13px; cursor: pointer;
}
.chip .n { color: var(--muted); font-size: 11px; margin-left: 3px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .8; }
.chips.collapsed .chip:nth-child(n+13):not([aria-pressed="true"]) { display: none; }
.show-all { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 4px 0; }

.list-pane { overflow: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.list-head {
  position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; justify-content: space-between;
  align-items: center; padding: 10px 14px; gap: 8px; border-bottom: 1px solid var(--line);
}
.summary { color: var(--muted); font-size: 13px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--surface); padding: 4px 12px; cursor: pointer; font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

.list { display: grid; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; background: var(--surface); text-align: left;
  border-left: 3px solid transparent; width: 100%; border-top: 0; border-right: 0;
}
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { border-left-color: var(--accent); background: var(--accent-soft); }
.row .name { font-weight: 600; }
.row .name small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.row .meta { grid-column: 1 / -1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.tag.job { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.care { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.house { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.house-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.house-head b { font-size: 15px; }
.house-head span { color: var(--muted); font-size: 12px; }
.house .members { display: flex; flex-wrap: wrap; gap: 6px; }
.house .members button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 13px; }
.house .members button small { color: var(--muted); margin-left: 3px; }
.more { margin: 12px auto; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* 詳細 */
.detail { overflow: auto; background: var(--surface); }
.detail-empty { height: 100%; display: grid; place-items: center; color: var(--muted); padding: 16px; }
.d-head { position: sticky; top: 0; background: var(--surface); padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; z-index: 2; }
.d-head h2 { margin: 0; font-size: 20px; flex: 1; min-width: 0; }
.d-head h2 small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.d-back { display: none; }
.d-body { padding: 6px 18px 28px; }
.sect { margin-top: 16px; }
.sect h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 0 6px; letter-spacing: .05em; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.kv dd { margin: 0; word-break: break-word; }
.kv dd a { color: var(--accent); }
.kv dd.none { color: var(--line); }
.notes { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0; }
.family { display: flex; flex-wrap: wrap; gap: 6px; }
.family button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.family button[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
.family small { color: var(--muted); margin-left: 3px; }

/* 表單 */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form label.wide { grid-column: 1 / -1; }
.form input, .form textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 16px; color: var(--text);
}
.form textarea { min-height: 90px; resize: vertical; }
.form h3 { grid-column: 1 / -1; margin: 10px 0 -4px; font-size: 12px; color: var(--muted); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.banner { padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); margin: 12px 0 0; font-size: 14px; }

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.35); }
.idle-dlg { width: min(420px, calc(100vw - 32px)); }
.idle-dlg .dlg-body { line-height: 1.7; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-body { padding: 14px 18px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.loglist { display: grid; gap: 8px; }
.logitem { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.logitem .when { color: var(--muted); font-size: 12px; }
.logitem .chg { font-size: 13px; color: var(--muted); margin-top: 4px; }
.logitem .chg b { color: var(--text); font-weight: 500; }
.logitem .actions { margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; transition: .2s; pointer-events: none; z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* 平板：篩選收起來 */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .filters { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; overflow: visible; }
  .layout { grid-template-rows: auto minmax(0, 1fr); }
  .filters-toggle { display: inline-flex; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
  .filters-body { display: none; padding-top: 10px; max-height: 50vh; overflow: auto; }
  .filters.open .filters-body { display: block; }
}
/* 手機：清單與詳細切換 */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 8px 16px; }
  .brand span { display: none; }
  .search { order: 3; flex-basis: 100%; }
  .top-actions { margin-left: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); height: auto; display: block; }
  .list-pane { border-right: 0; overflow: visible; }
  .list-head { top: 101px; }
  .detail { position: fixed; inset: 0; z-index: 40; display: none; }
  body.show-detail .detail { display: block; }
  body.show-detail { overflow: hidden; }
  .d-back { display: inline-block; }
  .d-body { padding: 4px 16px 40px; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 76px 1fr; }
}
.mt6 { margin-top: 6px; } .mt12 { margin-top: 12px; } .mt18 { margin-top: 18px; } .mt22 { margin-top: 22px; }
.full { width: 100%; }
.d-body a { color: var(--accent); }

/* 挑選與名單 */
.rowwrap { display: grid; grid-template-columns: 44px minmax(0, 1fr); background: var(--surface); border-bottom: 1px solid var(--line); }
.rowwrap .row { border-bottom: 0; padding-left: 4px; }
.rowwrap.picked, .rowwrap.picked .row:not([aria-current="true"]) { background: var(--accent-soft); }
.pick { display: grid; place-items: center; cursor: pointer; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.house .members button.picked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 0 0 6px; font-size: 13px; }
.pickbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 35;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow);
  padding: 8px 10px 8px 16px; width: max-content; max-width: calc(100vw - 32px);
}
.pickbar-info { font-size: 14px; }
.pickbar-info b { color: var(--accent); font-size: 16px; }
.pickbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pickbar .btn { padding: 5px 11px; font-size: 14px; }
.pickbar .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
body.has-pickbar .list { padding-bottom: 80px; }
.copybox { width: 100%; min-height: 260px; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.form .wide { grid-column: 1 / -1; }
.inline { display: flex; gap: 6px; }
.inline input { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .pickbar { left: 8px; right: 8px; transform: none; width: auto; max-width: none; bottom: 8px; padding: 8px 10px; gap: 6px; }
  .pickbar-actions { width: 100%; }
  .pickbar-actions .btn { flex: 1; padding: 6px 4px; }
  body.has-pickbar .list { padding-bottom: 120px; }
  body.show-detail .pickbar { display: none; }
}
.form label { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.inline .btn { flex: none; }
body.has-pickbar .toast { bottom: 84px; }
@media (max-width: 760px) { body.has-pickbar .toast { bottom: 110px; } }
.form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 16px; color: var(--text); }

/* 左側篩選放大（2026-09-30 使用者要求） */
.layout { grid-template-columns: 320px minmax(0, 1fr) minmax(0, 1.1fr); }
.filters { padding: 14px 16px; }
.fgroup { margin-bottom: 18px; }
.fgroup h3 { font-size: 14px; margin-bottom: 8px; }
.fgroup h3 button { font-size: 13px; }
.chips { gap: 7px; }
.chip { font-size: 15px; padding: 5px 13px; }
.chip .n { font-size: 12px; margin-left: 4px; }
.show-all { font-size: 14px; }
@media (max-width: 1100px) { .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
@media (max-width: 760px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.fsel { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 15px; color: var(--text); cursor: pointer; }
.fsel.on { border-color: var(--accent); background: var(--accent-soft); }
.filters .fgroup.dd { margin-bottom: 12px; }
.filters .fgroup.dd h3 { margin-bottom: 5px; }

/* 地圖 */
.mapwrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mapwrap[hidden] { display: none; }
#map { flex: 1; min-height: 420px; background: var(--surface-2); }
.map-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface); }
.map-head b { color: var(--text); }
.map-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.map-actions .btn { padding: 4px 10px; font-size: 13px; }
.map-legend { display: flex; gap: 4px; align-items: center; }
.lg { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-left: 6px; border: 2px solid var(--accent); }
.lg.precise { background: var(--accent); }
.lg.rough { border-style: dashed; border-color: var(--muted); background: transparent; }
.lg.picked { background: var(--warn); border-color: var(--warn); }
body.map-view .list-pane { overflow: hidden; }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-tooltip { background: var(--surface); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.pop b { font-size: 15px; }
.pop-sub { color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
.pop .family button { font-size: 13px; padding: 3px 8px; }
.pop .family button.picked { border-color: var(--warn); color: var(--warn); }
.pop-actions { display: flex; gap: 6px; margin-top: 8px; }
.pop-actions .btn { padding: 4px 10px; font-size: 13px; }
.drag-pin span { display: block; width: 28px; height: 28px; background: var(--danger); border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--text); cursor: pointer; }
@media (max-width: 760px) {
  body.map-view .list-pane { height: calc(100dvh - 101px); display: flex; }
  #map { min-height: 0; }
}

/* 身分證 */
.idno, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; }
.imp-actions { display: flex; gap: 8px; margin: 10px 0; }
.imp-sum p { margin: 8px 0; }
.imp-list { margin: 6px 0; font-size: 14px; }
.imp-list summary { cursor: pointer; }
.imp-list.warn summary { color: var(--warn); }
.imp-list.bad summary { color: var(--danger); }
.imp-list ul { margin: 4px 0; padding-left: 20px; max-height: 180px; overflow: auto; color: var(--muted); }
.banner.ok { background: var(--accent-soft); color: var(--accent); }
body.map-view .list-head { position: static; }
@media (max-width: 760px) { body.map-view .list-pane { height: calc(100dvh - 150px); } }

/* 地圖分組圖釘（顏色依組號固定；圖釘上印組號，顏色只是輔助） */
:root { --g1: #2a78d6; --g2: #eb6834; --g3: #1baf7a; --g4: #eda100; --g5: #e87ba4; --g6: #008300; --g7: #4a3aa7; --gother: #8a877f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --g1: #3987e5; --g2: #d95926; --g3: #199e70; --g4: #c98500; --g5: #d55181; --g6: #008300; --g7: #9085e9; --gother: #8a877f; }
}
:root[data-theme="dark"] { --g1: #3987e5; --g2: #d95926; --g3: #199e70; --g4: #c98500; --g5: #d55181; --g6: #008300; --g7: #9085e9; --gother: #8a877f; }
.g1 { --gc: var(--g1); } .g2 { --gc: var(--g2); } .g3 { --gc: var(--g3); } .g4 { --gc: var(--g4); }
.g5 { --gc: var(--g5); } .g6 { --gc: var(--g6); } .g7 { --gc: var(--g7); } .other, .none { --gc: var(--gother); }

.pin-wrap { background: none; border: 0; }
.pin { position: relative; width: 26px; height: 34px; }
.pin-head {
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--gc); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.35);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; line-height: 1;
}
.pin-head > b { transform: rotate(45deg); text-shadow: 0 0 2px rgba(0,0,0,.5); }
.pin.rough .pin-head { opacity: .55; border-style: dashed; }
.pin.picked .pin-head { border-color: var(--warn); border-width: 3px; }
.pin-label {
  position: absolute; left: 24px; top: 2px; white-space: nowrap; display: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--gc);
  border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.pin-label small { margin-left: 4px; color: var(--muted); font-weight: 400; }
.pin.picked .pin-label { background: var(--warn-soft); border-color: var(--warn); border-left-color: var(--gc); }
#map.show-labels .pin-label { display: block; }
.leaflet-marker-icon:hover { z-index: 1000 !important; }
.leaflet-marker-icon:hover .pin-label { display: block; }

.map-groups { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; align-items: center; }
.lg-group {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 3px 10px 3px 6px; font-size: 13px; cursor: pointer; color: var(--text);
}
.lg-group i { width: 12px; height: 12px; border-radius: 50%; background: var(--gc); }
.lg-group small { color: var(--muted); }
.lg-group[aria-pressed="false"] { opacity: .45; }
.lg-group[aria-pressed="false"] i { background: transparent; border: 2px solid var(--gc); }

/* ===== 分頁版面（2026-09-30）：會友／依戶／地圖各自一頁，會友資料從右邊滑出來 ===== */
.pages { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex: none; }
.pages a { padding: 6px 16px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.pages a:hover { color: var(--text); }
.pages a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

.layout { grid-template-columns: 320px minmax(0, 1fr); }
.list-pane { border-right: 0; }
.detail {
  position: fixed; top: 57px; right: 0; bottom: 0; width: min(500px, 100vw); z-index: 36;
  border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12);
  transform: translateX(105%); transition: transform .18s ease; visibility: hidden;
}
body.show-detail .detail { transform: none; visibility: visible; }
.d-back { display: inline-block; }

/* 會友頁：寬螢幕是表格 */
.row-head .row { cursor: default; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 8px; padding-bottom: 8px; }
.row-head { background: var(--surface-2); }
.list-people .row {
  grid-template-columns: minmax(110px, 1.1fr) minmax(130px, 1.3fr) minmax(90px, .9fr) 88px minmax(110px, 1fr) 96px 80px 64px;
  gap: 12px; align-items: center;
}
.list-people .row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.c-name { font-weight: 600; }
.c-name small, .c-house small { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 12px; }
.c-area, .c-tel, .c-bap, .c-care { color: var(--muted); font-size: 14px; }
.c-meta { display: none; }

/* 依戶頁：卡片排成好幾欄 */
.list-houses { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; padding: 14px; }
.list-houses .house { border: 1px solid var(--line); border-radius: 10px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .list-people .row { grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(80px, .8fr) 84px minmax(100px, 1fr) 70px; }
  .list-people .c-bap, .list-people .c-care, .row-head .row span:nth-child(n+7) { display: none; }
}
@media (max-width: 760px) {
  .pages { order: 2; }
  .pages a { padding: 5px 12px; font-size: 14px; }
  .detail { top: 0; width: auto; transform: none; transition: none; box-shadow: none; }
  body:not(.show-detail) .detail { display: none; }
  .row-head { display: none; }
  .list-people .row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
  .list-people .row > span.c-house, .list-people .row > span.c-area, .list-people .row > span.c-tel,
  .list-people .row > span.c-job, .list-people .row > span.c-bap, .list-people .row > span.c-care { display: none; }
  .list-people .row > span.c-meta { display: block; grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
  .list-houses { padding: 10px; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .top-actions { order: 3; }
  .search { order: 4; }
}

/* 日夜切換按鈕 */
.theme-btn { font-weight: 600; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.theme-btn:hover { border-color: var(--accent); filter: brightness(1.05); }
.login-card { position: relative; }
.login-theme { position: absolute; top: 14px; right: 14px; padding: 4px 10px; font-size: 13px; }
/* 夜間模式時地圖底圖調暗一點，不會太刺眼 */
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.78) contrast(1.05); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.78) contrast(1.05); } }
@media (max-width: 760px) { .theme-btn { padding: 7px 10px; } }

/* ===== 給司機看的接送單 ===== */
.driver-btn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); font-weight: 600; }
.driver { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow: auto; }
body.driver-open { overflow: hidden; }
.driver-bar {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.driver-title-input { flex: 1; min-width: 160px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 16px; }
.driver-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.driver-actions a.btn { text-decoration: none; color: var(--text); }
.driver-sheet { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.dv-title { font-size: 28px; margin: 0 0 4px; }
.dv-sum { color: var(--muted); margin: 0 0 16px; font-size: 16px; }
.stops { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.stop {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.stop-no { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.stop-addr { font-size: 24px; font-weight: 700; line-height: 1.35; word-break: break-word; }
.stop-who { margin-top: 6px; font-size: 17px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.stop-who a { color: var(--accent); }
.stop-who em { font-style: normal; color: var(--muted); font-size: 14px; }
.stop-ctl { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.stop-ctl a.btn { text-align: center; text-decoration: none; font-size: 16px; padding: 8px 18px; }
.updown { display: flex; gap: 4px; }
.updown .btn { flex: 1; padding: 4px 10px; }
.dv-noaddr { color: var(--warn); margin-top: 16px; }
@media (max-width: 760px) {
  .stop { grid-template-columns: 40px minmax(0, 1fr); padding: 12px; }
  .stop-no { width: 36px; height: 36px; font-size: 18px; }
  .stop-addr { font-size: 20px; }
  .stop-ctl { grid-column: 1 / -1; flex-direction: row; }
  .stop-ctl a.btn { flex: 1; }
  .dv-title { font-size: 22px; }
}

/* 列印：只印接送單，白底黑字、大字 */
@media print {
  body.driver-open > *:not(.driver) { display: none !important; }
  .driver { position: static; overflow: visible; background: #fff; }
  .no-print { display: none !important; }
  .driver-sheet { max-width: none; padding: 0; color: #000; }
  .dv-sum { color: #333; }
  .stop { background: #fff; border: 1.5px solid #000; break-inside: avoid; grid-template-columns: 52px 1fr; }
  .stop-no { background: #000; color: #fff; }
  .stop-who a { color: #000; text-decoration: none; }
  .stop-who em { color: #333; }
}

/* 疊在一起的「N 戶」圓圈 */
.cluster {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-content: center; text-align: center; line-height: 1;
  background: var(--surface); color: var(--text); border: 3px dashed var(--muted); box-shadow: 0 1px 5px rgba(0,0,0,.3); cursor: pointer;
}
.cluster b { font-size: 15px; }
.cluster small { font-size: 10px; color: var(--muted); }
.cluster.picked { border-color: var(--warn); border-style: solid; background: var(--warn-soft); }
.cl-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.cl-list li { display: flex; align-items: center; gap: 6px; }
.cl-list li i { width: 20px; height: 20px; border-radius: 50%; background: var(--gc); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; display: grid; place-items: center; text-shadow: 0 0 2px rgba(0,0,0,.5); flex: none; }
.cl-list li small { color: var(--muted); }
.cl-list li .btn { margin-left: auto; padding: 1px 10px; font-size: 12px; }
.leaflet-popup-content .linkbtn { padding: 0; font-size: 14px; }

/* 新朋友登記（幹事端） */
#btnMenu.has-badge { position: relative; }
#btnMenu.has-badge::after { content: ""; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.menu-count { color: var(--danger); margin-left: 4px; }
.jitem .jp { margin-top: 4px; font-size: 15px; }
.jitem .jp small { color: var(--muted); margin: 0 6px 0 4px; }
.jitem .fam-line { padding-left: 14px; color: var(--muted); }
.jitem .fam-line b { color: var(--text); font-weight: 500; }
.jopts { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.jopts label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.jopts select, .jopts input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 14px; }
.jitem .actions { display: flex; gap: 8px; }
.jitem .banner { margin-top: 8px; }
.qr-poster { text-align: center; padding: 10px 0; }
.qr-poster h1 { margin: 0; font-size: 26px; }
.qr-poster p { margin: 6px 0; color: var(--muted); }
.qr-img { width: 240px; margin: 12px auto; background: #fff; padding: 10px; border-radius: 10px; }
.qr-img svg { display: block; width: 100%; height: auto; }
.qr-url { font-size: 12px; word-break: break-all; }
.qr-foot { font-weight: 700; color: var(--text) !important; }
@media print {
  body.print-qr > *:not(#dlg) { display: none !important; }
  body.print-qr #dlg { position: static; border: 0; box-shadow: none; width: auto; max-height: none; }
  body.print-qr #dlg::backdrop { background: none; }
  body.print-qr .dlg-head, body.print-qr .form-actions, body.print-qr .banner { display: none !important; }
  body.print-qr .qr-poster { padding-top: 60px; color: #000; }
  body.print-qr .qr-poster h1 { font-size: 48px; }
  body.print-qr .qr-poster p { font-size: 22px; color: #000; }
  body.print-qr .qr-img { width: 420px; }
  body.print-qr .qr-url { font-size: 14px; }
}

/* 登入：手機驗證碼、帳號設定 */
.otp-input, .setup-card .otp-input { font-size: 24px !important; letter-spacing: .35em; text-align: center; }
.setup-card { width: min(460px, 100%); }
.setup-card h1 { font-size: 20px; margin: 0; }
.setup-card .steps { display: flex; gap: 6px; font-size: 12px; color: var(--muted); }
.setup-card .steps span { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.setup-card .steps span.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.setup-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.setup-card ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.totp-qr { width: 200px; margin: 4px auto; background: #fff; padding: 8px; border-radius: 10px; }
.totp-qr svg { display: block; width: 100%; height: auto; }
.totp-key { text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); word-break: break-all; }
.acc-sect { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.acc-sect:first-child { border-top: 0; margin-top: 0; padding-top: 0; }

/* 地圖自己一層：Leaflet 內部的 z-index（400～1000）只在地圖裡比，不會蓋住右邊的會友資料、選單、底部選取列 */
#map { isolation: isolate; position: relative; z-index: 0; }

/* 刪除會友確認 */
.del-who { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.del-who b { font-size: 18px; }
.del-who small { color: var(--muted); margin-left: 6px; }

/* 效能：大頭針不用陰影，改用淺色邊框區隔 */
.pin-head { box-shadow: none; border-color: var(--surface); }
.pin-head > b { text-shadow: none; }
.pin-label { box-shadow: none; }

/* ---------- 戶內樹狀圖 ---------- */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 12px; padding-left: 14px; }
.tree li { position: relative; padding: 3px 0; }
.tree ul > li::before { content: ""; position: absolute; left: -14px; top: 0; width: 14px; height: 19px; border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); border-radius: 0 0 0 7px; }
.tree ul > li:not(:last-child)::after { content: ""; position: absolute; left: -14px; top: 19px; bottom: 0; border-left: 1.5px solid var(--line); }
.tree .gen { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tree .amp { color: var(--muted); font-size: 12px; }
.tree .blabel { display: inline-block; font-size: 12px; color: var(--muted); padding: 3px 0; }
.tree .tn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 13px; color: inherit; }
.tree .tn small { color: var(--muted); margin-right: 5px; font-size: 11px; }
.tree .tn em { font-style: normal; font-weight: 600; color: var(--accent); margin-left: 8px; font-size: 18px; }
.tree .tn.dim { opacity: .4; }
.tree .tn.picked, .house .members .tn.picked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tree .tn[aria-current="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.family .tree { width: 100%; }
.c-name small.bday { color: var(--accent); font-size: 18px; font-weight: 600; margin-left: 10px; }

/* 家族樹分頁：由上往下的組織圖 */
.list-tree { display: block; padding: 18px; overflow-x: auto;
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
.ftree .summary { background: var(--surface); display: inline-block; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); margin-bottom: 18px; }
.orgs { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; margin-bottom: 26px; }
.org { max-width: 100%; overflow-x: auto; padding: 22px 26px 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 6px 22px rgba(0,0,0,.10); }
.org ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 34px 0 0; position: relative; }
.org > ul { padding-top: 0; justify-content: flex-start; }
.org li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 34px 9px 0; }
.org li.otop { padding-top: 0; margin: 0 auto; }
.org li::before, .org li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 34px; border-top: 2.5px solid var(--c, var(--line)); }
.org li::after { right: auto; left: 50%; border-left: 2.5px solid var(--c, var(--line)); }
.org li.otop::before, .org li.otop::after { display: none !important; }
.org li:only-child::before { display: none; }
.org li:only-child::after { width: 0; border-top: 0; }
.org li:first-child::before, .org li:last-child::after { border-top-color: transparent; }
.org li:last-child::before { border-right: 2.5px solid var(--c, var(--line)); border-radius: 0 14px 0 0; }
.org li:first-child::after { border-radius: 14px 0 0 0; }
.org li:last-child:not(:only-child)::after { border-left: 0; }
.org ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 34px; border-left: 2.5px solid var(--c, var(--line)); }
.org li.otop > ul::before { border-color: #4a90e2; }

.onode { width: 200px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--c, var(--accent));
  border-radius: 14px; padding: 12px 12px 8px; box-shadow: 0 3px 12px rgba(0,0,0,.12); transition: transform .15s, box-shadow .15s; }
.onode:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.onode.isroot { border-top-color: #4a90e2; background: linear-gradient(180deg, color-mix(in srgb, #4a90e2 14%, var(--surface)), var(--surface) 70px); width: 220px; }
.otitle { font-weight: 700; font-size: 19px; line-height: 1.2; padding: 0 2px 8px; margin-bottom: 6px; border-bottom: 1px dashed var(--line); color: var(--text); }
.onode:not(.isroot) .otitle { color: color-mix(in srgb, var(--c, var(--accent)) 70%, var(--text)); }
.otitle small { display: block; margin-top: 3px; font-weight: 400; font-size: 13px; color: var(--muted); }
.olink { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 3px 8px; margin-bottom: 6px; }
.olink::before { content: "↳ "; }
.om { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; border-radius: 8px; background: none; color: inherit; padding: 6px 6px; font-size: 17px; cursor: pointer; }
.om small { flex: none; min-width: 2.6em; text-align: center; font-size: 12px; line-height: 1; padding: 4px 6px; border-radius: 99px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.om.k-head small { color: #8a5a00; background: #fff1c9; border-color: #f0d68a; }
.om.k-spouse small { color: #a13a63; background: #fde4ee; border-color: #f3b8cf; }
.om.k-child small, .om.k-down small { color: #1d6b5a; background: #dff4ee; border-color: #a9dccf; }
.om.k-up small { color: #5a4a9a; background: #ece8fa; border-color: #cfc6ee; }
.om em { margin-left: auto; font-style: normal; font-weight: 700; color: var(--accent); font-size: 21px; }
.om:hover { background: var(--surface-2); }
.om.dim { opacity: .3; }
.om.picked { background: var(--accent-soft); color: var(--accent); }
.ofoot { font-size: 15px; font-weight: 600; color: var(--text); margin: 8px 0 12px; }
.olone { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.olone .onode { width: auto; min-width: 0; }
.c-name small.bday { color: var(--accent); font-size: 18px; font-weight: 600; margin-left: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .om.k-head small { color: #f3d27a; background: #3d3317; border-color: #5c4d1f; }
  :root:not([data-theme="light"]) .om.k-spouse small { color: #f3a7c4; background: #3d2030; border-color: #5c3048; }
  :root:not([data-theme="light"]) .om.k-child small, :root:not([data-theme="light"]) .om.k-down small { color: #8fd9c4; background: #1b3a32; border-color: #2a5a4d; }
  :root:not([data-theme="light"]) .om.k-up small { color: #c0b4f0; background: #2b2646; border-color: #453d70; } }

.asec { margin-bottom: 30px; }
.ahead { display: flex; align-items: baseline; gap: 12px; font-size: 22px; margin: 0 0 14px; padding: 8px 16px; border-left: 6px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.ahead small { font-size: 14px; font-weight: 400; color: var(--muted); }

/* 會友列表的小組、職份標籤放大 */
.list-people .c-group .tag, .list-people .c-job .tag { font-size: 16px; font-weight: 600; padding: 2px 10px; }
.list-people .c-group .tag { color: var(--text); }
.list-people .c-group .tag { background: var(--g, var(--accent)); color: #fff; border-color: var(--g, var(--accent)); }

.gtag { display: inline-block; background: var(--g, var(--accent)); color: #fff; font-weight: 700; font-size: 14px; line-height: 1.3; padding: 1px 10px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
.otitle small .gtag { font-size: 13px; }

/* CSP 不准行內 style，所以顏色都用 class */
.grp-1 { --g: var(--g1); } .grp-2 { --g: var(--g2); } .grp-3 { --g: var(--g3); } .grp-4 { --g: var(--g4); } .grp-5 { --g: var(--g5); } .grp-6 { --g: var(--g6); } .grp-7 { --g: var(--g7); } 
.grp-x0 { --g: hsl(190 62% 36%); } .grp-x1 { --g: hsl(330 62% 36%); } .grp-x2 { --g: hsl(100 62% 36%); } .grp-x3 { --g: hsl(20 62% 36%); } .grp-x4 { --g: hsl(260 62% 36%); } .grp-x5 { --g: hsl(60 62% 36%); } .grp-x6 { --g: hsl(350 62% 36%); } .grp-x7 { --g: hsl(170 62% 36%); } .grp-x8 { --g: hsl(290 62% 36%); } .grp-x9 { --g: hsl(40 62% 36%); } .grp-x10 { --g: hsl(120 62% 36%); } .grp-x11 { --g: hsl(220 62% 36%); } 
.org li.hc-0 { --c: hsl(210 65% 55%); } .org li.hc-1 { --c: hsl(25 65% 55%); } .org li.hc-2 { --c: hsl(150 65% 55%); } .org li.hc-3 { --c: hsl(280 65% 55%); } .org li.hc-4 { --c: hsl(350 65% 55%); } .org li.hc-5 { --c: hsl(45 65% 55%); } .org li.hc-6 { --c: hsl(180 65% 55%); } .org li.hc-7 { --c: hsl(320 65% 55%); } .org li.hc-8 { --c: hsl(100 65% 55%); } .org li.hc-9 { --c: hsl(0 65% 55%); } .org li.hc-10 { --c: hsl(240 65% 55%); } .org li.hc-11 { --c: hsl(70 65% 55%); } 
.org li.otop { --c: #4a90e2; }

/* ====== 活潑版面 ====== */
.ar-0 { --a: hsl(200 62% 38%); } .ar-1 { --a: hsl(340 62% 38%); } .ar-2 { --a: hsl(25 62% 38%); } .ar-3 { --a: hsl(150 62% 38%); } .ar-4 { --a: hsl(270 62% 38%); } .ar-5 { --a: hsl(48 62% 38%); } .ar-6 { --a: hsl(180 62% 38%); } .ar-7 { --a: hsl(310 62% 38%); } .ar-8 { --a: hsl(100 62% 38%); } .ar-9 { --a: hsl(0 62% 38%); } 
body { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--bg)) 0, var(--bg) 260px) fixed; }
.top { background: linear-gradient(100deg, #2f7d6b 0%, #3a86c8 60%, #7a6bd1 100%); border-bottom: 0; box-shadow: 0 3px 14px rgba(40,70,110,.25); color: #fff; }
.top .brand { color: #fff; font-size: 17px; letter-spacing: .04em; }
.top .brand-mark { background-color: #fff; border-radius: 50%; padding: 2px; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.top .search input { border: 0; background: rgba(255,255,255,.95); color: #22201c; border-radius: 999px; padding: 10px 18px; box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
.top .btn { border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.top .btn:hover { background: rgba(255,255,255,.3); border-color: #fff; }
.top .btn.primary { background: #ffd24d; color: #4a3600; border-color: #ffd24d; font-weight: 700; }
.pages { display: flex; gap: 6px; background: none; border: 0; padding: 0; }
.pages a { color: #fff; text-decoration: none; padding: 6px 16px; border-radius: 999px; font-weight: 600; background: rgba(255,255,255,.12); }
.pages a:hover { background: rgba(255,255,255,.28); }
.pages a[aria-current="page"] { background: #fff; color: #2f6a8e; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.menu, .menu button { color: var(--text); }
.filters { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.chip { border-radius: 999px; transition: transform .1s, background .15s; }
.chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.chip[aria-pressed="true"] { box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.fgroup h3 { font-size: 13px; color: var(--accent); }
.list-head { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(6px); }

/* 會友列表：每列像一張卡片，左邊是小組色條 */
.list-people { gap: 0; }
.list-people .rowwrap { margin: 5px 10px; border: 1px solid var(--line); border-left: 6px solid var(--g, var(--line)); border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.07); transition: transform .12s, box-shadow .12s; overflow: hidden; }
.list-people .rowwrap:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(0,0,0,.14); }
.list-people .rowwrap.row-head { border: 0; box-shadow: none; background: none; margin-bottom: 0; }
.list-people .row-head:hover { transform: none; box-shadow: none; }
.list-people .rowwrap .row { padding: 9px 8px; }
.c-name { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 16px; color: #fff; background: var(--g, var(--muted)); }
.rowwrap:not([class*="grp-"]) .av { background: var(--muted); }
.rowwrap.picked { outline: 2px solid var(--accent); }
.apill { display: inline-block; background: var(--a, var(--muted)); color: #fff; font-weight: 600; font-size: 14px; padding: 2px 11px; border-radius: 999px; }
.house-head span .apill { font-size: 12px; padding: 1px 8px; }
.kv dd .apill { font-size: 14px; }
.list-people .c-job .tag, .list-people .c-bap, .list-people .c-care { font-size: 14px; }

/* 依戶卡片 */
.list-houses .house { border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 3px 12px rgba(0,0,0,.08); transition: transform .15s, box-shadow .15s; }
.list-houses .house:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.16); }
.house-head b { font-size: 17px; }

/* 家族樹分區標題 */
.ahead { border-left-color: var(--a, var(--accent)); background: linear-gradient(90deg, color-mix(in srgb, var(--a, var(--accent)) 16%, var(--surface)), var(--surface) 55%); }
.ahead.ar-0, .ahead[class*="ar-"] { color: var(--text); }
.btn { border-radius: 999px; }
.detail { border-top-left-radius: 18px; }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; }
  .list-people .rowwrap { margin: 5px 8px; }
  .av { width: 30px; height: 30px; font-size: 14px; }
}
.list-people .rowwrap.row-head { border-left: 6px solid transparent; margin: 0 10px; border-radius: 0; }
.list-people .row-head .row { padding: 8px 8px; }
.house-head { flex-direction: column; gap: 6px; }
.house-head > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.house-head > span .gtag, .house-head > span .apill { margin: 0; font-size: 13px; line-height: 1.4; padding: 1px 9px; }
.house-head > span .linkbtn { margin-left: auto; padding: 0; }
.house-head > span .gtag, .house-head > span .apill, .otitle small .gtag { color: #fff; }

/* ====== 詳細資料：頂部大卡片 + 分區卡片 ====== */
.detail { background: color-mix(in srgb, var(--accent) 5%, var(--bg)); }
.d-head { background: var(--surface); }
.d-title { flex: 1; font-weight: 700; color: var(--muted); }
.hero { margin: 14px 16px 0; padding: 18px; border-radius: 20px; color: #fff; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--g, var(--accent)), color-mix(in srgb, var(--g, var(--accent)) 55%, #1b2a4a)); box-shadow: 0 8px 22px rgba(0,0,0,.2); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.12); }
.av.big { width: 68px; height: 68px; font-size: 32px; background: rgba(255,255,255,.25); border: 3px solid rgba(255,255,255,.7); position: relative; z-index: 1; }
.hero-main { flex: 1; min-width: 160px; position: relative; z-index: 1; }
.hero-main h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.2; }
.hero-main h2 small { font-size: 14px; font-weight: 500; margin-left: 10px; background: rgba(255,255,255,.22); padding: 2px 10px; border-radius: 999px; vertical-align: middle; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.htag { background: rgba(255,255,255,.92); color: #22201c; font-weight: 700; font-size: 14px; padding: 2px 12px; border-radius: 999px; }
.htag.job { background: #ffd24d; color: #4a3600; }
.hero-sub { margin-top: 8px; font-size: 15px; opacity: .95; }
.hero-call { position: relative; z-index: 1; background: #fff; color: #1d6b5a !important; font-weight: 700; text-decoration: none; padding: 10px 18px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.hero-call:hover { transform: translateY(-1px); }
.d-body { padding: 4px 16px 32px; }
.sect { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-top: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.06); border-top: 4px solid var(--sc, var(--accent)); }
.sect h3 { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: 0; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.sect h3::before { content: "📋"; font-size: 18px; }
.s-basic { --sc: #4a90e2; } .s-basic h3::before { content: "🧑"; }
.s-contact { --sc: #1baf7a; } .s-contact h3::before { content: "📞"; }
.s-church { --sc: #7a6bd1; } .s-church h3::before { content: "⛪"; }
.s-notes { --sc: #eda100; } .s-notes h3::before { content: "📝"; }
.s-house { --sc: #e87ba4; } .s-house h3::before { content: "🏠"; }
.kv { grid-template-columns: 92px 1fr; gap: 9px 12px; }
.kv dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.kv dd { font-size: 16px; }
.notes { background: var(--warn-soft); }

/* ====== 左邊篩選選單 ====== */
.filters { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface) 60%); padding: 14px 12px; }
.filters .fgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 12px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.fgroup h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; align-items: center; }
.fgroup h3::before { content: "🔹"; margin-right: 6px; font-size: 13px; }
.fgroup.f-_bm h3::before { content: "🎂"; } .fgroup.f-nm_area h3::before { content: "📍"; } .fgroup.f-no_group h3::before { content: "👥"; }
.fgroup.f-nm_job h3::before { content: "🎖️"; } .fgroup.f-fg_baptism h3::before { content: "💧"; } .fgroup.f-fg_member h3::before { content: "🪪"; }
.fgroup.f-fg_attend h3::before { content: "🙏"; } .fgroup.f-fg_care h3::before { content: "💗"; }
.fgroup h3 { justify-content: flex-start; } .fgroup h3 button { margin-left: auto; }
.fgroup.f-_bm .chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fgroup.f-_bm .chip { text-align: center; padding: 5px 4px; border-radius: 12px; font-weight: 600; }
.fgroup.f-_bm .chip[aria-pressed="false"] { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.fsel { border-radius: 12px; background: var(--surface-2); font-weight: 500; }
.fsel.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.filters .btn.full { background: var(--danger-soft); color: var(--danger); border-color: transparent; font-weight: 700; }

/* 帳號管理 */
.acct-hint { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--muted); display: grid; gap: 3px; margin-bottom: 12px; }
.acct { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.acct-main small { display: block; color: var(--muted); font-size: 12px; }
.acct-me { background: var(--accent); color: var(--accent-ink); font-size: 11px; padding: 0 7px; border-radius: 99px; margin-left: 6px; }
.acct-btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.acct-btns .btn { padding: 4px 12px; font-size: 13px; }
.acct-new { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 8px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.acct-new h3 { grid-column: 1 / -1; margin: 0; font-size: 15px; }
/* 手機：帳號一整行，權限和「新增」放第二行，按鈕才不會被擠出畫面 */
@media (max-width: 480px) { .acct-new { grid-template-columns: minmax(0, 1fr) auto; } .acct-new input { grid-column: 1 / -1; } }
.acct-new input { min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.acct-msg { margin-top: 12px; }
.acct-msg:not(:empty) { background: var(--warn-soft); border-radius: 12px; padding: 10px 14px; }
.acct-msg code { font-size: 18px; font-weight: 700; user-select: all; }

/* 登入圖形驗證碼 */
.login-cap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.login-cap .cap-img { width: 240px; height: 84px; border-radius: 12px; background: #f4efe4; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; color: #666; font-size: 13px; }
.login-cap .cap-img svg { display: block; width: 240px; height: 84px; }
.login-card .cap-input { font-size: 24px; letter-spacing: .25em; text-align: center; text-transform: uppercase; }
/* 登入表單：欄位一律不超出卡片（驗證碼欄字大，原本會把版面撐開） */
.login-card { min-width: 0; }
.login-card > * { min-width: 0; }
.login-card label { min-width: 0; }
.login-card input { width: 100%; min-width: 0; box-sizing: border-box; }
.login-card .cap-input { font-size: 22px; letter-spacing: .2em; }
.login-cap { max-width: 100%; }
.login-cap .cap-img { max-width: 100%; }
.login-cap .cap-img svg { max-width: 100%; height: auto; }

/* 篩了生日月份時，姓名欄要放得下「🎂 月/日」，不能被擠掉 */
.list-people.has-bday .row { grid-template-columns: minmax(290px, 2.2fr) minmax(130px, 1.3fr) minmax(90px, .9fr) 88px minmax(110px, 1fr) 96px 80px 64px; }
.c-name small.bday { flex: none; white-space: nowrap; overflow: visible; }
.c-name { min-width: 0; }
@media (max-width: 1100px) { .list-people.has-bday .row { grid-template-columns: minmax(260px, 2fr) minmax(110px, 1.2fr) minmax(80px, .8fr) 84px minmax(100px, 1fr) 70px; } }
@media (max-width: 760px) { .list-people.has-bday .row { grid-template-columns: minmax(0, 1fr) auto; } }
@media (max-width: 760px) { .list-people .rowwrap .row { padding-right: 12px; } }

/* 職份顏色：長老紅、執事綠（2026-11 分組） */
.tag.job.job-elder, .htag.job.job-elder { background: #c62828; color: #fff; border-color: #c62828; }
.tag.job.job-deacon, .htag.job.job-deacon { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.acct-group[hidden] { display: none; }

/* 分組長老：沒有電話欄，空間讓給職份（「本組召集長老」放得下）；手機版職份標籤放在名字下面那行 */
.scoped .list-people .row > span.c-tel, .scoped .row-head .row > span:nth-child(5) { display: none; }
.scoped .list-people .row { grid-template-columns: minmax(110px, 1.1fr) minmax(130px, 1.3fr) minmax(90px, .9fr) 88px 150px 80px 64px; }
.c-meta .tag { margin-right: 6px; font-size: 12px; }
@media (max-width: 1100px) {
  .scoped .list-people .row { grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(80px, .8fr) 84px 150px; }
}
@media (max-width: 760px) {
  .scoped .list-people .row { grid-template-columns: minmax(0, 1fr) auto; }
}
/* 標籤上下留一點空間，圓角不會被切掉 */
.list-people .row > span.c-group, .list-people .row > span.c-job { padding-block: 3px; }
.list-people .row > span.c-meta { padding-block: 2px; }

/* 頁尾版權、隱私權說明連結、登入頁保密提醒 */
.site-foot { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; margin-top: 16px; }
.site-foot a, .consent a { color: var(--accent); }
.login { grid-template-rows: 1fr auto; }
.login-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.menu-link { display: block; padding: 9px 10px; border-radius: 6px; color: var(--muted); font-size: 13px; text-decoration: none; }
.menu-link:hover { background: var(--surface-2); }
