:root {
  color-scheme: light;
  --bg: #f8efe4;
  --surface: #fffaf4;
  --surface-soft: #f0e3d4;
  --ink: #4a3427;
  --muted: #887160;
  --line: #e5d3bf;
  --brand: #9a6a3e;
  --brand-dark: #684328;
  --brand-soft: #ead7c0;
  --sand: #d5ad7b;
  --alert: #a34f3f;
  --alert-soft: #f3ddd3;
  --shadow: 0 10px 28px rgba(104, 67, 40, 0.1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #e4d7c9; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button { color: inherit; }
.login-screen { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: var(--bg); }
.login-panel { width: min(100%, 420px); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.login-panel > p:not(.eyebrow) { color: var(--muted); }
.login-panel .field { margin-bottom: 14px; }
.login-error { min-height: 20px; margin: 5px 0 10px; color: var(--alert); font-size: 13px; }

.app-shell { width: 100%; min-height: 100dvh; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: max(16px, env(safe-area-inset-top)) 20px 12px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(227, 224, 216, .7); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.store-name { margin: 0; font-weight: 750; font-size: 15px; }
.avatar { width: 42px; height: 42px; border: 0; border-radius: 50%; color: white; background: var(--brand); font-weight: 800; }
.account-controls { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 750; }
.logout-button { min-height: 38px; padding: 0 14px; color: var(--brand-dark); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 800; }
main { padding: 0 20px calc(104px + env(safe-area-inset-bottom)); }
.screen { display: none; animation: enter .22s ease; }
.screen.is-active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(30px, 9vw, 40px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.02em; }
.greeting { padding: 28px 0 22px; }
.greeting p { margin-bottom: 5px; color: var(--muted); font-size: 14px; }
.greeting span { color: var(--muted); font-size: 14px; }
.card { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.accent-card { margin-bottom: 30px; padding: 20px; color: #fff; border: 0; background: linear-gradient(140deg, var(--brand-dark), var(--brand)); }
.accent-card .eyebrow, .accent-card p { color: rgba(255,255,255,.72); }
.accent-card p { margin: 12px 0 18px; font-size: 14px; }
.text-button { display: flex; justify-content: space-between; width: 100%; padding: 12px 0 0; color: white; border: 0; border-top: 1px solid rgba(255,255,255,.2); background: transparent; text-align: left; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 14px; }
.section-heading.compact { margin: 0; align-items: flex-start; }
.count-badge { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: white; background: var(--brand); font-weight: 800; }
.status { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: var(--surface-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-ready { color: #674529; background: #f1dfca; }
.status-alert { color: var(--alert); background: var(--alert-soft); }
.task-list { display: grid; gap: 10px; }
.task-card { display: grid; grid-template-columns: 42px 1fr 16px; gap: 12px; align-items: center; width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; }
.task-card strong, .task-card small { display: block; }
.task-card strong { margin-bottom: 3px; font-size: 15px; }
.task-card small { color: var(--muted); font-size: 12px; }
.task-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--brand-soft); font-weight: 900; }
.task-icon.urgent { color: var(--alert); background: var(--alert-soft); }
.chevron { color: #8b928d; font-size: 24px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { min-height: 126px; padding: 18px; box-shadow: none; }
.metric span, .metric small, .metric strong { display: block; }
.metric span, .metric small { color: var(--muted); font-size: 12px; }
.metric strong { margin: 8px 0 4px; font-size: 30px; letter-spacing: -.04em; }
.metric.wide { grid-column: 1 / -1; min-height: auto; }
.metric.wide strong { font-size: 27px; }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; padding: 26px 0 20px; }
.page-title h1 { margin: 0; }
.primary-small { min-height: 42px; padding: 0 16px; color: white; border: 0; border-radius: 13px; background: var(--brand); font-weight: 750; }
.date-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 2px -4px 18px; }
.date-strip button { display: grid; gap: 6px; justify-items: center; padding: 10px 2px; color: var(--muted); border: 0; border-radius: 16px; background: transparent; }
.date-strip span { font-size: 11px; }
.date-strip strong { font-size: 17px; }
.date-strip .is-selected { color: white; background: var(--brand); box-shadow: 0 7px 18px rgba(104,67,40,.2); }
.date-jump { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 750; }
.date-jump input { width: auto; min-width: 160px; height: 42px; padding: 0 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: white; }
.filter-row { display: flex; gap: 8px; overflow: auto; margin-bottom: 24px; scrollbar-width: none; }
.chip { padding: 9px 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: transparent; white-space: nowrap; font-size: 13px; }
.chip.is-selected { color: var(--brand-dark); border-color: var(--brand-soft); background: var(--brand-soft); font-weight: 800; }
.timeline { position: relative; display: grid; gap: 14px; }
.timeline::before { content: ""; position: absolute; top: 23px; bottom: 28px; left: 66px; width: 1px; background: var(--line); }
.booking-row { position: relative; display: grid; grid-template-columns: 52px 10px 1fr; gap: 9px; align-items: start; }
.booking-row time, .open-slot time { padding-top: 17px; color: var(--muted); font-size: 13px; font-weight: 700; }
.line-dot { z-index: 2; width: 10px; height: 10px; margin-top: 21px; border: 2px solid var(--bg); border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.attention .line-dot { background: var(--alert); box-shadow: 0 0 0 2px var(--alert-soft); }
.completed .line-dot { background: #9fa59f; }
.booking-card { display: block; width: 100%; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; box-shadow: 0 5px 18px rgba(104,67,40,.06); }
.status-group { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.booking-top { display: flex; justify-content: space-between; align-items: center; }
.booking-card small, .booking-card .therapist { display: block; }
.booking-card small { margin: 8px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.therapist { color: var(--brand); font-size: 12px; font-weight: 700; }
.open-slot { display: grid; grid-template-columns: 62px 1fr; gap: 9px; align-items: center; }
.open-slot span { padding: 13px 16px; color: var(--muted); border: 1px dashed #cacbc5; border-radius: 15px; font-size: 12px; }

.search-box { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 0 15px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.search-box span { color: var(--muted); font-size: 24px; }
.search-box input { width: 100%; height: 52px; border: 0; outline: 0; background: transparent; }
.member-list { display: grid; gap: 11px; }
.member-card { display: grid; grid-template-columns: 46px 1fr 16px; gap: 13px; align-items: center; padding: 16px; text-align: left; box-shadow: none; }
.member-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: var(--brand-dark); background: var(--brand-soft); font-weight: 850; }
.member-card strong, .member-card small, .member-card em { display: block; }
.member-card small { margin: 4px 0 9px; color: var(--muted); font-size: 12px; }
.member-card em { color: var(--brand); font-size: 12px; font-style: normal; font-weight: 700; }
.empty-state { padding: 50px 0; color: var(--muted); text-align: center; }
.settings-list { overflow: hidden; box-shadow: none; }
.settings-list button { display: flex; justify-content: space-between; width: 100%; padding: 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.settings-list button:last-child { border-bottom: 0; }
.prototype-note { margin: 18px 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; min-height: 74px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,249,.96); backdrop-filter: blur(18px); }
.bottom-nav button { display: grid; gap: 4px; justify-items: center; padding: 5px 0; color: #8a908b; border: 0; background: transparent; font-size: 10px; }
.bottom-nav button > span { font-size: 20px; line-height: 1; }
.bottom-nav .is-active { color: var(--brand-dark); font-weight: 800; }
.bottom-nav .create-button { position: relative; top: -18px; color: var(--brand-dark); font-weight: 800; }
.bottom-nav .create-button > span { display: grid; place-items: center; width: 54px; height: 54px; color: white; border: 5px solid var(--bg); border-radius: 50%; background: var(--brand); box-shadow: 0 8px 22px rgba(104,67,40,.24); font-size: 28px; font-weight: 400; }
.desktop-settings-nav { display: none; }
.field.therapist-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.therapist-actions button { padding: 9px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: transparent; font-size: 13px; }
.inline-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.inline-add textarea { width: 100%; min-width: 0; padding: 12px 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 13px; outline: none; background: #fff; font: inherit; resize: vertical; }
.inline-add textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.inline-add .primary-small { min-height: 48px; }
.service-row { display: grid; gap: 10px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.service-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; }
.service-flags { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.service-flags button { height: 40px; padding: 0 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: transparent; font-size: 13px; }
.addon-choices { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.addon-choices[hidden] { display: none; }
.addon-title { margin: 8px 0 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.admin-addons { margin: 0; padding: 0; border: 0; }
.admin-addons > div { display: grid; gap: 8px; margin-top: 8px; }
.member-suggest { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: -4px; }
.member-suggest button { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: var(--brand-soft); text-align: left; }
.member-suggest small { color: var(--muted); }
.template-button.field { display: flex; align-items: center; justify-content: center; min-height: 46px; color: var(--muted); border: 1px solid var(--line); border-radius: 13px; background: transparent; font-size: 13px; font-weight: 700; }
.add-service.field { display: flex; align-items: center; justify-content: center; min-height: 46px; color: var(--brand-dark); border: 1px dashed var(--brand); border-radius: 13px; background: transparent; font-weight: 750; }

.backdrop { position: fixed; z-index: 40; inset: 0; background: rgba(62,40,26,.42); backdrop-filter: blur(2px); }
.bottom-sheet { position: fixed; z-index: 50; right: 0; bottom: 0; left: 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--surface); box-shadow: 0 -16px 50px rgba(78,50,30,.17); animation: sheet-up .25s ease; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; }
.form-sheet { max-height: 90dvh; overflow-y: auto; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 18px; border-radius: 99px; background: #d7d5cf; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.sheet-header h2 { font-size: 25px; }
.sheet-header button { width: 34px; height: 34px; color: var(--muted); border: 0; border-radius: 50%; background: var(--surface-soft); font-size: 23px; }
.sheet-action { display: grid; grid-template-columns: 46px 1fr; gap: 13px; align-items: center; width: 100%; margin-top: 9px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: transparent; text-align: left; }
.sheet-action > span:first-child { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--surface-soft); font-weight: 800; }
.sheet-action strong, .sheet-action small { display: block; }
.sheet-action small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.sheet-action.primary-action { color: white; border-color: var(--brand); background: var(--brand); }
.sheet-action.primary-action small { color: rgba(255,255,255,.72); }
.sheet-action.primary-action > span:first-child { background: rgba(255,255,255,.16); }
.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 90px 1fr; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.detail-actions button { min-height: 48px; border: 1px solid var(--line); border-radius: 14px; background: transparent; font-weight: 800; }
.detail-actions .primary-small { color: white; border: 0; background: var(--brand); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.field.full { grid-column: 1 / -1; }
.field input, .field select { width: 100%; min-width: 0; height: 48px; padding: 0 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 13px; outline: none; background: #fff; }
.field input:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.skill-options { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.skill-options legend { padding: 0 6px; color: var(--muted); font-weight: 750; }
.check-field { display: flex; align-items: center; gap: 10px; min-height: 42px; color: var(--ink); font-size: 14px; }
.check-field input { width: 20px; height: 20px; accent-color: var(--brand); }
.branch-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.branch-row-head button { padding: 9px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: transparent; font-size: 13px; }
.branch-row .service-nums { grid-template-columns: 1fr 1fr; }
.branch-more { display: grid; gap: 10px; }
.branch-weekdays { display: flex; flex-wrap: wrap; gap: 0 16px; }
.branch-weekdays legend { width: 100%; }
.branch-row textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.branch-more[open] > summary { margin-bottom: 10px; }
.branch-more > summary { color: var(--brand-dark); font-size: 14px; font-weight: 700; cursor: pointer; }
.form-help { margin: 16px 2px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.submit-button { width: 100%; min-height: 50px; color: #fff; border: 0; border-radius: 15px; background: var(--brand); font-weight: 800; }
.booking-row.local-entry .booking-card { border-color: var(--sand); }
.booking-row.remote-entry .booking-card { border-color: var(--brand); box-shadow: 0 7px 22px rgba(104,67,40,.12); }
.member-card.local-entry { border-color: var(--sand); }
.toast { position: fixed; z-index: 60; right: 20px; bottom: 100px; left: 20px; padding: 13px 16px; color: white; border-radius: 14px; background: var(--brand-dark); text-align: center; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: none; }
.user-list { display: grid; gap: 8px; margin-bottom: 22px; }
.user-row { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 14px; }
.user-row small { display: block; margin-top: 3px; color: var(--muted); }
.user-row button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 12px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-row select { padding: 7px 8px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px; }
.user-row button.danger { color: #a33a2a; border-color: #e3b9b0; }
.password-field { position: relative; display: block; }
.field .password-field input { padding-right: 76px; }
.password-toggle { position: absolute; top: 50%; right: 7px; height: 34px; padding: 0 12px; transform: translateY(-50%); color: var(--brand-dark); border: 0; border-radius: 9px; background: var(--brand-soft); font-size: 12px; font-weight: 750; }

/* Desktop administration layout: persistent sidebar, wider work area and centered dialogs. */
@media (min-width: 900px) {
  html, body { min-height: 100%; background: var(--bg); }
  .app-shell { min-height: 100vh; padding-left: 240px; }
  .topbar { top: 0; padding: 22px 36px 18px; }
  main { width: min(100%, 1260px); margin: 0 auto; padding: 0 40px 60px; }
  .greeting { padding-top: 42px; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric.wide { grid-column: auto; min-height: 126px; }
  .task-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-card { grid-template-columns: 42px 1fr; min-height: 86px; }
  .task-card .chevron { display: none; }
  .page-title { padding-top: 40px; }
  .timeline { max-width: 860px; }
  .member-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-list { max-width: 820px; }

  .bottom-nav {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    display: flex;
    width: 240px;
    min-height: 100vh;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding: 104px 18px 24px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: #fffaf4;
  }
  .bottom-nav button {
    display: grid;
    grid-template-columns: 32px 1fr;
    align-items: center;
    justify-items: start;
    gap: 12px;
    min-height: 50px;
    padding: 0 14px;
    border-radius: 14px;
    font-size: 14px;
    text-align: left;
  }
  .bottom-nav button > span { font-size: 20px; }
  .bottom-nav .is-active { background: var(--brand-soft); }
  .bottom-nav .create-button {
    position: static;
    order: -1;
    grid-template-columns: 40px 1fr;
    margin-bottom: 14px;
    color: white;
    background: var(--brand);
  }
  .bottom-nav .create-button > span {
    width: 40px;
    height: 40px;
    color: white;
    border: 0;
    background: rgba(255,255,255,.14);
    box-shadow: none;
    font-size: 24px;
  }
  .bottom-nav .more-nav { display: none; }
  .desktop-settings-nav { display: grid; gap: 3px; margin: 14px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
  .desktop-settings-title { margin: 0 0 4px; padding: 0 14px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
  .desktop-settings-nav button { display: block; min-height: 40px; padding: 0 14px; color: var(--muted); font-size: 13px; }
  .desktop-settings-nav button.is-active { color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }

  .bottom-sheet {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(620px, calc(100vw - 64px));
    max-height: 85vh;
    overflow-y: auto;
    padding: 22px 28px 28px;
    border-radius: 28px;
    transform: translate(-50%, -50%);
    animation: none;
  }
  .sheet-handle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
input[type="date"], input[type="time"] { text-align: left; line-height: 46px; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { margin: 0; text-align: left; }
.service-row.is-addon [data-buffer-field] { display: none; }
.service-row.is-addon .service-nums { grid-template-columns: 1fr 1fr; }
.flag-checkbox { display: none; }
.service-flags { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.flag-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.service-flags button { height: 40px; padding: 0 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: transparent; font-size: 13px; }
.addon-usage { color: var(--muted); font-size: 12px; font-weight: 750; }
.addon-usage[hidden] { display: none; }
details.addon-choices { display: block; padding: 10px 0 0; border-top: 1px dashed var(--line); }
details.addon-choices[hidden] { display: none; }
details.addon-choices summary { color: var(--brand-dark); font-size: 13px; font-weight: 800; cursor: pointer; }
details.addon-choices[open] summary { margin-bottom: 10px; }
details.addon-choices .check-field { margin-top: 8px; }
.service-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: var(--brand-soft); }
.service-tabs button { min-height: 42px; color: var(--muted); border: 0; border-radius: 11px; background: transparent; font-size: 14px; font-weight: 800; }
.service-tabs button.is-active { color: var(--brand-dark); background: #fff; box-shadow: 0 2px 8px rgba(78, 50, 30, .12); }
#service-rows[data-tab="main"] .service-row.is-addon { display: none; }
#service-rows[data-tab="addon"] .service-row:not(.is-addon) { display: none; }
.empty-tab { margin: 0; padding: 18px; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; text-align: center; font-size: 13px; }

.assign-box { display: grid; gap: 10px; margin: 14px 0 4px; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.03); }
.assign-title { margin: 0; font-size: 14px; font-weight: 800; }
.assign-box .primary-small { justify-self: end; }
.ghost-small { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: inherit; font-weight: 750; }
.ghost-small.danger { color: #a33a2a; border-color: #e3b9b0; }
.confirm-row { display: flex; align-items: center; gap: 10px; }
.confirm-row .confirm-name { flex: 1; font-weight: 800; }
.confirm-row .primary-small { min-height: 36px; padding: 0 12px; justify-self: auto; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

.reschedule-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.owner-actions { display: flex; justify-content: space-between; gap: 10px; }
.owner-actions .danger { color: #a33a2a; border-color: #e3b9b0; }
.line-bind input[readonly] { width: 100%; margin: 8px 0; font-size: 13px; }

/* ---- 功能模組：日曆、排班、數據、對帳 ---- */
.back-link { margin: 0 0 8px; padding: 6px 2px; color: var(--brand-dark); font-weight: 700; background: none; border: 0; }
@media (min-width: 900px) { .back-link { display: none; } }
.feature-toolbar, .stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; }
.feature-toolbar button, .stats-toolbar button { min-height: 38px; min-width: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.feature-toolbar input { flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.feature-card { padding: 14px; margin: 12px 0; }
.feature-card h3 { margin: 0 0 8px; font-size: 15px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.chip-row .chip { flex: none; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 6px 0; }
.segmented button { padding: 8px 14px; background: var(--surface); border: 0; color: var(--muted); font-weight: 700; }
.segmented button.is-selected { background: var(--brand-dark); color: #fff; }
.segmented.small button { padding: 6px 12px; }
.request-row, .week-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.request-row small, .week-row small, .request-row span small { display: block; color: var(--muted); font-size: 12px; }
.request-row button, .week-row button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.request-actions { display: flex; gap: 6px; }
.request-row.is-stale > span:first-child { opacity: .6; }
.request-row.is-editing { background: var(--surface-2, rgba(0,0,0,.03)); }
.request-row button:disabled { opacity: .4; cursor: not-allowed; }
.amounts { text-align: right; }
.week-editor, .special-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; margin: 4px 0 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.03); }
.week-editor .range-row { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-inputs { display: flex; gap: 6px; }
.range-inputs input { min-width: 0; flex: 1; }
.range-inputs { flex-wrap: wrap; }
.range-inputs .shift-branch { flex: 1 0 100%; min-width: 0; }
.week-editor .primary-small, .special-form .primary-small { grid-column: 1 / -1; justify-self: end; }
.special-form .field.full { grid-column: 1 / -1; }
.calendar-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cal { min-width: calc(48px + var(--cols) * 104px); }
.cal-head { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(104px, 1fr)); position: sticky; top: 0; background: var(--surface-soft); border-bottom: 1px solid var(--line); z-index: 3; }
.cal-head span { padding: 8px 4px; text-align: center; font-weight: 800; font-size: 13px; border-left: 1px solid var(--line); }
.cal-head span:first-child { border-left: 0; }
.cal-body { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(104px, 1fr)); }
.cal-times { position: relative; }
.cal-times span { position: absolute; left: 4px; transform: translateY(-7px); font-size: 11px; color: var(--muted); }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 59px, var(--line) 59px, var(--line) 60px); }
.cal-off { position: absolute; left: 0; right: 0; background: rgba(120, 110, 100, 0.16); pointer-events: none; }
.cal-block { position: absolute; left: 2px; right: 2px; padding: 3px 5px; font-style: normal; font-size: 11px; color: #555; border-radius: 6px; background-image: repeating-linear-gradient(135deg, rgba(120,110,100,.22) 0 6px, rgba(120,110,100,.1) 6px 12px); overflow: hidden; }
.cal-block.teaching { background-image: none; background: rgba(110, 140, 220, 0.3); color: #2b3f78; }
.cal-block b { display: block; }
.cal-booking { position: absolute; left: 3px; right: 3px; padding: 3px 5px; text-align: left; border: 0; border-radius: 8px; background: var(--brand); color: #fff; font-size: 11px; overflow: hidden; z-index: 2; }
.cal-booking b, .cal-booking small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-booking.pending { background: #f1c48f; color: #5b3a12; }
.cal-booking.no_show { background: #bdb3a8; }
.donut { position: relative; width: 220px; height: 220px; margin: 12px auto; }
.donut svg { width: 100%; height: 100%; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center small { color: var(--muted); }
.donut-center strong { font-size: 22px; }
.legend { display: grid; gap: 8px; margin: 8px 0 12px; }
.legend-item { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; font-size: 14px; }
.legend-item .dot { width: 12px; height: 12px; border-radius: 50%; }
.legend-item small { color: var(--muted); }
.teacher-detail summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none; }
.teacher-detail summary small { display: block; color: var(--muted); font-size: 12px; }
.teacher-detail .detail-body { padding-bottom: 6px; }
.day-card .day-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.day-card .day-top small { color: var(--muted); }
.day-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.diff { display: inline-block; margin-top: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.diff.ok { background: #dff0e0; color: #2f6b3a; }
.diff.bad { background: #f6dcd6; color: #a34f3f; }
.diff.pending { background: var(--surface-soft); color: var(--muted); }
.commission-row { display: grid; grid-template-columns: 1fr 130px 80px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.commission-row:first-child { border-top: 0; }
.module-row { display: flex; gap: 12px; align-items: flex-start; grid-column: 1 / -1; padding: 10px 0; border-bottom: 1px solid var(--line); }
.module-row span { display: grid; gap: 2px; }
.module-row small { color: var(--muted); }
.empty-state { color: var(--muted); text-align: center; padding: 18px 8px; }

/* 電腦版左側選單：內容超過視窗高度時可以捲動，並縮小間距 */
@media (min-width: 900px) {
  .bottom-nav { height: 100vh; min-height: 0; overflow-y: auto; overscroll-behavior: contain; gap: 4px; padding-top: 96px; scrollbar-width: thin; }
  .bottom-nav button { min-height: 46px; }
  .bottom-nav .create-button { margin-bottom: 8px; }
  .desktop-settings-nav { margin-top: 8px; padding-top: 10px; }
  .desktop-settings-nav button { min-height: 36px; }
}

/* 包堂與結帳 */
.checkout-box { gap: 12px; }
.co-done { margin: 0; color: var(--ink); font-size: 14px; }
.co-amounts { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.6); font-size: 14px; }
.co-amounts div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.co-amounts dt { color: var(--muted); }
.co-amounts dd { margin: 0; font-weight: 700; text-align: right; }
.co-amounts .total { padding-top: 6px; border-top: 1px solid var(--line); }
.co-amounts .total dd { font-size: 16px; }
.co-modes { display: grid; gap: 4px; }
.co-due { display: flex; justify-content: space-between; align-items: baseline; margin: 0; padding: 12px 14px; color: var(--brand-dark); border-radius: 12px; background: var(--brand-soft); font-weight: 750; }
.co-due strong { font-size: 20px; }
.co-pays { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.checkout-box .form-help { margin: 0; }
.checkout-box button.danger, .pkg-actions button.danger { color: #a33a2a; border-color: #e3b9b0; }
.checkout-box > button.danger { justify-self: start; min-height: 40px; padding: 0 14px; border: 1px solid #e3b9b0; border-radius: 12px; background: var(--surface); }
.pkg-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0; }
.pkg-card .day-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pkg-card .day-top small { color: var(--muted); }
.pkg-line { margin: 6px 0; font-size: 14px; }
.pkg-card > small { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; }
.pkg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pkg-actions button { min-height: 36px; padding: 0 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pkg-log { margin-top: 10px; font-size: 12px; color: var(--muted); }
.pkg-log p { margin: 6px 0 0; line-height: 1.5; }
.pkg-results { display: grid; gap: 6px; }
.pkg-results button { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pkg-results small { color: var(--muted); }
#package-form { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
#package-form .assign-title { margin: 14px 0 10px; }
.method-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.method-row input[data-method-name] { flex: 1; min-width: 0; height: 44px; padding: 0 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pay-table { overflow-x: auto; }
.pay-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pay-table th, .pay-table td { padding: 8px 6px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.pay-table th:first-child, .pay-table td:first-child { text-align: left; }
.pay-table th { color: var(--muted); font-weight: 700; border-top: 0; }
.pay-table tr.total td { font-weight: 800; }
.pkg-holders { margin-top: 10px; }
.pkg-holders summary { cursor: pointer; color: var(--brand-dark); font-weight: 700; font-size: 13px; }

/* 每日進帳月曆 */
.inc-week, .inc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.inc-week span { padding: 4px 0; color: var(--muted); font-size: 12px; text-align: center; }
.inc-cell { display: grid; align-content: center; justify-items: center; gap: 2px; min-height: 52px; padding: 4px 0; color: var(--ink); border: 1px solid transparent; border-radius: 10px; background: transparent; }
.inc-cell.empty { visibility: hidden; }
.inc-cell b { font-size: 13px; font-weight: 700; }
.inc-cell small { min-height: 13px; color: var(--brand-dark); font-size: 11px; font-weight: 750; }
.inc-cell.has { background: var(--brand-soft); }
.inc-cell.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.inc-detail { margin-top: 12px; font-size: 14px; }
.inc-detail:empty { display: none; }
.inc-detail p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* 首頁預約月曆 */
.home-cal { padding: 14px; }
.hc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hc-head strong { font-size: 16px; }
.hc-head button { min-height: 38px; min-width: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.hc-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.hc-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #7b9170; }
.hc-dot.st-near { background: #c49a62; } .hc-dot.st-full { background: #9a4f58; } .hc-dot.st-closed { background: #b9a9a9; }
.hc-cell.st-near .hc-dot { background: #c49a62; } .hc-cell.st-full .hc-dot { background: #9a4f58; }
.hc-week, .hc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hc-week span { padding: 4px 0; color: var(--muted); font-size: 12px; text-align: center; }
.hc-cell { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; min-height: 56px; padding: 6px 6px 5px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: #fffaf4; text-align: left; }
.hc-cell.empty { visibility: hidden; border: 0; }
.hc-cell b { font-size: 13px; }
.hc-cell em { position: absolute; top: 5px; right: 4px; padding: 1px 5px; color: #fff; border-radius: 99px; background: #b39aa0; font-size: 10px; font-style: normal; font-weight: 700; }
.hc-cell.st-closed { background: #ede6e4; color: var(--muted); }
.hc-cell.is-past b { color: var(--muted); }
.hc-cell.is-today { border-color: #9a4f58; }
.hc-cell.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.hc-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 12px; }
.hc-foot i:empty:not(.hc-dot) { width: 9px; }
.hc-foot small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 700; }
.hc-detail { margin-top: 14px; }
.hc-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hc-detail-top button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.hc-item { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px 0; color: var(--ink); border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.hc-item time { color: var(--muted); font-weight: 700; }
.hc-item span strong, .hc-item small { display: block; }
.hc-item small { color: var(--muted); font-size: 12px; }
.hc-detail-top strong { font-size: 14px; line-height: 1.4; }
.hc-detail-top button { flex: none; white-space: nowrap; }

/* 首頁月曆：老師班表 */
.hc-toggle { margin: 0 0 10px; }
.hc-off { position: absolute; top: 5px; right: 4px; padding: 1px 5px; color: #7a5560; border-radius: 99px; background: #ead9db; font-size: 10px; font-style: normal; font-weight: 700; }
.hc-pill { padding: 1px 6px; color: #7a5560; border-radius: 99px; background: #ead9db; font-size: 10px; font-style: normal; font-weight: 700; }
.hc-un { color: #c0662b; font-size: 13px; font-weight: 900; line-height: 1; }
.hc-foot .hc-un { margin-left: 4px; }
.hc-own { margin-top: 2px; color: var(--brand-dark); font-size: 11px; font-weight: 800; line-height: 1.2; }
.hc-own.off { color: #9a4f58; font-size: 13px; }
.hc-legend b { color: var(--ink); font-size: 12px; margin-right: 3px; }
.hc-matrix { overflow-x: auto; margin: 0 -4px; padding-bottom: 6px; }
.hc-matrix table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.hc-matrix th, .hc-matrix td { min-width: 34px; height: 34px; padding: 0; text-align: center; border-bottom: 1px solid var(--line); }
.hc-matrix th.hc-name { position: sticky; left: 0; z-index: 1; min-width: 64px; padding: 0 8px; text-align: left; color: var(--ink); background: var(--surface); font-weight: 750; }
.hc-col { display: grid; width: 100%; min-height: 40px; padding: 2px 0; color: var(--ink); border: 0; border-radius: 8px; background: transparent; }
.hc-col small { color: var(--muted); font-size: 10px; }
.hc-col.is-today b { color: #9a4f58; }
.hc-col.is-selected { background: var(--brand-soft); }
.hc-matrix td.work { color: var(--brand-dark); font-weight: 800; }
.hc-matrix td.off { color: #fff; background: #b39aa0; font-weight: 800; }
.hc-matrix td.unset { color: var(--muted); }
.hc-matrix td.is-today:not(.off) { background: rgba(154, 79, 88, 0.07); }
.hc-matrix sup { color: #c0662b; font-size: 9px; }
.hc-matrix tr.hc-wait td { color: #c0662b; font-weight: 800; }
.hc-shifts { margin: 4px 0 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.03); }
.hc-shifts .assign-title { margin: 0 0 6px; }
.hc-shift-row { display: grid; grid-template-columns: 58px 1fr auto; align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.hc-shift-row:first-of-type { border-top: 0; }
.hc-shift-row.off strong, .hc-shift-row.off span { color: #9a4f58; }
.hc-shift-row.unset span { color: var(--muted); }
.hc-shift-row small { color: var(--muted); }
.hc-chip { margin-left: 6px; padding: 1px 7px; color: #c0662b; border-radius: 99px; background: #f6e4d5; font-size: 11px; font-style: normal; font-weight: 700; white-space: nowrap; }
.hc-warn-line { margin: 0 0 8px; color: #c0662b; font-size: 13px; font-weight: 700; }
.hc-detail-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.hc-detail-top { flex-wrap: wrap; }

/* 電腦版側邊欄整理：品牌、固定三組（主要／營運／設定）、統一樣式 */
.side-brand, .side-title, .lbl-long { display: none; }
.bottom-nav .side-only, .bottom-nav button.side-only { display: none; }
.bottom-nav .create-button em, .bottom-nav .lbl-short { font-style: normal; }
@media (min-width: 900px) {
  .bottom-nav { width: 232px; gap: 2px; padding: 24px 14px 28px; }
  .topbar > div:first-child { display: none; }
  .topbar { justify-content: flex-end; }
  .side-brand { display: grid; gap: 3px; padding: 2px 12px 20px; }
  .side-brand strong { font-size: 22px; letter-spacing: .04em; }
  .side-brand small { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
  .bottom-nav .create-button { order: 1; display: flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; margin: 0 0 20px; padding: 0 14px; border-radius: 12px; }
  .bottom-nav .create-button > span { display: inline; width: auto; height: auto; background: none; font-size: 18px; }
  .bottom-nav .lbl-short { display: none; }
  .bottom-nav .lbl-long { display: inline; }
  .side-title, .desktop-settings-title { display: block; margin: 0 0 4px; padding: 0 12px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
  .side-title { order: 2; }
  .bottom-nav > button:not(.create-button) { display: block; min-height: 40px; padding: 0 12px; color: var(--ink); border-radius: 10px; font-size: 14px; font-weight: 600; }

  .bottom-nav > [data-nav="home"] { order: 3; } .bottom-nav > [data-nav="bookings"] { order: 4; } .bottom-nav > .side-only { order: 5; display: flex; } .bottom-nav > [data-nav="members"] { order: 6; }
  .bottom-nav > .side-only[hidden] { display: none; }
  .bottom-nav > .more-nav { display: none; }
  .desktop-settings-nav { display: grid; gap: 2px; margin: 22px 0 0; padding: 0; border-top: 0; }
  .desktop-settings-nav[hidden], .bottom-nav [hidden] { display: none; }
  #side-ops { order: 7; } .side-group[data-manager-only] { order: 8; }
  .side-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; color: var(--ink); border-radius: 10px; font-size: 14px; font-weight: 600; text-align: left; }
  .desktop-settings-nav button { font-size: 14px; }
  .bottom-nav button:hover:not(.create-button):not(.is-off) { background: rgba(154, 106, 62, 0.08); }
  .bottom-nav .is-active, .bottom-nav .is-here { color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }
  .side-item.is-off { color: var(--muted); opacity: .55; cursor: default; }
  .side-item.is-off::after { content: "未開通"; padding: 1px 7px; color: var(--muted); border-radius: 99px; background: rgba(0, 0, 0, 0.07); font-size: 10px; font-weight: 700; }
}
@media (min-width: 900px) {
  .bottom-nav > button.more-nav { display: none; }
  .bottom-nav .side-item, .bottom-nav .desktop-settings-nav button.side-item { display: flex; min-height: 40px; padding: 0 12px; color: var(--ink); font-size: 14px; font-weight: 600; }
  .bottom-nav .side-item.is-off, .bottom-nav .desktop-settings-nav button.side-item.is-off { color: var(--muted); }
  .bottom-nav .side-item.is-here, .bottom-nav .desktop-settings-nav button.side-item.is-here { color: var(--brand-dark); font-weight: 800; }
  .bottom-nav .side-item[hidden] { display: none; }
}

/* 首頁月曆：手機點日期從下方滑出面板，電腦版固定在右側 */
.hc-layout { display: block; }
.hc-side { position: fixed; z-index: 60; right: 0; bottom: 0; left: 0; max-height: 78vh; overflow-y: auto; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: 0 -12px 40px rgba(62, 40, 26, 0.25); transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility .25s; margin: 0; }
.hc-side.is-open { transform: none; visibility: visible; }
.hc-backdrop { position: fixed; z-index: 55; inset: 0; background: rgba(62, 40, 26, 0.42); opacity: 0; pointer-events: none; transition: opacity .25s; }
.hc-backdrop.is-open { opacity: 1; pointer-events: auto; }
.hc-grab { width: 42px; height: 4px; margin: 0 auto 10px; border-radius: 99px; background: var(--line); }
.hc-close { flex: none; width: 36px; height: 36px; color: var(--ink); border: 0; border-radius: 50%; background: var(--brand-soft); font-size: 20px; line-height: 1; }
.hc-detail-buttons { justify-content: flex-start; margin-bottom: 10px; }
.hc-detail-buttons button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); white-space: nowrap; }
@media (min-width: 900px) {
  .hc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
  .hc-side { position: sticky; top: 90px; z-index: auto; max-height: calc(100vh - 120px); padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #fffaf4; box-shadow: none; transform: none; visibility: visible; transition: none; }
  .hc-backdrop, .hc-backdrop.is-open { display: none; }
  .hc-grab, .hc-close { display: none; }
  .hc-cell { min-height: 78px; }
}

.line-login-link { display: block; margin-top: 14px; text-align: center; font-weight: 700; color: inherit; text-decoration: underline; }
.line-login-link[hidden] { display: none; }

/* 登出：手機維持在頂端；電腦版移到左側欄底部（頂端列整個隱藏） */
.side-account { display: none; }
@media (min-width: 900px) {
  .topbar { display: none; }
  .bottom-nav { padding-bottom: 0; background: var(--surface); backdrop-filter: none; }
  .bottom-nav > .side-account { order: 99; position: sticky; z-index: 2; bottom: 0; display: grid; flex: none; gap: 8px; margin: auto -14px 0; padding: 14px 26px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -10px 12px -6px var(--surface); }
  .side-account span { color: var(--muted); font-size: 12px; font-weight: 750; }
  .bottom-nav .side-account .side-logout { display: block; min-height: 40px; padding: 0 12px; color: var(--ink); border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; text-align: left; }
  .bottom-nav .side-account .side-logout:hover { background: rgba(154, 106, 62, 0.08); }
}

/* ---- 圖示（SVG sprite）---- */
.ic { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; }
.bottom-nav button > span .ic { width: 22px; height: 22px; }
.bottom-nav .create-button > span .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.sheet-action > span:first-child .ic { width: 22px; height: 22px; }
.search-box span .ic { width: 20px; height: 20px; }
.sheet-header button { display: grid; place-items: center; padding: 0; }
.sheet-header button .ic { width: 18px; height: 18px; }
.metric span .ic { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }
.text-button span .ic { width: 14px; height: 14px; vertical-align: -2px; }
.settings-list button { align-items: center; gap: 12px; }
.settings-list button > span:first-of-type { flex: 1; }
.settings-list .ic-lead { width: 20px; height: 20px; color: var(--brand-dark); }
.settings-list .ic-chev { width: 16px; height: 16px; color: var(--muted); }

/* desktop sidebar item icons */
@media (min-width: 900px) {
  .bottom-nav .side-item, .bottom-nav .side-account .side-logout { display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
  .bottom-nav .side-item .ic, .bottom-nav .side-logout .ic { width: 18px; height: 18px; color: var(--brand-dark); opacity: .85; }
  .bottom-nav .side-item.is-off::after { margin-left: auto; }
}

.member-count { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }

/* 電腦版側邊欄：首頁、預約、會員補上圖示；項目順序由 --side-order 決定（可在後台自訂） */
@media (min-width: 900px) {
  .bottom-nav > button:not(.create-button):not(.more-nav):not(.side-edit):not(.side-item) { display: flex; align-items: center; gap: 10px; }
  .bottom-nav > button:not(.create-button):not(.more-nav):not(.side-edit):not(.side-item) > span { display: inline-flex; font-size: inherit; }
  .bottom-nav > button:not(.create-button):not(.more-nav):not(.side-edit):not(.side-item) > span .ic { width: 18px; height: 18px; color: var(--brand-dark); opacity: .85; }
  .bottom-nav > [data-side-key] { order: var(--side-order, 5); }
  #side-ops { order: 20; } .side-group[data-manager-only] { order: 30; }
  .side-group > [data-side-key] { order: var(--side-order, 0); }
  .side-edit { order: 40; display: block; margin: 14px 0 0; padding: 8px 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; background: transparent; font-size: 12px; font-weight: 700; text-align: left; }
  .side-edit[hidden] { display: none; }
  .side-edit:hover { color: var(--brand-dark); border-color: var(--brand); }
  .bottom-nav.is-sorting .side-item.is-off::after { display: none; }
  .side-move { margin-left: auto; display: inline-flex; gap: 4px; }
  .side-move i { display: grid; place-items: center; width: 26px; height: 26px; color: var(--brand-dark); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 10px; font-style: normal; cursor: pointer; }
  .side-move i:hover { background: var(--brand-soft); }
  .side-move i[data-disabled] { opacity: .25; cursor: default; pointer-events: none; }
}
@media (max-width: 899px) { .side-edit, .side-move { display: none; } }

/* 預約開放與店休設定頁 */
.settings-section { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.settings-section-title { color: var(--brand-dark); font-size: 14px; font-weight: 800; }
.weekday-row { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-row .flag-checkbox { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.closure-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.closure-row button { color: var(--brand-dark); border: 0; background: transparent; font-weight: 700; }
.closure-add { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.closure-add .full, .closure-add > button { grid-column: 1 / -1; }
.closure-add [hidden] { display: none; }

.settings-section input[type="checkbox"], .module-row input[type="checkbox"] { width: 20px; min-width: 20px; height: 20px; padding: 0; flex: none; }
.settings-section .module-row { align-items: center; }
.hc-closure { display: grid; gap: 8px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.hc-closure .closure-add { margin-top: 0; }
.hc-closure .closure-add[hidden] { display: none; }

/* 「日曆」是直接放在側邊欄底下的項目，原本被「首頁／預約」的 display:block 規則蓋過，圖示與文字沒有間距 */
@media (min-width: 900px) {
  .bottom-nav > button.side-item.side-only:not([hidden]) { display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
}

.today-list { margin-top: 10px; padding: 4px 16px; }
.today-list .hc-item:first-child { border-top: 0; }
.today-money { color: var(--brand); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* 預約取消提醒：首頁跳出，按「知道了」才消失 */
.cancel-notice { margin-top: 10px; padding: 14px 16px; border-color: var(--alert); }
.cancel-notice strong { display: block; color: var(--alert); }
.cancel-notice ul { margin: 8px 0 12px; padding: 0; list-style: none; }
.cancel-notice li { padding: 6px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.cancel-notice li:first-child { border-top: 0; }
.cancel-notice li small { display: block; color: var(--muted); }
.cancel-notice button { padding: 8px 18px; color: #fff; border: 0; border-radius: 10px; background: var(--brand-dark); font: inherit; }

/* 預約問卷設定 */
.q-card { display: grid; gap: 12px; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.q-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.q-actions { display: flex; gap: 6px; flex: none; }
.q-actions button { min-width: 40px; min-height: 36px; padding: 0 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 700; }
.q-actions button:disabled { opacity: .35; }
.q-actions button[data-q-remove] { color: #b3392b; }
.q-card textarea, .q-card select { width: 100%; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; }
#questionnaire-sheet .primary-small { margin: 4px 0 14px; }

/* 暫不開放客人預約的療程 */
.service-hide { min-height: 40px; font-size: 13px; }
.service-row.is-hidden { border-style: dashed; }
.service-row.is-hidden [data-service-name] { color: var(--muted); }
.service-row.is-hidden .service-hide span { color: var(--brand-dark); font-weight: 750; }
.q-hide-box { display: grid; gap: 2px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.q-hide-box:empty { display: none; }
.q-hide-title { color: var(--muted); font-size: 12px; font-weight: 750; }
.q-hide-box .check-field { min-height: 34px; font-size: 13px; }

/* ---- 按鈕互動回饋：滑過變色、按下縮一下、鍵盤選取有框線（只動外觀，不影響資料與功能）---- */
button:not(:disabled), .check-field, summary { cursor: pointer; }
button:not(:disabled) { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:not(:disabled):active:not(.hc-cell):not(.empty) { transform: scale(.98); }
@media (hover: hover) {
  /* 外框按鈕（次要動作） */
  .ghost-small:hover, .logout-button:hover, .hc-head button:hover, .hc-detail-buttons button:hover, .hc-detail-top button:hover,
  .pkg-actions button:hover, .pkg-results button:hover, .feature-toolbar button:hover, .stats-toolbar button:hover,
  .request-row button:not(:disabled):hover, .week-row button:hover, .service-flags button:hover, .therapist-actions button:hover,
  .detail-actions button:not(.primary-small):hover, .q-actions button:not(:disabled):hover, .member-suggest button:hover,
  .template-button:hover, .user-row button:hover, .inline-add button:not(.primary-small):hover {
    color: var(--brand-dark); border-color: var(--sand); background: #f4e7d7;
  }
  /* 危險動作：滑過變淡紅 */
  .ghost-small.danger:hover, .checkout-box button.danger:hover, .pkg-actions button.danger:hover, .q-actions button[data-q-remove]:not(:disabled):hover {
    color: #8f2f21; border-color: #d9a498; background: var(--alert-soft);
  }
  /* 切換鈕與分頁（沒選到的才變色，選到的維持原樣） */
  .segmented button:not(.is-selected):hover { color: var(--brand-dark); background: #f4e7d7; }
  .chip:not(.is-selected):hover { color: var(--brand-dark); border-color: var(--sand); background: rgba(154, 106, 62, 0.08); }
  .service-tabs button:not(.is-active):hover { color: var(--brand-dark); background: rgba(255, 255, 255, .6); }
  .date-strip button:not(.is-selected):hover { color: var(--brand-dark); background: rgba(154, 106, 62, 0.1); }
  /* 主要按鈕：滑過變深 */
  .primary-small:not(:disabled):hover, .submit-button:not(:disabled):hover, .bottom-nav .create-button:hover { background: var(--brand-dark); }
  .sheet-action:not(.primary-action):hover { border-color: var(--sand); background: #f4e7d7; }
  .sheet-action.primary-action:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
  /* 可點的卡片與列 */
  .booking-card:hover, .member-card:hover { border-color: var(--sand); box-shadow: 0 8px 22px rgba(104, 67, 40, .14); }
  .settings-list button:hover { background: rgba(154, 106, 62, 0.08); }
  .hc-cell:not(.empty):hover { border-color: var(--brand); filter: brightness(.96); }
  .closure-row button:hover { text-decoration: underline; }
  .sheet-header button:hover { color: var(--brand-dark); background: var(--brand-soft); }
}

/* ---- 班表週曆 ---- */
.wk-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.wk-top h3 { margin: 0; }
.wk-nav { display: flex; gap: 6px; }
.wk-nav button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; }
.wk-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.wk-scroll { overflow-x: auto; margin: 0 -2px; padding: 2px; }
.wk-grid { display: grid; grid-template-columns: 76px repeat(7, minmax(96px, 1fr)); gap: 4px; min-width: 760px; }
.wk-head { padding: 6px 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.wk-head small { display: block; font-weight: 500; }
.wk-head.is-today { color: var(--brand-dark); }
.wk-corner { text-align: left; }
.wk-name, .wk-corner { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.wk-name { display: flex; align-items: center; padding: 0 4px; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.wk-cell { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 66px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font: inherit; font-size: 12px; text-align: left; }
.wk-cell.is-today { border-color: var(--sand); }
.wk-cell.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.wk-cell.is-past { opacity: .5; cursor: default; }
.wk-shift { display: block; padding: 2px 6px; border-radius: 6px; background: #e4efe4; color: #2f5233; font-weight: 700; }
.wk-shift small { display: block; font-weight: 500; font-size: 11px; }
.wk-shift.br-1 { background: #e2e9f5; color: #2f4366; }
.wk-shift.br-2 { background: #f5e6d6; color: #6b4520; }
.wk-shift.br-3 { background: #eee2f2; color: #553063; }
.wk-legend .wk-shift { display: inline-block; font-size: 12px; }
.wk-off { display: block; padding: 2px 6px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-weight: 700; }
.wk-unset { color: var(--muted); font-size: 11px; line-height: 1.4; }
.wk-block { display: block; padding: 2px 6px; border-radius: 6px; background: var(--alert-soft); color: var(--alert); font-size: 11px; }
.wk-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.wk-tag { padding: 1px 5px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.wk-tag.is-count { border-color: var(--sand); color: var(--brand-dark); }
.wk-tag.is-pending { border-color: var(--alert); background: var(--alert-soft); color: var(--alert); font-weight: 700; }
.wk-list { display: grid; gap: 6px; }
.wk-list .wk-cell { min-height: 0; padding: 10px 12px; font-size: 13px; }
.wk-date { font-size: 13px; }
.wk-editor { display: grid; gap: 10px; margin-top: 12px; padding: 14px; border: 1px solid var(--brand); border-radius: 14px; background: var(--surface); }
.wk-editor-head { display: grid; gap: 2px; }
.wk-editor-head small { color: var(--muted); }
.wk-editor .range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wk-editor .range-row .full { grid-column: 1 / -1; }
.wk-actions { display: flex; justify-content: flex-end; gap: 8px; }
.wk-actions button:not(.primary-small) { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); }
.wk-sub { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.schedule-advanced { margin: 12px 0; }
.schedule-advanced > summary { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700; }
@media (max-width: 520px) { .wk-editor .range-row { grid-template-columns: 1fr; } }
