/* ====== Reset & Base ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.6;
}
:root {
  --primary: #4f6df5;
  --primary-light: #eef1fe;
  --primary-dark: #3b54d4;
  --success: #22c55e;
  --success-light: #e8fbeF;
  --warning: #f59e0b;
  --warning-light: #fef3e2;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #0ea5e9;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ====== Login ====== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card h1 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 4px;
  color: var(--gray-800);
}
.login-card .subtitle {
  text-align: center;
  color: var(--gray-400);
  font-size: 13px;
  margin-bottom: 28px;
}
.role-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 4px;
}
.role-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-500);
  transition: all .2s;
  border: none;
  background: none;
  font-size: 14px;
}
.role-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* ====== Form Elements ====== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--gray-600);
  font-size: 13px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
  color: var(--gray-800);
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,109,245,0.12);
}
.form-group input[type="number"] { text-align: right; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost {
  background: var(--gray-100);
  color: var(--gray-600);
}
.btn-ghost:hover { background: var(--gray-200); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ====== Layout ====== */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
}
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.sidebar-header .logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 700;
}
.sidebar-header .sub {
  font-size: 11px; color: var(--gray-400); margin-top: 4px; padding-left: 40px;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #111827;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 2px;
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--gray-100); color: #000; }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  font-size: 12px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.user-name { font-weight: 500; color: var(--gray-700); }
.user-role { color: var(--gray-400); font-size: 11px; }

.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 24px 32px;
  max-width: calc(100% - 220px);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
}
.page-desc {
  color: var(--gray-400);
  font-size: 13px;
  margin-top: 2px;
}

