/* ════════════════════════════════════════════════════════════
   髮藝沙龍 POS — 設計系統
   深色＋金色，Noto Serif TC 為主，行動裝置優先
   ════════════════════════════════════════════════════════════ */
:root {
  /* 主色 */
  --bg:           #0f0d0a;
  --bg-elev-1:    #1a1612;
  --bg-elev-2:    #221c16;
  --bg-elev-3:    #2c241c;
  --border:       #3b3127;
  --border-strong:#4d4030;

  /* 文字 */
  --text:         #f5ecdc;
  --text-2:       #b8a888;
  --text-3:       #806f55;

  /* 金色系 */
  --gold:         #d4a96a;
  --gold-bright:  #e6c98c;
  --gold-deep:    #a87f3f;
  --gold-glow:    rgba(212, 169, 106, 0.18);

  /* 狀態色 */
  --success:      #6b9e63;
  --warn:         #d49a4e;
  --danger:       #c66b5e;
  --info:         #6b8bc4;

  /* 排班色預設池（給設計師選） */
  --color-1: #d4a96a;
  --color-2: #b87f5e;
  --color-3: #8e9b7c;
  --color-4: #6b8bc4;
  --color-5: #c46b9e;
  --color-6: #e6c98c;

  --radius:       8px;
  --radius-lg:    14px;
  --shadow-1:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-2:     0 4px 12px rgba(0,0,0,0.5);
  --shadow-gold:  0 0 0 1px var(--gold-glow), 0 4px 16px var(--gold-glow);

  --font-serif: 'Noto Serif TC', serif;
  --font-sans:  'Noto Sans TC', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

a { color: var(--gold-bright); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; margin: 0; letter-spacing: 0.02em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-elev-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
::-webkit-scrollbar-track { background: var(--bg-elev-1); }

/* ── 啟動畫面 ─────────────────────────────────────────────── */
.boot-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: calc(100vh / var(--uiz, 1)); gap: 16px;
}
.boot-logo { font-family: var(--font-serif); font-size: 28px; color: var(--gold); letter-spacing: 0.1em; }
.boot-loading { color: var(--text-3); }

/* ── 登入頁 ───────────────────────────────────────────────── */
.login-page {
  min-height: calc(100vh / var(--uiz, 1));
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top, rgba(212,169,106,0.06), transparent 60%), var(--bg);
}
.login-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: min(380px, 92vw);
  box-shadow: var(--shadow-2);
}
.login-title {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.login-subtitle { text-align: center; color: var(--text-3); margin-bottom: 28px; font-size: 12px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }

/* ── App 框架 ─────────────────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh / var(--uiz, 1)); }
.sidebar {
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border);
  padding: 24px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: calc(100vh / var(--uiz, 1)); overflow-y: auto;
}
.sidebar-brand {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 0.1em;
  padding: 0 10px 22px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: 0.2em; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 18px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  user-select: none;
}
.nav-item:hover { background: var(--bg-elev-2); color: var(--text); }
.nav-item.active {
  background: var(--bg-elev-3);
  color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav-icon { width: 22px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── 內嵌 SVG 圖示 ── */
.icn { width: 1.05em; height: 1.05em; display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }
.icn.gold { color: var(--gold); }
.nav-icon .icn { width: 19px; height: 19px; }
/* 統計卡標籤前的小圖示（淡金色，與文字留點間距） */
.stat-label .icn { width: 14px; height: 14px; color: var(--gold); opacity: 0.85; margin-right: 6px; }
/* 卡片標題的圖示＋文字群組（避開 card-title 的 space-between） */
.ct-ico { display: inline-flex; align-items: center; gap: 8px; }
.ct-ico .icn { width: 16px; height: 16px; color: var(--gold); }

.sidebar-foot {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-elev-2);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 600;
  font-family: var(--font-serif);
}
.user-info { flex: 1; min-width: 0; }
.user-name { color: var(--text); font-size: 13px; font-weight: 500; }
.user-role { color: var(--text-3); font-size: 11px; }
.logout-btn {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
}
.logout-btn:hover { color: var(--danger); background: var(--bg-elev-3); }

