* { box-sizing: border-box; }
/* UnderDog CIS 色彩：Pantone 432C #333F48（深炭灰）、431C #5B6770（中灰藍）、7543C #98A4AE（淺鋼灰） */
:root {
  --bg: #f1f2f3;
  --card: #fff;
  --ink: #2b343c;
  --muted: #5f6a74;
  --line: #dfe3e6;
  --btn-line: #8d96a0;
  --inactive-ink: #767d88;
  --brand-dark: #333f48;
  --brand-mid: #5b6770;
  --brand-light: #98a4ae;
  --primary: #333f48;
  --primary-dark: #20282e;
  --free: #e8f5e9;
  --free-ink: #2e7d32;
  --booked: #dbeafe;
  --booked-ink: #1d4ed8;
  --seasonal: #ede9fe;
  --seasonal-ink: #6d28d9;
  --machine: #ccfbf1;
  --machine-ink: #0f766e;
  --tutoring: #ffedd5;
  --tutoring-ink: #c2410c;
  --pending: #fef9c3;
  --pending-ink: #a16207;
  --blocked: #f3f4f6;
  --blocked-ink: #767d88;
  --danger: #dc2626;
  --ok: #16a34a;
}
body { margin: 0; font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
/* 全站統一焦點環。用 :where() 讓權重維持 0，任何頁面的區域樣式都能蓋過，
   不會演變成 !important 互相覆蓋 */
:where(a, button, .btn, .tab, .stat, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--brand-mid);
  outline-offset: 2px;
  border-radius: 8px;
}
/* 深色 topbar 上改用亮色，貼著 #333f48 才看得出來 */
.topbar.admin :where(a, button):focus-visible { outline-color: #ccd4da; }
h1 { font-size: 1.4rem; margin: 18px 0 8px; color: var(--brand-dark); letter-spacing: .5px; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; color: var(--brand-dark); }
h3 { font-size: 1rem; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 640px; }
.muted { color: var(--muted); font-weight: normal; font-size: .9em; }
.sub { color: var(--muted); margin-top: 0; }
.error { color: var(--danger); }
.success-text { color: var(--ok); }
.warn-text { color: var(--danger); }

/* topbar：前台亮色（CIS 淺灰底＋深灰字），後台深炭灰 */
.topbar { background: #fff; color: var(--ink); border-bottom: 3px solid var(--brand-dark); box-shadow: 0 1px 6px rgba(51,63,72,.08); }
.topbar.admin { background: var(--brand-dark); border-bottom: 3px solid var(--brand-light); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
.brand { color: var(--ink); font-weight: 800; font-size: 1.02rem; display: flex; align-items: center; gap: 10px; letter-spacing: .5px; }
.brand img.logo-h { height: 40px; width: auto; display: block; }
.brand img.logo-badge-sm { height: 30px; width: auto; display: block; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--brand-mid); font-weight: 500; }
.topbar nav a:hover { color: var(--brand-dark); text-decoration: none; }
.topbar nav a.muted { color: var(--brand-light); }
.topbar nav a.member-link { color: var(--brand-dark); font-weight: 700; }

/* 前台導覽列：主連結＋右側漢堡選單 */
.topbar { position: relative; }
.main-links { display: flex; gap: 18px; align-items: center; margin-left: auto; margin-right: 14px; }
.main-links a { color: var(--brand-mid); font-weight: 500; }
.main-links a:hover { color: var(--brand-dark); text-decoration: none; }
.main-links a.nav-cta { background: var(--brand-dark); color: #fff; padding: 7px 16px; border-radius: 8px; font-weight: 700; }
.main-links a.nav-cta:hover { background: var(--primary-dark); }
.menu-btn { width: 40px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; padding: 0; }
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--brand-dark); border-radius: 2px; transition: transform .18s, opacity .18s; }
.menu-btn:hover { background: #f3f4f6; }
.menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.menu-drop { display: none; position: absolute; right: 12px; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(51,63,72,.15); min-width: 230px; padding: 8px; z-index: 100; }
.menu-drop.open { display: block; }
.menu-drop a, .menu-item-btn { display: block; width: 100%; text-align: left; padding: 10px 14px; border-radius: 8px; color: var(--ink); font-size: .95rem; border: none; background: none; cursor: pointer; font-family: inherit; }
.menu-drop a:hover, .menu-item-btn:hover { background: #f1f2f3; text-decoration: none; }
.menu-drop hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-user { padding: 10px 14px 4px; font-weight: 700; color: var(--brand-dark); font-size: .92rem; }
.menu-drop .mobile-only { display: none; }

/* 後台導覽列（深底）：主連結白字、漢堡深色 */
.topbar.admin .main-links a { color: #ccd4da; }
.topbar.admin .main-links a:hover { color: #fff; }
.topbar.admin .menu-btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.topbar.admin .menu-btn span { background: #fff; }
.topbar.admin .menu-btn:hover { background: rgba(255,255,255,.22); }
@media (max-width: 760px) {
  .main-links { display: none; }
  .menu-drop .mobile-only { display: block; }
  .menu-drop .menu-desktop-only { display: none; }
}
.topbar.admin .brand { color: #fff; }
.topbar.admin nav a { color: #ccd4da; }
.topbar.admin nav a:hover { color: #fff; }
.topbar.admin nav a.muted { color: #8b98a2; }
.topbar.admin .linklike { color: #ccd4da; }
input.readonly { background: #f3f4f6; color: #6b7280; }
.footer { color: var(--muted); padding: 24px 0; font-size: .82rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 22px; flex-wrap: wrap; letter-spacing: .02em; }
.footer-links { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.footer-links a, .footer-line { color: inherit; }
.footer-links a:hover, .footer-line:hover { color: var(--brand-dark); }
.footer-service, .footer-line, .footer-copy { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .footer-inner { flex-direction: column; justify-content: center; text-align: center; }
  .footer-links { justify-content: center; }
}

/* cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 3px rgba(51,63,72,.05); margin: 12px 0; overflow: hidden; }
.card.pad, .card .form, details.card { padding: 14px 16px; }
.form label { display: block; margin: 10px 0; font-size: .9rem; color: #374151; }
.form input, .form select, .form textarea { display: block; width: 100%; padding: 8px 10px; margin-top: 4px; border: 1px solid var(--btn-line); border-radius: 8px; font-size: .95rem; font-family: inherit; }
.form.inline { display: flex; gap: 10px; align-items: center; }
.form.inline input { margin: 0; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form .wide { grid-column: 1 / -1; }
.form .chk { display: flex; align-items: center; gap: 6px; }
.form .chk input { width: auto; display: inline; margin: 0; }
textarea { resize: vertical; }
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 16px; }
.filter-form label { margin: 0; }
.filter-form input, .filter-form select { width: auto; min-width: 110px; }

.btn { display: inline-block; padding: 8px 16px; border: 1px solid var(--btn-line); background: #fff; color: var(--ink); border-radius: 8px; cursor: pointer; font-size: .9rem; font-family: inherit; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
/* 動錢／執行＝實心，撤銷＝空心。不只靠顏色區分，也靠份量，
   避免「確認入帳」與「取消」在平板上被誤觸 */
.btn.danger { color: #b91c1c; border-color: var(--btn-line); }
.btn.danger:hover { background: #fef2f2; }
.btn.ok { background: #15803d; border-color: #15803d; color: #fff; font-weight: 700; }
.btn.ok:hover { background: #166534; }
/* inline-flex 才能讓文字在 min-height 內垂直置中；
   nowrap 是必要的——inline-flex 會讓純文字變成匿名 flex item，
   在窄的父層裡會被逐字折行（「＋ 開報價單」曾被折成 43×99） */
.btn.sm { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; padding: 6px 14px; font-size: .82rem; min-height: 36px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linklike { background: none; border: none; color: #e5e7eb; cursor: pointer; font-family: inherit; font-size: .9rem; }
.inline-form { display: inline; }

/* toolbar / tabs */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.tabs { display: flex; gap: 6px; }
.tab { padding: 7px 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-weight: 500; }
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab:hover { text-decoration: none; }
.weeknav { display: flex; gap: 6px; align-items: center; }
.weeknav input[type=date] { padding: 5px 8px; border: 1px solid var(--btn-line); border-radius: 8px; font-family: inherit; }

/* schedule grid */
.grid-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; min-width: 700px; }
table.grid th, table.grid td { border: 1px solid var(--line); text-align: center; font-size: .85rem; }
table.grid th { background: #f9fafb; padding: 8px 4px; }
table.grid th.today { background: #e4e8eb; color: var(--brand-dark); }
table.grid .datelabel { font-weight: normal; color: var(--muted); font-size: .8rem; }
table.grid .timecol { width: 64px; background: #f9fafb; color: var(--muted); font-size: .8rem; }
.cell { height: 38px; padding: 2px 4px; }
.cell a { display: block; width: 100%; height: 100%; line-height: 32px; }
.cell small { display: block; font-size: .72rem; opacity: .85; line-height: 1.2; }
.cell.free { background: var(--free); }
.cell.free a { color: var(--free-ink); }
.cell.free a:hover { text-decoration: none; font-weight: bold; }
.cell.closed { background: #fafafa; color: #767e87; }
.cell.temp, .cell.booked { background: var(--booked); color: var(--booked-ink); }
.cell.taken, .lg.taken { background: #eceef1; color: var(--inactive-ink); }
.cell.contact, .lg.contact { background: #e0f2fe; color: #0369a1; font-size: .78rem; }
.cell.contact a { color: #0369a1; display: block; width: 100%; height: 100%; line-height: 32px; }
.cell.contact a:hover { text-decoration: none; font-weight: bold; }
.cell.seasonal { background: var(--seasonal); color: var(--seasonal-ink); }
.cell.machine { background: var(--machine); color: var(--machine-ink); }
.cell.tutoring { background: var(--tutoring); color: var(--tutoring-ink); }
.cell.pending { background: var(--pending); color: var(--pending-ink); }
.cell.blocked { background: var(--blocked); color: var(--blocked-ink); text-decoration: line-through; }
.cell.clickable { cursor: pointer; }
table.grid.adm .cell { height: 46px; }
/* 原本靜止時是 #a5d6a7（對比 1.46，幾乎看不見），改用既有的 --free-ink（4.56 AA）。
   滑過的區別改由加粗與底色提亮負責，不再靠深淺綠 */
table.grid.adm .cell.free { color: var(--free-ink); font-size: 1.1rem; }
table.grid.adm .cell.free:hover { background: #d7eeda; font-weight: bold; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; font-size: .82rem; }
.lg { padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); }
.lg.free { background: var(--free); color: var(--free-ink); }
.lg.booked { background: var(--booked); color: var(--booked-ink); }
.lg.seasonal { background: var(--seasonal); color: var(--seasonal-ink); }
.lg.machine { background: var(--machine); color: var(--machine-ink); }
.lg.tutoring { background: var(--tutoring); color: var(--tutoring-ink); }
.lg.pending { background: var(--pending); color: var(--pending-ink); }
.lg.blocked { background: var(--blocked); color: var(--blocked-ink); }

/* lists */
/* 寬表格（訂單管理 14 欄，最小寬度約 810px）在手機上會把整頁推成橫向捲動。
   包一層 .table-wrap 讓捲動留在表格內，表頭固定住才知道哪欄是哪欄 */
/* 注意：只要設了 overflow-x: auto，overflow-y 也會一併算成 auto，
   .table-wrap 就成了捲動容器、表頭不會再跟著「頁面」捲動。
   因此這裡給一個 max-height，讓長表格在容器內捲、表頭才真的黏得住；
   沒超過高度的短表格完全不受影響 */
.table-wrap { overflow: auto; overscroll-behavior-x: contain; max-height: 78vh; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 3px rgba(51,63,72,.05); margin: 12px 0; }
.table-wrap > table.list { border: 0; margin: 0; }
@media print { .table-wrap { overflow: visible; max-height: none; } }
table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: .88rem; vertical-align: top; }
table.list th { background: #f9fafb; color: #374151; white-space: nowrap; }
/* 只有包在 .table-wrap 裡的（＝後台清單）才固定表頭，前台表格維持原樣 */
.table-wrap table.list thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
table.list tr.dim { opacity: .5; }
table.list tr.subrow td { background: #fafafa; padding: 4px 10px; }
/* 原本是 nowrap + margin 2px，兩顆 27px 的按鈕只差 4px，平板容易誤觸。
   改用 flex 讓間距固定 8px，窄畫面自然換行 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { display: inline-flex; margin: 0; }
.notecell { max-width: 180px; font-size: .8rem; color: var(--muted); }
/* 家教課的操作欄：編輯／本週停課是 details（區塊元素）會各自換行，
   改用 flex 讓所有按鈕排成一橫排，展開時再自然換行 */
.tut-acts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; white-space: normal; }
.tut-acts form { display: inline-block; margin: 0; }
/* 單週停課移進「狀態」欄，跟著該堂課走，不再另起一列 */
.tut-skips { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.tut-skips .skip-item { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tut-skips .badge { background: #fee2e2; color: #b91c1c; }
/* 帳號管理的操作欄：改帳號與重設密碼各佔一行。
   不可沿用 .actions（white-space:nowrap 會把三組表單排成一長列而溢出畫面看不到） */
.useracts form { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0; }
.useracts .ua-label { font-size: .78rem; color: var(--muted); min-width: 4.5em; }
.useracts input { padding: 4px 6px; border: 1px solid var(--btn-line); border-radius: 6px; font-size: .84rem; flex: 1 1 8em; min-width: 7em; max-width: 14em; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; background: #f3f4f6; color: #374151; white-space: nowrap; }
.badge.pay-unpaid { background: #fee2e2; color: #b91c1c; }
.badge.pay-unchecked { background: #ffedd5; color: #c2410c; }
.badge.pay-verified { background: #dcfce7; color: #15803d; }
.badge.pay-free { background: #f3f4f6; color: #6b7280; }
.badge.pay-refunded { background: #e0e7ff; color: #4338ca; }
.badge.st-pending { background: var(--pending); color: var(--pending-ink); }
.badge.st-confirmed { background: #dcfce7; color: #15803d; }
.badge.st-cancelled { background: #f3f4f6; color: var(--inactive-ink); }
.badge.kd-temp { background: var(--booked); color: var(--booked-ink); }
.badge.kd-seasonal { background: var(--seasonal); color: var(--seasonal-ink); }
.badge.kd-machine { background: var(--machine); color: var(--machine-ink); }
.badge.kd-tutoring { background: var(--tutoring); color: var(--tutoring-ink); }
.badge.kd-blocked { background: var(--blocked); color: var(--blocked-ink); }

/* 繳費狀態標籤：原本四種只有底色不同，轉成灰階後完全一樣，
   色覺辨識困難者分不出「未查帳」與「已查帳」。用 ::before 加符號，
   HTML 不用改，複製表格內容做報表時也不會被帶進去 */
.badge[class*="pay-"] { border: 1px solid currentColor; }
.badge[class*="pay-"]::before { font-size: .72rem; font-weight: 700; margin-right: 3px; }
.badge.pay-unpaid::before { content: "\25CF"; }     /* ● 還沒開始 */
.badge.pay-unchecked::before { content: "\25D0"; }  /* ◐ 進行中 */
.badge.pay-verified::before { content: "\2714"; }   /* ✔ 完成 */
.badge.pay-refunded::before { content: "\21A9"; }   /* ↩ 退回 */
.badge.pay-free::before { content: "\2014"; }       /* — 不收費 */

/* 分段選擇：固定且數量少的選項（週幾）不必用下拉。
   沿用合約頁 .date-chk 既有的視覺語彙 */
/* 外框不能用 <label> 包住（label 不可巢狀，會讓點擊只對到第一顆），
   所以另給一個排版與 .form label 一致的容器 */
.form .seg-field, .seg-field { display: block; margin: 10px 0; font-size: .9rem; color: #374151; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
/* 邊框寫死 #8d96a0（對比 3.00）而不用變數，是為了讓這個 PR 不依賴
   另一個 PR 的 --btn-line；兩包各自都能單獨合併 */
.seg label { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 36px; padding: 4px 10px; border: 1px solid #8d96a0; border-radius: 8px; background: #fff; font-size: .88rem; cursor: pointer; user-select: none; }
.seg label:hover { background: #f3f4f6; }
/* radio 蓋滿整個 label 而不是縮成 0×0：0 尺寸會讓它離開 Tab 焦點順序，
   鍵盤就完全操作不了，那比原本的下拉更糟。opacity:0 仍留在焦點順序內 */
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand-mid); outline-offset: 2px; }
.seg label:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* 空狀態：原本各處都是一行灰字，只說「目前沒有」，
   不說什麼時候會有、也不給下一步 */
.empty { text-align: center; padding: 30px 18px; }
.empty .e-mark { width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 50%; border: 2px dashed var(--brand-light); display: flex; align-items: center; justify-content: center; color: var(--brand-light); font-size: 17px; }
.empty .e-title { font-size: .95rem; font-weight: 700; color: #39424a; margin-bottom: 4px; }
.empty .e-desc { font-size: .84rem; color: var(--muted); max-width: 34ch; margin: 0 auto 14px; line-height: 1.7; }
.empty .e-desc:last-child { margin-bottom: 0; }
td > .empty { padding: 24px 12px; }
/* 開關（Switch）。直接用 input 本體不外包 span，才能免費拿到
   鍵盤操作與焦點樣式。只用於「撥下去立刻生效」的獨立系統設定；
   若還需要按儲存才生效，請維持 checkbox——開關的外觀等於承諾即時生效 */
/* 選擇器要寫成 input.sw：`.form input` 已經設了 width/padding/border/margin，
   權重 0,1,1 會蓋掉單純的 .sw（0,1,0），開關會被擠成細長一條 */
input.sw { -webkit-appearance: none; appearance: none; position: relative; flex: 0 0 auto; display: inline-block; width: 42px; min-width: 42px; height: 24px; padding: 0; border: 0; border-radius: 999px; background: #c2c9d0; margin: 0; cursor: pointer; transition: background .18s ease; }
input.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform .18s ease; }
input.sw:checked { background: #15803d; }
input.sw:checked::after { transform: translateX(18px); }
input.sw:disabled { opacity: .55; cursor: progress; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.setting-row .s-main { flex: 1; min-width: 0; }
.setting-row .s-desc { font-size: .78rem; color: var(--muted); }
.setting-row .s-saved { font-size: .75rem; color: #15803d; opacity: 0; transition: opacity .2s; white-space: nowrap; }
.setting-row .s-saved.on { opacity: 1; }
.setting-row .s-saved.err { color: var(--danger); }
@media (prefers-reduced-motion: reduce) {
  .sw, .sw::after, .setting-row .s-saved { transition: none; }
}

/* misc */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.stat { flex: 1; min-width: 140px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat .num { font-size: 1.8rem; font-weight: bold; }
.stat.has-tip { cursor: help; }
a.stat { text-decoration: none; }
a.stat.has-tip { cursor: pointer; }
.stat.has-tip:hover { border-color: var(--brand-mid); background: #f8fafb; }
.tipbox { position: absolute; z-index: 200; max-width: 340px; background: #20282e; color: #f1f2f3; font-size: .82rem; line-height: 1.7; padding: 10px 13px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.28); white-space: pre-line; pointer-events: none; opacity: 0; transition: opacity .12s; display: none; }
.tipbox.show { display: block; opacity: 1; }
.status-legend { font-size: .85rem; line-height: 2; }
.mini-sel { padding: 3px 4px; font-size: .8rem; border: 1px solid var(--btn-line); border-radius: 6px; max-width: 92px; }
.stat.warn .num { color: var(--pending-ink); }
.stat.alert .num { color: var(--danger); }
.page-head { margin-top: 16px; }
.book-summary div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.book-summary div:last-child { border-bottom: none; }
.book-summary .label { display: inline-block; width: 90px; color: var(--muted); }
.book-summary { padding: 6px 16px; }
.price-box { background: #eef1f3; border: 1px solid #c9d1d7; padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.price-box strong { font-size: 1.2rem; color: var(--brand-dark); }
.bkid { color: var(--muted); font-size: .9em; }
.notice-card { padding: 14px 16px; background: #fffbeb; border-color: #fde68a; }
.success-card { padding: 14px 16px; background: #f0fdf4; border-color: #86efac; }
.doorpw { font-size: 1.3rem; letter-spacing: 2px; color: var(--brand-dark); }
.bankinfo { white-space: pre-wrap; background: #f9fafb; padding: 10px 14px; border-radius: 8px; }
.announce { white-space: pre-wrap; font-family: inherit; margin: 0; line-height: 1.7; }
.announce.sm { font-size: .82rem; }
.login-wrap { display: flex; min-height: 80vh; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; padding: 24px; text-align: center; }
.login-card .form { text-align: left; }
details > summary.btn { list-style: none; display: inline-block; }
details > summary.btn.sm { display: inline-flex; }
details > summary.btn::-webkit-details-marker { display: none; }

/* modal */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 12px; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 18px 22px; width: 100%; max-width: 620px; }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.modal-actions .spacer { flex: 1; }

/* home / intro：CIS 淺灰識別底＋徽章 Logo */
.hero { background: linear-gradient(170deg, #e9ebed 0%, #dfe3e6 55%, #cfd5d9 100%); color: var(--ink); text-align: center; padding: 44px 16px 52px; border-bottom: 1px solid var(--line); }
.hero-badge img { height: 170px; width: auto; }
.hero h1 { font-size: 2rem; margin: 14px 0 4px; color: var(--brand-dark); letter-spacing: 2px; }
.hero-sub { font-size: 1.12rem; color: var(--brand-mid); margin: 4px 0; font-weight: bold; }
.hero-desc { color: var(--muted); margin: 6px 0 22px; }
.hero-cta { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; font-size: 1.05rem; padding: 12px 30px; letter-spacing: 1px; }
.hero-cta:hover { background: var(--primary-dark); color: #fff; }
.about-front .front-left { display: flex; flex-direction: column; justify-content: center; }
.about-headline { margin: 18px 0 0; max-width: 34em; color: var(--brand-mid); font-size: 1.2rem; line-height: 1.8; font-weight: 700; }
.about-front-right { align-items: center; }
.about-brand-figure { width: 100%; max-width: 330px; }
.about-brand-figure img { width: min(100%, 260px); margin: 0 auto; padding: 24px; }
.about-brand-figure .fig-cap { text-align: center; }
.about-page { padding-bottom: 20px; }
.about-section { margin: 34px 0; }
.about-prose { max-width: 820px; font-size: 1.02rem; line-height: 1.9; }
.about-prose p { margin: 0 0 1.2em; }
.about-service-grid, .about-venue-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.about-service { display: flex; flex-direction: column; min-width: 0; padding: 20px; color: var(--ink); overflow-wrap: anywhere; }
.about-service h3 { margin: 0 0 8px; }
.about-service p { color: var(--muted); line-height: 1.7; margin: 0 0 12px; }
a.about-service:hover { text-decoration: none; border-color: var(--brand-dark); }
.about-service-link { margin-top: auto; color: var(--brand-dark); font-weight: 700; }
.about-venue-card { min-width: 0; overflow-wrap: anywhere; }
.about-venue-card h3 { margin-top: 0; }
.about-venue-card p { line-height: 1.7; }
.about-hours { padding: 10px 12px; background: #f1f2f3; border-left: 3px solid var(--brand-mid); }
.about-contact-card { overflow-wrap: anywhere; }
.about-contact-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.about-contact-details p { line-height: 1.7; }
.about-line-action { margin-top: 14px; }
@media (max-width: 640px) {
  .about-service-grid, .about-venue-grid, .about-contact-details { grid-template-columns: 1fr; }
  .about-headline { font-size: 1.05rem; }
}
.feature-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 24px 0; }
.feature { flex: 1; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.feature .f-icon { font-size: 1.8rem; }
.feature h3 { margin: 8px 0 6px; }
.feature p { color: var(--muted); font-size: .9rem; margin: 0; line-height: 1.6; }
.price-table th { text-align: center; }
.price-table td:nth-child(2), .price-table td:nth-child(3) { text-align: center; font-weight: bold; color: var(--primary-dark); white-space: nowrap; }
.pad-x { padding: 0 16px 12px; }
.rules { margin: 4px 0; padding-left: 22px; line-height: 1.9; }
.venue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.venue-info p { line-height: 1.7; }
.prewrap { white-space: pre-wrap; }
.mapbox { min-height: 260px; }
.mapbox iframe { width: 100%; height: 100%; min-height: 260px; border: 0; display: block; }
.map-load { width: 100%; height: 100%; min-height: 260px; border: 0; background: #e9ebed; cursor: pointer; font-family: inherit; font-size: 1rem; color: var(--brand-mid); line-height: 1.8; }
.map-load:hover { background: #dfe3e6; }
.center { text-align: center; }
.btn.big { font-size: 1.05rem; padding: 12px 28px; }
.line-btn { background: #06c755; border-color: #06c755; color: #fff; font-weight: bold; }
.line-btn:hover { background: #05a648; color: #fff; }
.line-float { position: fixed; right: 18px; bottom: 18px; width: 54px; height: 54px; border-radius: 50%; background: #06c755; color: #fff; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 90; }
.line-float:hover { background: #05a648; text-decoration: none; transform: scale(1.06); }
.price-hint { background: #eef1f3; border: 1px solid #c9d1d7; border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; font-size: .9rem; }
.venue-tabs { margin: 0 0 12px; }
.rules-box { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-size: .88rem; }
.rules-box summary { cursor: pointer; color: var(--primary-dark); }
.chk.agree { font-size: .88rem; line-height: 1.5; }
.court-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; border-bottom: 1px dashed var(--line); padding: 8px 0; }
.court-row label { margin: 0; }
.court-row input, .court-row select { width: auto; min-width: 90px; }
.court-row input[name=name] { min-width: 150px; }
.court-row .court-id { font-weight: bold; font-size: 1.1rem; width: 28px; }
.venue-form { margin-bottom: 8px; }
.stats-result .stat { flex: 0 1 240px; max-width: 300px; }
.contract-card { margin-bottom: 12px; overflow: hidden; }
.contract-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px 8px; }
.contract-head .ch-main { flex: 1 1 420px; }
.contract-head .ch-money, .contract-head .ch-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.contract-payment-summary { margin: 0 16px 10px; padding: 8px 10px; border-radius: 8px; background: #f9fafb; color: #4b5563; font-size: .88rem; }
.contract-ledger { border-top: 1px solid var(--line); padding: 9px 16px; }
.contract-ledger > summary { cursor: pointer; color: var(--ink); }
.ledger-body { padding-top: 8px; }
.ledger-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 10px; margin-top: 8px; border-radius: 8px; background: #f9fafb; }
.ledger-form label { margin: 0; min-width: 130px; font-size: .82rem; }
.ledger-form label.grow { flex: 1 1 180px; }
.ledger-form input { padding: 6px 8px; }
.contract-no { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-dark); color: #fff; font-size: .78rem; font-weight: bold; margin-right: 4px; }
.date-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.date-chk { display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; background: #fff; cursor: pointer; }
.date-chk input { margin: 0; }
.date-chk.closed { background: #eceef1; color: #9ca3af; }
.calc-box { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; background: #f1f2f3; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 8px 0; font-size: .92rem; }
.calc-box .calc-total { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; font-size: 1.05rem; }
.calc-box .calc-total strong { color: var(--brand-dark); font-size: 1.2rem; }
.renewal-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: .92rem; }
.renewal-bar .spacer { flex: 1; }
.renewal-bar .done-step { color: var(--muted); text-decoration: line-through; }
.perm-table { margin-bottom: 18px; }
.perm-table td:nth-child(n+2), .perm-table th:nth-child(n+2) { text-align: center; }

/* reports */
.report-table th, .report-table td { text-align: right; white-space: nowrap; }
.report-table th:first-child, .report-table td:first-child { text-align: left; }
.report-table .vhead { text-align: center; border-left: 2px solid var(--line); }
.report-table td:nth-child(3n+2) { border-left: 2px solid var(--line); }
.ok-text { color: #15803d; }
.warn-cell { color: #c2410c; }
.total-cell { background: #eef1f3; border-left: 2px solid var(--line); }
.tfoot-row td { background: #f9fafb; border-top: 2px solid #d1d5db; }
.filter-form .tabs button.tab { cursor: pointer; }
.hours-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; font-size: .9rem; }
.hours-row input { width: 64px; padding: 6px 8px; border: 1px solid var(--btn-line); border-radius: 8px; }

/* venue quick cards & courses */
.venue-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.venue-card { display: flex; gap: 14px; align-items: center; padding: 18px; color: var(--ink); }
.venue-card:hover { text-decoration: none; border-color: var(--primary); }
.venue-card h3 { margin: 0 0 4px; }
.venue-card p { margin: 0 0 6px; font-size: .88rem; }
.venue-card .vc-icon { font-size: 2.2rem; }
.venue-card .vc-cta { color: var(--primary); font-weight: bold; font-size: .9rem; }
.venue-card.coming { opacity: .75; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 8px; }
.course-card { padding: 16px 18px; }
.course-card h3 { margin: 0 0 8px; }
.course-meta div { font-size: .88rem; padding: 2px 0; }
.course-meta .label { display: inline-block; width: 44px; color: var(--muted); }
.course-desc { color: var(--muted); font-size: .88rem; line-height: 1.6; }
.reg-box summary { list-style: none; }
.reg-box summary::-webkit-details-marker { display: none; }
.reg-form { display: flex; gap: 6px; align-items: center; }
.reg-form select, .reg-form input { padding: 5px 8px; border: 1px solid var(--btn-line); border-radius: 6px; font-size: .82rem; }
.reg-form input { width: 110px; }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: .85em; }

/* peak/off-peak cells & day tags */
.cell.free a { font-weight: 600; }
.cell.free.peakcell, .lg.peakcell { background: #fff3e0; }
.cell.free.peakcell a { color: #c2410c; }
.day-tag { font-size: .68rem; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 0 6px; display: inline-block; margin-top: 2px; }
.day-tag.special { background: #fee2e2; color: #b91c1c; font-weight: bold; }
.holiday-note { background: #fee2e2; border: 1px solid #fecaca; color: #7f1d1d; border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: .9rem; }

/* seasonal packages & pay-with */
.seasonal-pkg { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.pkg-price { font-size: 1.4rem; font-weight: bold; color: var(--brand-dark); margin-top: 6px; }
.pay-with { background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.pay-with .chk { margin: 6px 0; }

/* special day bar */
.special-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: .88rem; }
.special-bar.on { background: #fef2f2; border-color: #fecaca; }
.special-bar select { padding: 5px 8px; border: 1px solid var(--btn-line); border-radius: 6px; }

/* CRM kanban & timeline */
.kanban { display: grid; grid-template-columns: repeat(8, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; align-items: start; }
.kcol { background: #eef0f3; border-radius: 10px; padding: 8px; min-height: 120px; }
.kcol.over { outline: 2px dashed var(--primary); }
.kcol-head { font-weight: bold; font-size: .85rem; padding: 2px 4px 8px; }
.kcard { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; color: var(--ink); font-size: .82rem; cursor: grab; }
.kcard:hover { text-decoration: none; border-color: var(--primary); }
.kcard.stale { border: 2px solid var(--danger); }
.kname { font-weight: bold; font-size: .88rem; }
.kmeta { color: var(--muted); margin-top: 2px; }
.kfoot { display: flex; justify-content: space-between; margin-top: 6px; font-size: .76rem; color: #4b5563; }
.proc-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.proc-row .form.inline { gap: 6px; }
.proc-row select, .proc-row input { padding: 6px 8px; }
.timeline { border-left: 2px solid var(--line); padding-left: 14px; }
.tl-item { position: relative; padding: 6px 0 10px; }
.tl-item::before { content: ''; position: absolute; left: -19px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.tl-item.auto::before { background: #9ca3af; }
.tl-time { font-size: .78rem; color: var(--muted); }
.tl-content { font-size: .9rem; margin-top: 2px; }
@media (max-width: 900px) { .kanban { display: flex; overflow-x: auto; } .kcol { min-width: 170px; } }

/* photo gallery */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.photo-item { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-item img { width: 100%; height: 170px; object-fit: cover; display: block; }
.photo-item figcaption { padding: 6px 10px; font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 6px; }

@media (max-width: 640px) {
  .venue-grid { grid-template-columns: 1fr; }
  .form.grid2 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  h1 { font-size: 1.2rem; }
}