/* ====== Cards ====== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }

/* ====== Stats Cards ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
}
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-800);
}
.stat-extra {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ====== Tables ====== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 14px;
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
tr:hover td { background: var(--gray-50); }
.table-wrap { overflow-x: auto; }

/* ====== Badges ====== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: var(--success-light); color: #15803d; }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-danger { background: var(--danger-light); color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* ====== Rank Display ====== */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
}
.rank-1 { background: #fef3c7; color: #d97706; }
.rank-2 { background: #e5e7eb; color: #6b7280; }
.rank-3 { background: #fee2e2; color: #b45309; }
.rank-other { background: var(--gray-100); color: var(--gray-500); }

/* 排名折叠块：点击展开查看前三名以外的名次 */
.rank-more {
  margin-top: 10px;
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  background: var(--gray-50);
}
.rank-more summary {
  cursor: pointer;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rank-more summary::-webkit-details-marker { display: none; }
.rank-more summary::before {
  content: '▸';
  font-size: 12px;
  transition: transform 0.15s ease;
  color: var(--primary);
}
.rank-more[open] summary::before { transform: rotate(90deg); }
.rank-more summary:hover { color: var(--primary-dark, #4f46e5); }
.rank-more .table-wrap { padding: 0 8px 8px; }
.rank-more table { margin: 0; }

.rank-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
}
.rank-card .rank-num {
  font-size: 36px;
  font-weight: 800;
  margin: 8px 0;
}
.rank-card .rank-total {
  font-size: 13px;
  color: var(--gray-400);
}
.rank-card .rank-label {
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}
.rank-card .rank-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 4px;
}

/* ====== Form Sections ====== */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
}
.section-tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  border-top: none; border-left: none; border-right: none;
  background: none;
  font-size: 14px;
  font-family: inherit;
}
.section-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.section-tab:hover { color: var(--gray-700); }
.section-tab-disabled,
.section-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 768px) {
  .field-grid-3 { grid-template-columns: 1fr; }
}

.calc-display {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.calc-display .calc-label { font-size: 13px; color: var(--gray-600); }
.calc-display .calc-value { font-size: 20px; font-weight: 700; color: var(--primary); }

.staff-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}
.staff-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.staff-card-title {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ====== Alerts ====== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-info { background: #e0f2fe; color: #0369a1; }
.alert-warning { background: var(--warning-light); color: #b45309; }
.alert-success { background: var(--success-light); color: #15803d; }
.alert-danger { background: var(--danger-light); color: #b91c1c; }

/* ====== Modal ====== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal select {
  position: relative;
  z-index: 10;
  -webkit-appearance: menulist;
  appearance: menulist;
  cursor: pointer;
}
.modal select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--gray-800);
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ====== Misc ====== */
.text-muted { color: var(--gray-400); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width .3s;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }

.date-picker-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  background: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.date-picker-bar label {
  font-weight: 500;
  color: var(--gray-600);
  font-size: 13px;
}

/* ====== Badge Primary ====== */
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ====== Review Banner ====== */
.review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 2px solid;
}
.review-banner.reviewed {
  background: var(--success-light);
  border-color: var(--success);
}
.review-banner.pending {
  background: var(--warning-light);
  border-color: var(--warning);
}
.review-status-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.review-check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.review-pending-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}
.date-picker-bar input[type="date"] {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-700);
  min-width: 140px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.date-picker-bar .btn { flex-shrink: 0; }
.wb-date-bar { margin-bottom: 0; }
.wb-date-bar + #wbContent { margin-top: 16px; }

.tooltip-note {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ====== 累计汇总折叠明细 ====== */
.summary-details {
  margin-top: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--gray-50);
}
.summary-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 13px;
  user-select: none;
}
.summary-details summary:hover { color: var(--primary); }
.summary-details[open] summary { margin-bottom: 8px; }

/* ====== 数据审核门店折叠 ====== */
.review-store-details {
  margin-bottom: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.review-store-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  list-style: none;
  user-select: none;
}
.review-store-summary::-webkit-details-marker { display: none; }
.review-store-summary::before {
  content: '▸';
  color: var(--gray-400);
  font-size: 14px;
  transition: transform .2s;
  flex-shrink: 0;
}
.review-store-details[open] .review-store-summary::before { transform: rotate(90deg); }
.review-store-summary:hover { background: var(--gray-50); }
.review-store-summary .review-summary-meta {
  font-size: 12px;
  color: var(--gray-400);
}
.review-store-summary .review-toggle-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--gray-400);
}
.review-store-card { border: none; box-shadow: none; border-top: 1px solid var(--gray-200); border-radius: 0; margin-bottom: 0; }

/* 页面头部按钮防止被 flex 挤压导致点不开 */
.page-header .btn { flex-shrink: 0; }
.summary-details table { background: #fff; }

/* ====== 累计汇总按门店展示 ====== */
.store-summary-note {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 12px;
}
.store-summary {
  margin-top: 10px;
  background: #fff;
}
.store-summary summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.store-summary summary .fw-bold { font-size: 14px; color: var(--text); }
.store-summary[open] summary { border-bottom: 1px dashed var(--gray-200); padding-bottom: 8px; margin-bottom: 4px; }

/* ====== 档期计划表 ====== */
.schedule-plan-table input[type="number"] {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.schedule-plan-table th {
  position: sticky;
  top: 0;
  background: var(--gray-50);
  z-index: 1;
}
.schedule-plan-table td { vertical-align: middle; }
/* 档期计划表：营业状态（上班/店休）选择器 */
.schedule-plan-table select.work-status-select {
  width: 78px;
  padding: 6px 4px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-700);
  background: #fff;
}
/* 店休行：整行淡化提示闭店休息，计数不参与统计 */
tr.rest-row td {
  background: var(--gray-100);
  color: var(--gray-400);
}
tr.rest-row input[type="number"] {
  background: var(--gray-100);
  color: var(--gray-400);
}
.date-picker-bar input[type="month"] {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-700);
}
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

/* ====== Workbench (教练工作中台) ====== */
.workbench-task {
  position: relative;
}
.workbench-task:last-child {
  border-bottom: none !important;
}
.workbench-task-done {
  opacity: 0.7;
}
.workbench-task:hover .workbench-checkbox {
  border-color: var(--primary);
}

/* Workbench new styles */
.wb-summary-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.wb-stat-card {
  flex: 1;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}
.wb-stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.wb-stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}
.wb-progress-wrap {
  width: 100%;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.wb-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.wb-period-group {
  margin-bottom: 20px;
}
.wb-period-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  padding: 8px 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 8px;
}
.wb-task-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}
.wb-task-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.wb-task-item.wb-task-done .wb-task-content {
  text-decoration: line-through;
  color: var(--gray-400);
}
.wb-task-item.wb-task-done .wb-task-time {
  color: var(--gray-400);
}
.wb-task-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.wb-check-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-top: 2px;
}
.wb-check-btn:hover {
  border-color: var(--primary);
}
.wb-check-btn.checked {
  background: var(--success);
  border-color: var(--success);
}
.wb-task-info {
  flex: 1;
  min-width: 0;
}
.wb-task-time {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 2px;
}
.wb-task-content {
  font-size: 14px;
  color: var(--gray-800);
  line-height: 1.5;
}
.wb-task-done-time {
  font-size: 11px;
  color: var(--success);
  margin-top: 2px;
}
.wb-task-note {
  margin-top: 8px;
  margin-left: 36px;
}
.wb-note-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-700);
  background: var(--gray-50);
  transition: border-color 0.2s;
}
.wb-note-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.wb-note-input::placeholder {
  color: var(--gray-400);
}
.wb-meeting-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.wb-meeting-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}
.wb-meeting-time {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}
.wb-rate-bar-wrap {
  position: relative;
  width: 100%;
  height: 20px;
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
}
.wb-rate-bar {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}
.wb-rate-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  line-height: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

