/* 髮廊預約：前臺／後台共用樣式。手機優先。 */

:root {
  --bg: #faf8f5;
  --card: #ffffff;
  --ink: #2f2a24;
  --ink-soft: #7d7367;
  --line: #e8e1d8;
  --accent: #b8845f;
  --accent-ink: #ffffff;
  --ok: #4a7c59;
  --ok-bg: #eef5f0;
  --warn: #b4762a;
  --warn-bg: #fdf4e6;
  --bad: #a94a42;
  --bad-bg: #fbeeed;
  --line-green: #06c755;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(47, 42, 36, .05), 0 6px 20px rgba(47, 42, 36, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC",
        "Microsoft JhengHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 64px; }
.wrap-wide { max-width: 1040px; }

/* ── 頁首 ────────────────────────────────────────── */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 248, 245, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header.top .inner {
  max-width: 560px; margin: 0 auto; padding: 13px 16px;
  display: flex; align-items: center; gap: 10px;
}
.wrap-wide + header.top .inner, header.top.wide .inner { max-width: 1040px; }
header.top h1 { font-size: 16px; font-weight: 600; margin: 0; flex: 1; letter-spacing: .02em; }
header.top .who { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
header.top .who img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* ── 區塊 ────────────────────────────────────────── */
section { margin-top: 26px; }
h2 { font-size: 13px; font-weight: 600; color: var(--ink-soft); letter-spacing: .08em; margin: 0 0 11px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 10px; }

/* ── 按鈕 ────────────────────────────────────────── */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 10px 16px;
  transition: background .12s, border-color .12s, opacity .12s;
  text-decoration: none; display: inline-block; text-align: center;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { border-color: var(--line); }

.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #a5734f; border-color: #a5734f; }
.btn-line { background: var(--line-green); color: #fff; border-color: var(--line-green); font-weight: 600; }
.btn-line:hover { background: #05b34c; border-color: #05b34c; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }

/* ── 表單 ────────────────────────────────────────── */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; }
input[type=text], input[type=tel], input[type=number], input[type=time], input[type=date], textarea, select {
  font: inherit; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(184, 132, 95, .35); outline-offset: 1px; }
textarea { resize: vertical; min-height: 64px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

/* ── 選項卡（服務／時段）─────────────────────────── */
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  text-align: left; padding: 14px 16px; margin-bottom: 8px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
}
.opt:hover { border-color: var(--accent); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: #fdf8f4; }
.opt .name { font-weight: 600; }
.opt .meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.opt .price { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 13.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-variant-numeric: tabular-nums; font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.datebar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.datebar::-webkit-scrollbar { height: 0; }
.dateitem {
  flex: 0 0 auto; width: 62px; padding: 9px 0; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); text-align: center; line-height: 1.35;
}
.dateitem .wd { font-size: 11px; color: var(--ink-soft); }
.dateitem .dd { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dateitem .n { font-size: 10.5px; color: var(--ok); }
.dateitem[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.dateitem[aria-pressed="true"] .wd, .dateitem[aria-pressed="true"] .n { color: rgba(255,255,255,.85); }
.dateitem:disabled { opacity: .35; }
.dateitem:disabled .n { color: var(--ink-soft); }

/* ── 狀態徽章 ────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.badge.confirmed { background: var(--ok-bg); color: var(--ok); }
.badge.pending   { background: var(--warn-bg); color: var(--warn); }
.badge.cancelled { background: #f1eeea; color: var(--ink-soft); }
.badge.done      { background: #eef1f5; color: #4a5c7c; }
.badge.noshow    { background: var(--bad-bg); color: var(--bad); }

/* ── 提示 ────────────────────────────────────────── */
.note { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.6; }
.note.info { background: #f2efe9; color: var(--ink-soft); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.bad  { background: var(--bad-bg); color: var(--bad); }
.note.ok   { background: var(--ok-bg); color: var(--ok); }

.empty { text-align: center; padding: 34px 16px; color: var(--ink-soft); font-size: 14px; }

/* ── 後台分頁 ────────────────────────────────────── */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; }
.tabs button {
  flex: 0 0 auto; border-radius: 999px; padding: 7px 15px; font-size: 13.5px;
  border-color: transparent; background: transparent; color: var(--ink-soft);
}
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

/* ── 後台週曆 ────────────────────────────────────── */
#wkLabel { white-space: nowrap; }
.calscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.cal { border-collapse: collapse; width: 100%; min-width: 640px; font-variant-numeric: tabular-nums; }
table.cal thead th:not(.timecol) { min-width: 84px; }
table.cal th, table.cal td { border: 1px solid var(--line); padding: 0; }
table.cal thead th {
  position: sticky; top: 0; z-index: 2; background: #f5f1ea;
  font-size: 12px; font-weight: 600; padding: 7px 4px; line-height: 1.4;
}
table.cal thead th .sub { display: block; font-size: 10.5px; color: var(--ink-soft); font-weight: 400; }
table.cal thead th .colbtns { display: flex; gap: 3px; justify-content: center; margin-top: 4px; }
table.cal thead th .colbtns button {
  padding: 1px 6px; font-size: 10.5px; border-radius: 6px; line-height: 1.5;
  white-space: nowrap;   /* 不加會在手機上被折成「全／開」兩行，把表頭撐高一倍 */
}
table.cal td.timecol, table.cal th.timecol {
  position: sticky; left: 0; z-index: 1; background: #f5f1ea;
  width: 54px; min-width: 54px; font-size: 11.5px; color: var(--ink-soft);
  text-align: center; padding: 0 4px;
}
table.cal thead th.timecol { z-index: 3; }
td.slot { height: 30px; cursor: pointer; background: #fbf9f6; }
td.slot:hover { background: #f0ece5; }
td.slot.open { background: var(--ok-bg); }
td.slot.open:hover { background: #e2eee7; }
td.slot.booked { background: #fdf1e3; cursor: default; font-size: 10.5px; color: #8a5a20; padding: 0 4px; overflow: hidden; white-space: nowrap; }
td.slot.past { background: #f4f2ef; cursor: not-allowed; opacity: .55; }
.callegend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
.callegend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); vertical-align: -2px; margin-right: 5px; }

/* ── 清單列 ──────────────────────────────────────── */
.item { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .avatar { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; background: #ece6dd; object-fit: cover; }
.item .body { flex: 1; min-width: 0; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.when { font-variant-numeric: tabular-nums; font-weight: 600; }

.spinner { text-align: center; padding: 40px; color: var(--ink-soft); font-size: 14px; }
.hidden { display: none !important; }
