/* 卡片 / 清單 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--gloss); overflow: hidden; }
.card + .card, .group + .group { margin-top: 14px; }
.group-title { font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 18px 4px 8px; letter-spacing: .04em; }
.group-title:first-child { margin-top: 4px; }
.group-hint { font-size: 12px; color: var(--text-muted); margin: 6px 6px 0; }

.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; width: 100%; text-align: left;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.row:last-child { border-bottom: 0; }
button.row:active, a.row:active { background: var(--surface-sunken); }
.row .lead { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-tint); color: var(--gold-deep); flex: none; }
.row .body { flex: 1; min-width: 0; }
.row .label { font-weight: 600; color: var(--maroon); }
.row .sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .trail { color: var(--text-faint); display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--r-pill); font-weight: 700; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--maroon);
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--maroon); color: #fff; border-color: var(--maroon); box-shadow: var(--halo); }
.btn.primary:active { background: var(--maroon-dark); }
.btn.gold { background: var(--gold-gradient); color: var(--maroon-dark); border-color: transparent; box-shadow: var(--shadow-sm); }
.btn.danger { color: var(--danger); border-color: var(--danger-tint); background: var(--danger-tint); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* 標籤 */
.badge-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; background: var(--surface-sunken); color: var(--text-muted);
}
.badge-pill.gold { background: var(--gold-tint); color: var(--gold-deep); }
.badge-pill.pink { background: var(--pink-tint); color: var(--pink-deep); }
.badge-pill.ok { background: var(--ok-tint); color: var(--ok); }
.badge-pill.warn { background: var(--warn-tint); color: var(--warn); }
.badge-pill.danger { background: var(--danger-tint); color: var(--danger); }
.badge-pill.info { background: var(--info-tint); color: var(--info); }

/* 開關 */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: var(--r-pill); background: #D9CFCB; transition: background .18s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .18s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:disabled + .track { opacity: .5; }

/* 表單 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 0 4px 6px; }
.field .hint { font-size: 12px; color: var(--text-muted); margin: 5px 4px 0; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); outline: none; color: var(--maroon);
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198, 164, 106, .2); }
.field.error .input, .field.error .select, .field.error .textarea { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: 12px; margin: 5px 4px 0; }

/* 分段 */
.segmented { display: flex; background: var(--surface-sunken); border-radius: var(--r-pill); padding: 3px; }
.segmented button { flex: 1; height: 34px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.segmented button.active { background: var(--surface); color: var(--maroon); box-shadow: var(--shadow-sm); }

/* chip（多選） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; color: var(--text); }
.chip.on { background: var(--pink-tint); border-color: var(--pink); color: var(--maroon); }

/* 空狀態 / 載入 */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty .ic-wrap { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--gold-tint); color: var(--gold-deep); display: grid; place-items: center; }
.empty .ic-wrap svg.ic { width: 30px; height: 30px; }
.empty h3 { margin-bottom: 4px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: var(--danger-tint); color: var(--danger); border-radius: var(--r-card); padding: 16px; text-align: center; }
.error-box .btn { margin-top: 10px; }

/* 底部抽屜 / 彈窗 */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(56, 18, 17, .42); opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101; max-height: 88%; display: flex; flex-direction: column;
  max-width: 480px; margin: 0 auto;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  border: 1px solid rgba(240, 226, 228, .85); box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
  padding-bottom: var(--safe-bottom);
}
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet .sheet-head { display: flex; align-items: center; padding: 8px 8px 8px 20px; flex: none; }
.sheet .sheet-head h2 { flex: 1; font-size: 17px; }
.sheet .sheet-body { overflow-y: auto; padding: 4px 16px 16px; }
.sheet .sheet-foot { display: flex; gap: 10px; padding: 8px 16px 14px; flex: none; border-top: 1px solid var(--line); }
.sheet .sheet-foot .btn { flex: 1; }

.dialog {
  position: fixed; left: 50%; top: 50%; z-index: 102; width: min(88%, 340px); transform: translate(-50%, -46%) scale(.96); opacity: 0;
  background: var(--surface); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow-lg); transition: all .18s;
}
.dialog.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.dialog h2 { font-size: 17px; margin-bottom: 8px; }
.dialog p { color: var(--text); margin-bottom: 16px; }
.dialog .actions { display: flex; gap: 10px; }
.dialog .actions .btn { flex: 1; }

/* toast */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--maroon-dark); color: #fff; padding: 10px 18px; border-radius: var(--r-pill); font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .2s; max-width: 86%; }
.toast.ok { background: var(--ok); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* 拖拉排序 */
.sortable .s-item { display: flex; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 56px; position: relative; }
.sortable .s-item:last-child { border-bottom: 0; }
.sortable .s-handle { width: 48px; height: 56px; display: grid; place-items: center; color: var(--text-faint); touch-action: none; cursor: grab; flex: none; }
.sortable .s-content { flex: 1; min-width: 0; padding: 8px 12px 8px 0; }
.sortable .s-item.dragging { z-index: 5; box-shadow: var(--shadow-lg); background: var(--gold-tint); border-radius: 12px; opacity: .96; }
.sortable.is-sorting { user-select: none; -webkit-user-select: none; }

/* 色塊 */
.swatch { width: 10px; align-self: stretch; border-radius: 6px; flex: none; }
.dot-sm { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* 頭像 / 師傅列 */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--gold-gradient); color: var(--maroon-dark); display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; }
.avatar.lg { width: 60px; height: 60px; font-size: 24px; }
.row.profile { padding: 16px; gap: 14px; }
.avatar-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.avatar-row::-webkit-scrollbar { display: none; }
.avatar-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); flex: none; }
.avatar-item .avatar { opacity: .55; }
.avatar-item.on { color: var(--maroon); font-weight: 700; }
.avatar-item.on .avatar { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }

/* 店務圖示格 */
.tile-card { padding: 16px 12px 8px; }
.tile-title { font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 0 6px 12px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 0; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 2px 12px; font-size: 12.5px; font-weight: 600; color: var(--maroon); text-align: center; }
.tile:active .tile-ic { transform: scale(.94); }
.tile-ic { position: relative; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; transition: transform .1s; }
.tile-ic svg.ic { width: 26px; height: 26px; }
.tile-ic.pink { background: var(--pink-tint); color: var(--pink-deep); }
.tile-ic.green { background: var(--ok-tint); color: var(--ok); }
.tile-ic.amber { background: var(--warn-tint); color: var(--warn); }
.tile-ic.teal { background: var(--info-tint); color: var(--info); }
.tile-ic.blue { background: var(--info-tint); color: var(--info); }
.tile-ic.gold { background: var(--gold-tint); color: var(--gold-deep); }
.tile-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--pink-deep); color: #fff; font-size: 10.5px; line-height: 18px; font-weight: 700; }
.tile-label { line-height: 1.25; }