/* ====== Workbench: Store tracking & evidence ====== */
.wb-period-count {
  font-size: 12px;
  color: var(--gray-400);
  margin-left: 8px;
}
.wb-add-custom-btn {
  margin: 8px 12px 12px;
  width: fit-content;
  opacity: 0.7;
}
.wb-add-custom-btn:hover { opacity: 1; }
.wb-del-custom {
  margin-top: 4px;
  font-size: 11px;
  padding: 2px 8px;
}
.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}
.wb-stores-section {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 8px;
}
.wb-stores-title {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.wb-stores-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wb-stores-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wb-store-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: 6px;
  transition: all 0.15s;
}
.wb-store-item.wb-store-done {
  background: var(--success-light, #e8f5e9);
  border-color: var(--success);
}
.wb-store-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.wb-store-label input[type="checkbox"] {
  display: none;
}
.wb-store-checkmark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  transition: all 0.15s;
  flex-shrink: 0;
}
.wb-store-checkmark.checked {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}
.wb-store-name {
  color: var(--gray-700);
}
.wb-store-done .wb-store-name {
  color: var(--success);
  font-weight: 500;
}
.wb-store-done-by {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
  padding-left: 24px;
}
.wb-store-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wb-upload-btn {
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
  background: var(--gray-50);
}
.wb-upload-btn:hover {
  background: var(--primary-light, #e3f2fd);
}

/* ====== Upload modal ====== */
.wb-upload-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.wb-upload-modal, .wb-detail-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.wb-detail-modal {
  max-width: 800px;
}
.wb-upload-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-50);
  font-weight: 600;
  font-size: 15px;
}
.wb-upload-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.wb-detail-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.wb-upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}
.wb-evidence-list {
  border-top: 1px solid var(--gray-50);
  padding-top: 12px;
}

/* ====== Evidence thumbnails (supervisor view) ====== */
.wb-evidence-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}
.wb-evidence-thumb {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--gray-100);
}
.wb-evidence-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wb-evidence-thumb:hover {
  border-color: var(--primary);
}
.wb-evidence-thumb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wb-evidence-thumb-wrap .wb-evidence-thumb {
  width: 80px;
  height: 80px;
}
.wb-evidence-del-btn {
  padding: 1px 6px;
  font-size: 11px;
}
.wb-task-note-display {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--gray-50);
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

