/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* 行動裝置：略過 300ms 點擊延遲（不影響桌機） */
button, .btn, a.mobile-bottom-nav__link, .side-nav-btn, .home-hero-act-btn,
.month-picker-nav, .month-picker-title, .shop-tab-btn, .admin-sidebar-toggle {
  touch-action: manipulation;
}

:root {
  --primary: #4f6ef7;
  --primary-dark: #3a57e8;
  --danger: #e53e3e;
  --success: #38a169;
  --warn: #dd6b20;
  --bg: #f0f2f7;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.10);
  --surface-alt: #f7f9fc;
  --toast-bg: #2d3748;
  --overlay: rgba(0,0,0,.4);
  --badge-blue-bg: #ebf4ff;
  --badge-blue: #2b6cb0;
  --badge-green-bg: #e9f8f0;
  --badge-green: #276749;
  --badge-warn-bg: #fff3e0;
  --badge-orange-bg: #feebc8;
  --badge-orange: #c05621;
  --warn-box-bg: #fff8f0;
  --warn-box-border: #fbd38d;
  --info-box-bg: #f0fff4;
  --info-box-border: #9ae6b4;
  --cell-under-bg: #fff5f5;
  --cell-ok-bg: #f0fff4;
  --cell-over-bg: #fffaf0;
  --weekend-bg: #fffbf0;
  --off-bg: #f7f8fa;
  --hover-bg: rgba(0,0,0,.03);
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

#app { min-height: 100vh; overflow-x: hidden; }

/* ─── Page Layout ───────────────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  max-width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.page-header h2 { font-size: 1.4rem; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }

/* ─── Home Page ─────────────────────────────────────────────────── */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 12px;
  max-width: 100%;
}
.home-hero { text-align: center; margin-bottom: 48px; }
.home-title { font-size: 2.6rem; font-weight: 700; color: var(--primary); letter-spacing: -1px; }
.home-brand-name { display: block; font-size: 3.2rem; font-weight: 700; letter-spacing: -2px; color: var(--text); margin-bottom: 2px; font-family: 'Inter', sans-serif; }
.home-sub { color: var(--text-muted); font-size: 1.1rem; margin-top: 8px; }

.home-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  padding: 0 8px;
}
.home-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 180px;
  padding: 28px 16px;
  border-radius: 16px;
  text-decoration: none;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  cursor: pointer;
}
.home-btn:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.home-btn-icon { font-size: 2.4rem; margin-bottom: 10px; }
.home-btn-label { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.home-btn-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.btn-mine:hover { border-color: #6366f1; }
.btn-schedule:hover { border-color: var(--primary); }
.btn-report:hover { border-color: var(--success); }
.btn-admin:hover { border-color: var(--warn); }

/* 我的班表月曆 */
.my-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  width: 100%;
}
.my-cal-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  font-size: 11px;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
}
.my-cal-cell:hover { border-color: var(--primary); }
.my-cal-empty { background: transparent; border: none; cursor: default; }
.my-cal-daynum { font-weight: 700; margin-bottom: 2px; color: var(--text-muted); font-size: 11px; }
.my-cal-slot { margin-bottom: 2px; line-height: 1.15; overflow: hidden; }
.my-cal-name { display: block; font-weight: 600; color: var(--text); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-cal-time { font-size: 9px; color: var(--text-muted); white-space: nowrap; }
.my-existing-list { margin: 0; padding-left: 0; list-style: none; font-size: 13px; }
.my-shop-pick { display: block; margin-bottom: 8px; cursor: pointer; }

/* 我的班表：檢視模式切換 */
.my-view-toggle {
  display: flex; gap: 4px; margin-bottom: 10px;
}
.my-view-btn {
  padding: 4px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); transition: background .15s, color .15s, border-color .15s;
}
.my-view-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* 我的班表：清單檢視 */
.my-list-view {
  display: flex; flex-direction: column; gap: 6px;
}
.my-list-day {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px;
}
.my-list-day-header {
  font-weight: 700; font-size: 16px; color: var(--text);
  border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 6px;
}
.my-list-entry {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 15px; flex-wrap: wrap;
}
.my-list-entry .my-list-shop {
  font-size: 15px; font-weight: 700; min-width: 80px;
}
.my-list-entry .my-list-time {
  color: var(--text-muted); font-size: 14px;
}
.my-list-empty { color: var(--text-muted); font-size: 12px; }

@media (max-width: 480px) {
  .my-cal-cell { aspect-ratio: auto; min-height: 48px; padding: 2px; }
  .my-cal-daynum { font-size: 10px; }
  .my-cal-name { font-size: 9px; }
  .my-cal-time { font-size: 8px; }
  .my-cal-grid { gap: 2px; }
}

