/* public/style.css - Mindanao Retail Pulse (M-Ops) */
:root {
  --primary: #0066FF;
  --primary-hover: #0052CC;
  --primary-light: #EBF3FF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
}

/* 顶部导航栏 */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #f1f5f9;
  color: var(--danger);
  border-color: var(--danger-light);
}

/* 主容器 */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* 登录卡片 */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 80px);
  padding: 20px 16px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s;
}

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

.demo-account-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  text-align: left;
}

.demo-account-box h4 {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s;
}

.chip-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* 统计卡片 Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }

/* 控制栏 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* 门店卡片列表 */
.store-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.store-card:hover {
  box-shadow: var(--shadow-md);
}

.store-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.store-info h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.store-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-submitted {
  background: var(--success-light);
  color: #065F46;
}

.badge-substitute {
  background: #EDE9FE;
  color: #5B21B6;
}

.badge-pending {
  background: var(--warning-light);
  color: #92400E;
}

.badge-vacant {
  background: var(--danger-light);
  color: #991B1B;
}

.store-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.body-item strong {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
}

.store-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-action {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  transition: all 0.2s;
}

.btn-action.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

.btn-action.assign {
  background: #F1F5F9;
  color: #334155;
}

.btn-action.assign:hover {
  background: #E2E8F0;
}

/* 导购专属填报单页 */
.report-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.status-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.status-option-label {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.status-option-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.status-option-label input {
  accent-color: var(--primary);
}

.sales-stepper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stepper-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stepper-box label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.stepper-input {
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 0;
  background: #fff;
}

/* 模态弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

/* 响应式调整 */
@media (max-width: 640px) {
  .status-options-grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-left, .toolbar-right {
    justify-content: space-between;
  }
}


/* 专业数据大表样式 (Table View) */
.container.wide-mode {
  max-width: 1440px;
}

.view-toggle-group {
  display: flex;
  background: #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  border: none;
  background: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.view-toggle-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.matrix-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 20px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
  text-align: left;
}

.matrix-table thead th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  user-select: none;
}

.matrix-table thead th:hover {
  background: #F1F5F9;
  color: var(--primary);
}

.matrix-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.matrix-table tbody tr:hover {
  background-color: #F8FAFC;
}

.matrix-table tfoot td {
  background: #F1F5F9;
  font-weight: 700;
  padding: 14px;
  border-top: 2px solid var(--border);
  color: var(--text-main);
}

.table-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  display: inline-block;
}

.table-badge.cdo { background: #E0E7FF; color: #3730A3; }
.table-badge.smin { background: #FEF3C7; color: #92400E; }
.table-badge.zam { background: #FCE7F3; color: #9D174D; }

.table-num {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-table-action {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-table-action:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-table-action.primary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(0, 102, 255, 0.2);
}

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

/* 7 品牌战报矩阵样式 */
.brand-matrix-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.brand-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.brand-row.realme-highlight {
  background: #FFFBEB;
  border-color: #FCD34D;
}

.brand-name-tag {
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-input-group label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  width: 45px;
}

.brand-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.brand-row.realme-highlight .brand-input {
  border-color: #F59E0B;
  color: #B45309;
}

.market-share-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #E2E8F0;
  margin-top: 6px;
}

.share-slice {
  height: 100%;
  transition: width 0.3s;
}

.slice-realme { background: #F59E0B; }
.slice-oppo { background: #10B981; }
.slice-vivo { background: #3B82F6; }
.slice-xiaomi { background: #F97316; }
.slice-honor { background: #8B5CF6; }
.slice-infinix { background: #EF4444; }
.slice-tecno { background: #06B6D4; }

.col-brand-header {
  font-size: 11px;
  text-align: center !important;
  background: #F1F5F9 !important;
}

.table-brand-cell {
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}

.table-brand-cell .so-val {
  font-weight: 700;
  font-size: 13px;
}

.table-brand-cell .ps-val {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 2px;
}

.share-pill {
  font-weight: 700;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.share-pill.high { background: #D1FAE5; color: #065F46; }
.share-pill.mid { background: #FEF3C7; color: #92400E; }
.share-pill.low { background: #FEE2E2; color: #991B1B; }