/* ====== 门店客情记录 ====== */
.cr-modal { max-width: 760px; }
.cr-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 10px;
}
.cr-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.cr-tab:hover { border-color: var(--primary); color: var(--primary); }
.cr-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.cr-tab-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  text-align: center;
}
.cr-tab.active .cr-tab-badge { background: rgba(255,255,255,0.35); }
.cr-content { min-height: 200px; }
.cr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cr-toolbar-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.cr-form-card {
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.cr-form-title { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 12px; }
.cr-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.cr-audio-name { font-size: 12px; color: var(--success); margin-top: 4px; }
.cr-list { display: flex; flex-direction: column; gap: 10px; }
.cr-item {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.cr-item-done { opacity: 0.62; }
.cr-item-done .cr-item-body { text-decoration: line-through; }
.cr-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.cr-item-date { font-weight: 600; color: var(--gray-800); font-size: 13px; }
.cr-item-tag {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
}
.cr-item-meta { color: var(--gray-400); font-size: 12px; margin-left: auto; }
.cr-item-body { font-size: 13px; color: var(--gray-700); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.cr-item-sub { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.cr-item-audio { margin-top: 8px; }
.cr-item-actions { display: flex; gap: 6px; margin-top: 8px; }

/* 改进计划：红绿灯状态指示 */
.plan-status-light {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  animation: plan-light-pulse 2s ease-in-out infinite;
}
.plan-light-red { background: #ff4444; box-shadow: 0 0 6px rgba(255,68,68,0.6); }
.plan-light-green { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); animation: none; }
.plan-light-yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.plan-light-blue { background: #3b82f6; box-shadow: 0 0 6px rgba(59,130,246,0.4); animation: none; }
@keyframes plan-light-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.cr-item-overdue {
  border-left: 3px solid #ff4444 !important;
  background: rgba(255,68,68,0.04);
}
.cr-item-plan-time {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
}
.plan-time-label { color: var(--gray-500); }
.plan-time-range { color: var(--gray-700); font-weight: 500; }
.plan-countdown {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
  background: var(--gray-100);
  color: var(--gray-600);
}
.countdown-overdue { background: #fee2e2; color: #dc2626; }
.countdown-urgent { background: #fef3c7; color: #d97706; }
.countdown-done { background: #d1fae5; color: #059669; }

/* 门店端：超时改进计划提醒 */
.overdue-plans-alert {
  margin-bottom: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
}
.overdue-plans-title { font-weight: 700; font-size: 14px; }
.overdue-plans-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.overdue-plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: rgba(255,255,255,0.5);
  border-radius: 6px;
  font-size: 13px;
}
.overdue-plan-task { font-weight: 600; }
.overdue-plan-meta { color: var(--gray-600); font-size: 12px; }
.overdue-plan-time { color: #dc2626; font-size: 12px; margin-left: auto; }

/* ====== 手机端适配 ====== */
@media (max-width: 768px) {
  .app-layout { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    padding: 8px 10px;
    z-index: 200;
  }
  .sidebar-header {
    padding: 0 4px;
    border: none;
    display: flex;
    align-items: center;
  }
  .sidebar-header .logo { font-size: 14px; }
  .sidebar-header .logo-icon { width: 26px; height: 26px; font-size: 13px; border-radius: 6px; }
  .sidebar-header .sub { display: none; }
  .sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    padding: 2px 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item { flex-shrink: 0; padding: 7px 10px; margin-bottom: 0; white-space: nowrap; font-size: 12px; }
  .sidebar-footer {
    width: 100%;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
  }
  .sidebar-footer .user-info { margin-bottom: 0; }
  .sidebar-footer .btn { margin: 0; }
  .main-content { margin-left: 0; padding: 12px; max-width: 100%; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .page-title { font-size: 17px; }
  .page-desc { font-size: 12px; }
  .date-picker-bar { flex-wrap: wrap; gap: 6px; }
  .date-picker-bar input[type="date"] { font-size: 14px; }
  .review-store-summary { padding: 10px 12px; }
  .review-store-summary .review-toggle-hint { display: none; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table th, .table td, .table-wrap table th, .table-wrap table td { padding: 6px 8px; white-space: nowrap; }
  .table-wrap table { font-size: 12px; }

  .field-grid { grid-template-columns: 1fr; }
  .field-grid-3 { grid-template-columns: 1fr; }

  .modal { max-width: 100%; padding: 16px; }
  .modal-overlay { padding: 10px; align-items: flex-start; overflow-y: auto; }
  .cr-modal { max-width: 100%; }
  .cr-form-grid { grid-template-columns: 1fr; }
  .cr-item-meta { margin-left: 0; width: 100%; }
  .cr-tab { padding: 7px 10px; font-size: 12px; }

  .section-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .section-tab { white-space: nowrap; flex-shrink: 0; }

  .wb-summary-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wb-stat-card { padding: 12px; }
  .wb-store-item { flex: 1 1 auto; }

  .form-group input, .form-group select, .form-group textarea,
  input[type="text"], input[type="date"], input[type="number"], select, textarea { font-size: 16px; }

  .login-card { padding: 24px 20px; }
  .role-tab { font-size: 13px; padding: 8px; }

  .review-banner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .review-banner .btn { align-self: flex-end; }

  .card-header { align-items: flex-start; }
  .page-header .btn { align-self: flex-start; }
}
@media (max-width: 480px) {
  .sidebar-nav { max-width: 100vw; }
  .wb-stores-grid { flex-direction: column; }
  .wb-store-item { width: 100%; }
}

/* ====== 门店基础信息附件 ====== */
.cr-attachment-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.cr-attachment-thumb {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary, #f7fafc);
}
.cr-attachment-thumb img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  transition: opacity 0.2s;
}
.cr-attachment-thumb img:hover { opacity: 0.85; }
.cr-attachment-info {
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.cr-attachment-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.cr-attachment-files { display: flex; flex-direction: column; gap: 8px; }
.cr-attachment-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--bg-secondary, #f7fafc);
}
.cr-attachment-file .cr-file-icon { font-size: 20px; }
.cr-file-link {
  flex: 1;
  color: var(--primary, #3b82f6);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-file-link:hover { text-decoration: underline; }

/* ====== 通用图片预览弹窗（可缩放） ====== */
.img-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
}
.img-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.img-preview-toolbar .btn { color: #fff; border-color: rgba(255,255,255,0.3); }
.img-preview-toolbar .btn:hover { background: rgba(255,255,255,0.15); }
.img-preview-title { font-size: 14px; margin-right: auto; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-preview-info { font-size: 13px; min-width: 40px; text-align: center; }
.img-preview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  touch-action: none;
}
.img-preview-img {
  max-width: 90%;
  max-height: 90%;
  user-select: none;
  transition: none;
  will-change: transform;
}

/* ====== 老板数据驾驶舱 ====== */
.boss-login-card {
  max-width: 380px;
  margin: 60px auto;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.boss-login-icon { font-size: 48px; margin-bottom: 16px; }
.boss-login-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.boss-login-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 18px;
  text-align: center;
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 8px;
  letter-spacing: 4px;
}
.boss-login-input:focus { border-color: var(--primary, #3b82f6); outline: none; }
.boss-range-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-secondary, #f7fafc);
  border-radius: 8px;
}
.boss-range-bar input[type="date"] { padding: 6px 10px; border: 1px solid var(--border, #e2e8f0); border-radius: 6px; }
.boss-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.boss-stat-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.boss-stat-label { font-size: 12px; color: var(--text-muted, #64748b); margin-bottom: 6px; }
.boss-stat-value { font-size: 24px; font-weight: 700; }
.boss-section {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.boss-section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* ====== 手机端适配补充 ====== */
@media (max-width: 768px) {
  .boss-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .boss-stat-value { font-size: 20px; }
  .boss-range-bar { flex-direction: column; align-items: stretch; }
  .boss-range-bar input[type="date"] { width: 100%; }
  .cr-attachment-images { grid-template-columns: repeat(2, 1fr); }
  .img-preview-toolbar { padding: 8px; gap: 4px; }
  .img-preview-title { max-width: 120px; font-size: 12px; }
  .img-preview-img { max-width: 95%; max-height: 85%; }
  .boss-login-card { margin: 30px 16px; padding: 30px 20px; }
}
@media (max-width: 480px) {
  .boss-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cr-attachment-images { grid-template-columns: 1fr 1fr; }
  .img-preview-toolbar .btn { padding: 4px 8px; font-size: 12px; }
}