/* ─── Login Card ────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: 12px; padding: 32px; box-shadow: var(--shadow); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.login-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.back-link { display: block; margin-top: 16px; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--primary); }

/* ─── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--primary); }
.input-sm { width: 70px; padding: 4px 6px; }
.input-time-shift { width: 130px; min-width: 130px; padding: 4px 8px; font-size: 14px; }
.month-select { padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--surface); }

/* 月份選擇：日曆式左右切換（取代長下拉） */
.month-picker-cal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.month-picker-title {
  font-weight: 700;
  font-size: 15px;
  min-width: 7.5em;
  text-align: center;
}
.month-picker-nav {
  min-width: 36px;
  padding: 4px 8px;
  font-size: 1.25rem;
  line-height: 1;
}

/* 店家代碼：最近使用（本機） */
.shop-history-mount { margin-top: 8px; }
.shop-history-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.shop-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.shop-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  max-width: 100%;
}
.shop-history-chip:hover {
  border-color: var(--primary);
  background: var(--surface);
}
.shop-history-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.shop-history-code {
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  font-size: 12px;
}

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--success); color: #fff; border-color: var(--success); }
.btn-secondary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.w-full { width: 100%; justify-content: center; }

.login-email-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.login-email-label-row label {
  margin-bottom: 0;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-divider span { flex-shrink: 0; }

.btn-google {
  background: #fff;
  color: #3c4043;
  border-color: #dadce0;
  font-weight: 600;
  gap: 10px;
}
.btn-google .btn-google-icon {
  flex-shrink: 0;
  display: block;
}
.btn-google:hover {
  background: #f8f9fa;
  border-color: #dadce0;
}

.provider-badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.provider-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.settings-muted { color: var(--text-muted); font-size: 13px; margin: 0; }

/* ─── Tabs ──────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Table ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table, .schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th, .data-table td,
.schedule-table th, .schedule-table td {
  padding: 9px 12px;
  border: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}
.data-table th, .schedule-table th {
  background: var(--surface-alt);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.schedule-table td { text-align: center; }
.date-cell { white-space: nowrap; text-align: center; min-width: 52px; }
.date-cell strong { display: block; font-size: 15px; }
.dow { font-size: 11px; color: var(--text-muted); }
.shift-cell { min-width: 80px; }
.weekend-row { background: var(--weekend-bg); }
.empty-cell { color: var(--border); font-size: 18px; }
.empty-td { text-align: center; color: var(--text-muted); padding: 24px; }

/* report table checkboxes */
.report-table .shift-cell input[type=checkbox] {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary);
}

/* scheduling cell states */
.cell-under { background: var(--cell-under-bg); }
.cell-ok { background: var(--info-box-bg); }
.cell-over { background: var(--cell-over-bg); }
.shift-cell:hover { filter: brightness(0.97); }

/* ─── Employee Tags & Badges ────────────────────────────────────── */
.emp-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin: 1px;
}
.tag-full { background: var(--badge-blue-bg); color: var(--badge-blue); }
.tag-part { background: var(--info-box-bg); color: var(--badge-green); }

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}
.badge-report { background: var(--badge-green-bg); color: var(--success); }
.badge-warn { background: var(--badge-warn-bg); color: var(--warn); }
.badge-full { background: var(--badge-blue-bg); color: var(--badge-blue); }
.avail-badge {
  display: inline-block;
  background: var(--badge-green-bg);
  color: var(--success);
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}

/* cell legend */
.cell-legend { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin: 0 2px; vertical-align: middle; }
.cell-under-leg { background: #fed7d7; }
.cell-ok-leg { background: #c6f6d5; }
.cell-over-leg { background: var(--badge-orange-bg); }
.legend { display: flex; gap: 12px; margin-bottom: 10px; font-size: 13px; align-items: center; }

/* ─── Modal ─────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); }
.modal-box {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: var(--surface);
  border-radius: 12px;
  padding: 28px;
  width: min(480px, 94vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.modal-box h3 { font-size: 1.1rem; margin-bottom: 8px; }
.modal-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ─── Emp Check List (assign modal) ────────────────────────────── */
.emp-check-list { display: flex; flex-direction: column; gap: 4px; }
.emp-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.emp-check-row:hover { background: var(--bg); }
.emp-check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.emp-name { font-weight: 600; }
.emp-code { color: var(--text-muted); font-size: 12px; }
.conflict-row { background: var(--weekend-bg); }
.no-report-row { opacity: .6; }

/* ─── Rules Layout ──────────────────────────────────────────────── */
.rules-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.rules-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.rules-card h3 { font-size: 1rem; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.add-shift-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-shift-row .input { flex: 1; min-width: 100px; }
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border); border-radius: 20px; transition: .2s;
  cursor: pointer;
}
.toggle-track::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: .2s;
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle input:checked + .toggle-track::before { transform: translateX(16px); }

/* ─── Section Header ────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.section-header h3 { font-size: 1rem; font-weight: 700; }

/* ─── Warnings ──────────────────────────────────────────────────── */
.warnings-box {
  background: var(--warn-box-bg);
  border: 1px solid var(--warn-box-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
}
.warnings-box ul { margin-top: 6px; padding-left: 18px; }
.warnings-box li { margin-bottom: 2px; }
.info-box {
  background: var(--info-box-bg);
  border: 1px solid var(--info-box-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--success);
}

/* ─── Save Bar (mobile) ─────────────────────────────────────────── */
.save-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--toast-bg);
  color: white;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: transform .3s, opacity .3s;
  z-index: 999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ─── Fulltime priority progress bar ───────────────────────────── */
.ft-progress-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--radius);
  padding: 8px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow); font-size: 13px;
}
.ft-progress-item { color: var(--text-muted); }
.ft-progress-item strong { font-size: 13px; }