/* ── 主內容 ───────────────────────────────────────────────── */
.main {
  padding: 28px 32px;
  max-width: 100%;
  overflow-x: hidden;
}
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 22px; }
.page-sub { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── 卡片 ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-pad-lg { padding: 28px; }
.card-title {
  font-family: var(--font-serif);
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* 指標分欄列（服務/產品營收、產品營收/利潤/分潤） */
.metric-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.metric-row:last-child { border-bottom: none; }
.metric-row .metric-period {
  font-size: 13px; color: var(--text-2);
  flex: 0 0 44px;
}
.metric-row .metric-items {
  display: flex; gap: 10px; flex: 1; flex-wrap: wrap;
}
.metric-item {
  flex: 1 1 76px; text-align: right; min-width: 76px;
  background: var(--bg-elev-2); border-radius: var(--radius);
  padding: 6px 10px;
}
.metric-item .mi-label { font-size: 11px; color: var(--text-3); display: block; margin-bottom: 2px; }
.metric-item .mi-val { font-size: 15px; font-weight: 600; color: var(--gold); }
.metric-item .mi-val.text-normal { color: var(--text); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ── 統計卡 ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card.accent { border-color: var(--gold-deep); box-shadow: var(--shadow-gold); }
.stat-card.danger { border-color: var(--danger); }
.stat-label {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.stat-value.text-normal { color: var(--text); }
.stat-detail { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ── 表格 ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-1);
  position: sticky; top: 0; z-index: 1;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tbody tr { cursor: pointer; transition: background 0.1s; }
.table tbody tr:hover { background: var(--bg-elev-2); }
.table tbody tr.no-hover { cursor: default; }
.table tbody tr.no-hover:hover { background: transparent; }

/* ── 表單 ─────────────────────────────────────────────────── */
.form-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.seg-row { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-row .btn { flex: 1; min-width: 56px; }
.form-label {
  font-size: 12px; color: var(--text-2);
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 4px;
}
.form-label .req { color: var(--danger); }
.input, .textarea, .select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  min-width: 0;          /* 允許在 grid/flex 中縮小，避免 date 等固有寬度欄位被擠出裁切 */
  box-sizing: border-box;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.textarea { resize: vertical; min-height: 80px; font-family: inherit; }
/* date/month 原生欄位不要用等寬字（CJK 在 mono 較寬，窄手機會把「年月日」擠出去） */
.input[type="date"], .input[type="month"] { font-family: inherit; }
.input.error, .textarea.error { border-color: var(--danger); }
.form-help { font-size: 11px; color: var(--text-3); }
.form-error { color: var(--danger); font-size: 12px; }

/* ── 按鈕 ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-elev-3); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: var(--bg);
  border-color: var(--gold-deep);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(198, 107, 94, 0.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 6px 8px; }

/* ── 標籤、徽章 ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elev-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-gold { background: var(--gold-glow); color: var(--gold-bright); border-color: var(--gold-deep); }
.badge-success { background: rgba(107, 158, 99, 0.15); color: var(--success); border-color: var(--success); }
.badge-warn { background: rgba(212, 154, 78, 0.15); color: var(--warn); border-color: var(--warn); }
.badge-danger { background: rgba(198, 107, 94, 0.15); color: var(--danger); border-color: var(--danger); }

.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* ── 模態 ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid; place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(560px, 92vw);
  max-height: calc(88vh / var(--uiz, 1));
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-2);
}
.modal-lg { width: min(820px, 95vw); }
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--font-serif); font-size: 18px; color: var(--gold); }
.modal-close { background: none; border: none; color: var(--text-3); font-size: 22px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Toast ────────────────────────────────────────────────── */
#toast-host {
  position: fixed; right: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  padding: 12px 18px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-2);
  animation: slideIn 0.2s;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }

/* ── 客人詳情：髮型紀錄時間軸 ──────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -22px; top: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg);
}
.timeline-date { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); }
.timeline-title { font-weight: 500; margin: 4px 0 4px; color: var(--gold-bright); }
.timeline-detail { color: var(--text-2); font-size: 13px; }

/* ── 篩選 chip ─────────────────────────────────────────────── */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 4px 12px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-2);
  user-select: none;
}
.chip.active { background: var(--gold-glow); border-color: var(--gold-deep); color: var(--gold-bright); }
.chip:hover:not(.active) { background: var(--bg-elev-2); }

/* ── 排班 ───────────────────────────────────────────────── */
.schedule-list { display: flex; flex-direction: column; gap: 10px; }
.schedule-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  align-items: start;
}
.schedule-item.done { border-left-color: var(--success); opacity: 0.85; }
.schedule-item.leave { border-left-color: var(--text-3); background: var(--bg); }
.schedule-time { font-size: 13px; color: var(--gold); padding-top: 2px; }
.schedule-body { min-width: 0; }
.schedule-customer { font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.schedule-services, .schedule-note { margin-top: 4px; }
.schedule-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.schedule-actions .btn { white-space: nowrap; }

/* ── 深色主題下的 date / time / month picker 圖示 ── */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(70%) sepia(40%) saturate(400%) hue-rotate(5deg);
  cursor: pointer;
  opacity: 0.9;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ── 月度區塊分區 ─────────────────────────────────── */
.month-section { padding: 14px; border: 1px dashed var(--border); border-radius: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--gold-bright);
}

