/* ===== CSS Variables ===== */
:root {
  --primary: #e85d04;
  --primary-dark: #c44a03;
  --primary-light: #fff4ed;
  --spicy-color: #dc2626;
  --spicy-bg: #fef2f2;
  --non-spicy-color: #16a34a;
  --non-spicy-bg: #f0fdf4;
  --staple-color: #2563eb;
  --staple-bg: #eff6ff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 6px 20px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-sm: 6px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Leelawadee UI", "Thonburi", "Noto Sans Thai", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ===== App Layout ===== */
#app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ===== Header ===== */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  font-size: 1.5rem;
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-link {
  background: rgba(255,255,255,0.25);
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
  transition: all 0.15s;
  white-space: nowrap;
}
.customer-link:hover {
  background: rgba(255,255,255,0.4);
}

.date-label {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
}

.date-icon {
  font-size: 0.85rem;
}

#datePicker {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

#datePicker::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

.icon-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 49px;
  z-index: 99;
  box-shadow: var(--shadow);
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  position: relative;
}

.tab .tab-icon {
  font-size: 1.2rem;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab:hover:not(.active) {
  background: var(--primary-light);
}

/* ===== Main Content ===== */
#main {
  flex: 1;
  padding: 12px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.form-card {
  border: 2px solid var(--border);
}

/* ===== Section Header ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ===== Forms ===== */
.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-inline {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.form-row-inline > .toggle-group {
  flex: 1;
  min-width: 120px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232,93,4,0.12);
}

.required {
  color: var(--danger);
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ===== Number Input ===== */
.number-input {
  display: flex;
  align-items: center;
  gap: 0;
  width: fit-content;
}

.num-btn {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--border-dark);
  background: var(--surface);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: all 0.15s;
  user-select: none;
}

.num-btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}

.num-btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: none;
}

.num-btn:hover {
  background: var(--primary-light);
}

.num-btn:active {
  background: var(--primary);
  color: #fff;
}

.number-input input[type="number"] {
  width: 60px;
  text-align: center;
  border-left: none;
  border-right: none;
  border-radius: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ===== Toggle Buttons ===== */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-group > label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.toggle-buttons {
  display: flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border-dark);
}

.toggle-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
  border-right: 1.5px solid var(--border-dark);
}

.toggle-btn:last-child {
  border-right: none;
}

.toggle-btn.active[data-spicy="true"] {
  background: var(--spicy-color);
  color: #fff;
}

.toggle-btn.active[data-spicy="false"] {
  background: var(--non-spicy-color);
  color: #fff;
}

.toggle-btn.active[data-staple="true"] {
  background: var(--staple-color);
  color: #fff;
}

.toggle-btn.active[data-staple="false"] {
  background: var(--text-secondary);
  color: #fff;
}

/* ===== Quick Entry ===== */
.quick-entry-card {
  border: 2px solid var(--primary);
  background: var(--primary-light);
}

.quick-entry-row {
  display: flex;
  gap: 8px;
}

