/* 共用骨架；A（Fresha 式）與 B（Booksy 式）只換變數與少數元件 */
:root { --font: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', sans-serif; }
body[data-theme="a"] { --bg: #f4f4f5; --card: #fff; --line: #e4e4e7; --ink: #0d0d0d; --mut: #62626b; --pri: #0d0d0d; --priInk: #fff; --acc: #6950f3; --accSoft: #efecff; --rad: 16px; --pill: 999px; --ok: #16a34a; }
body[data-theme="b"] { --bg: #fff; --card: #fff; --line: #dfe3e6; --ink: #1a1f24; --mut: #5b6670; --pri: #16728c; --priInk: #fff; --acc: #16728c; --accSoft: #e3f3f7; --rad: 10px; --pill: 8px; --ok: #12a150; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
body.noscroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 96px; }
.mut { color: var(--mut); }
.pad { padding: 0 20px 16px; }
.hint { color: var(--mut); font-size: 14px; margin: 10px 0; }
.empty { color: var(--mut); text-align: center; padding: 28px 0; }
.redtxt { color: #d92d20; font-size: 14px; }
.red { color: #d92d20; } .org { color: #c2410c; }

/* 示範工具列 */
.demobar { position: sticky; top: 0; z-index: 30; display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 3px 6px; height: 56px; background: #1b1b1f; }
.demobar .seg { background: #2e2e35; }
.demobar .seg button { color: #c9c9d1; }
.demobar .seg button.on { background: #fff; color: #111; }
.demobar .ibtn { color: #fff; }
.seg { display: inline-flex; border-radius: 999px; padding: 3px; background: #ececef; }
.seg button { min-height: 44px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.seg.sm button { min-height: 44px; padding: 0 10px; font-size: 13.5px; }
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.wide { display: flex; width: 100%; margin: 14px 0 12px; border-radius: var(--pill); }
.seg.wide button { flex: 1; text-align: center; min-height: 44px; border-radius: var(--pill); }
.ibtn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 22px; }
.ibtn.sm { min-width: 44px; min-height: 44px; font-size: 15px; color: var(--mut); }
.ibtn.ph { visibility: hidden; }
.btn { min-height: 48px; padding: 0 20px; border-radius: var(--pill); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 500; }
.btn.pri { background: var(--pri); color: var(--priInk); }
.btn.pri:disabled { opacity: .35; }
.btn.ghost { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.btn.danger { color: #d92d20; }
.btn.block { display: flex; width: 100%; margin: 10px 0; }
.btn2 { display: flex; gap: 10px; margin-top: 14px; } .btn2 .btn { flex: 1; }

/* 客人端標頭 */
.ch { padding: 4px 12px 0; }
.ch-top { display: flex; align-items: center; justify-content: space-between; }
.ch .store { font-size: 14px; color: var(--mut); text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog { display: flex; gap: 6px; padding: 2px 8px 0; }
.prog i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.prog i.on { background: var(--pri); }
.ch h1 { font-size: 28px; line-height: 1.25; margin: 14px 8px 10px; font-weight: 700; letter-spacing: .5px; }
.sec { font-size: 20px; margin: 18px 0 10px; }
.sub { font-size: 15px; margin: 18px 0 8px; color: var(--mut); font-weight: 500; }

/* 分類標籤 */
.tabs { position: sticky; top: 56px; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 8px 20px; background: var(--bg); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 500; }
.tabs button.on { background: var(--pri); color: var(--priInk); border-color: var(--pri); }

/* 卡片 */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card { display: block; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--rad); padding: 16px; margin-bottom: 12px; }
.cards .card { margin: 0; }
.scard { display: flex; flex-direction: column; gap: 4px; }
.scard .t { font-size: 17px; }
.scard .desc { color: var(--mut); font-size: 14px; }
.scard .row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.scard .price { font-size: 17px; }
.plus { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.scard.on { border: 2px solid var(--acc); padding: 15px; }
.scard.on .plus { background: var(--acc); color: #fff; border-color: var(--acc); }

/* B：服務列表 */
.slist { border-top: 1px solid var(--line); }
.srow { display: flex; width: 100%; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: center; }
.srow .sr-main { flex: 1; display: flex; flex-direction: column; } .srow small { color: var(--mut); font-size: 13.5px; }
.srow .sr-side { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; }
.srow em { font-style: normal; margin-top: 6px; min-height: 44px; min-width: 72px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--pri); color: #fff; font-size: 14px; font-weight: 700; }
.srow.on { background: var(--accSoft); } .srow.on em { background: #0f7a3c; }

/* 選人 */
.av { --s: 40px; --c: #999; width: var(--s); height: var(--s); flex: none; border-radius: 999px; background: var(--c); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(var(--s) * .42); vertical-align: middle; }
.av.any { --s: 52px; background: var(--accSoft); color: var(--acc); font-size: 22px; }
.av.any.sm { --s: 24px; font-size: 12px; }
.prow { display: flex; align-items: center; gap: 14px; min-height: 84px; }
.prow .pr-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.prow small { font-size: 13.5px; color: var(--mut); }
.prow .sel { flex: none; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; align-items: center; font-size: 14px; }
.prow.any { border-color: var(--acc); }
.tag { font-style: normal; font-size: 12px; padding: 1px 8px; border-radius: 999px; margin-left: 4px; font-weight: 500; }
.tag.gold { background: #fff3d6; color: #9a6400; }
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pcell { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 14px 4px; border: 1px solid var(--line); border-radius: var(--rad); background: var(--card); min-height: 150px; }
.pcell small { font-size: 12.5px; color: var(--mut); white-space: nowrap; } .pcell .pc-price { margin-top: 2px; } .pcell .tag { margin: 4px 0 0; }

/* 選時間 */
.trow-top { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 4px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 500; }
.pill.static { padding-right: 14px; }
.chev { color: var(--mut); font-size: 12px; }
.ibtn.cal { border: 1px solid var(--line); background: var(--card); width: 52px; }
.mhead { text-align: center; font-size: 20px; margin: 10px 0 4px; }
.dstrip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 6px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; scroll-snap-type: x proximity; scroll-padding-inline: 20px; scrollbar-width: none; }
.dstrip::-webkit-scrollbar { display: none; }
.dcell { flex: none; width: 62px; min-height: 84px; border: 1px solid var(--line); border-radius: var(--rad); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; scroll-snap-align: start; }
.dcell small { font-size: 12.5px; color: var(--mut); } .dcell b { font-size: 22px; line-height: 1.2; }
.dcell.on { background: var(--acc); border-color: var(--acc); color: #fff; } .dcell.on small { color: #fff; }
.dcell.none { opacity: .45; } .dcell.none b { text-decoration: line-through; }
.dot { width: 6px; height: 6px; border-radius: 9px; background: transparent; margin-top: 3px; } .dot.ok { background: var(--ok); }
.dcell.on .dot.ok { background: #fff; }
.bar { width: 26px; height: 5px; border-radius: 9px; background: #d5dade; margin-top: 4px; } .bar.ok { background: var(--ok); }
.dcell.on .bar { background: #fff; }
.tlist { display: flex; flex-direction: column; gap: 10px; }
.trow { min-height: 52px; padding: 0 18px; border: 1px solid var(--line); border-radius: var(--rad); background: var(--card); font-weight: 500; text-align: left; }
.trow.on { border: 2px solid var(--acc); background: var(--accSoft); }
.tgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpill { min-height: 48px; border: 1px solid var(--line); border-radius: var(--pill); background: #fff; font-weight: 700; text-align: center; }
.tpill.on { background: var(--pri); border-color: var(--pri); color: #fff; }
.note { display: block; width: 100%; background: var(--accSoft); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 8px 0; text-align: left; min-height: 44px; }
.note.more { background: transparent; border: 1px dashed var(--line); }

/* 底部摘要列 */
.bbar { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; gap: 12px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.05); }
.bb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 15px; }
.bb-txt .mut { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbar .btn { flex: none; min-width: 120px; }

/* 確認／完成 */
.sum .kv, .kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 15px; }
.kv span { color: var(--mut); flex: none; } .kv b { text-align: right; font-weight: 500; }
.fld { display: block; margin: 12px 0; } .fld span { display: block; font-size: 14px; color: var(--mut); margin-bottom: 4px; }
.fld input, .fld select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: #fff; font-size: 16px; }
.done { text-align: center; padding-top: 28px; } .done .sum { text-align: left; }
.done .ok { width: 72px; height: 72px; margin: 0 auto; border-radius: 99px; background: var(--ok); color: #fff; font-size: 38px; display: flex; align-items: center; justify-content: center; }
.done h1 { margin: 12px 0 18px; }

/* 後台 */
.ah { position: sticky; top: 56px; z-index: 12; background: var(--bg); padding: 4px 10px 2px; }
.ah-row { display: flex; align-items: center; gap: 4px; }
.dtitle { flex: 1; font-size: 18px; font-weight: 700; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.dtitle small { font-size: 12px; background: var(--accSoft); color: color-mix(in srgb, var(--acc) 80%, #000); padding: 1px 8px; border-radius: 99px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 44px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; display: inline-flex; align-items: center; gap: 5px; }
.chips button.on { background: var(--pri); color: #fff; border-color: var(--pri); }
.dotc { width: 9px; height: 9px; border-radius: 9px; display: inline-block; }
.simrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; color: #b42318; padding: 2px 0 6px; }
.calwrap { overflow: auto; height: calc(100vh - 230px); height: calc(100dvh - 230px); scroll-snap-type: x mandatory; scroll-padding-left: 46px; background: var(--card); border-top: 1px solid var(--line); overscroll-behavior: contain; }
.mode-solo .calwrap { height: calc(100dvh - 186px); }
.cal-in { position: relative; }
.cal-h { position: sticky; top: 0; z-index: 4; display: flex; background: var(--card); border-bottom: 1px solid var(--line); }
.corner { position: sticky; left: 0; z-index: 5; width: 46px; flex: none; background: var(--card); }
.colh { width: var(--colw); flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-left: 1px solid var(--line); text-align: center; }
.colh b { font-size: 14px; margin-top: 2px; } .colh small { font-size: 11.5px; color: var(--mut); line-height: 1.3; }
.cal-b { display: flex; position: relative; }
.axis { position: sticky; left: 0; z-index: 3; width: 46px; flex: none; background: var(--card); }
.axis span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--mut); }
.axis span:first-child { transform: none; }
.col { position: relative; width: var(--colw); flex: none; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0 65px, #eef0f2 65px 66px); }
.off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #eceef1 0 6px, #f8f9fa 6px 12px); pointer-events: none; }
.now { position: absolute; left: -4px; right: 0; height: 2px; background: #e5484d; z-index: 2; pointer-events: none; }
.now::before { content: ''; position: absolute; left: 0; top: -4px; width: 10px; height: 10px; border-radius: 9px; background: #e5484d; }
.bk { position: absolute; left: 3px; right: 3px; z-index: 1; border-radius: 8px; padding: 4px 6px; overflow: hidden; display: flex; flex-direction: column; gap: 1px; background: color-mix(in srgb, var(--c) 16%, #fff); border-left: 4px solid var(--c); font-size: 12px; line-height: 1.3; text-align: left; }
.bk-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bk-s { color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-tags { display: flex; flex-wrap: wrap; gap: 3px; } .bk-tags em { font-style: normal; font-size: 10.5px; padding: 0 4px; border-radius: 4px; background: rgba(255,255,255,.8); }
.t-req { color: #9a3c00; } .t-any { color: #3554a8; } .t-ok { color: #11743a; } .t-warn { color: #8a5a00; } .t-red { color: #fff !important; background: #d92d20 !important; }
.bk.hold { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 18%, #fff) 0 6px, #fff 6px 12px); }
.bk.red { outline: 2px solid #d92d20; }
.bk.hl { box-shadow: 0 0 0 3px var(--acc); }
.ghostcard { position: absolute; left: 3px; right: 3px; border: 1.5px dashed #a1a1aa; border-radius: 8px; color: #71717a; font-size: 11px; padding: 4px 6px; line-height: 1.3; background: rgba(255,255,255,.7); pointer-events: none; overflow: hidden; }
.legend { font-size: 12px; color: var(--mut); text-align: center; margin: 6px 0; }
.fab { position: fixed; z-index: 15; right: max(16px, calc(50% - 224px)); bottom: 84px; width: 56px; height: 56px; border-radius: 99px; background: var(--pri); color: #fff; font-size: 28px; box-shadow: 0 6px 18px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; }
.anav { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.anav button { flex: 1; min-height: 60px; text-align: center; font-weight: 500; color: var(--mut); }
.anav button.on { color: var(--pri); font-weight: 700; box-shadow: inset 0 3px 0 var(--pri); }
.badge { font-style: normal; background: #d92d20; color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; }

/* 班表 */
.shiftwrap { overflow-x: auto; background: var(--card); border-top: 1px solid var(--line); }
.shift { border-collapse: collapse; font-size: 12.5px; }
.shift th, .shift td { border-bottom: 1px solid var(--line); padding: 0; }
.shift thead th { font-weight: 400; color: var(--mut); padding: 6px 2px; text-align: center; min-width: 62px; }
.shift thead th.today b { background: var(--acc); color: #fff; border-radius: 99px; padding: 0 6px; }
.shift tbody th { position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--line); }
.sname { display: flex; align-items: center; gap: 6px; padding: 6px 8px; min-height: 58px; width: 104px; text-align: left; }
.sname span { display: flex; flex-direction: column; font-weight: 700; font-size: 14px; } .sname small { font-weight: 400; color: var(--acc); font-size: 11.5px; }
.sc { width: 100%; min-height: 58px; min-width: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.25; border-left: 1px solid var(--line); }
.sc.offc { color: var(--mut); background: repeating-linear-gradient(135deg, #f1f2f4 0 6px, #fafafa 6px 12px); }
.sc em { font-style: normal; font-size: 11px; color: #fff; background: #ea580c; border-radius: 4px; padding: 0 4px; margin-top: 2px; }
.sc.ovc { box-shadow: inset 0 0 0 2px #fdba74; }

/* 收件匣 */
.inbox { padding-top: 6px; }
.msg { margin: 0 0 16px; }
.msg-h { display: flex; justify-content: space-between; font-size: 13px; color: var(--mut); margin-bottom: 4px; }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 12px 14px; font-size: 15px; }
.mbtns { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mbtns button { min-height: 44px; border-radius: 10px; border: 1px solid #06803c; color: #06803c; font-weight: 700; text-align: center; background: #fff; }
.mbtns button.used { border-color: var(--line); color: var(--mut); }
.mused { font-size: 13px; color: var(--mut); margin: 8px 0 0; }

/* 抽屜 */
.ov { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); }
.sheet { position: fixed; z-index: 41; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: var(--card); border-radius: 20px 20px 0 0; padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 4px 48px 12px 0; font-size: 21px; }
.sx { position: absolute; right: 8px; top: 8px; font-size: 18px; color: var(--mut); }
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mw { font-size: 12px; color: var(--mut); }
.mday { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); font-weight: 500; text-align: center; }
.mday.dis { border-color: transparent; color: #c4c4c8; }
.mday.on { background: var(--acc); color: #fff; border-color: var(--acc); }
.redbox { border: 2px solid #d92d20; border-radius: 12px; padding: 12px; margin: 12px 0; background: #fff5f4; } .redbox b { color: #b42318; } .redbox p { margin: 6px 0; font-size: 14px; }
.wrow { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.wday { width: 64px; flex: none; display: flex; flex-direction: column; gap: 4px; }
.offt { padding-top: 10px; font-size: 14px; }
.segs { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.segrow { display: flex; align-items: center; gap: 4px; }
.segrow select { flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; background: #fff; font-size: 15px; }
.sw { position: relative; display: inline-block; width: 50px; height: 30px; }
.sw input { position: absolute; opacity: 0; left: -6px; top: -7px; width: 64px; height: 44px; margin: 0; z-index: 1; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 99px; background: #d4d4d8; transition: .15s; }
.sw i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 99px; background: #fff; transition: .15s; }
.sw input:checked + i { background: var(--ok); } .sw input:checked + i::after { left: 23px; }
.radios { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.radios label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; }
.radios input { width: 20px; height: 20px; accent-color: var(--acc); }
.aff { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; } .aff small { color: var(--mut); margin-left: 6px; } .aff p { margin: 6px 0 0; font-size: 14px; }
.toast { position: fixed; z-index: 60; left: 50%; top: 64px; transform: translateX(-50%); width: calc(100% - 32px); max-width: 440px; background: #1b1b1f; color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 14.5px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }

/* B 風格的細部差異 */
body[data-theme="b"] .ch h1 { text-align: center; font-size: 22px; }
body[data-theme="b"] .tabs button { border-radius: 8px; }
body[data-theme="b"] .tabs button.on { background: var(--accSoft); color: var(--pri); border-color: var(--pri); }
body[data-theme="b"] .dcell { width: 56px; border-radius: 10px; }
body[data-theme="b"] .seg.wide { background: #eef1f3; }
body[data-theme="b"] .btn.pri { border-radius: 10px; box-shadow: 0 3px 8px rgba(22,114,140,.3); }

.bk.short { flex-direction: row; align-items: center; gap: 4px; padding: 2px 6px; }
.bk.short .bk-s, .bk.short .bk-tags em:not(.t-red) { display: none; }
.bk.short .bk-t { flex: 1; min-width: 0; }
#app.tab-cal { padding-bottom: 0; min-height: 0; }
.tab-cal .fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
