/* 版面概念：像工單一樣清楚的卡片堆疊，手機優先；石油藍為主色，帶一點藍的中性灰 */
:root {
  --bg: #f1f4f5;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --ink: #142027;
  --muted: #5d6d76;
  --line: #d8e0e4;
  --accent: #0d5c75;
  --accent-ink: #ffffff;
  --accent-soft: #e0eef3;
  --ok: #1d7a46;   --ok-soft: #e1f3e8;
  --warn: #9a5b00; --warn-soft: #fbefd9;
  --bad: #b3261e;  --bad-soft: #fbe4e2;
  --line-green: #06c755;
  --radius: 12px;
  --font: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1519; --surface: #172127; --surface-2: #1c2830; --ink: #e5edf0; --muted: #98a9b2; --line: #2b3a43;
    --accent: #5bb6d3; --accent-ink: #062029; --accent-soft: #163543;
    --ok: #5fd08e; --ok-soft: #133a26; --warn: #f0b45a; --warn-soft: #3d2c10; --bad: #f2857d; --bad-soft: #43201d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.3; margin: 0; text-wrap: balance; }
h1 { font-size: 1.6rem; }
h2, .h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.h3 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; color: var(--accent); }
.lead { font-size: 1.05rem; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 56px; display: flex; flex-direction: column; gap: 18px; }
.wrap.narrow { max-width: 560px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; min-width: 0; }
.card > summary { cursor: pointer; font-weight: 700; }
details.card[open] > summary { margin-bottom: 14px; }