/* ─── Code Input ────────────────────────────────────────────────── */
.input-code { font-size: 1.4rem; letter-spacing: 6px; text-align: center; font-weight: 700; }

/* ─── Off-day rows & badges ─────────────────────────────────────── */
.off-row { background: var(--off-bg) !important; color: var(--text-muted); }
.off-cell { color: var(--border); background: var(--off-bg); }
.holiday-row { background: var(--warn-box-bg) !important; }
.off-badge {
  display: inline-block; font-size: 10px; padding: 1px 5px;
  border-radius: 3px; margin-left: 4px;
  background: #e2e8f0; color: var(--text-muted);
}
.holiday-badge { background: var(--badge-orange-bg); color: var(--badge-orange); }

/* ─── Report type hint ──────────────────────────────────────────── */
.report-type-hint {
  display: inline-block; padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px;
}
.fulltime-hint { background: #ebf8ff; color: var(--badge-blue); border-left: 3px solid #4299e1; }
.parttime-hint { background: var(--info-box-bg); color: var(--badge-green); border-left: 3px solid #48bb78; }

/* ─── Fulltime stats bar ────────────────────────────────────────── */
.ft-stats {
  display: flex; gap: 20px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow); font-size: 14px;
}
.ft-stats strong { color: var(--primary); }

/* ─── Calendar legend ───────────────────────────────────────────── */
.cal-legend {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 12px; margin-bottom: 10px;
}
.cal-leg {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 4px; font-size: 12px;
}
.cal-leg.cal-workday { background: var(--info-box-bg); color: var(--badge-green); border: 1px solid var(--info-box-border); }
.cal-leg.cal-leave { background: var(--badge-blue-bg); color: var(--badge-blue); border: 1px solid #bee3f8; }
.cal-leg.cal-weekly-off { background: #f7fafc; color: var(--text-muted); border: 1px solid var(--border); }
.cal-leg.cal-holiday { background: var(--warn-box-bg); color: var(--badge-orange); border: 1px solid var(--warn-box-border); }

/* ─── Fulltime Calendar ─────────────────────────────────────────── */
.cal-wrapper { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.cal-dow-headers { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-dow-hdr { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  border-radius: 6px; padding: 6px 4px; min-height: 58px;
  display: flex; flex-direction: column; align-items: center;
  border: 1.5px solid transparent; font-size: 13px;
  transition: transform .1s, box-shadow .1s;
}
.cal-cell.cal-workday {
  background: var(--info-box-bg); border-color: var(--info-box-border); cursor: pointer;
}
.cal-cell.cal-weekend { background: #f7fff9; }
.cal-cell.cal-workday:hover { transform: scale(1.05); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.cal-cell.cal-leave {
  background: var(--badge-blue-bg); border-color: #bee3f8; cursor: pointer;
}
.cal-cell.cal-weekly-off {
  background: #f7fafc; border-color: var(--border); opacity: .7;
}
.cal-cell.cal-holiday {
  background: var(--warn-box-bg); border-color: var(--warn-box-border);
}
.cal-cell.cal-empty { background: transparent; border: none; }
.cal-day-num { font-size: 15px; font-weight: 700; color: var(--text); }
.cal-dow { font-size: 10px; color: var(--text-muted); }
.cal-label { font-size: 11px; font-weight: 600; margin-top: 2px; }
.cal-leave .cal-label { color: var(--badge-blue); }
.cal-weekly-off .cal-label { color: var(--text-muted); }
.cal-holiday .cal-label { color: var(--badge-orange); }

/* ─── Holiday rules UI ──────────────────────────────────────────── */
.week-chk-row { display: flex; gap: 8px; flex-wrap: wrap; }
.week-chk-lbl {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 6px;
  border: 1.5px solid var(--border); cursor: pointer; font-weight: 600;
}
.week-chk-lbl input { accent-color: var(--primary); }
.add-holiday-row { display: flex; gap: 8px; }
.add-holiday-row .input { flex: 1; }
.holiday-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--bg); border-radius: 6px;
  margin-bottom: 4px; font-size: 14px;
}
.empty-hint { color: var(--text-muted); font-size: 13px; }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .page { padding: 12px 8px 40px; }
  .rules-grid { grid-template-columns: 1fr; }
  .home-btn { width: calc(50% - 10px); min-width: 0; padding: 18px 8px; }
  .home-btn-icon { font-size: 1.8rem; }
  .home-btn-label { font-size: 1rem; }
  .home-btn-desc { font-size: 11px; }
  .home-title { font-size: 1.8rem; }
  .home-brand-name { font-size: 2.4rem; }
  .home-page { padding: 24px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .modal-box { padding: 16px; width: min(480px, 96vw); }
  .tabs { gap: 0; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab-btn { padding: 8px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .data-table th, .data-table td,
  .schedule-table th, .schedule-table td { padding: 6px 6px; font-size: 12px; }
  .section-header { gap: 6px; }
  .input-code { font-size: 1.2rem; letter-spacing: 4px; }
  .card { padding: 20px 16px; }
  .login-card { max-width: 100%; }
}
@media (max-width: 380px) {
  .home-btn { width: 100%; }
  .home-buttons { gap: 10px; }
  body { font-size: 14px; }
  .home-title { font-size: 1.4rem; }
  .home-brand-name { font-size: 2rem; }
}

/* ── 公休日月曆（多選） ────────────────────────────────── */
.hcal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.hcal-title { font-weight: 600; font-size: 0.95rem; }
.hcal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.hcal-dow span { text-align: center; font-size: 0.72rem; color: var(--text-muted); padding: 2px 0; }
.hcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.hcal-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; border-radius: 5px; cursor: pointer; user-select: none;
  background: var(--bg); border: 1px solid var(--border); transition: background 0.1s; }
.hcal-cell:hover:not(.hcal-empty) { background: var(--bg-alt, #f1f5f9); }
.hcal-cell.hcal-empty { background: transparent; border-color: transparent; cursor: default; }
.hcal-cell.hcal-selected { background: var(--danger); color: #fff; border-color: var(--danger); }
.hcal-actions { margin-top: 10px; }

/* ── 登入記住帳號 Checkbox ─────────────────────────────── */
.remember-label { display: flex; align-items: center; gap: 6px; font-size: 0.88rem;
  color: var(--text-muted); cursor: pointer; margin: 4px 0 8px; }
.remember-label input[type="checkbox"] { cursor: pointer; }

/* ── 正職月休統計提示 ──────────────────────────────────── */
.ft-stats-hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* ── Phase 1：班表請假、LINE、主管標籤 ───────────────────── */
.sched-emp-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.leave-pending-tag { font-size: 0.72rem; color: var(--warn); white-space: nowrap; }
.btn-xs { font-size: 0.75rem; padding: 2px 8px; min-height: auto; }
.tag-ok { color: var(--success); font-size: 0.88rem; font-weight: 600; }
.line-bind-inline h3 { font-size: 1rem; margin-bottom: 6px; }

.swap-inbox-banner { margin-bottom: 12px; }
.swap-inbox-list { margin: 8px 0 0 1rem; list-style: disc; }
.swap-inbox-list li { margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ── Login Branding ──────────────────────────────────────── */
.login-company {
  display: block;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.login-brand {
  font-size: 2rem; font-weight: 700; color: var(--primary);
  text-align: center; margin-bottom: 4px; letter-spacing: -1px;
}
.login-brand-name {
  display: block; font-size: 2.4rem; font-weight: 700;
  letter-spacing: -2px; color: var(--text); font-family: 'Inter', sans-serif;
  margin-bottom: 2px; text-align: center;
}
.login-subtitle {
  text-align: center; color: var(--text-muted); font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ── Home User Bar ───────────────────────────────────────── */
.home-user-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 12px; flex-wrap: wrap;
}
.home-user-name { font-weight: 600; color: var(--text); }
.trial-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
  background: #dbeafe; color: #1e40af;
}
.free-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
  background: #f1f5f9; color: var(--text-muted);
}
.home-btn-locked {
  opacity: 0.5; cursor: pointer;
}

/* ── Home Nav Section (3-button row + shop login) ─────────────── */
.home-nav-section {
  width: 100%; max-width: 560px;
}
.home-btn-row {
  display: flex; gap: 12px; width: 100%; margin-bottom: 16px;
}
.home-nav-btn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 8px; border-radius: 12px;
  text-decoration: none; background: var(--surface);
  box-shadow: var(--shadow); border: 2px solid var(--border);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  cursor: pointer;
}
.home-nav-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.home-nav-icon { font-size: 1.8rem; margin-bottom: 6px; }
.home-nav-label { font-size: 1rem; font-weight: 700; color: var(--text); }
.btn-mine:hover { border-color: #6366f1; }

.home-shop-login {
  background: var(--surface); border-radius: 12px;
  padding: 24px; box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
}
.shop-login-title {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
  color: var(--text);
}

@media (max-width: 480px) {
  .home-btn-row { gap: 8px; }
  .home-nav-btn { padding: 14px 6px; }
  .home-nav-icon { font-size: 1.4rem; }
  .home-nav-label { font-size: 0.85rem; }
  .home-shop-login { padding: 16px; }
}

/* ── Shop Tabs ───────────────────────────────────────────── */
.shop-tabs {
  display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap;
}
.shop-tab-btn {
  padding: 6px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: background .15s, color .15s, border-color .15s;
}
.shop-tab-btn.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}
.shop-tab-btn:hover:not(.active) { border-color: var(--primary); }
.shop-tab-add {
  border-style: dashed; color: var(--primary);
}

/* ── Time Scroller (My Schedule) ─────────────────────────── */
.time-scroller {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px;
}
.time-scroller-group {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.time-btn {
  width: 36px; height: 26px; border: none; border-radius: 4px;
  background: var(--bg); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.time-btn:hover { background: var(--border); }
.time-btn:active { background: var(--primary); color: #fff; }
.time-input {
  width: 42px; text-align: center; font-size: 1.2rem; font-weight: 700;
  border: 1px solid var(--border); border-radius: 4px; padding: 4px;
  -moz-appearance: textfield;
}
.time-input::-webkit-outer-spin-button,
.time-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.time-sep { font-size: 1.4rem; font-weight: 700; color: var(--text); padding: 0 2px; }

/* ── Time Row Side-by-Side (My Schedule) ─────────────────── */
.my-time-row {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 4px;
  flex-wrap: wrap;
}
.my-time-col {
  flex: 1; min-width: 120px;
}
.my-time-col label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px;
}
@media (max-width: 420px) {
  .my-time-row { gap: 6px; }
  .time-scroller { padding: 4px 4px; gap: 2px; }
  .time-input { width: 34px; font-size: 1rem; }
  .time-btn { width: 30px; height: 22px; font-size: 12px; }
}

/* ── Color Picker (My Schedule) ──────────────────────────── */
.color-pick-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.color-pick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 32px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; border: 2px solid transparent;
  transition: border-color .15s, transform .1s;
}
.color-pick:hover { transform: scale(1.1); }
.color-pick input { display: none; }
.color-pick:has(input:checked) { border-color: var(--text); transform: scale(1.15); }

/* ── Report Tap-to-Select ────────────────────────────────── */
.report-tap-cell {
  cursor: pointer; user-select: none;
  transition: background .15s, color .15s;
  min-height: 38px; font-size: 13px; font-weight: 600;
}
.report-tap-cell:hover { background: var(--cell-under-bg); }
.report-tap-cell.report-selected {
  background: #ef4444 !important; color: #fff !important;
}

/* ── Shop Picker (email-based entry) ─────────────────────── */
.shop-pick-list {
  display: flex; flex-direction: column; gap: 10px; margin: 16px 0;
}
.shop-pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 16px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; text-align: center;
}
.shop-pick-btn:hover {
  border-color: var(--primary); background: #f0f4ff;
}
.shop-pick-btn:active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.shop-pick-btn:active .shop-pick-code { color: rgba(255,255,255,.8); }
.shop-pick-name {
  font-size: 1.15rem; font-weight: 700; color: var(--text);
}
.shop-pick-code {
  font-size: 0.8rem; color: var(--text-muted); font-family: monospace;
}
.shop-pick-btn:disabled {
  opacity: .6; cursor: wait;
}

/* ── Bind Code Accent Button ─────────────────────────────── */
.btn-accent {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff; border: none; font-weight: 600;
  border-radius: var(--radius); padding: 4px 14px;
  cursor: pointer; transition: opacity .15s;
}
.btn-accent:hover { opacity: .85; }

/* ── Field Hint (admin modal) ────────────────────────────── */
.field-hint {
  font-size: 0.78rem; color: var(--text-muted);
  margin: 4px 0 0; line-height: 1.4;
}

/* ── Fallback Toggle ─────────────────────────────────────── */
.fallback-toggle { margin-top: 12px; }
.fallback-toggle summary {
  cursor: pointer; user-select: none; color: var(--text-muted);
  font-size: 0.85rem; list-style: none;
}
.fallback-toggle summary::-webkit-details-marker { display: none; }
.fallback-toggle[open] summary { color: var(--primary); }

/* ── Settings Modal ──────────────────────────────────────── */
.settings-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.settings-section:last-of-type {
  border-bottom: none; margin-bottom: 0;
}
.settings-section h4 {
  font-size: 0.95rem; font-weight: 700;
  margin: 0 0 8px; color: var(--text);
}
.home-settings-btn {
  font-size: 1.2rem !important; padding: 2px 6px !important;
  line-height: 1; cursor: pointer;
}

/* ── Responsive Additions ────────────────────────────────── */
@media (max-width: 700px) {
  .home-user-bar { font-size: 12px; gap: 6px; }
  .shop-tabs { gap: 2px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .shop-tab-btn { padding: 4px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .time-scroller { padding: 4px 4px; gap: 2px; }
  .time-input { width: 34px; font-size: 1rem; }
  .time-btn { width: 30px; height: 22px; font-size: 12px; }
  .shop-pick-btn { padding: 14px 12px; }
  .shop-pick-name { font-size: 1rem; }
  .header-actions { gap: 4px; }
  .header-actions .btn { padding: 5px 8px; font-size: 12px; }
  .rules-card { padding: 14px; max-width: 100%; overflow-x: auto; }
  .ft-progress-bar, .ft-stats { padding: 6px 10px; font-size: 12px; gap: 8px; }
  .warnings-box, .info-box { padding: 8px 10px; font-size: 12px; }
  .add-shift-row { flex-direction: column; }
}

/* ── Notification Bell ──────────────────────────────────────── */
.notif-bell {
  position: relative; cursor: pointer; font-size: 1.3rem;
  padding: 2px 6px; border: none; background: none; line-height: 1;
}
.notif-badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 50%; padding: 0 3px;
}
.notif-panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.15); padding: 16px;
  max-height: 60vh; overflow-y: auto;
}
.notif-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg); margin-bottom: 8px;
  font-size: 13px; border-left: 3px solid var(--primary);
}
.notif-item.notif-leave { border-left-color: var(--warn); }
.notif-item.notif-swap { border-left-color: var(--primary); }
.notif-item-title { font-weight: 700; font-size: 13px; }
.notif-item-desc { color: var(--text-muted); font-size: 12px; }
.notif-item-time { color: var(--text-muted); font-size: 11px; }
.notif-item-actions { display: flex; gap: 6px; margin-top: 4px; }
.notif-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px; }

/* ── Super Admin Panel ──────────────────────────────────────── */
.super-admin-btn {
  background: linear-gradient(135deg, #e53e3e, #c53030);
  color: #fff; border: none; font-weight: 700; font-size: 0.85rem;
  border-radius: var(--radius); padding: 4px 14px;
  cursor: pointer; transition: opacity .15s;
}
.super-admin-btn:hover { opacity: .85; }
.sa-shop-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg); margin-bottom: 8px; flex-wrap: wrap;
}
.sa-shop-name { font-weight: 700; font-size: 14px; }
.sa-shop-code { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.sa-shop-status { font-size: 12px; }
.sa-shop-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Month Quick Jump ───────────────────────────────────────── */
.month-picker-title {
  cursor: pointer; user-select: none;
}
.month-picker-title:hover { color: var(--primary); }
.month-jump-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 10px;
}
.month-jump-btn {
  padding: 8px 4px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 600;
  text-align: center; transition: background .15s, color .15s, border-color .15s;
}
.month-jump-btn:hover { border-color: var(--primary); background: var(--bg); }
.month-jump-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Dark Mode ────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #6b8aff;
    --primary-dark: #5a7bf7;
    --bg: #1a1b2e;
    --surface: #252640;
    --border: #3a3b5c;
    --text: #e8e8f0;
    --text-muted: #9a9bb8;
    --shadow: 0 1px 4px rgba(0,0,0,.3);
    --danger: #ff6b6b;
    --success: #4ade80;
    --warn: #fbbf24;
    --surface-alt: #2e2f4a;
    --toast-bg: #3a3b5c;
    --overlay: rgba(0,0,0,.6);
    --badge-blue-bg: #1e2a4a;
    --badge-blue: #7db4f0;
    --badge-green-bg: #1a2e24;
    --badge-green: #6dd8a0;
    --badge-warn-bg: #2e2518;
    --badge-orange-bg: #2e2518;
    --badge-orange: #f5a623;
    --warn-box-bg: #2e2518;
    --warn-box-border: #6b5530;
    --info-box-bg: #1a2e24;
    --info-box-border: #3a6b50;
    --cell-under-bg: #2e1a1a;
    --cell-ok-bg: #1a2e24;
    --cell-over-bg: #2e2518;
    --weekend-bg: #2a2540;
    --off-bg: #222236;
    --hover-bg: rgba(255,255,255,.05);
  }
  .btn-danger:hover { background: #3a1a1a; }
  .btn-ghost:hover { background: var(--hover-bg); }
  .report-tap-cell:hover { background: var(--cell-under-bg); }
  .shop-pick-btn:hover { background: #2a2b4a; border-color: var(--primary); }
  .shop-pick-btn:active { background: var(--primary); }
  .home-btn:hover, .home-nav-btn:hover { box-shadow: 0 8px 20px rgba(0,0,0,.3); }
}

/* ═══ Worka UI v2 — X-Lumion shell ═══════════════════════════════ */
.brand-hide-cn .brand-cn-subtitle { display: none !important; }

.app-top-bar {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 12px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ── 首頁 Hero：手機版 mobile-first（直向三區塊） ── */
.app-top-bar--home-hero {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}

.home-hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 1px;
  padding: 2px 4px 4px;
  width: 100%;
}
.home-hero-company {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 2px;
}
.home-hero-logo {
  border-radius: 6px;
  object-fit: contain;
  margin-bottom: 2px;
}
.home-hero-product {
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  line-height: 1.15;
}
.home-hero-cn {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.home-hero-tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 0;
  line-height: 1.35;
  max-width: 20rem;
  padding: 0 8px;
}

.home-hero-account {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  row-gap: 4px;
  padding: 6px 8px 8px;
  border-top: 1px solid var(--border);
  width: 100%;
  align-self: stretch;
  max-width: 100%;
  box-sizing: border-box;
}
.home-hero-user {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.home-hero-trial-wrap .trial-badge {
  font-size: 12px;
  vertical-align: middle;
}

.home-hero-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 0 2px;
  margin: 0;
  border-top: 1px solid var(--border);
  width: 100%;
}
.home-hero-act-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 2px 8px;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
}
.home-hero-act-btn:hover {
  border-color: var(--primary);
  background: var(--hover-bg);
}
.home-hero-act-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.home-hero-act-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.home-hero-act-btn--link {
  text-decoration: none;
  box-sizing: border-box;
}
.home-hero-actions .home-hero-act-btn.notif-bell {
  padding: 6px 2px 8px;
  font-size: inherit;
  background: var(--surface-alt);
}
.home-hero-actions .notif-bell .notif-badge {
  top: 4px;
  right: 6px;
  transform: none;
}
.home-hero-actions .home-hero-act-btn.super-admin-btn {
  background: linear-gradient(135deg, #e53e3e, #c53030);
  color: #fff;
  border: none;
}
.home-hero-actions .home-hero-act-btn.super-admin-btn .home-hero-act-label {
  color: rgba(255, 255, 255, 0.95);
}
.home-hero-actions .btn.btn-sm {
  min-height: 48px;
  padding: 6px 4px 8px;
}

/* 桌機首頁 hero：維持與手機相同的垂直節奏與置中，僅放大字級與留白（勿覆寫 max-width:768px 以下規則） */
@media (min-width: 768px) {
  .app-top-bar--home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 18px;
    margin-bottom: 18px;
  }
  .home-hero-brand {
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 28rem;
    padding: 6px 8px 4px;
  }
  .home-hero-company {
    font-size: 11px;
  }
  .home-hero-product {
    font-size: 1.85rem;
  }
  .home-hero-cn {
    font-size: 1rem;
  }
  .home-hero-tagline {
    font-size: 12px;
    max-width: 22rem;
    margin-top: 4px;
  }
  .home-hero-account {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--border);
    width: 100%;
    max-width: 36rem;
    padding: 10px 8px 8px;
    gap: 8px 16px;
  }
  .home-hero-user {
    text-align: center;
    max-width: 100%;
    font-size: 14px;
  }
  .home-hero-actions {
    justify-content: center;
    flex-wrap: wrap;
    max-width: 28rem;
    margin: 0 auto;
    border-top: 1px solid var(--border);
    padding: 10px 0 4px;
    gap: 8px;
  }
  .home-hero-act-btn {
    flex: 0 1 auto;
    min-width: 52px;
    padding: 8px 10px;
    min-height: 50px;
  }
}

.home-page--v2 {
  justify-content: flex-start;
  align-items: stretch;
  padding: 10px 10px 88px;
  max-width: 960px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .home-page--v2 {
    padding: 16px 16px 88px;
  }
}
.home-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}
@media (min-width: 769px) {
  .home-main-grid {
    grid-template-columns: minmax(0, 8fr) minmax(0, 2fr);
    align-items: start;
  }
}
.home-primary-zone {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px 16px;
}
.home-cta-primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 28px 16px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff !important;
  text-align: center;
  margin-bottom: 16px;
  transition: transform .15s, box-shadow .15s;
}
.home-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(79, 110, 247, 0.35);
}
.home-cta-primary__icon { font-size: 2.2rem; margin-bottom: 8px; }
.home-cta-primary__label { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.home-cta-primary__hint { font-size: 12px; opacity: 0.9; margin-top: 6px; font-weight: 600; }
.home-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.home-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.home-chip-link:hover { border-color: var(--primary); color: var(--primary); }
.home-hint-inline {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
  line-height: 1.45;
}
.home-aside-zone { width: 100%; }
.home-aside-card {
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
}
.home-aside-title { font-size: 1rem; margin-bottom: 6px; color: var(--text-muted); font-weight: 700; }

/* Admin sidebar layout — 窄版預設關閉，僅 .admin-sidebar--open 滑出 */
.admin-app {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}
.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--overlay);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.admin-sidebar-backdrop.is-visible {
  display: block;
}
.admin-sidebar-toggle {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}
.admin-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  min-height: 48px;
  position: relative;
  z-index: 20;
  background: var(--bg);
}
.admin-toolbar__title {
  flex: 1;
  min-width: 0;
}
.admin-toolbar__h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-toolbar__actions {
  flex-shrink: 0;
}
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform .22s ease;
}
.admin-sidebar__brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--border);
}
.admin-sidebar__xl { font-size: 10px; letter-spacing: 0.08em; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.admin-sidebar__product { font-size: 14px; font-weight: 700; }
.admin-sidebar .shop-tabs {
  flex-direction: column;
  flex-wrap: nowrap;
  overflow: visible;
  gap: 6px;
}
.admin-sidebar .shop-tab-btn {
  width: 100%;
  justify-content: center;
}
.admin-side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-nav-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.side-nav-btn:hover { background: var(--hover-bg); color: var(--text); }
.side-nav-btn.active {
  background: var(--badge-blue-bg);
  color: var(--primary);
}
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 16px 16px 48px;
}
.admin-main-header { margin-bottom: 12px; }
.admin-tab-content { padding-top: 4px; }