/* ── 業績每日趨勢 ────────────────────────────────── */
.daily-bars { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.daily-bar-row {
  display: grid;
  grid-template-columns: 50px 1fr 100px 100px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.daily-bar-date { color: var(--text-3); font-family: var(--font-mono); }
.daily-bar-track {
  height: 14px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.daily-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}
.daily-bar-value { text-align: right; }
.daily-bar-commission { text-align: right; font-size: 12px; }

.text-right { text-align: right; }
.table th.text-right { text-align: right; } /* 標題靠右需覆蓋 .table th 預設的靠左，否則標題與數字錯位 */

/* ── 客人搜尋下拉 ─────────────────────────────────── */
.suggest-list {
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev-1);
}
.suggest-list:empty { display: none; }
.suggest-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--bg-elev-2); }
.picked-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 12px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-deep);
  border-radius: 6px;
}

/* ── 空狀態 ──────────────────────────────────────────────── */
.empty {
  text-align: center; padding: 48px 20px;
  color: var(--text-3);
}
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

/* ── 工具 class ──────────────────────────────────────────── */
.text-muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }

/* ── 收據 ───────────────────────────────────────────────── */
.receipt {
  background: #fff;
  color: #000;
  padding: 24px;
  font-family: var(--font-sans);
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid #ddd;
}
.receipt-head { text-align: center; margin-bottom: 16px; }
.receipt-store { font-family: var(--font-serif); font-size: 22px; font-weight: 700; }
.receipt-sub { font-size: 13px; color: #666; margin-top: 4px; }
.receipt-meta { font-size: 13px; line-height: 1.8; }
.receipt-hr { border: none; border-top: 1px dashed #999; margin: 12px 0; }
.receipt-section-title { font-weight: 600; margin-top: 12px; margin-bottom: 6px; font-size: 13px; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.receipt-table th, .receipt-table td { padding: 4px 6px; border-bottom: 1px dotted #ddd; }
.receipt-table th { text-align: left; font-weight: 500; color: #555; }
.receipt-table tr.receipt-subtotal th, .receipt-table tr.receipt-subtotal td { font-weight: 700; color: #000; border-bottom: 1px solid #000; }
.receipt-totals { width: 100%; margin-top: 12px; font-size: 14px; }
.receipt-totals td { padding: 4px 6px; }
.receipt-totals tr.receipt-grand td {
  font-size: 17px; font-weight: 700;
  border-top: 2px solid #000;
  padding-top: 8px;
}
.receipt-note { margin-top: 10px; font-size: 12px; color: #666; padding: 6px; background: #f6f6f6; }
.receipt-voided { margin-top: 10px; padding: 6px; text-align: center; color: #c00; font-weight: 700; border: 2px solid #c00; }
.receipt-foot { margin-top: 18px; padding-top: 8px; border-top: 1px dashed #999; font-size: 11px; color: #888; text-align: center; line-height: 1.6; }

/* ── 列印 ───────────────────────────────────────────────── */
@media print {
  /* 隱藏所有 UI chrome */
  .sidebar, .nav, .page-head, .toast-host,
  .modal-head, .modal-foot, .modal-close { display: none !important; }
  .app-shell { display: block !important; }
  /* 有開彈窗（收據/薪資單）時列印 → 只印彈窗，隱藏後面的主頁面（否則會多印一頁「背景頁」） */
  body:has(#modal-backdrop) #app { display: none !important; }
  .main { padding: 0 !important; padding-bottom: 0 !important; }
  .modal-backdrop {
    position: static !important;
    background: white !important;
    display: block !important;
    padding: 0 !important;
  }
  .modal {
    box-shadow: none !important;
    background: white !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .modal-body {
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
  }
  body { background: white !important; color: black !important; }
  .receipt { border: none; max-width: 100%; }
}

/* ── 響應式 ──────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: auto; min-height: 0; padding: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; align-items: center;
    border-right: none; border-top: 1px solid var(--border);
    z-index: 50;
  }
  .sidebar-brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 4px; padding: 0; overflow-x: auto; flex: 1; }
  .nav-item { padding: 8px 10px; flex-direction: column; gap: 2px; font-size: 11px; min-width: 60px; }
  .nav-item.active { box-shadow: inset 0 -3px 0 var(--gold); }
  .main { padding: 16px; padding-bottom: 80px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row-grid { grid-template-columns: 1fr; }
  /* 手機上資料表不要把文字直斷壓縮（如「洗髮精」變三行）；改成整列不換行、表格本身橫向捲動 */
  .table th, .table td { white-space: nowrap; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { flex-wrap: wrap; width: 100%; }
  .page-actions .input,
  .page-actions .select { flex: 1 1 140px; width: auto !important; min-width: 0; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .chip-row { flex-wrap: wrap; }

  /* 卡片內距縮小，手機螢幕更多空間 */
  .card { padding: 16px; }
  .card-pad-lg { padding: 18px; }

  /* 業績每日長條：縮欄位，留空間給長條本身 */
  .daily-bar-row { grid-template-columns: 38px 1fr auto auto; gap: 8px; font-size: 12px; }
  .daily-bar-commission { font-size: 11px; }

  /* 排班卡：時間獨立一行，內容與操作並排 */
  .schedule-item { grid-template-columns: 1fr auto; }
  .schedule-time { grid-column: 1 / -1; }

  /* 模態：滿版貼底、按鈕等寬，手機更好按 */
  .modal-backdrop { padding: 12px; align-items: end; }
  .modal, .modal-lg { width: 100%; max-height: calc(92vh / var(--uiz, 1)); }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }

  /* Toast 移到底部導覽列上方，避免被蓋住 */
  #toast-host { right: 12px; left: 12px; bottom: 76px; }
}

@media (max-width: 480px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
  .daily-bar-commission { display: none; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  /* 結帳/賣產品的勾選品項列：窄手機可換行、數字欄變窄，名稱不被擠掉 */
  .modal-body label.flex { flex-wrap: wrap; row-gap: 4px; }
  .modal-body input[type="number"] { width: 72px !important; }
  /* 客人多地址列：標籤欄縮短 */
  .cust-addr-row .cust-addr-label { flex: 0 0 84px !important; }
}