/* ---------- 按鈕 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.line { background: var(--line-green); color: #fff; }
.btn.block { width: 100%; }
.btn.lg { padding: 15px; font-size: 1.05rem; }
.btn.sm { padding: 6px 12px; font-size: 0.88rem; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.linkbtn { background: none; border: none; color: inherit; font: inherit; cursor: pointer; padding: 4px 8px; opacity: 0.85; }

/* ---------- 表單 ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 0.86rem; font-weight: 600; color: var(--muted); padding: 0; }
.field small { color: var(--muted); font-size: 0.8rem; }
input, select, textarea { font: inherit; color: inherit; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input .prefix { display: flex; align-items: center; padding: 0 10px; background: var(--line); border-radius: 9px 0 0 9px; color: var(--muted); font-family: var(--mono); font-size: 0.9rem; }
.prefix-input input { border-radius: 0 9px 9px 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 120px; }
.inline-form .grow { flex: 3 1 220px; }
.weekdays { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.flash { padding: 10px 14px; border-radius: 10px; font-size: 0.92rem; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

/* ---------- 產品首頁 ---------- */
.hero { padding-block: 36px 12px; display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); letter-spacing: -0.01em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.features article { border-top: 3px solid var(--accent); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.features h2 { font-size: 1.05rem; }
.features p { color: var(--muted); font-size: 0.93rem; }
.pricing { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.price .num { font-size: 2rem; font-weight: 800; }

/* ---------- 客人預約頁 ---------- */
.shop-head { display: flex; flex-direction: column; gap: 6px; padding-block: 8px; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.8rem; margin-right: 8px; vertical-align: 2px; }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice input { margin-top: 5px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-body { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; flex: 1; min-width: 0; }
.choice-title { font-weight: 700; }
.choice-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.choice-meta { grid-column: 1 / -1; color: var(--muted); font-size: 0.86rem; }
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.date-chip { position: relative; flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; padding: 8px 0; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.date-chip input { position: absolute; opacity: 0; pointer-events: none; }
.date-chip .dow, .date-chip .mm { font-size: 0.75rem; color: var(--muted); }
.date-chip .dd { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.date-chip:has(input:checked) { background: var(--accent); border-color: var(--accent); }
.date-chip:has(input:checked) * { color: var(--accent-ink); }
.date-chip:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.date-chip.is-closed { opacity: 0.4; cursor: not-allowed; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.slot-grid .full { grid-column: 1 / -1; }
.slot { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot-time { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.slot-why { font-size: 0.75rem; color: var(--muted); }
.slot:has(input:checked) { background: var(--accent); border-color: var(--accent); }
.slot:has(input:checked) * { color: var(--accent-ink); }
.slot:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.slot.is-off { opacity: 0.45; cursor: not-allowed; }
.slot.is-off .slot-time { text-decoration: line-through; }
.ticket-card { border-style: dashed; border-width: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.powered { text-align: center; color: var(--muted); font-size: 0.78rem; padding-top: 12px; }

/* ---------- 後台 ---------- */
.topbar { background: var(--accent); color: var(--accent-ink); position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; min-height: 54px; }
.brand { color: inherit; text-decoration: none; font-weight: 800; display: flex; align-items: center; gap: 8px; min-width: 0; }
.mark { width: 12px; height: 12px; border-radius: 3px; background: var(--accent-ink); opacity: 0.85; flex: none; }
.mainnav { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; }
.mainnav a { color: inherit; text-decoration: none; padding: 15px 10px; opacity: 0.8; white-space: nowrap; border-bottom: 3px solid transparent; }
.mainnav a[aria-current="page"] { opacity: 1; font-weight: 700; border-bottom-color: var(--accent-ink); }
.logout, .who { margin-left: auto; }
.who { display: flex; align-items: center; gap: 4px; }
.who form { margin: 0; }
.who-name { color: inherit; text-decoration: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; padding: 4px 6px; border-radius: 6px; }
.who-name small { font-size: 0.72rem; opacity: 0.8; }
.who-name[aria-current="page"] { background: rgba(255, 255, 255, 0.15); }
@media (max-width: 640px) {
  .mainnav { order: 3; flex-basis: 100%; margin-inline: -6px; }
  .mainnav a { padding: 8px 8px 10px; }
}
.banner { padding: 10px 16px; text-align: center; font-size: 0.92rem; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--bad-soft); color: var(--bad); }
.banner a { color: inherit; font-weight: 700; }
.banner.demo { background: var(--accent-soft); color: var(--accent); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.search { display: flex; gap: 8px; flex: 1 1 260px; max-width: 420px; }

.day-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.day-title { min-width: 160px; }
.jump { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.jump input { width: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.stats .num { font-size: 1.6rem; font-weight: 800; }
.stats .lbl { color: var(--muted); font-size: 0.82rem; }
.pending-box { border-color: var(--warn); }
.plain { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }

.timeline { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tl-row { display: grid; grid-template-columns: 84px 1fr; border-top: 1px solid var(--line); min-width: 0; }
.tl-row:first-child { border-top: 0; }
.tl-time { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border-right: 1px solid var(--line); }
.tl-time .t { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.cap { font-size: 0.75rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; align-self: flex-start; font-variant-numeric: tabular-nums; }
.cap.free { background: var(--ok-soft); color: var(--ok); }
.cap.some { background: var(--warn-soft); color: var(--warn); }
.cap.full { background: var(--bad-soft); color: var(--bad); }
.tl-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tl-body .empty { padding-block: 4px; }
.cont { font-size: 0.85rem; color: var(--muted); background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; }

.bk { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); min-width: 0; }
.bk.pending { border-left-color: var(--warn); }
.bk.done { border-left-color: var(--ok); }
.bk.cancelled, .bk.no_show { border-left-color: var(--line); opacity: 0.75; }
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bk-svc { font-weight: 600; }
.bk-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; color: var(--muted); }
.bk-note { font-size: 0.9rem; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.bk-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bk-actions form { margin: 0; }
.move[open] { flex-basis: 100%; }
.move > summary { list-style: none; display: inline-flex; }
.move > summary::-webkit-details-marker { display: none; }
.move[open] > summary { margin-bottom: 8px; }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.s-pending { background: var(--warn-soft); color: var(--warn); }
.s-confirmed { background: var(--accent-soft); color: var(--accent); }
.s-done { background: var(--ok-soft); color: var(--ok); }
.s-cancelled, .s-no_show { background: var(--bad-soft); color: var(--bad); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
.table thead th { border-top: 0; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.table .num { text-align: right; }
.table .inline-form input, .table .inline-form select { flex: 0 1 auto; }

.reminder { display: flex; flex-direction: column; gap: 8px; }
.rm-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.msg { font-size: 0.9rem; background: var(--surface-2); }

.svc-list { display: flex; flex-direction: column; gap: 10px; }
.svc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.svc-row.is-off { opacity: 0.6; }
.svc-row .check { padding-bottom: 10px; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .choice, .date-chip, .slot { transition: background-color 0.15s, border-color 0.15s; }
}

/* ---------- 進銷存 ---------- */
.month-nav { display: flex; align-items: center; gap: 12px; }
.month-nav strong { font-size: 1.1rem; min-width: 8.5em; text-align: center; }
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.line:first-child { border-top: 0; }
.line select { flex: 2 1 180px; width: auto; }
.line-name { flex: 2 1 180px; display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.line-name small { font-weight: 400; }
.qty-input { flex: 1 1 110px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.qty-input input { text-align: right; font-variant-numeric: tabular-nums; }
.qty-input span { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }
.total-bar { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); }
.total-bar strong { font-size: 1.5rem; }
.pl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pl th { text-align: left; font-weight: 400; padding: 6px 0; }
.pl td { text-align: right; padding: 6px 0; }
.pl tr.sum th, .pl tr.sum td { font-weight: 700; border-top: 1px solid var(--line); }
.pl tr.sub th, .pl tr.sub td { color: var(--muted); }
.pl tr.total th, .pl tr.total td { font-size: 1.1rem; border-top: 2px solid var(--ink); }
.table-wrap.flat { border: 0; border-radius: 0; }
.is-void td { opacity: 0.5; text-decoration: line-through; }
.is-void td:last-child { text-decoration: none; }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }
.ok-text { color: var(--ok); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.paid { font-size: 0.86rem; font-weight: 700; color: var(--ok); }
.void-form { margin: 0; }

/* ---------- 員工 ---------- */
.temp-pw { font-size: 1.8rem; font-weight: 800; letter-spacing: 0.08em; background: var(--warn-soft); color: var(--warn); padding: 10px 16px; border-radius: 10px; align-self: flex-start; }
.perm-table td, .perm-table th { padding: 7px 10px; }
.perm-table .center { text-align: center; }

/* ---------- 套票／儲值 ---------- */
.wallets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wallet { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); min-width: 0; }
.wallet.pass { border-top: 4px solid var(--accent); }
.wallet.stored { border-top: 4px solid var(--ok); }
.wallet-name { font-weight: 700; }
.wallet-left strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.wallet form { margin: 4px 0 0; }
.wallet.is-void { opacity: 0.55; }
.sell-form select { flex: 2 1 200px; }
.plan-row { display: flex; flex-direction: column; gap: 10px; }
.plan-row.is-off { opacity: 0.6; }
.plan-row .full, .grid2 .full { grid-column: 1 / -1; }

/* ---------- 上手 ---------- */
.site-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; align-items: center; color: var(--muted); font-size: 0.82rem; padding-top: 24px; }
.site-foot a, .powered a { color: inherit; }
.help-link { color: inherit; text-decoration: none; padding: 6px 8px; border-radius: 6px; opacity: 0.9; }
.help-link[aria-current="page"] { background: rgba(255, 255, 255, 0.15); }
.checklist { display: flex; flex-direction: column; gap: 12px; border-color: var(--accent); }
.checklist form { margin: 0; }
.progress { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 0 8px; align-items: start; padding: 4px 0; }
.steps li small { grid-column: 2; font-size: 0.8rem; }
.steps .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; margin-top: 2px; }
.steps li.done { color: var(--muted); }
.steps li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.next .tick { border-color: var(--accent); }
.steps li.next a { font-weight: 700; }
.wizard h2 { font-size: 1.1rem; }
.narrow-field { max-width: 260px; }
.svc-quick { display: flex; flex-direction: column; gap: 8px; }
.svc-quick-head, .svc-quick-row { display: grid; grid-template-columns: 44px minmax(0, 2fr) minmax(80px, 1fr) minmax(100px, 1fr); gap: 8px; align-items: center; }
.svc-quick-head { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.svc-quick-row .check { justify-content: center; }
.choice-meta input { margin-top: 6px; }
.welcome-done h1 { font-size: 1.5rem; }
.big-link { font-size: 1rem; padding: 12px; }
.plain-ol { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }
.help { display: flex; flex-direction: column; gap: 20px; }
.help details.card { padding: 14px 16px; }
.help details p { margin-top: 10px; color: var(--muted); line-height: 1.7; }
.legal { display: flex; flex-direction: column; gap: 10px; line-height: 1.8; }
.legal h2 { font-size: 1.05rem; margin-top: 8px; }
.legal ul { margin: 0; padding-left: 1.2em; }
.banner.demo .btn { margin-left: 4px; }
@media (max-width: 520px) {
  .svc-quick-head { display: none; }
  .svc-quick-row { grid-template-columns: 32px 1fr 1fr; padding: 8px 0; border-top: 1px dashed var(--line); }
  .svc-quick-row .check { grid-row: 1 / 3; }
  .svc-quick-row > input[name^="name_"] { grid-column: 2 / 4; }
}

.narrow-card { max-width: 480px; }