@media (max-width: 1023px) {
  .admin-app {
    display: block;
  }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    max-width: min(280px, 86vw);
    /* 降級陰影：減少合成層與重繪成本（手機） */
    box-shadow: 2px 0 12px rgba(0,0,0,.1);
    transform: translateX(-100%);
    overflow-y: auto;
  }
  .admin-sidebar.admin-sidebar--open {
    transform: translateX(0);
  }
  .admin-main {
    padding: 12px 12px 48px;
    width: 100%;
  }
  body.admin-sidebar-open {
    overflow: hidden;
    touch-action: none;
  }
}

@media (min-width: 1024px) {
  .admin-sidebar-backdrop {
    display: none !important;
  }
  .admin-sidebar {
    position: relative;
    transform: none !important;
    z-index: 1;
  }
  .admin-sidebar-toggle {
    display: none !important;
  }
}

/* KPI */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi-card--warn { border-color: var(--warn); background: var(--warn-box-bg); }
.kpi-card__label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-card__value { font-size: 1.5rem; font-weight: 700; color: var(--text); }

.sched-kpi-row { margin-bottom: 8px; }
.sched-toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sched-clear-warn {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.sched-clear-warn strong { color: var(--danger); }
.overview-shop-auth-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.overview-shop-auth-strip--warn {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.overview-shop-auth-strip__label { font-size: 13px; color: var(--text-muted); }
.overview-shop-auth-strip__value { font-size: 1.1rem; }
.overview-shop-auth-strip__hint { font-size: 11px; flex-basis: 100%; }
.sched-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.sched-section-header {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 10px !important;
}
.collapsible-box__toggle {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--warn-box-bg);
  cursor: pointer;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.collapsible-box__body { padding: 8px 4px 0 16px; }
.collapsible-box__body ul { margin: 0; }
.sched-warnings { margin-bottom: 12px; }

/* Rules three zones */
.rules-page-zones {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.rules-zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.rules-zone-title {
  font-size: 1.05rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.rules-zone-row.rules-policy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.rules-policy-field { min-width: 160px; flex: 1; }
.rules-subhead { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }

/* Settings modal tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.settings-tab {
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px 6px 0 0;
}
.settings-tab.active {
  color: var(--primary);
  background: var(--badge-blue-bg);
}
.settings-panel:not(.is-visible)[hidden] { display: none !important; }

/* Mobile bottom navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.mobile-bottom-nav--visible { display: flex; }
.mobile-bottom-nav__link {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 2px;
  border-radius: 8px;
  line-height: 1.2;
}
.mobile-bottom-nav__link.active {
  color: var(--primary);
  background: var(--badge-blue-bg);
}
body.has-mobile-nav {
  padding-bottom: 56px;
}

/* Responsive data tables → cards (mobile) */
@media (max-width: 768px) {
  .responsive-stack thead { display: none; }
  .responsive-stack tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .admin-tab-content .admin-emp-table tbody tr {
    margin-bottom: 8px;
    padding: 8px 10px;
    box-shadow: none;
  }
  .admin-tab-content .admin-emp-table tbody td {
    padding: 4px 0 !important;
    font-size: 13px;
  }
  .responsive-stack tbody td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0 !important;
    border: none !important;
    font-size: 14px;
  }
  .responsive-stack tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .tabs-scroll-hint { display: none; }
}

/* Schedule grid: keep table but allow horizontal scroll on small screens */
@media (max-width: 768px) {
  .sched-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
  }
  .schedule-table.sched-table { min-width: 520px; }
}

.account-hub-page .card-link-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-size: 15px;
}
.account-hub-page .card-link-btn:hover { border-color: var(--primary); }
.brand-cms-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.brand-logo-preview img { max-height: 48px; }

@media (min-width: 1024px) {
  .admin-main { max-width: 1200px; margin: 0 auto; }
}

/* 全站載入 overlay（不置換 #app，避免整頁 DOM 清空） */
.worka-app-loading {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(240, 242, 247, 0.85);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.worka-app-loading[hidden] {
  display: none !important;
}
.worka-app-loading__panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 28px;
  min-width: 160px;
  text-align: center;
}
.worka-app-loading__text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}