.quick-entry-row input {
  flex: 1;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.hint b {
  color: var(--primary);
}

.parse-result {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.parse-result .parse-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.parse-result .parse-value {
  font-weight: 700;
  color: var(--text);
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-large {
  padding: 12px 24px;
  font-size: 1rem;
  width: 100%;
  margin-top: 4px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== Summary Bar ===== */
.summary-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-bar .stat {
  text-align: center;
}

.summary-bar .stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.summary-bar .stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ===== Summary Cards (for verify & reconcile) ===== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-cards .stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}

.summary-cards .stat-card.spicy { border-top-color: var(--spicy-color); }
.summary-cards .stat-card.non-spicy { border-top-color: var(--non-spicy-color); }
.summary-cards .stat-card.staple { border-top-color: var(--staple-color); }
.summary-cards .stat-card.paid { border-top-color: var(--success); }
.summary-cards .stat-card.unpaid { border-top-color: var(--danger); }

.summary-cards .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.summary-cards .stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.summary-cards .stat-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== Order List ===== */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--border-dark);
  transition: all 0.15s;
}

.order-item.spicy {
  border-left-color: var(--spicy-color);
}

.order-item.non-spicy {
  border-left-color: var(--non-spicy-color);
}

.order-item .order-info {
  flex: 1;
  min-width: 0;
}

.order-item .order-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.order-item .order-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-item .order-amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.order-item .order-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-item .action-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.order-item .action-btn:hover {
  background: var(--bg);
}

.order-item .action-btn.edit:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.order-item .action-btn.delete:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-spicy {
  background: var(--spicy-bg);
  color: var(--spicy-color);
}

.badge-non-spicy {
  background: var(--non-spicy-bg);
  color: var(--non-spicy-color);
}

.badge-staple {
  background: var(--staple-bg);
  color: var(--staple-color);
}

.badge-portions {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== Meal Set List ===== */
.meal-set-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meal-set-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.meal-set-item .meal-set-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.meal-set-item .meal-set-name {
  font-size: 1rem;
  font-weight: 700;
}

.meal-set-item .meal-set-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.meal-set-item .meal-set-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.meal-set-item .meal-set-options {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meal-set-item .meal-set-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.meal-set-item .meal-set-actions .action-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.meal-set-item .meal-set-actions .action-btn.edit:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.meal-set-item .meal-set-actions .action-btn.delete:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== Extra Products Management ===== */
.product-emoji-input {
  text-align: center;
  font-size: 1.5rem;
  padding: 8px 4px;
  height: 44px;
}

.product-list {
  margin-top: 12px;
}

.product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.product-item:hover { box-shadow: var(--shadow); }

.product-item.product-disabled { opacity: 0.45; }

.product-emoji {
  font-size: 1.8rem;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  flex-shrink: 0;
}

.product-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.product-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
  margin-left: 12px;
  white-space: nowrap;
}

.product-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.product-actions .action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.product-actions .action-btn:hover { transform: scale(1.08); }
.product-actions .action-btn.toggle:hover { background: #e8f5e9; border-color: #4caf50; }
.product-actions .action-btn.edit:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.product-actions .action-btn.delete:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ===== Verify Details ===== */
.verify-details {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.verify-detail-group {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}

.verify-detail-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.verify-detail-group h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.verify-detail-table {
  width: 100%;
  font-size: 0.85rem;
}

.verify-detail-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.verify-detail-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.verify-detail-table td.num {
  text-align: center;
  font-weight: 700;
}

.verify-detail-table tr:last-child td {
  border-bottom: none;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border-dark);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== Reconcile List ===== */
.reconcile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reconcile-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--danger);
}

.reconcile-item.paid {
  border-left-color: var(--success);
}

.reconcile-item .reconcile-info {
  flex: 1;
  min-width: 0;
}

.reconcile-item .reconcile-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.reconcile-item .reconcile-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.reconcile-item .reconcile-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.reconcile-item .pay-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
}

.reconcile-item .pay-btn.unpaid {
  background: var(--success);
  color: #fff;
}

.reconcile-item .pay-btn.paid {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ===== Member Management ===== */
.member-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.member-card:hover { box-shadow: var(--shadow-md); }

.member-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.member-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
  flex-shrink: 0;
}
.member-avatar-lg {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 0.95rem; font-weight: 700; }
.member-sub { font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px; }
.member-balances { text-align: right; flex-shrink: 0; }
.member-balance { font-size: 0.7rem; color: var(--text-secondary); }
.member-balance .bal-amt { font-size: 0.9rem; font-weight: 700; color: var(--primary); }
.member-points { font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px; }
.member-points .pts-amt { font-size: 0.9rem; font-weight: 700; color: #9333ea; }

.member-card-actions {
  display: flex;
  gap: 6px;
  padding: 8px 16px 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-sm:hover { border-color: var(--primary); background: var(--primary-light); }
.btn-sm.btn-recharge { color: #16a34a; border-color: #bbf7d0; }
.btn-sm.btn-recharge:hover { background: #f0fdf4; }
.btn-sm.btn-consume { color: #dc2626; border-color: #fecaca; }
.btn-sm.btn-consume:hover { background: #fef2f2; }
.btn-sm.btn-redeem { color: #9333ea; border-color: #e9d5ff; }
.btn-sm.btn-redeem:hover { background: #faf5ff; }
.btn-sm.btn-delete { color: #dc2626; border-color: #fecaca; }
.btn-sm.btn-delete:hover { background: #fef2f2; }

/* Member form */
.member-form { display: flex; flex-direction: column; gap: 8px; }
.member-form label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.member-form input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.member-form input:focus { outline: none; border-color: var(--primary); }
.member-txn-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--primary-light);
  border-radius: 8px;
  font-size: 0.8rem;
}
.quick-amt-btn {
  padding: 4px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.quick-amt-btn:hover { border-color: var(--primary); background: var(--primary-light); }

/* Redeem product grid (admin) */
.redeem-product-section { margin-top: 4px; }
.redeem-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.redeem-product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid #e0f2fe;
  background: linear-gradient(135deg, #f0f9ff, #fff);
  text-align: center;
  transition: all 0.2s;
}
.redeem-product-card.disabled {
  opacity: 0.5;
  border-color: var(--border);
  background: var(--surface);
}
.rp-emoji { font-size: 1.5rem; }
.rp-name { font-size: 0.8rem; font-weight: 600; }
.rp-price { font-size: 0.72rem; color: var(--text-secondary); text-decoration: line-through; }
.rp-points { font-size: 0.85rem; font-weight: 700; color: #0891b2; }
.rp-btn {
  margin-top: 4px;
  padding: 4px 16px;
  border-radius: 6px;
  border: none;
  background: #0891b2;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.rp-btn:hover { background: #0e7490; transform: translateY(-1px); }
.rp-btn:disabled { background: #d1d5db; cursor: not-allowed; }
.redeem-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
}
.redeem-divider::before, .redeem-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Member detail */
.member-detail { display: flex; flex-direction: column; gap: 16px; }
.member-detail-header { display: flex; gap: 12px; align-items: center; }
.member-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.md-stat {
  text-align: center;
  padding: 8px 4px;
  background: var(--primary-light);
  border-radius: 8px;
}
.md-stat-val { font-size: 0.95rem; font-weight: 700; color: var(--primary); }
.md-stat-label { font-size: 0.65rem; color: var(--text-secondary); margin-top: 2px; }

/* Transaction table */
.txn-table { display: flex; flex-direction: column; gap: 2px; }
.txn-row {
  display: grid;
  grid-template-columns: 70px 100px 60px 50px 50px;
  gap: 4px;
  padding: 6px 8px;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.txn-row.txn-header { font-weight: 700; color: var(--text-secondary); font-size: 0.7rem; }
.txn-note {
  font-size: 0.7rem;
  color: var(--text-secondary);
  padding: 2px 8px 6px;
  margin-top: -2px;
}
@media (max-width: 480px) {
  .member-detail-stats { grid-template-columns: repeat(2, 1fr); }
  .txn-row { grid-template-columns: 60px 80px 50px 40px 40px; font-size: 0.7rem; }
}

/* Currency selector */
.currency-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.currency-radio {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
  background: var(--surface);
}
.currency-radio input { display: none; }
.currency-radio.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* Dual-currency balance badges */
.bal-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-end;
}
.bal-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
}
.bal-tag-thb { color: #0d9488; }
.bal-tag-cny { color: #dc2626; }
.bal-tag .bal-sym { font-size: 0.72rem; }

/* Currency tag in transaction records */
.txn-currency-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}
.txn-currency-tag.thb { background: #ccfbf1; color: #0d9488; }
.txn-currency-tag.cny { background: #fee2e2; color: #dc2626; }

/* Portions input in consume dialog */
.portions-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.portions-input-group input {
  width: 60px;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}
.portions-hint {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Member KPI grid with dual currency */
.member-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.member-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.member-kpi-card .mk-val { font-size: 1.1rem; font-weight: 800; }
.member-kpi-card .mk-label { font-size: 0.68rem; color: var(--text-secondary); margin-top: 2px; }
.member-kpi-card.thb .mk-val { color: #0d9488; }
.member-kpi-card.cny .mk-val { color: #dc2626; }
.member-kpi-card.points .mk-val { color: #9333ea; }

/* Country code select */
.cc-select {
  -webkit-appearance: auto;
  appearance: auto;
  cursor: pointer;
  min-width: 110px;
}

/* Batch import table */
.batch-import-table {
  width: 100%;
  font-size: 0.82rem;
  border-collapse: collapse;
}
.batch-import-table th {
  padding: 8px 6px;
  text-align: left;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--text-secondary);
}
.batch-import-table td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
}
.batch-import-table tr:hover td {
  background: var(--primary-light);
}
.batch-import-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--primary-light);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.batch-import-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

/* ===== Footer ===== */
.app-footer {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
}

/* ICP 备案号 */
.icp-beian {
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.7;
}
.icp-beian a {
  color: inherit;
  text-decoration: none;
}
.icp-beian a:hover {
  text-decoration: underline;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
}

.close-btn:hover {
  color: var(--text);
}

.modal-body {
  padding: 16px;
}

.settings-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-section .hint {
  margin-bottom: 10px;
}

.settings-section .hint a {
  color: var(--primary);
  text-decoration: underline;
}

.danger-section h3 {
  color: var(--danger);
}

.settings-section button {
  margin-right: 8px;
  margin-bottom: 8px;
}

/* ===== Cloud Sync Config ===== */
.cloud-config-form {
  margin-top: 8px;
}

.cloud-config-form .form-row {
  margin-bottom: 10px;
}

.cloud-config-form .form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.cloud-config-form .form-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-sizing: border-box;
}

.cloud-config-form .form-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.cloud-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background: #ccc;
}

.status-dot.syncing {
  background: var(--warning);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  color: var(--text-secondary);
}

.cloud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.cloud-actions button {
  font-size: 0.8rem;
  padding: 7px 14px;
}

/* Sync badge in header */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.sync-badge.online {
  background: #ecfdf5;
  color: var(--success);
}

.sync-badge.offline {
  background: #f3f4f6;
  color: var(--text-secondary);
}

.sync-badge.syncing {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

/* ===== Print Area ===== */
#printArea {
  display: none;
}

/* ===== Print Styles ===== */
@media print {
  body * {
    visibility: hidden;
  }

  #printArea,
  #printArea * {
    visibility: visible;
  }

  #printArea {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  @page {
    margin: 10mm;
  }
}

/* ===== Print: Labels ===== */
.print-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4mm;
}

.print-label {
  border: 1.5px dashed #999;
  border-radius: 4px;
  padding: 4mm 5mm;
  text-align: center;
  page-break-inside: avoid;
  position: relative;
  min-height: 45mm;
}

.print-label .lbl-title {
  font-size: 9pt;
  font-weight: 700;
  color: #666;
  border-bottom: 1px solid #ccc;
  padding-bottom: 2mm;
  margin-bottom: 3mm;
}

.print-label .lbl-customer {
  font-size: 14pt;
  font-weight: 700;
  margin-bottom: 2mm;
}

.print-label .lbl-meal {
  font-size: 10pt;
  color: #333;
  margin-bottom: 1mm;
}

.print-label .lbl-portions {
  font-size: 12pt;
  font-weight: 700;
  margin: 2mm 0;
}

.print-label .lbl-spicy {
  display: inline-block;
  padding: 1mm 4mm;
  border-radius: 3px;
  font-size: 9pt;
  font-weight: 700;
  margin: 1mm;
}

.print-label .lbl-spicy.spicy {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #dc2626;
}

.print-label .lbl-spicy.non-spicy {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #16a34a;
}

.print-label .lbl-staple {
  font-size: 9pt;
  color: #2563eb;
  font-weight: 600;
  margin-top: 1mm;
}

.print-label .lbl-amount {
  font-size: 11pt;
  font-weight: 700;
  color: #e85d04;
  margin-top: 2mm;
  border-top: 1px solid #ccc;
  padding-top: 2mm;
}

.print-label .lbl-date {
  font-size: 7pt;
  color: #999;
  margin-top: 2mm;
}

/* ===== Print: Reconciliation ===== */
.print-reconcile {
  padding: 10mm;
}

.print-reconcile .pr-header {
  text-align: center;
  margin-bottom: 8mm;
}

.print-reconcile .pr-header h1 {
  font-size: 18pt;
  margin-bottom: 4px;
}

.print-reconcile .pr-header .pr-date {
  font-size: 12pt;
  color: #666;
}

.print-reconcile .pr-summary {
  display: flex;
  justify-content: space-around;
  margin-bottom: 6mm;
  padding: 4mm;
  background: #f5f5f5;
  border-radius: 4px;
}

.print-reconcile .pr-summary .pr-stat {
  text-align: center;
}

.print-reconcile .pr-summary .pr-stat-value {
  font-size: 14pt;
  font-weight: 700;
}

.print-reconcile .pr-summary .pr-stat-label {
  font-size: 9pt;
  color: #666;
}

.print-reconcile table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
}

.print-reconcile th {
  background: #e85d04;
  color: #fff;
  padding: 4mm 3mm;
  text-align: left;
  font-weight: 700;
}

.print-reconcile td {
  padding: 3mm 3mm;
  border-bottom: 1px solid #ddd;
}

.print-reconcile tr:nth-child(even) td {
  background: #fafafa;
}

.print-reconcile .pr-footer {
  margin-top: 6mm;
  text-align: right;
  font-size: 10pt;
  font-weight: 700;
}

.print-reconcile .pr-unpaid-list {
  margin-top: 4mm;
  padding: 4mm;
  background: #fef2f2;
  border-radius: 4px;
  font-size: 10pt;
}

.print-reconcile .pr-unpaid-list h3 {
  font-size: 11pt;
  color: #dc2626;
  margin-bottom: 2mm;
}

.print-reconcile .pr-sign {
  margin-top: 10mm;
  display: flex;
  justify-content: space-between;
  font-size: 10pt;
}

.print-reconcile .pr-sign-line {
  border-top: 1px solid #333;
  padding-top: 2mm;
  min-width: 40mm;
  text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .form-row-2col {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .tab .tab-text {
    font-size: 0.68rem;
  }

  .app-header h1 {
    font-size: 1rem;
  }

  .print-labels {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 360px) {
  .tab .tab-text {
    display: none;
  }

  .tab {
    padding: 10px 2px;
  }

  .tab .tab-icon {
    font-size: 1.4rem;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }
}

/* ===== Worksite Select ===== */
.worksite-select {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  max-width: 100px;
  outline: none;
}
.worksite-select option { color: var(--text); background: var(--surface); }

/* ===== Language Button ===== */
.lang-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.lang-btn:hover { background: rgba(255,255,255,0.35); }

/* ===== Worksite Management in Settings ===== */
.worksite-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ws-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.ws-item.ws-editing {
  background: #fff8f3; border: 1px solid var(--primary);
}
.ws-name { font-weight: 700; }
.ws-addr { color: var(--text-secondary); font-size: 0.8rem; flex: 1; }
.ws-delete { margin-left: auto; }
.ws-edit { white-space: nowrap; }
.ws-edit-input {
  padding: 5px 8px; border: 1px solid var(--border-dark); border-radius: 4px;
  font-size: 0.82rem; font-family: inherit; background: var(--surface);
}
.ws-edit-name { flex: 1; min-width: 80px; }
.ws-edit-addr { flex: 2; min-width: 100px; }
.ws-save, .ws-cancel { white-space: nowrap; }
.worksite-add-row { display: flex; gap: 8px; }
.worksite-add-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--border-dark); border-radius: var(--radius-sm); font-size: 0.85rem; }

/* ===== Meal Set Item refined ===== */
.meal-set-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  background: var(--surface); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border-left: 4px solid var(--primary); gap: 10px;
}
.meal-set-info { flex: 1; min-width: 0; }
.meal-set-name { font-size: 1rem; font-weight: 700; }
.meal-set-price { font-size: 1.15rem; font-weight: 700; color: var(--primary); margin-left: 6px; }
.meal-set-desc { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }
.meal-set-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.meal-set-actions { display: flex; gap: 6px; flex-shrink: 0; }
.meal-set-actions .action-btn { padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 0.8rem; transition: all 0.15s; }
.meal-set-actions .action-btn.edit:hover { background: var(--primary-light); border-color: var(--primary); }
.meal-set-actions .action-btn.delete:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.staple-price-info { font-size: 0.78rem; color: var(--staple-color); margin-top: 3px; font-weight: 500; }

.badge-spicy-op { background: var(--spicy-bg); color: var(--spicy-color); }
.badge-staple-op { background: var(--staple-bg); color: var(--staple-color); }

/* ===== Summary Cards refactor ===== */
.summary-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px; text-align: center; box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}
.summary-card.spicy { border-top-color: var(--spicy-color); }
.summary-card.non-spicy { border-top-color: var(--non-spicy-color); }
.summary-card.staple { border-top-color: var(--staple-color); }
.summary-card.paid { border-top-color: var(--success); }
.summary-card.unpaid { border-top-color: var(--danger); }
.sc-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sc-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

/* ===== Verify Table ===== */
.verify-group { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px dashed var(--border); }
.verify-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.verify-group-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.verify-group-subtotal { font-size: 0.85rem; color: var(--primary); font-weight: 600; }
.verify-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.verify-table th { text-align: left; padding: 6px 8px; color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--border); }
.verify-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.verify-table tr:last-child td { border-bottom: none; }
.verify-table tr.row-spicy td { background: var(--spicy-bg); }
/* 表头对齐覆盖：.verify-table th 优先级高于 .text-center，需显式声明 */
.verify-table th.text-center { text-align: center; }
.verify-table th.text-right { text-align: right; }
.verify-table td.text-center { text-align: center; }
.verify-table td.text-right { text-align: right; }

/* Worksite grouping in verify tab */
.verify-worksite-group {
  background: #fffbeb; border: 2px solid #f59e0b; border-radius: 12px;
  padding: 14px; margin-bottom: 16px;
}
.worksite-title { color: #d97706; font-size: 1.05rem; }
.verify-subgroup-title {
  font-size: 0.88rem; font-weight: 600; padding: 6px 0; margin: 4px 0;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px dashed var(--border); padding-bottom: 6px;
}

/* ===== Reconcile Toggle Button ===== */
.reconcile-toggle-btn {
  padding: 7px 14px; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  transition: all 0.15s;
}
.reconcile-toggle-btn.unpaid-btn { background: var(--success); color: #fff; }
.reconcile-toggle-btn.unpaid-btn:hover { background: #15803d; }
.reconcile-toggle-btn.paid-btn { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.reconcile-toggle-btn.paid-btn:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* ===== 退款相关样式 ===== */
.reconcile-item.refunded { background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.2); }
.reconcile-toggle-btn.refunded-btn { background: #dc2626; color: #fff; cursor: default; opacity: 0.7; }
.reconcile-toggle-btn.refunded-btn:disabled { opacity: 0.5; }
.reconcile-toggle-btn.refunded-btn:hover { background: #b91c1c; }
.reconcile-refund-btn {
  padding: 5px 10px; border: 1px solid #fca5a5; border-radius: var(--radius-sm);
  background: #fef2f2; color: #dc2626; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.15s; margin-left: 4px;
}
.reconcile-refund-btn:hover { background: #fee2e2; border-color: #ef4444; }
.reconcile-refund-btn.undo { background: #f0fdf4; border-color: #86efac; color: #16a34a; }
.reconcile-refund-btn.undo:hover { background: #dcfce7; border-color: #22c55e; }
.reconcile-refund-reason { font-size: 0.7rem; color: #dc2626; margin-top: 2px; font-style: italic; }
.refunded-amount s { color: #dc2626; }
.refunded-tag { display: inline-block; background: #dc2626; color: #fff; font-size: 0.65rem; padding: 1px 6px; border-radius: 8px; margin-left: 4px; vertical-align: middle; }
.summary-card.refunded { background: linear-gradient(135deg, #fef2f2, #fee2e2); border-color: #fca5a5; }
.summary-card.refunded .sc-value { color: #dc2626; }
.summary-card.net { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #86efac; }
.summary-card.net .sc-value { color: #16a34a; }

/* Member badge & pay button in reconcile */
.member-badge-sm {
  display: inline-block;
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
  color: #9333ea;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
  border: 1px solid #d8b4fe;
}
.reconcile-member-pay-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  border-radius: 6px;
  border: 1px solid #c4b5fd;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  color: #7c3aed;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  transition: all 0.15s ease;
}
.reconcile-member-pay-btn:hover {
  background: linear-gradient(135deg, #ddd6fe, #c4b5fd);
  border-color: #7c3aed;
}
.filter-btn[data-filter="refunded"].active { background: #dc2626; color: #fff; border-color: #dc2626; }
.refunded-row { opacity: 0.6; }

/* ===== Print Labels v2 ===== */
.print-labels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.pl-header { font-size: 9pt; font-weight: 700; color: #666; border-bottom: 1px solid #ccc; padding-bottom: 2mm; margin-bottom: 3mm; display: flex; justify-content: space-between; }
.pl-date { font-size: 7pt; color: #999; font-weight: 400; }
.pl-name { font-size: 14pt; font-weight: 700; margin-bottom: 2mm; text-align: center; }
.pl-meal { font-size: 10pt; color: #333; margin-bottom: 1mm; text-align: center; }
.pl-tags { display: flex; justify-content: center; gap: 4px; margin: 3mm 0; flex-wrap: wrap; }
.pl-spicy { display: inline-block; padding: 1mm 4mm; border-radius: 3px; font-size: 8pt; font-weight: 700; }
.pl-spicy.spicy { background: #fee2e2; color: #dc2626; border: 1px solid #dc2626; }
.pl-spicy.non-spicy { background: #f0fdf4; color: #16a34a; border: 1px solid #16a34a; }
.pl-staple { font-size: 8pt; color: #2563eb; font-weight: 600; padding: 1mm 3mm; background: #eff6ff; border-radius: 3px; }
.pl-price { font-size: 11pt; font-weight: 700; color: #e85d04; margin-top: 2mm; border-top: 1px solid #ccc; padding-top: 2mm; text-align: center; }

/* ===== Print Reconciliation v2 ===== */
.pr-date { font-size: 11pt; color: #666; text-align: center; margin-bottom: 4mm; }
.pr-summary { display: flex; justify-content: space-around; margin-bottom: 6mm; padding: 4mm; background: #f5f5f5; border-radius: 4px; font-size: 10pt; flex-wrap: wrap; gap: 4mm; }
.pr-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.pr-table th { background: #e85d04; color: #fff; padding: 4mm 3mm; text-align: left; font-weight: 700; }
.pr-table td { padding: 3mm 3mm; border-bottom: 1px solid #ddd; }
.pr-table tr:nth-child(even) td { background: #fafafa; }
.pr-unpaid { margin-top: 6mm; padding: 4mm; background: #fef2f2; border-radius: 4px; font-size: 10pt; }
.pr-sign { margin-top: 10mm; font-size: 10pt; }

/* ===== Payment QR Upload ===== */
.qr-upload-row { display: flex; gap: 16px; flex-wrap: wrap; }
.qr-upload-item { flex: 1; min-width: 140px; }
.qr-upload-item label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; }
.qr-upload-box { border: 2px dashed var(--border); border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; min-height: 100px; display: flex; align-items: center; justify-content: center; background: #fafafa; transition: border-color 0.2s; }
.qr-upload-box:hover { border-color: var(--primary); }
.qr-placeholder { color: var(--text-secondary); font-size: 0.85rem; }
.qr-remove-btn { margin-top: 6px; width: 100%; }

/* ===== Pending Confirm Summary Card ===== */
.summary-card.pending-confirm .sc-value { color: #f59e0b; }

/* ===== Meal Image Upload ===== */
.meal-img-upload {
  border: 2px dashed var(--border); border-radius: 8px; padding: 16px;
  text-align: center; cursor: pointer; min-height: 80px;
  display: flex; align-items: center; justify-content: center;
  background: #fafafa; transition: border-color 0.2s;
}
.meal-img-upload:hover { border-color: var(--primary); }
.meal-img-placeholder { color: var(--text-secondary); font-size: 0.85rem; }
.meal-img-upload img {
  max-width: 100%; max-height: 160px; border-radius: 4px; object-fit: cover;
}
/* Meal set list thumbnail */
.meal-set-thumb {
  width: 64px; height: 64px; border-radius: 8px; background-size: cover;
  background-position: center; flex-shrink: 0; border: 1px solid var(--border);
}
.meal-set-thumb-empty {
  background: #f5f5f5; display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem;
}
.meal-set-item {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow); transition: box-shadow 0.15s;
}
.meal-set-item:hover { box-shadow: var(--shadow-lg); }
.meal-set-info { flex: 1; min-width: 0; }
.meal-set-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== Printer Bar ===== */
.printer-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  flex-wrap: wrap; gap: 8px;
}
.printer-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 600;
}
.printer-status .connected { color: var(--non-spicy-color); }
.printer-status .disconnected { color: var(--text-secondary); }
.printer-status .error { color: var(--spicy-color); }
.printer-actions { display: flex; gap: 6px; align-items: center; }
.printer-bar-warn { background: #fffbeb; border-color: #f59e0b; }
.printer-bar-error { background: #fef2f2; border-color: #ef4444; }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.order-print-btn {
  background: var(--primary-light); border: 1px solid var(--primary);
  color: var(--primary); border-radius: 16px; padding: 4px 12px;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.order-print-btn:hover { background: var(--primary); color: #fff; }
.order-print-btn.printed { background: #e8f5e9; border-color: var(--non-spicy-color); color: var(--non-spicy-color); }

/* 出餐核对 — 操作列按钮 */
.verify-action-cell { white-space: nowrap; }
.verify-action-cell button { margin-left: 4px; }
.order-edit-btn {
  background: var(--warning-bg, #fffbeb); border: 1px solid var(--warning, #f59e0b);
  color: var(--warning, #f59e0b); border-radius: 16px; padding: 4px 10px;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.order-edit-btn:hover { background: #f59e0b; color: #fff; }
.order-del-btn {
  background: #fef2f2; border: 1px solid #ef4444;
  color: #ef4444; border-radius: 16px; padding: 4px 10px;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.order-del-btn:hover { background: #ef4444; color: #fff; }

/* 编辑订单弹窗 */
.edit-order-form .form-row { margin-bottom: 12px; }
.edit-order-form .form-row > label {
  display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px;
}
.edit-order-form .form-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.9rem; background: var(--surface);
  color: var(--text); box-sizing: border-box;
}
.edit-order-form .form-input:focus { outline: none; border-color: var(--primary); }
.edit-order-form .form-row-2col { display: flex; gap: 12px; }
.edit-order-form .form-row-2col > div { flex: 1; }
.edit-order-form textarea.form-input { resize: vertical; font-family: inherit; }
.edit-order-preview {
  margin: 8px 0 14px; padding: 8px 12px; background: var(--bg, #f8fafc);
  border-radius: var(--radius); font-size: 0.85rem; color: var(--text);
}
.edit-order-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px;
}
.edit-order-actions .btn { padding: 8px 20px; font-size: 0.88rem; border-radius: var(--radius); border: none; cursor: pointer; font-weight: 600; }
.edit-order-actions .btn-secondary { background: var(--border, #e2e8f0); color: var(--text); }
.edit-order-actions .btn-primary { background: var(--primary); color: #fff; }

/* 未打印数量徽章 */
.unprinted-badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px;
  text-align: center; background: #ef4444; color: #fff;
  border-radius: 9px; font-size: 0.7rem; font-weight: 700;
  padding: 0 5px; margin-left: 4px; vertical-align: middle;
}
#printLabelsBtn:disabled { opacity: 0.5; cursor: not-allowed; }
#reprintAllBtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 标签内容设置开关 ===== */
.label-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
@media (max-width: 600px) {
  .label-toggles { grid-template-columns: 1fr 1fr; }
}
.label-toggle-item {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 6px;
  background: var(--bg-secondary, #f5f5f5);
  cursor: pointer; user-select: none;
  font-size: 0.8rem; transition: background 0.15s;
}
.label-toggle-item:hover { background: var(--bg-tertiary, #eaeaea); }
.label-toggle-item .lt-star {
  color: #e85d04; font-size: 0.7rem; width: 10px;
}
.label-toggle-item .lt-text { flex: 1; }
.label-toggle-item input[type="checkbox"] { display: none; }
.lt-switch {
  width: 32px; height: 18px; border-radius: 9px;
  background: #ccc; position: relative; transition: background 0.2s;
  flex-shrink: 0;
}
.lt-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
.label-toggle-item input:checked ~ .lt-switch { background: #1d9e75; }
.label-toggle-item input:checked ~ .lt-switch::after { transform: translateX(14px); }

/* ===== 标签预览 ===== */
.label-preview {
  width: 100%; max-width: 280px; margin: 0 auto;
  border: 2px dashed #aaa; border-radius: 6px;
  padding: 8px 10px; background: #fff;
  font-family: sans-serif; position: relative;
}
.label-preview::before {
  content: '50mm × 30mm'; position: absolute;
  bottom: -20px; right: 0; font-size: 0.65rem; color: #999;
}
.lp-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 2px;
}
.lp-header { border-bottom: 1px solid #ddd; padding-bottom: 3px; margin-bottom: 4px; }
.lp-lg { font-size: 1rem; font-weight: 700; }
.lp-md { font-size: 0.85rem; font-weight: 500; }
.lp-sm-r { font-size: 0.7rem; color: #666; }
.lp-detail { font-size: 0.8rem; color: #333; }
.lp-paid-yes { color: #1d9e75; font-weight: 600; }
.lp-paid-no { color: #e24b4a; font-weight: 600; }
.lp-sep { border-top: 1px solid #ddd; margin: 3px 0; }
.lp-footer { font-size: 0.65rem; color: #999; }
#labelPreviewContainer { min-height: 140px; }

/* ===== 微信/支付宝浏览器引导弹窗 ===== */
.browser-guide-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: guideFadeIn 0.25s ease;
}
@keyframes guideFadeIn { from { opacity: 0; } to { opacity: 1; } }
.browser-guide-card {
  background: #fff; border-radius: 20px; max-width: 380px; width: 100%;
  padding: 28px 24px 24px; position: relative;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  text-align: center;
}
.guide-close {
  position: absolute; top: 12px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: #f3f4f6; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #6b7280; cursor: pointer; transition: all 0.15s;
}
.guide-close:hover { background: #e5e7eb; color: #1f2937; }
.guide-icon { font-size: 2.8rem; margin-bottom: 8px; }
.guide-title { font-size: 1.2rem; font-weight: 800; color: #1f2937; margin-bottom: 8px; }
.guide-desc { font-size: 0.88rem; color: #6b7280; line-height: 1.6; margin-bottom: 16px; }
.guide-steps { text-align: left; margin-bottom: 18px; }
.guide-step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px;
  background: #f8f9fa; border-radius: 12px;
  font-size: 0.85rem; color: #374151;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
}
.guide-url-box {
  display: flex; gap: 8px; margin-bottom: 14px;
}
.guide-url-input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 0.75rem; color: #6b7280;
  background: #f8f9fa; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.guide-copy-feedback {
  font-size: 0.82rem; color: var(--non-spicy-color); font-weight: 600;
  margin-bottom: 10px; animation: guideFadeIn 0.2s;
}
.guide-footer-hint {
  font-size: 0.78rem; color: #9ca3af; padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

/* ===== 销售分析仪表盘 ===== */
.analytics-dashboard {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.analytics-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.analytics-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.analytics-period-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 8px; padding: 3px; }
.period-tab {
  padding: 6px 14px; border: none; border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary); transition: all 0.15s;
}
.period-tab.active { background: var(--primary); color: #fff; }
.period-tab:hover:not(.active) { background: rgba(232,93,4,0.1); color: var(--primary); }

/* KPI 卡片 */
.analytics-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.kpi-card {
  background: linear-gradient(135deg, #fff7f0, #fff);
  border-radius: 12px; padding: 14px; text-align: center;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.kpi-card.kpi-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.kpi-card.kpi-clickable::after {
  content: '🔍';
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.65rem;
  opacity: 0.35;
  pointer-events: none;
}
.kpi-card.kpi-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.kpi-card.kpi-clickable:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.kpi-card.kpi-revenue { background: linear-gradient(135deg, #e8f5e9, #fff); }
.kpi-card.kpi-orders { background: linear-gradient(135deg, #eff6ff, #fff); }
.kpi-card.kpi-customers { background: linear-gradient(135deg, #fefce8, #fff); }
.kpi-card.kpi-avg { background: linear-gradient(135deg, #fdf2f8, #fff); }
.kpi-icon { font-size: 1.5rem; margin-bottom: 4px; }
.kpi-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.kpi-value.kpi-color-revenue { color: #16a34a; }
.kpi-value.kpi-color-orders { color: #2563eb; }
.kpi-value.kpi-color-customers { color: #ca8a04; }
.kpi-value.kpi-color-avg { color: #db2777; }
.kpi-label { font-size: 0.72rem; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }

/* 图表卡片 */
.analytics-chart-card {
  background: var(--surface); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.chart-title { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.chart-container { position: relative; width: 100%; min-height: 250px; }
.chart-container canvas { max-height: 280px; }
.chart-container-sm canvas { max-height: 220px; }

.analytics-row-2col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 500px) {
  .analytics-row-2col { grid-template-columns: 1fr; }
  .analytics-kpis { grid-template-columns: repeat(2, 1fr); }
  .chart-container canvas { max-height: 220px; }
}

/* 顾客排行双维度 */
.rank-dual {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.rank-col-title {
  font-size: 0.8rem; font-weight: 700;
  margin-bottom: 10px; padding: 4px 10px;
  border-radius: 6px; display: inline-block;
}
.rank-col-orders {
  background: rgba(37, 99, 235, 0.1); color: #2563eb;
}
.rank-col-portions {
  background: rgba(232, 93, 4, 0.1); color: #e85d04;
}
.rank-list {
  display: flex; flex-direction: column; gap: 5px;
}
.rank-item {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  background: var(--bg); overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.rank-item:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.rank-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--bar-width, 0%);
  transition: width 0.4s ease; z-index: 0;
}
.rank-col-orders .rank-item::before {
  background: linear-gradient(90deg, rgba(37,99,235,0.16), rgba(37,99,235,0.03));
}
.rank-col-portions .rank-item::before {
  background: linear-gradient(90deg, rgba(232,93,4,0.16), rgba(232,93,4,0.03));
}
.rank-medal, .rank-no, .rank-name, .rank-val, .rank-star {
  position: relative; z-index: 1;
}
.rank-medal { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; }
.rank-no {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
  background: #e5e7eb; color: #6b7280;
}
.rank-name {
  flex: 1; font-size: 0.82rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 3px;
}
.rank-star { font-size: 0.7rem; }
.rank-val {
  font-size: 0.88rem; font-weight: 800; flex-shrink: 0;
  color: var(--text);
}
.rank-val .rank-unit {
  font-size: 0.62rem; font-weight: 500;
  color: var(--text-secondary); margin-left: 1px;
}
.rank-empty {
  font-size: 0.8rem; color: var(--text-secondary);
  padding: 16px 0; text-align: center;
}
@media (max-width: 500px) {
  .rank-dual { grid-template-columns: 1fr; gap: 12px; }
}
/* 桌面端双列排行更宽 */
@media (min-width: 769px) {
  .rank-dual { gap: 20px; }
  .rank-item { padding: 8px 14px; }
  .rank-name { font-size: 0.88rem; }
  .rank-val { font-size: 0.95rem; }
}

/* ===== 顾客姓名可点击 ===== */
.rank-name-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--text-secondary);
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.rank-name-clickable:hover {
  color: var(--primary);
  text-decoration-color: var(--primary);
}

/* ===== 顾客历史明细弹窗 ===== */
.cust-hist-modal { padding: 0; }

.cust-hist-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.cust-hist-stat-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.cust-hist-stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.3;
}
.cust-hist-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.cust-hist-refund-note {
  font-size: 0.78rem;
  color: #dc2626;
  background: rgba(220,38,38,0.08);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 14px;
}
.cust-hist-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--text);
}
.cust-hist-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.cust-hist-detail-wrap {
  max-height: 300px;
  overflow-y: auto;
}
.cust-hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.cust-hist-table thead {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.cust-hist-table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.cust-hist-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.cust-hist-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}
.cust-hist-table tbody tr:last-child td {
  border-bottom: none;
}
.cust-hist-date {
  font-weight: 600;
}
.cust-hist-amount {
  font-weight: 700;
  color: var(--primary);
  text-align: right;
}
.cust-hist-status-normal {
  font-size: 0.68rem;
  color: #16a34a;
  background: rgba(22,163,74,0.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.cust-hist-status-refunded {
  font-size: 0.68rem;
  color: #dc2626;
  background: rgba(220,38,38,0.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.cust-hist-refund-badge {
  font-size: 0.65rem;
  color: #dc2626;
  background: rgba(220,38,38,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}
.cust-hist-empty {
  text-align: center !important;
  color: var(--text-secondary);
  padding: 20px !important;
}
.cust-hist-more-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
}
@media (max-width: 600px) {
  .cust-hist-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .cust-hist-stat-val { font-size: 1.05rem; }
  .cust-hist-table { font-size: 0.72rem; }
  .cust-hist-table th, .cust-hist-table td { padding: 6px 7px; }
}

/* 经营建议 */
.analytics-insights {
  background: linear-gradient(135deg, #fff7f0, #fffbeb);
  border-radius: 12px; padding: 16px; margin-top: 8px;
  border: 1px solid rgba(245,158,11,0.2);
}
.insights-title { font-size: 0.9rem; font-weight: 700; color: #d97706; margin-bottom: 10px; }
.insight-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid rgba(245,158,11,0.1);
  font-size: 0.82rem; color: var(--text); line-height: 1.5;
}
.insight-item:last-child { border-bottom: none; }
.insight-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.insight-item strong { color: var(--primary); }

/* ===== 业务日期提示横幅 ===== */
.biz-date-banner {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #e0e0e0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border-left: 4px solid #7c4dff;
  box-shadow: 0 2px 12px rgba(124, 77, 255, 0.25);
}

/* ===== 时段指示器 ===== */
.slot-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  border-left: 4px solid #3b82f6;
}
.slot-indicator-icon { font-size: 1.3rem; }
.slot-indicator-label { font-weight: 700; font-size: 0.95rem; color: #1e40af; }
.slot-indicator-time { font-size: 0.8rem; color: #6366f1; }

/* ===== 时段分组 ===== */
.slot-group {
  margin-bottom: 16px;
  border-radius: 10px;
  overflow: hidden;
}
.slot-group.slot-current {
  border: 2px solid #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.slot-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary, #f3f4f6);
  border-radius: 8px 8px 0 0;
}
.slot-group:not(.slot-current) .slot-group-header {
  background: var(--bg-secondary, #f3f4f6);
  opacity: 0.75;
}
.slot-icon { font-size: 1.1rem; }
.slot-name { font-weight: 700; font-size: 0.9rem; color: var(--text-primary, #111827); }
.slot-time { font-size: 0.75rem; color: var(--text-secondary, #6b7280); }
.slot-now-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: #3b82f6;
  color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
}
.slot-meals { padding: 8px 0; }

/* ===== 时段筛选工具栏 ===== */
.slot-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-secondary, #f3f4f6);
  border-radius: 10px;
}
.slot-filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  margin-right: 4px;
}
.slot-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  transition: all 0.15s;
}
.slot-filter-btn:hover {
  border-color: #93c5fd;
  color: #2563eb;
}
.slot-filter-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.slot-filter-now {
  color: #f59e0b;
  font-size: 0.7rem;
}
.slot-filter-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 8px;
  background: rgba(0,0,0,0.08);
  font-size: 0.72rem;
  text-align: center;
}
.slot-filter-btn.active .slot-filter-count {
  background: rgba(255,255,255,0.25);
}
.slot-count-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  background: rgba(0,0,0,0.06);
  padding: 1px 8px;
  border-radius: 8px;
  margin-left: auto;
}
.slot-empty-hint {
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary, #9ca3af);
  font-style: italic;
}

/* 诊断提示：有数据但不匹配筛选条件时显示 */
.empty-diag-hint {
  margin: 8px 16px 16px;
  padding: 10px 14px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #856404;
  line-height: 1.5;
}

/* ===== 时段小徽章 ===== */
.slot-badge-sm {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 6px;
  padding: 1px 5px;
}
.biz-date-banner-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #b388ff;
}
.biz-date-banner-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 12px;
  color: #ccc;
}
.biz-date-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.biz-date-banner-actions .btn-sm {
  font-size: 0.8rem;
  padding: 8px 14px;
}

/* ===== 成本利润页面 ===== */
.cost-form-card { margin-bottom: 12px; }
.cost-form-card .form-row { margin-bottom: 10px; }

/* 汇率栏 */
.exchange-rate-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-radius: 8px; font-size: 0.82rem; flex-wrap: wrap;
}
.exchange-rate-bar .rate-label { color: var(--text-secondary); white-space: nowrap; }
.exchange-rate-bar .rate-value { font-weight: 600; color: var(--text); }
.exchange-rate-bar .rate-value.rate-ok { color: #15803d; }
.exchange-rate-bar .rate-value.rate-loading { color: #6b7280; }
.exchange-rate-bar .rate-value.rate-error { color: #dc2626; }
.btn-sm-text {
  background: none; border: 1px solid #d1d5db;
  border-radius: 6px; padding: 2px 8px; cursor: pointer;
  font-size: 0.8rem; color: var(--text-secondary);
  transition: all 0.2s;
}
.btn-sm-text:hover { background: #f3f4f6; color: var(--primary); border-color: var(--primary); }
.btn-sm-text:disabled { opacity: 0.5; cursor: not-allowed; }

/* CNY 预览 */
.cny-preview {
  display: block; margin-top: 2px;
  font-size: 0.75rem; color: #6b7280; font-weight: 500;
}

/* 成本金额 CNY 二级显示 */
.cost-amount-cny {
  font-size: 0.72rem; color: #9ca3af; font-weight: 400;
}

/* 利润 KPI 卡片变体 */
.kpi-card.kpi-profit { background: linear-gradient(135deg, #e8f5e9, #fff); }
.kpi-card.kpi-profit-up { background: linear-gradient(135deg, #e8f5e9, #fff); border-left: 3px solid #16a34a; }
.kpi-card.kpi-profit-down { background: linear-gradient(135deg, #fef2f2, #fff); border-left: 3px solid #dc2626; }
.kpi-card.kpi-margin { background: linear-gradient(135deg, #eff6ff, #fff); }
.kpi-card.kpi-cost { background: linear-gradient(135deg, #fefce8, #fff); }
.kpi-card.kpi-margin-up { background: linear-gradient(135deg, #eff6ff, #fff); border-left: 3px solid #2563eb; }
.kpi-card.kpi-margin-low { background: linear-gradient(135deg, #fff7ed, #fff); border-left: 3px solid #f59e0b; }
.kpi-color-profit { color: #16a34a; }
.kpi-color-loss { color: #dc2626; }
.kpi-color-margin { color: #2563eb; }
.kpi-color-cost { color: #92400e; }

/* 成本列表 */
.cost-list { background: #fff; border-radius: 12px; padding: 12px 16px; }
.cost-list .section-header { margin-bottom: 8px; }
.cost-list .section-header h3 { font-size: 0.95rem; }
.cost-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f0f0f0;
  font-size: 0.85rem;
}
.cost-item:last-child { border-bottom: none; }
.cost-item-cat {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 0.72rem;
  white-space: nowrap;
}
.cost-cat-ingredients { background: #fefce8; color: #a16207; }
.cost-cat-vegetables { background: #f0fdf4; color: #15803d; }
.cost-cat-meat { background: #fef2f2; color: #dc2626; }
.cost-cat-staples { background: #fffbeb; color: #b45309; }
.cost-cat-seasonings { background: #fdf4ff; color: #a21caf; }
.cost-cat-labor { background: #eff6ff; color: #1d4ed8; }
.cost-cat-transport { background: #fdf2f8; color: #be185d; }
.cost-cat-packaging { background: #f3f4f6; color: #374151; }
.cost-cat-utilities { background: #fefce8; color: #ca8a04; }
.cost-cat-marketing { background: #fce7f3; color: #be185d; }
.cost-cat-other { background: #f3f4f6; color: #4b5563; }
.cost-item-note { flex: 1; color: var(--text-secondary); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-item-amount { font-weight: 700; font-size: 0.9rem; color: var(--text); white-space: nowrap; }
.cost-item-del { 
  width: 24px; height: 24px; border: none; background: none; color: #9ca3af;
  font-size: 0.8rem; cursor: pointer; border-radius: 50%; transition: all 0.15s;
}
.cost-item-del:hover { background: #fef2f2; color: #dc2626; }
.cost-item-edit {
  width: 24px; height: 24px; border: none; background: none; color: #6b7280;
  font-size: 0.75rem; cursor: pointer; border-radius: 50%; transition: all 0.15s;
}
.cost-item-edit:hover { background: #f0f9ff; color: #2563eb; }

/* 附件凭证缩略图 */
.cost-item-att, .superz-entry-att {
  width: 32px; height: 32px; object-fit: cover; border-radius: 6px;
  cursor: pointer; border: 1px solid #e5e7eb; transition: transform 0.15s;
  flex-shrink: 0;
}
.cost-item-att:hover, .superz-entry-att:hover {
  transform: scale(1.15); border-color: var(--primary);
}

/* 附件上传区域 */
.attachment-section {
  margin-top: 8px; margin-bottom: 8px;
}
.attachment-label {
  display: block; font-size: 0.85rem; color: var(--text-secondary, #6b7280);
  margin-bottom: 6px;
}
.attachment-upload-area {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.attachment-preview-wrap {
  position: relative; display: inline-flex;
}
.attachment-preview-img {
  width: 60px; height: 60px; object-fit: cover; border-radius: 8px;
  border: 2px solid #e5e7eb;
}
.attachment-remove-btn {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; color: #fff; border: none; cursor: pointer;
  font-size: 10px; display: flex; align-items: center; justify-content: center;
}
.btn-attachment-upload {
  padding: 6px 12px; border: 1px dashed var(--primary); background: var(--primary-bg, #eff6ff);
  color: var(--primary); border-radius: 8px; cursor: pointer; font-size: 0.82rem;
  transition: all 0.15s; white-space: nowrap;
}
.btn-attachment-upload:hover { background: var(--primary); color: #fff; }
.btn-ocr {
  padding: 6px 12px; border: 1px solid #8b5cf6; background: #f5f3ff;
  color: #7c3aed; border-radius: 8px; cursor: pointer; font-size: 0.82rem;
  transition: all 0.15s; white-space: nowrap;
}
.btn-ocr:hover { background: #8b5cf6; color: #fff; }
.ocr-lang-select {
  padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 0.8rem; background: #fff; cursor: pointer;
}
.ocr-progress-wrap {
  width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 4px;
}
.ocr-progress-bar {
  flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;
}
.ocr-progress-fill {
  height: 100%; background: linear-gradient(90deg, #8b5cf6, #6366f1);
  border-radius: 3px; transition: width 0.3s; width: 0%;
}
.ocr-progress-text { font-size: 0.75rem; color: #7c3aed; white-space: nowrap; }
.ocr-result-wrap {
  width: 100%; margin-top: 6px;
}
.ocr-result-text {
  width: 100%; padding: 8px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 0.82rem; resize: vertical; min-height: 50px;
}
.btn-ocr-fill {
  margin-top: 4px; padding: 4px 10px; border: 1px solid #16a34a; background: #f0fdf4;
  color: #16a34a; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
}
.btn-ocr-fill:hover { background: #16a34a; color: #fff; }
.cost-cat-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 0.82rem;
}
.cost-cat-summary:last-child { border-bottom: none; padding-bottom: 2px; }
.cost-total-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; margin-top: 4px; border-top: 2px solid var(--primary);
  font-weight: 700; font-size: 0.9rem;
}

/* 分类成本明细表 */
.cost-breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cost-breakdown-table th {
  text-align: left; padding: 8px 6px; border-bottom: 2px solid #e5e7eb;
  font-weight: 600; color: var(--text-secondary); font-size: 0.78rem;
}
.cost-breakdown-table td { padding: 7px 6px; border-bottom: 1px solid #f3f4f6; }
.cost-breakdown-table .text-right { text-align: right; }
.cost-breakdown-table .text-positive { color: #16a34a; font-weight: 600; }
.cost-breakdown-table .text-negative { color: #dc2626; font-weight: 600; }

@media (max-width: 600px) {
  .cost-breakdown-table { font-size: 0.72rem; }
  .cost-breakdown-table th, .cost-breakdown-table td { padding: 6px 3px; }
}

/* ===== 单份成本分析表 ===== */
.perunit-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.perunit-table th {
  text-align: left; padding: 8px 6px; border-bottom: 2px solid #e5e7eb;
  font-weight: 600; color: var(--text-secondary); font-size: 0.78rem; white-space: nowrap;
}
.perunit-table td { padding: 7px 6px; border-bottom: 1px solid #f3f4f6; white-space: nowrap; }
.perunit-table .text-right { text-align: right; }
.perunit-today-row { background: rgba(37,99,235,0.06); }
.perunit-today-row:hover { background: rgba(37,99,235,0.12); }
@media (max-width: 600px) {
  .perunit-table { font-size: 0.7rem; }
  .perunit-table th, .perunit-table td { padding: 5px 3px; }
}
.kpi-card.kpi-cost-up { border-color: #dc2626; }
.kpi-card.kpi-cost-down { border-color: #16a34a; }

/* ===== Super Z 泰国公司仪表盘 ===== */
.superz-dashboard {
  margin-top: 24px;
  border-top: 3px solid var(--primary, #2563eb);
  padding-top: 20px;
}
.superz-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.superz-header h3 {
  font-size: 1.15rem; font-weight: 700; margin: 0;
  color: var(--text, #1f2937);
}
.superz-header-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.superz-canteen-bar {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
}
.superz-entry-level-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px 12px;
  background: var(--surface, #fff); border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb);
}
.superz-entry-level-bar > label {
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary, #6b7280);
  margin: 0; white-space: nowrap;
}
.superz-level-tabs {
  display: flex; gap: 4px;
}
.superz-level-tab {
  padding: 6px 14px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px; background: transparent; cursor: pointer;
  font-size: 0.85rem; color: var(--text-secondary, #6b7280);
  transition: all 0.2s;
}
.superz-level-tab.active {
  background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb);
}
.superz-stall-select { max-width: 200px; }
.superz-form-row {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.superz-form-row > .card {
  flex: 1; min-width: 280px;
}
.superz-revenue-card { border-left: 3px solid #16a34a; }
.superz-cost-card { border-left: 3px solid #f59e0b; }
.superz-today-entries {
  margin-bottom: 16px;
}
.superz-entry-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border, #f3f4f6);
  font-size: 0.85rem;
}
.superz-entry-item:last-child { border-bottom: none; }
.superz-entry-tag {
  padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
.superz-entry-tag.tag-revenue { background: #dcfce7; color: #15803d; }
.superz-entry-tag.tag-cost { background: #fef3c7; color: #b45309; }
.superz-entry-del {
  padding: 2px 8px; border: none; background: transparent;
  cursor: pointer; font-size: 1rem; color: #9ca3af; border-radius: 4px;
}
.superz-entry-del:hover { background: #fef2f2; color: #dc2626; }
.superz-entry-edit {
  padding: 2px 8px; border: none; background: transparent;
  cursor: pointer; font-size: 0.85rem; color: #6b7280; border-radius: 4px;
}
.superz-entry-edit:hover { background: #f0f9ff; color: #2563eb; }
.superz-analytics { margin-top: 20px; }
.superz-compare-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.superz-compare-table th {
  padding: 8px 10px; text-align: left; font-weight: 600;
  background: var(--bg-secondary, #f9fafb); border-bottom: 2px solid var(--border, #e5e7eb);
}
.superz-compare-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border, #f3f4f6);
}
.superz-compare-table tr:hover { background: var(--bg-hover, #f9fafb); }
.superz-detail-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.superz-detail-table th {
  padding: 6px 8px; text-align: left; font-weight: 600;
  background: var(--bg-secondary, #f9fafb); border-bottom: 2px solid var(--border, #e5e7eb);
  white-space: nowrap;
}
.superz-detail-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--border, #f3f4f6);
  white-space: nowrap;
}
@media (max-width: 768px) {
  .superz-form-row { flex-direction: column; }
  .superz-header { flex-direction: column; align-items: flex-start; }
  .superz-detail-table { font-size: 0.7rem; }
  .superz-detail-table th, .superz-detail-table td { padding: 4px 3px; }
}

/* ===== 公司综合仪表盘 ===== */
.superz-company-dashboard {
  margin-top: 28px;
  border-top: 3px dashed var(--primary, #2563eb);
  padding-top: 20px;
}
.superz-company-header {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(22,163,74,0.06));
  border-radius: 10px;
  border: 1px solid rgba(37,99,235,0.15);
  justify-content: space-between;
}
.superz-company-header-left { flex: 1; min-width: 200px; }
.superz-company-header h3 {
  font-size: 1.1rem; font-weight: 700; margin: 0;
  color: var(--text, #1f2937);
}
.superz-company-sub {
  font-size: 0.78rem; color: var(--text-secondary, #6b7280);
}
.superz-company-time-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.superz-company-time-controls .analytics-period-tabs {
  display: flex; gap: 4px;
}
.superz-company-time-controls .period-tab {
  padding: 4px 12px; font-size: 0.78rem; border-radius: 6px;
  border: 1px solid var(--border, #e2e8f0); background: var(--surface, #fff);
  color: var(--text-secondary, #6b7280); cursor: pointer; transition: all 0.15s;
}
.superz-company-time-controls .period-tab.active {
  background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb);
}
.superz-company-time-controls .period-tab:hover:not(.active) {
  border-color: var(--primary, #2563eb); color: var(--primary, #2563eb);
}

/* ===== 退款及客诉分析板块 ===== */

/* ===== 固定成本管理 ===== */
.superz-fixed-cost-section {
  margin: 16px 0;
  border: 1px solid rgba(180,83,9,0.2);
  border-radius: 10px;
  overflow: hidden;
}
.superz-fixed-cost-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(180,83,9,0.06);
}
.superz-fixed-cost-header h4 {
  margin: 0; font-size: 1rem; font-weight: 700;
  color: var(--text, #1f2937);
}
.superz-fixed-cost-body {
  padding: 14px 16px;
}
.superz-fixed-cost-list {
  max-height: 360px;
  overflow-y: auto;
}
.kpi-fixed-cost {
  border-left: 3px solid #b45309;
}
.kpi-color-fixed {
  color: #b45309 !important;
}
.btn-del-sm {
  font-size: 1rem; padding: 2px 6px;
}

/* ===== 退款及客诉分析板块 ===== */
.refund-kpi-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.refund-kpi-card {
  flex: 1; min-width: 110px;
  background: var(--surface, #fff); border: 1px solid #fecaca; border-radius: 8px;
  padding: 10px 12px; text-align: center; position: relative;
}
.refund-kpi-card .rk-icon { font-size: 1.1rem; }
.refund-kpi-card .rk-value { font-size: 1.15rem; font-weight: 700; margin: 2px 0; }
.refund-kpi-card .rk-label { font-size: 0.72rem; color: var(--text-secondary, #6b7280); }
.refund-detail-table {
  width: 100%; border-collapse: collapse; font-size: 0.72rem;
}
.refund-detail-table th {
  text-align: left; padding: 5px 4px; border-bottom: 2px solid #fecaca;
  font-weight: 600; color: #991b1b; font-size: 0.68rem; white-space: nowrap; position: sticky; top: 0; background: #fef2f2; z-index: 1;
}
.refund-detail-table td { padding: 4px; border-bottom: 1px solid #fef2f2; white-space: nowrap; }
.refund-detail-table tbody tr:hover { background: #fff5f5; }
.refund-reason-item { margin-bottom: 6px; }
.refund-rank-list { display: flex; flex-direction: column; gap: 4px; }
.refund-rank-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: #fef2f2; border-radius: 6px; font-size: 0.78rem;
}
.refund-rank-item .rr-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refund-rank-item .rr-count { color: #dc2626; font-weight: 600; margin: 0 8px; white-space: nowrap; }
.refund-rank-item .rr-amount { color: #991b1b; white-space: nowrap; }
@media (max-width: 600px) {
  .refund-kpi-card { min-width: 90px; padding: 8px 6px; }
  .refund-kpi-card .rk-value { font-size: 1rem; }
  .refund-detail-table { font-size: 0.65rem; }
  .refund-detail-table th, .refund-detail-table td { padding: 3px 2px; }
  .refund-rank-item { font-size: 0.7rem; padding: 5px 8px; }
}

/* ===== 管理员登录遮罩 ===== */
.auth-overlay {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; z-index: 10000;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 40%, #c2410c 100%);
  min-height: 100vh; min-height: 100dvh;
}
.auth-card {
  background: #fff; border-radius: 20px; padding: 36px 28px;
  width: 100%; max-width: 380px; margin: 0 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  text-align: center; animation: authSlideIn 0.4s ease-out;
}
@keyframes authSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-logo { font-size: 3rem; margin-bottom: 8px; }
.auth-title { font-size: 1.3rem; font-weight: 800; color: var(--text); margin: 0 0 4px; }
.auth-subtitle { font-size: 0.82rem; color: var(--text-secondary); margin: 0 0 16px; }
.auth-error {
  background: #fef2f2; color: #dc2626; padding: 8px 12px;
  border-radius: 8px; font-size: 0.8rem; margin-bottom: 12px;
  text-align: left;
}
.auth-form { text-align: left; }
.auth-field { margin-bottom: 12px; }
.auth-field label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 4px;
}
.auth-field .name-modal-input { width: 100%; box-sizing: border-box; }
.auth-switch { margin-top: 14px; text-align: center; font-size: 0.82rem; color: var(--text-secondary); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; margin-left: 4px; }
.auth-switch a:hover { text-decoration: underline; }

/* 登出按钮 */
.logout-btn {
  background: none; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 4px 8px; cursor: pointer; font-size: 1rem;
  color: var(--text-secondary); transition: all 0.2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.logout-btn:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* ===== 微信内访问引导遮罩 ===== */
.wx-guide-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,0.85);
  flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 40px 24px 24px;
}
.wx-guide-overlay.show { display: flex; }
.wx-guide-arrow {
  position: absolute; top: 16px; right: 20px;
  font-size: 3rem; color: #fff;
  animation: wx-bounce 1s ease-in-out infinite;
}
@keyframes wx-bounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.wx-guide-content {
  margin-top: 100px;
  text-align: center; color: #fff;
  max-width: 320px;
}
.wx-guide-icon { font-size: 3rem; margin-bottom: 12px; }
.wx-guide-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.wx-guide-text { font-size: 0.9rem; line-height: 1.6; color: rgba(255,255,255,0.85); margin-bottom: 16px; }
.wx-guide-steps {
  background: rgba(255,255,255,0.1);
  border-radius: 12px; padding: 16px;
  text-align: left; margin-bottom: 20px;
}
.wx-guide-steps p { font-size: 0.85rem; color: rgba(255,255,255,0.9); margin-bottom: 8px; }
.wx-guide-steps p:last-child { margin-bottom: 0; }
.wx-guide-steps .step-num {
  display: inline-block; width: 20px; height: 20px;
  background: #e85d04; border-radius: 50%;
  text-align: center; line-height: 20px;
  font-size: 0.75rem; font-weight: 700; margin-right: 8px;
}
.wx-copy-btn {
  background: #e85d04; color: #fff; border: none;
  border-radius: 24px; padding: 12px 32px;
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.wx-copy-btn:active { transform: scale(0.96); }
.wx-copy-tip { font-size: 0.78rem; color: rgba(255,255,255,0.6); margin-top: 8px; }

/* ===== 批量录入订单 ===== */
.bulk-format-hint {
  background: #f0f7ff; border: 1px solid #c5d9f0; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px; font-size: 0.82rem;
  color: #3a6ea5; display: flex; align-items: flex-start; gap: 8px;
}
.hint-icon { font-size: 1rem; flex-shrink: 0; }
.bulk-slot-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.bulk-slot-row label {
  font-size: 0.85rem; font-weight: 600; color: #475569;
  white-space: nowrap;
}
.bulk-order-textarea {
  width: 100%; border: 2px dashed #cbd5e1; border-radius: 10px;
  padding: 12px; font-size: 0.9rem; font-family: var(--font-mono, 'Consolas', monospace);
  line-height: 1.6; resize: vertical; background: #fafbfc;
  transition: border-color 0.2s; min-height: 120px;
}
.bulk-order-textarea:focus {
  outline: none; border-color: var(--primary, #378ADD);
  background: #fff; box-shadow: 0 0 0 3px rgba(55,138,221,0.1);
}
.bulk-preview-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.bulk-preview-header h3 { margin: 0; }
.bulk-stat {
  font-size: 0.82rem; padding: 4px 10px; border-radius: 6px;
  background: #f1f5f9; font-weight: 500;
}
.bulk-preview-table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
.bulk-preview-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.bulk-preview-table th {
  background: #f8fafc; padding: 8px 6px; text-align: left;
  font-weight: 500; font-size: 0.78rem; color: #64748b;
  border-bottom: 2px solid #e2e8f0; position: sticky; top: 0; z-index: 1;
}
.bulk-preview-table td { padding: 6px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.bulk-row-error { background: #fef2f2; }
.bulk-row-warn { background: #fffbeb; }
.bulk-edit-cell {
  width: 100%; border: 1px solid transparent; border-radius: 4px;
  padding: 4px 6px; font-size: 0.85rem; background: transparent;
  transition: border-color 0.15s; font-family: inherit;
}
.bulk-edit-cell:focus {
  outline: none; border-color: var(--primary, #378ADD);
  background: #fff; box-shadow: 0 0 0 2px rgba(55,138,221,0.12);
}
.bulk-edit-sel {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 4px 6px; font-size: 0.85rem; background: #fff;
  font-family: inherit; cursor: pointer; color: #1e293b;
  transition: border-color 0.15s;
  -webkit-appearance: auto; appearance: auto;
}
.bulk-edit-sel:focus {
  outline: none; border-color: var(--primary, #378ADD);
  box-shadow: 0 0 0 2px rgba(55,138,221,0.12);
}
.bulk-edit-sel option:disabled { color: #dc2626; }
.bulk-edit-sel-spicy {
  border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 2px 4px; font-size: 0.8rem; background: #fff;
  font-family: inherit; cursor: pointer; color: #1e293b;
}
.bulk-edit-sel-spicy:focus {
  outline: none; border-color: var(--primary, #378ADD);
  box-shadow: 0 0 0 2px rgba(55,138,221,0.12);
}
.bulk-edit-num { width: 50px !important; text-align: center; }
.bulk-edit-num2 { width: 40px !important; text-align: center; }
.btn-icon-sm {
  width: 24px; height: 24px; border: none; background: transparent;
  border-radius: 4px; color: #94a3b8; cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon-sm:hover { background: #fee2e2; color: #dc2626; }

/* 批量录入 - 顾客匹配状态 */
.bulk-match-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 11px; font-size: 0.75rem;
  font-weight: 700;
}
.bulk-match-exact {
  background: #dcfce7; color: #16a34a;
}
.bulk-match-partial {
  background: #fef3c7; color: #d97706;
}
.bulk-match-fuzzy {
  background: #e0e7ff; color: #6366f1;
}
.bulk-match-none {
  background: #f1f5f9; color: #94a3b8;
}
.bulk-match-new {
  background: #ede9fe; color: #7c3aed;
}
.bulk-match-cell {
  text-align: center; font-size: 0.8rem; line-height: 1.3;
}
.bulk-match-stat {
  background: #dcfce7; color: #16a34a;
}

/* ===== Desktop Responsive（管理端平板 / 桌面适配） ===== */
@media (min-width: 769px) {
  #app { max-width: 960px; }

  /* Header */
  .app-header { padding: 14px 24px; }
  .app-header h1 { font-size: 1.3rem; }
  .logo { font-size: 1.7rem; }

  /* Tabs */
  .tabs { top: 55px; }
  .tab { padding: 12px 8px; font-size: 0.78rem; }
  .tab .tab-icon { font-size: 1.3rem; }

  /* Main */
  #main { padding: 20px; }

  /* Cards */
  .card { padding: 20px; margin-bottom: 16px; }
  .card h3 { font-size: 1.05rem; }

  /* Summary cards */
  .summary-cards { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .summary-cards .stat-value { font-size: 2rem; }
  .summary-cards .stat-label { font-size: 0.82rem; }

  /* Forms */
  .form-row-2col { grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

  /* Order list */
  .order-item { padding: 14px 18px; }
  .order-item .order-name { font-size: 1.05rem; }
  .order-item .order-meta { font-size: 0.82rem; }
  .order-item .order-amount { font-size: 1.15rem; }

  /* Buttons */
  .btn-primary, .btn-secondary { font-size: 0.88rem; padding: 9px 18px; }
  .btn-sm { font-size: 0.8rem; padding: 6px 14px; }
  .btn-lg { font-size: 1rem; padding: 12px 24px; }

  /* Modal */
  .modal { max-width: 540px; }
  .modal-header { padding: 18px 20px; }
  .modal-header h2 { font-size: 1.15rem; }
  .modal-body { padding: 20px; }

  /* Analytics */
  .analytics-kpis { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .chart-container { min-height: 300px; }
  .chart-container canvas { max-height: 350px; }
  .analytics-row-2col { gap: 16px; }
  .analytics-insights { padding: 20px; }
  .insight-item { font-size: 0.87rem; }

  /* Tables */
  .cost-breakdown-table { font-size: 0.85rem; }
  .cost-breakdown-table th, .cost-breakdown-table td { padding: 8px 6px; }
  .perunit-table { font-size: 0.85rem; }
  .perunit-table th, .perunit-table td { padding: 8px 6px; }

  /* Refund / Returns */
  .refund-kpi-card { min-width: 110px; padding: 12px 10px; }
  .refund-kpi-card .rk-value { font-size: 1.25rem; }
  .refund-detail-table { font-size: 0.8rem; }
  .refund-detail-table th, .refund-detail-table td { padding: 6px 5px; }

  /* Footer */
  .app-footer { padding: 14px 24px; font-size: 0.85rem; }

  /* Customer link in header */
  .customer-link { font-size: 0.85rem; padding: 5px 12px; }

  /* Label toggles */
  .label-toggles { grid-template-columns: 1fr 1fr 1fr; }

  /* Worksite select in header */
  .worksite-select { max-width: 140px; font-size: 0.82rem; }

  /* Biz date banner */
  .biz-date-banner { padding: 20px 24px; }
  .biz-date-banner-title { font-size: 1.1rem; }
  .biz-date-banner-desc { font-size: 0.9rem; }

  /* Bulk order */
  .bulk-order-textarea { font-size: 0.95rem; min-height: 140px; }
}

/* ===== Large Desktop（管理端大屏 1025px+） ===== */
@media (min-width: 1025px) {
  #app { max-width: 1140px; }

  #main { padding: 24px; }
  .card { padding: 24px; }
  .card h3 { font-size: 1.1rem; }

  .summary-cards { grid-template-columns: repeat(5, 1fr); }
  .form-row-2col { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .analytics-kpis { grid-template-columns: repeat(5, 1fr); }

  .chart-container { min-height: 340px; }
  .chart-container canvas { max-height: 400px; }

  .app-header h1 { font-size: 1.4rem; }
  .app-header { padding: 16px 28px; }
  .tabs { top: 59px; }
  .tab { padding: 14px 10px; font-size: 0.82rem; }
  .tab .tab-icon { font-size: 1.35rem; }

  .modal { max-width: 600px; }

  .order-item { padding: 16px 20px; }
  .order-item .order-name { font-size: 1.1rem; }

  .analytics-row-2col { gap: 20px; }
  .biz-date-banner { padding: 22px 28px; }

  #main { padding: 28px; }
}
