/* 韓眉苑 — 視覺系統 v2（暖調 mocha / 奶油，霧眉美業質感） */
:root {
  --bg: #f6f2ec;
  --bg-tint: #efe7db;
  --card: #ffffff;
  --card-2: #fcfaf6;
  --ink: #3a332c;
  --ink-soft: #6b6156;
  --muted: #9c9287;
  --faint: #c6bbac;
  --line: #ebe2d6;
  --line-strong: #ddd1c1;
  --brand: #a06b4a;
  --brand-dark: #895a3d;
  --brand-deep: #6f462d;
  --brand-soft: #f2e8dd;
  --brand-tint: #f8f1e9;
  --rose: #b57d8a;
  --ok: #4e8a6b;
  --ok-bg: #e7f0ea;
  --warn: #bd7736;
  --warn-bg: #f7ead8;
  --bad: #bd5750;
  --bad-bg: #f7e6e3;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(58,51,44,.05);
  --shadow: 0 1px 2px rgba(58,51,44,.04), 0 6px 20px rgba(58,51,44,.06);
  --shadow-lg: 0 10px 40px rgba(58,51,44,.16);
  --sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  --serif: "Noto Serif TC", "Microsoft JhengHei", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 500; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-family: var(--serif); }
h3 { font-size: 17px; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.ti { line-height: 1; vertical-align: -.12em; }

/* 按鈕 */
button, .btn {
  font: inherit;
  font-family: var(--sans);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 8px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .05s;
}
button:hover { border-color: var(--brand); background: var(--brand-tint); }
button:active { transform: scale(.98); }
button.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: var(--shadow-sm);
}
button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
button.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--brand-tint); }

/* 表單 */
input, select, textarea {
  font: inherit;
  font-family: var(--sans);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: var(--card);
  color: var(--ink);
  max-width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
input:hover, select:hover, textarea:hover { border-color: var(--brand); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
select { cursor: pointer; }
label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 500; letter-spacing: .02em; }
.field { margin-bottom: 14px; }

/* 卡片 / 版面 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 { color: var(--brand-deep); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.grow { flex: 1; min-width: 150px; }

/* 表格 */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted); font-weight: 500; white-space: nowrap;
  background: var(--card-2); position: sticky; top: 0; z-index: 1;
  font-size: 12.5px; letter-spacing: .03em;
}
tbody tr { transition: background .1s; }
tr:hover td { background: var(--brand-tint); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; max-height: 70vh; overflow-y: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.tablewrap table th { border-top: none; }

/* 標籤 chip */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: var(--brand-soft); color: var(--brand-deep); white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.gray { background: var(--bg-tint); color: var(--ink-soft); }

/* 手機：排班頁「接下來的班表」每個班段 chip 上的刪除 ✕ 原本只有 10x19px，
   寬度 10px 手指根本點不準，偏偏它是刪班段（誤刪＝客人被放鳥）。
   把 chip 撐到 44px 高、✕ 給滿觸控範圍；視覺上仍是原本的小 ✕。 */
@media (max-width: 760px) {
  .chip { min-height: 44px; padding: 3px 6px 3px 12px; font-size: 12.5px; }
  .chip .sched-del {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; align-self: stretch; font-size: 15px;
  }
  .chip .ti-lock { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; }
}
.muted { color: var(--muted); font-size: 13px; }

/* 儀錶板數字卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 13px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-soft);
}
.stat .v { font-size: 27px; font-weight: 500; color: var(--brand-deep); font-family: var(--serif); letter-spacing: .01em; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* 時段 slot */
.slot {
  display: inline-flex; align-items: baseline; gap: 3px; margin: 3px;
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  cursor: pointer; font-size: 14px; background: var(--card); transition: all .12s;
}
.slot:hover { border-color: var(--brand); background: var(--brand-tint); transform: translateY(-1px); }
.slot small { color: var(--faint); font-size: 11px; }
.slot.full { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.slot.full:hover { transform: none; border-color: var(--line-strong); background: var(--card); }
.slot.residual { border-color: var(--brand); border-style: dashed; }
.slot.sel { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 手機／觸控：選時段是整個預約流程最關鍵的一次點擊，原本 40px 低於 44px 觸控標準，
   手指容易點歪或誤觸隔壁時段。桌面維持原本較密的排版。 */
@media (max-width: 760px), (pointer: coarse) {
  .slot {
    min-height: 46px; align-items: center; justify-content: center;
    padding: 12px 14px; font-size: 15px; margin: 4px 3px;
  }
}

/* 可點選 chip（排班日期 / 班段） */
.chipwrap { display: flex; gap: 9px; flex-wrap: wrap; }
.pchip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 10px 15px; border: 1.5px solid var(--line-strong); border-radius: 11px;
  cursor: pointer; user-select: none; background: var(--card); font-size: 14px;
  transition: all .12s;
}
.pchip small { color: var(--muted); font-size: 11px; }
.pchip:hover { border-color: var(--brand); background: var(--brand-tint); }
.pchip.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.pchip.on small { color: rgba(255,255,255,.82); }

/* 帳號設定：常駐分店排序清單 */
.acct-list { display: flex; flex-direction: column; gap: 8px; }
.acct-store {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card-2);
}
.acct-store .grow { flex: 1; font-weight: 500; color: var(--ink); }
.acct-pri {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
}
.acct-store .small { padding: 6px 9px; }
.acct-store .small:disabled { opacity: .3; cursor: default; }

/* 配人建議清單（§10.3） */
.sugg { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; margin-bottom: 6px; cursor: pointer; background: var(--card); }
.sugg:hover { border-color: var(--brand); background: var(--brand-tint); }
.sugg.on { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 2px var(--brand-soft); }
.sugg.cross { border-style: dashed; border-color: var(--bad); }
.sugg b { color: var(--ink); }

/* 進度條 */
.bar { height: 9px; background: var(--brand); border-radius: 99px; min-width: 3px; }
.bartrack { background: var(--bg-tint); border-radius: 99px; overflow: hidden; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(58,51,44,.42);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--card); border-radius: var(--radius-lg); padding: 22px;
  width: 480px; max-width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 { color: var(--brand-deep); }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 99px; z-index: 99;
  font-size: 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toastin .2s ease;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }

/* 導覽徽章 */
.navbadge:not(:empty) {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 5px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 500;
}

/* 月曆班表 */
.calgrid { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.calhead { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--card-2); border-bottom: 1px solid var(--line); }
.calhead > div { padding: 10px 4px; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.calbody { display: grid; grid-template-columns: repeat(7, 1fr); }
.calcell { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; overflow: hidden; }
.calcell:nth-child(7n) { border-right: none; }
.calcell.empty { background: var(--card-2); }
.calcell.today { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); }
.calcell.overbooked { box-shadow: inset 0 0 0 2px var(--bad); background: var(--bad-bg); }
.calcell.today.overbooked { box-shadow: inset 0 0 0 2px var(--bad); }
.caldate { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.caldate.sun { color: var(--bad); }
.caldate.sat { color: #5f7bb0; }
.calcount { background: var(--brand); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 6px; font-weight: 500; min-width: 16px; text-align: center; }
.calev {
  font-size: 11px; line-height: 1.4; padding: 3px 5px; margin-bottom: 3px;
  background: var(--card-2); border-left: 3px solid var(--brand); border-radius: 0 5px 5px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calhead .sun { color: var(--bad); }
.calhead .sat { color: #5f7bb0; }
.caldot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); display: inline-block; }

/* 點某天 → 當天明細 sheet */
.daysheet { margin: 8px 0; }
.dayrow { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dayrow:last-child { border-bottom: none; }
.dayrow:hover { background: var(--brand-tint); }
.dayrow-t { font-variant-numeric: tabular-nums; font-weight: 500; min-width: 46px; color: var(--brand-deep); }
.dayrow-c { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dayrow-b { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.dayrow-x { color: var(--faint); font-size: 18px; flex: none; }

/* 老師「行程」清單（agenda，§10.8） */
.viewtoggle { display: inline-flex; background: var(--card-2); border: 1px solid var(--line-strong); border-radius: 11px; padding: 3px; margin-bottom: 12px; gap: 2px; }
.viewtoggle button { border: none; background: transparent; padding: 7px 16px; border-radius: 8px; font-size: 14px; color: var(--ink-soft); box-shadow: none; }
.viewtoggle button.on { background: var(--brand); color: #fff; }
.viewtoggle button:hover:not(.on) { background: var(--brand-tint); }
.itin-greet { display: flex; align-items: center; gap: 12px; }
.itin-av { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 700; flex: none; }
.itin-hi { font-weight: 600; color: var(--ink); font-size: 16px; }
.itin-today { font-size: 13.5px; margin-top: 2px; }
.itin-day { padding-top: 12px; padding-bottom: 6px; }
.itin-day.itin-now { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.itin-date { font-weight: 600; color: var(--brand-deep); font-size: 15px; margin-bottom: 4px; }
.itin-day .dayrow:last-child { border-bottom: none; }
.dayrow .small.danger { flex: none; padding: 5px 9px; }

/* 手機：行程是老師最常用的畫面，整頁要滑很久。
   刪空班的 ✕ 原本只有 31x33px，就貼在「點可指派/改店」旁邊，手指容易點錯家。
   （真的按到有 confirm 擋，這裡是讓它不要一開始就點歪。） */
@media (max-width: 760px) {
  .dayrow { padding: 13px 4px; gap: 8px; }
  .dayrow .small.danger { min-width: 44px; min-height: 44px; padding: 0; font-size: 15px; }
}

/* 客人名冊列 */
.listitem { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.listitem:last-child { border-bottom: none; }
.listitem:hover { background: var(--brand-tint); }
.listitem .ci { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); display: flex; align-items: center; justify-content: center; font-weight: 500; flex: none; }
.listitem .grow { flex: 1; min-width: 0; }
.listitem .ttl { font-weight: 500; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.listitem .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.section-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin: 4px 0 8px; display: flex; align-items: center; gap: 6px; }

/* 底部分頁（手機） */
.bottomnav { display: none; }

/* 頭部 / 導覽 */
header.appbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow-sm); min-height: 58px;
}
.brandmark { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: .06em; color: var(--brand-deep); }
.brandmark .leaf {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}
nav.appnav { display: flex; gap: 3px; flex-wrap: wrap; }
nav.appnav button {
  border: none; background: none; padding: 8px 13px; border-radius: 9px; color: var(--ink-soft);
  font-size: 14px; box-shadow: none;
}
nav.appnav button .ti { font-size: 17px; color: var(--faint); transition: color .14s; }
nav.appnav button:hover { background: var(--brand-tint); }
nav.appnav button.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 500; }
nav.appnav button.active .ti { color: var(--brand); }
#userbox { margin-left: auto; display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }

main.appmain { max-width: 1200px; margin: 0 auto; padding: 20px 16px 70px; }

/* 手機 */
@media (max-width: 760px) {
  body { font-size: 14px; }
  header.appbar { padding: 0 12px; gap: 10px; }
  header.appbar nav.appnav { display: none; }        /* 手機改用底部分頁 */
  .brandmark { font-size: 17px; }
  #userbox { font-size: 12px; gap: 6px; }
  .stat .v { font-size: 22px; }
  .modal { padding: 16px; }
  .calcell { min-height: 56px; padding: 4px; cursor: pointer; }
  .calcell .calevs { display: none; }                /* 手機改「點日期看當天明細」 */
  .caldate { font-size: 13px; }
  main.appmain { padding: 14px 11px 86px; }           /* 留空間給底部分頁 */

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(58,51,44,.06);
  }
  .bottomnav button {
    flex: 1; flex-direction: column; gap: 2px; border: none; background: none; box-shadow: none;
    padding: 6px 2px; border-radius: 10px; color: var(--muted); font-size: 11px; position: relative;
  }
  .bottomnav button:hover { background: none; }
  .bottomnav button .ti { font-size: 23px; color: var(--faint); transition: color .14s; }
  .bottomnav button.active { color: var(--brand-deep); font-weight: 500; }
  .bottomnav button.active .ti { color: var(--brand); }
  .bottomnav .navbadge:not(:empty) { position: absolute; top: 2px; left: 56%; margin: 0; }
}
