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

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #3b82f6;
  --info-light: #eff6ff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --transition: .25s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes countUp { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 50%, #7c3aed 100%);
  color: #fff;
  padding: 0 28px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(67, 56, 202, .25);
}

.header-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.header-title { font-size: 18px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }

.district-select-wrap { position: relative; }
.district-select {
  appearance: none;
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 6px 32px 6px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background var(--transition);
}
.district-select:hover { background: rgba(255,255,255,.26); }
.district-select:focus { outline: none; border-color: rgba(255,255,255,.6); }
.district-select option { color: #1a1a2e; }
.district-select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid rgba(255,255,255,.8);
  border-bottom: 2px solid rgba(255,255,255,.8);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.header-badge { background: rgba(255,255,255,.15); padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid rgba(255,255,255,.1); }
.badge-primary { background: rgba(255,255,255,.28); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.header-update { font-size: 12px; opacity: .85; font-weight: 500; white-space: nowrap; }

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}
.refresh-btn:hover { background: rgba(255,255,255,.28); }
.refresh-btn svg { width: 15px; height: 15px; }
.refresh-btn.loading svg { animation: spin .8s linear infinite; }

.month-progress { display: flex; align-items: center; gap: 8px; }
.progress-label { font-size: 11px; opacity: .8; white-space: nowrap; }
.progress-bar { width: 90px; height: 5px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b); border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }

/* ===== Main ===== */
.main { max-width: 1440px; margin: 0 auto; padding: 24px 28px 40px; }

/* ===== KPI ===== */
.kpi-section { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }

.kpi-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px 20px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
  animation: fadeSlideUp .45s cubic-bezier(.4,0,.2,1) both;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.kpi-card:nth-child(1)::before { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.kpi-card:nth-child(2)::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.kpi-card:nth-child(3)::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-card:nth-child(4)::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.kpi-icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 21px; height: 21px; }
.icon-stores { background: var(--primary-light); color: var(--primary); }
.icon-orders { background: var(--info-light); color: var(--info); }
.icon-staff { background: var(--success-light); color: var(--success); }
.icon-pending { background: var(--warning-light); color: var(--warning); }

.kpi-content { flex: 1; min-width: 0; }
.kpi-value { font-size: 26px; font-weight: 800; line-height: 1.15; color: var(--text); letter-spacing: -.5px; animation: countUp .4s cubic-bezier(.4,0,.2,1) both; }
.kpi-label { font-size: 12px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }
.kpi-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; line-height: 1.5; padding-top: 6px; border-top: 1px dashed var(--border-light); }
.kpi-sub b { color: var(--text-secondary); }

/* ===== Sections ===== */
.section { margin-bottom: 28px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 2px solid var(--border-light); }
.section-icon { width: 20px; height: 20px; color: var(--primary); }
.subsection-title { font-size: 14px; font-weight: 700; color: var(--text); margin: 4px 0 12px; padding-left: 10px; border-left: 4px solid var(--primary); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--border-light); }
.section-head .section-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.download-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff; border: none;
  padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; font-family: inherit;
  box-shadow: 0 2px 6px rgba(79,70,229,.28); transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.download-btn:hover { background: #4338ca; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.34); }
.download-btn:active { transform: translateY(0); }
.download-btn:disabled { background: var(--border); color: var(--text-tertiary); cursor: not-allowed; box-shadow: none; transform: none; }
.download-btn svg { width: 15px; height: 15px; }
.download-btn-sm { padding: 5px 11px; font-size: 11.5px; box-shadow: 0 1px 4px rgba(79,70,229,.22); }
.download-btn-sm svg { width: 13px; height: 13px; }

.table-scroll { max-height: 360px; overflow: auto; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
/* 滚动时表头吸顶，便于对照列名 */
.table-scroll thead th { position: sticky; top: 0; z-index: 2; }
.table-note { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; text-align: right; }
.data-table .cell-warning { color: var(--warning); font-weight: 700; }

/* ===== Metric Card ===== */
.metric-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); transition: box-shadow var(--transition), transform var(--transition); }
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metric-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.metric-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.metric-badge { font-size: 20px; font-weight: 800; color: var(--success); margin-left: auto; letter-spacing: -.3px; }
.badge-warn { color: var(--warning); }
.badge-danger { color: var(--danger); }
.metric-detail { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.5; padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm); }
.metric-detail b { color: var(--text); }

.metric-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-item { display: flex; flex-direction: column; align-items: center; padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm); min-width: 72px; flex: 1; transition: background var(--transition); }
.stat-item:hover { background: var(--primary-light); }
.stat-value { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; font-weight: 500; }

.track-badge { font-size: 12px; padding: 3px 12px; border-radius: 12px; font-weight: 700; letter-spacing: .3px; }
.track-on { background: var(--success-light); color: var(--success); }
.track-off { background: var(--danger-light); color: var(--danger); }

/* ===== Quality Summary ===== */
.quality-summary { margin-bottom: 16px; }
.quality-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.q-card { background: var(--surface); border-radius: var(--radius); padding: 18px 16px 14px; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--border); position: relative; overflow: hidden; transition: transform var(--transition), box-shadow var(--transition); }
.q-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.q-card::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 36px; height: 3px; border-radius: 0 0 3px 3px; }
.q-card:nth-child(1)::before { background: var(--primary); }
.q-card:nth-child(2)::before { background: var(--info); }
.q-card:nth-child(3)::before { background: var(--success); }
.q-card:nth-child(4)::before { background: var(--warning); }
.q-card-value { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.5px; margin-top: 4px; }
.val-good { color: var(--success); }
.val-bad { color: var(--danger); }
.q-card-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; font-weight: 600; }
.q-card-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; line-height: 1.5; padding-top: 6px; border-top: 1px dashed var(--border-light); }

/* ===== Grids ===== */
.quality-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
/* 一行两列（图表卡 + 明细卡）等高对齐：包裹层撑满行高，内部卡片填满 */
.quality-grid > div { min-width: 0; display: flex; flex-direction: column; }
.quality-grid > div > .metric-card { flex: 1 1 auto; }
.quality-grid > .metric-card { flex: 1 1 auto; }

/* ===== 洗碗机模块：同行两视图统一长宽高 + 内容内部滚动 ===== */
.dish-section .quality-grid { height: 440px; }
.dish-section .quality-grid > div { height: 100%; min-height: 0; }
.dish-section .metric-card { height: 100%; display: flex; flex-direction: column; min-height: 0; }
/* 卡片主体（图表 / 明细表 / 内嵌工程师表）填满剩余高度，超出则内部滚动。
   关键：flex-basis 用 0（而非 auto/内容高度），否则响应式图表会与容器互相撑大，导致画面持续“跳动”。 */
.dish-section .metric-card > .chart-container { flex: 1 1 0; height: auto; min-height: 0; }
.dish-section .metric-card > .table-container.table-scroll { flex: 1 1 0; min-height: 0; max-height: none; }
.dish-section .metric-card > #proactive-table-wrap,
.dish-section .metric-card > #proactive-done-table-wrap,
.dish-section .metric-card > #multi-repair-table-wrap { flex: 1 1 0; min-height: 0; display: flex; }
.dish-section #proactive-table-wrap > .table-container,
.dish-section #proactive-done-table-wrap > .table-container,
.dish-section #multi-repair-table-wrap > .table-container { flex: 1 1 0; width: 100%; min-height: 0; max-height: none; }
/* 明细卡片头部不被压缩，标题行更紧凑美观 */
.dish-section .metric-card > .metric-header { flex: 0 0 auto; }
.dish-section .metric-card > .metric-detail,
.dish-section .metric-card > .metric-stats { flex: 0 0 auto; }

/* ===== PCO 履约（餐饮/茶饮/到店异常）：同行多视图统一长宽高 + 内容内部滚动 ===== */
.pco-section .pco-row { display: grid; gap: 16px; margin-top: 16px; height: 460px; }
.pco-section .pco-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pco-section .pco-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pco-section .pco-row.cols-1 { grid-template-columns: 1fr; }
/* 整行趋势图行更矮，宽幅曲线更耐看 */
.pco-section .pco-row.row-chart { height: 320px; }
.pco-section .pco-cell { min-width: 0; display: flex; flex-direction: column; }
.pco-section .pco-cell > .metric-card { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
/* 头部/说明/指标不压缩 */
.pco-section .metric-card > .metric-header,
.pco-section .metric-card > .metric-detail,
.pco-section .metric-card > .metric-stats { flex: 0 0 auto; }
/* 卡片主体填满剩余高度，超出则内部滚动。flex-basis 用 0 防止响应式图表与容器互相撑大导致“跳动”。 */
.pco-section .metric-card > .chart-container { flex: 1 1 0; height: auto; min-height: 0; }
.pco-section .metric-card > .table-container.table-scroll { flex: 1 1 0; min-height: 0; max-height: none; }
.pco-section .metric-card > .expire-grid { flex: 1 1 0; min-height: 0; overflow: auto; align-content: start; }
.pco-section .metric-card > .empty-state { flex: 1 1 0; display: flex; align-items: center; justify-content: center; }
.pco-section .metric-card > [id$="-table-wrap"] { flex: 1 1 0; min-height: 0; display: flex; }
.pco-section [id$="-table-wrap"] > .table-container { flex: 1 1 0; width: 100%; min-height: 0; max-height: none; }
.pco-section [id$="-table-wrap"] > .empty-state { flex: 1 1 0; display: flex; align-items: center; justify-content: center; }

.completion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card-full { grid-column: 1 / -1; }
.pending-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trend-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== Charts ===== */
.chart-container { position: relative; width: 100%; height: 220px; }
.chart-sm { height: 280px; }

/* ===== Tables ===== */
.table-container { overflow-x: auto; margin-top: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-light); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: linear-gradient(180deg, #f8f9fb, #f3f4f6); padding: 10px 12px; text-align: left; font-weight: 700; color: var(--text-secondary); font-size: 11px; white-space: nowrap; border-bottom: 2px solid var(--border); letter-spacing: .5px; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .cell-danger { color: var(--danger); font-weight: 700; }
.data-table .cell-success { color: var(--success); font-weight: 700; }
.data-table .cell-total { font-weight: 700; background: #eef2ff; color: #1e293b; }

/* 冻结表格首列（人名/首列）：横向滚动时始终可见是谁的数据 */
.table-scroll .data-table th:first-child,
.table-scroll .data-table td:first-child { position: sticky; left: 0; }
.table-scroll .data-table td:first-child { z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--border); }
.table-scroll .data-table thead th:first-child { z-index: 3; box-shadow: inset -1px 0 0 var(--border); }
.table-scroll .data-table td.cell-total:first-child { background: #eef2ff; }
.table-scroll .data-table tbody tr:hover td:first-child { background: var(--primary-light); }

/* Rate bars in tables */
.rate-bar { display: flex; align-items: center; gap: 8px; }
.rate-bar-track { flex: 1; height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; min-width: 50px; }
.rate-bar-fill { height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.rate-bar-label { font-size: 12px; font-weight: 700; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Expire Grid ===== */
.expire-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-top: 8px; }
.expire-item { text-align: center; padding: 14px 8px 12px; border-radius: var(--radius-sm); background: var(--bg); transition: transform var(--transition); position: relative; overflow: hidden; }
.expire-item:hover { transform: scale(1.03); }
.expire-item::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.expire-danger::before { background: var(--danger); }
.expire-warning::before { background: var(--warning); }
.expire-normal::before { background: var(--border); }
.expire-value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.expire-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }
.expire-danger .expire-value { color: var(--danger); }
.expire-warning .expire-value { color: var(--warning); }
.expire-normal .expire-value { color: var(--text); }

/* ===== Staff ===== */
.staff-members { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.staff-tag { display: inline-flex; align-items: center; padding: 4px 12px; background: var(--primary-light); color: var(--primary); border-radius: 16px; font-size: 12px; font-weight: 600; transition: background var(--transition), transform var(--transition); }
.staff-tag:hover { background: #ddd6fe; transform: scale(1.05); }

/* ===== Alert / Empty ===== */
.alert-card { border-left: 4px solid var(--danger); background: linear-gradient(135deg, var(--surface), var(--danger-light)); }
.empty-state { text-align: center; padding: 28px 16px; color: var(--text-tertiary); font-size: 13px; background: var(--bg); border-radius: var(--radius-sm); border: 1px dashed var(--border); }

/* ===== Footer ===== */
.footer { text-align: center; padding: 20px 28px; color: var(--text-tertiary); font-size: 11px; border-top: 1px solid var(--border-light); margin-top: 12px; }

/* ===== Scrollbar ===== */
.table-container::-webkit-scrollbar { height: 6px; }
.table-container::-webkit-scrollbar-track { background: var(--bg); border-radius: 3px; }
.table-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .kpi-section { grid-template-columns: repeat(2, 1fr); }
  .quality-cards { grid-template-columns: repeat(2, 1fr); }
  .trend-grid { grid-template-columns: 1fr 1fr; }
  /* 中屏：三列过挤，降为两列，行高改由每格自撑 */
  .pco-section .pco-row.cols-3 { grid-template-columns: 1fr 1fr; height: auto; }
  .pco-section .pco-row.cols-3 .pco-cell { height: 440px; }
}
@media (max-width: 768px) {
  .header { padding: 10px 16px; }
  .main { padding: 16px 12px; }
  .kpi-section { grid-template-columns: 1fr; }
  .quality-cards, .quality-grid, .completion-grid, .pending-grid, .trend-grid { grid-template-columns: 1fr; }
  .card-full { grid-column: auto; }
  .expire-grid { grid-template-columns: repeat(3, 1fr); }
  /* 移动端单列堆叠：行高改由单卡片承担，避免两卡挤在一个固定行高里 */
  .dish-section .quality-grid { height: auto; }
  .dish-section .quality-grid > div { height: 380px; }
  .pco-section .pco-row.cols-2, .pco-section .pco-row.cols-3 { grid-template-columns: 1fr; height: auto; }
  .pco-section .pco-cell { height: 380px; }
}

/* ===== 登录 / 权限 ===== */
.login-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); }
.login-card { width: 360px; max-width: 90vw; background: #fff; border-radius: 18px; padding: 40px 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center; }
.login-logo { font-size: 24px; font-weight: 800; color: #1f2937; letter-spacing: 1px; }
.login-sub { margin-top: 8px; font-size: 14px; color: #6b7280; }
#login-form { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.login-input { height: 48px; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 0 16px; font-size: 16px; outline: none; transition: border-color .15s; letter-spacing: 1px; }
.login-input:focus { border-color: var(--primary, #4f46e5); }
.login-btn { height: 48px; border: none; border-radius: 10px; background: var(--primary, #4f46e5); color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 4px; cursor: pointer; transition: filter .15s; }
.login-btn:hover { filter: brightness(1.07); }
.login-btn:disabled { cursor: wait; opacity: .65; filter: none; letter-spacing: 1px; }
.login-error { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--danger, #ef4444); }
.login-tip { margin-top: 6px; font-size: 12px; color: #9ca3af; }
.header-user { font-size: 13px; color: var(--text, #1f2937); font-weight: 700; }
.logout-btn { border: 1px solid var(--border, #e5e7eb); background: #fff; color: #6b7280; border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; transition: all .15s; }
.logout-btn:hover { color: var(--danger, #ef4444); border-color: var(--danger, #ef4444); }

/* ===== 业务分析总结 ===== */
.ai-tag { display: inline-flex; align-items: center; margin-left: 10px; padding: 2px 10px; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-light, #eef2ff); border-radius: 999px; letter-spacing: .3px; }
.analysis-card { border-left: 4px solid var(--primary); }
.analysis-card.a-border-bad { border-left-color: var(--danger); }
.analysis-card.a-border-warn { border-left-color: var(--warning); }
.analysis-card.a-border-good { border-left-color: var(--success); }
.analysis-verdict { font-size: 15px; line-height: 1.7; color: var(--text, #1f2937); margin-bottom: 14px; }
.analysis-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.a-chip { display: inline-flex; flex-direction: column; gap: 2px; padding: 7px 12px; border-radius: 10px; min-width: 92px; border: 1px solid var(--border); }
.a-chip-label { font-size: 11px; color: #6b7280; }
.a-chip-val { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.a-chip.a-good { background: var(--success-light); border-color: transparent; }
.a-chip.a-good .a-chip-val { color: var(--success); }
.a-chip.a-warn { background: var(--warning-light); border-color: transparent; }
.a-chip.a-warn .a-chip-val { color: var(--warning); }
.a-chip.a-bad { background: var(--danger-light); border-color: transparent; }
.a-chip.a-bad .a-chip-val { color: var(--danger); }
.a-chip.a-info { background: #f4f6f8; border-color: transparent; }
.a-chip.a-info .a-chip-val { color: #374151; }
.person-filter { margin-left: auto; font-size: 12px; padding: 3px 26px 3px 9px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #374151; max-width: 150px; cursor: pointer; outline: none; }
.person-filter:hover { border-color: var(--primary); }
.person-filter:focus { border-color: var(--primary); }
.analysis-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.analysis-block-title { font-size: 13px; font-weight: 800; color: var(--text, #1f2937); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.analysis-list { margin: 0; padding-left: 18px; }
.analysis-list li { font-size: 13px; line-height: 1.75; color: #4b5563; margin-bottom: 6px; }
.analysis-list b { color: var(--text, #1f2937); font-weight: 700; }
.analysis-block { margin-top: 16px; }
.analysis-cols + .analysis-block { margin-top: 18px; }
.a-chip.a-click { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.a-chip.a-click:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.10); }
/* 重点关注指标列表 */
.focus-list { display: flex; flex-direction: column; gap: 8px; }
.focus-item { border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; padding: 10px 14px; cursor: pointer; transition: background .12s, transform .12s; }
.focus-item:hover { background: #f9fafb; transform: translateX(2px); }
.focus-item.focus-bad { border-left-color: var(--danger); }
.focus-item.focus-warn { border-left-color: var(--warning); }
.focus-head { display: flex; align-items: center; gap: 10px; }
.focus-name { font-size: 14px; font-weight: 700; color: var(--text, #1f2937); }
.focus-val { font-size: 14px; font-weight: 800; }
.focus-bad .focus-val { color: var(--danger); }
.focus-warn .focus-val { color: var(--warning); }
.focus-go { margin-left: auto; font-size: 12px; color: var(--primary, #4f46e5); font-weight: 700; }
.focus-people { margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: #4b5563; }
.focus-people > span { display: block; margin-bottom: 4px; font-size: 11.5px; color: #9ca3af; }
.rk-list { display: flex; flex-wrap: wrap; gap: 6px; }
.rk-person { display: inline-flex; align-items: center; gap: 5px; background: #f3f4f6; border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; }
.rk-person b { font-weight: 700; color: #1f2937; }
.rk { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.rk-red { background: var(--danger-light); color: var(--danger); }
.rk-orange { background: #fff1e6; color: #c2410c; }
.rk-amber { background: var(--warning-light); color: #b45309; }
.rk-gray { background: #eef1f5; color: #64748b; }
.rk-green { background: var(--success-light); color: var(--success); }
/* 业务分析总结：分层结构（洗碗机 / PCO -> 子项 -> 指标） */
.ana-group + .ana-group { margin-top: 22px; }
.ana-group-title { font-size: 15px; font-weight: 800; color: var(--text, #1f2937); padding-bottom: 8px; margin-bottom: 12px; border-bottom: 2px solid var(--border); }
.ana-sub { margin-bottom: 14px; }
.ana-sub-title { font-size: 13.5px; font-weight: 800; color: var(--primary); margin: 12px 0 8px; }
.ana-metric { border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
.ana-metric.ana-bad { border-left-color: var(--danger); }
.ana-metric.ana-warn { border-left-color: var(--warning); }
.ana-metric.ana-good { border-left-color: var(--success); }
.ana-metric.ana-info { border-left-color: var(--border); }
.ana-metric-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ana-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: 0 0 auto; }
.ana-bad .ana-dot { background: var(--danger); }
.ana-warn .ana-dot { background: var(--warning); }
.ana-good .ana-dot { background: var(--success); }
.ana-metric-name { font-size: 14px; font-weight: 700; color: var(--text, #1f2937); }
.ana-metric-val { font-size: 14px; font-weight: 800; }
.ana-bad .ana-metric-val { color: var(--danger); }
.ana-warn .ana-metric-val { color: var(--warning); }
.ana-good .ana-metric-val { color: var(--success); }
.ana-info .ana-metric-val { color: #374151; }
.ana-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.ana-tag-bad { background: var(--danger-light); color: var(--danger); }
.ana-tag-warn { background: var(--warning-light); color: #b45309; }
.ana-tag-good { background: var(--success-light); color: var(--success); }
.ana-tag-info { background: #eef1f5; color: #64748b; }
.ana-jump { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-light); border: none; border-radius: 8px; padding: 5px 11px; cursor: pointer; transition: background .12s, transform .12s; }
.ana-jump:hover { transform: translateY(-1px); background: #e0e7ff; }
.ana-metric-note { font-size: 13px; line-height: 1.7; color: #4b5563; margin-top: 6px; }
.ana-metric-note b { color: var(--text, #1f2937); font-weight: 700; }
.ana-people { margin-top: 7px; display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ana-people-label { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; flex: 0 0 auto; margin-top: 2px; }
.pl-weak { background: var(--danger-light); color: var(--danger); }
.pl-good { background: var(--success-light); color: var(--success); }
.ana-empty { font-size: 12.5px; color: #9ca3af; padding: 4px 2px; }
.analysis-list li.prob-click { cursor: pointer; }
.analysis-list li.prob-click:hover { color: var(--primary, #4f46e5); text-decoration: underline dotted; }
/* 跳转高亮 */
.flash-highlight { animation: flashHi 1.8s ease; border-radius: 12px; }
@keyframes flashHi {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); }
  15% { box-shadow: 0 0 0 4px rgba(79,70,229,.45); }
  60% { box-shadow: 0 0 0 4px rgba(79,70,229,.20); }
}
@media (max-width: 900px) {
  .analysis-cols { grid-template-columns: 1fr; gap: 16px; }
}

/* ===== Tabs & Views ===== */
.tab-nav {
  position: sticky; top: 60px; z-index: 90;
  display: flex; gap: 4px; align-items: center;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 28px; box-shadow: var(--shadow);
}
.tab-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  padding: 13px 18px; border-bottom: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn svg { width: 17px; height: 17px; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.tab-active { color: var(--primary); border-bottom-color: var(--primary); }
.view { display: none; animation: fadeSlideUp .35s cubic-bezier(.4,0,.2,1) both; }
.view.view-active { display: block; }

/* ===== Home 左侧目录导航 ===== */
#view-home.view-active { display: flex; align-items: flex-start; gap: 20px; }
.home-body { flex: 1 1 auto; min-width: 0; }
.home-body > section, .home-body > .kpi-section { scroll-margin-top: 120px; }
/* 二级/三级导航跳转目标（子标题、指标卡）避免被顶部吸附栏遮挡 */
.subsection-title, .metric-card[id], [id^="repair-rate-section"], [id^="basket-repair-section"] { scroll-margin-top: 120px; }
.home-nav {
  position: sticky; top: 112px; align-self: flex-start;
  flex: 0 0 200px; width: 200px;
  max-height: calc(100vh - 132px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 8px; box-shadow: var(--shadow);
}
.home-nav-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 2px 10px 8px; letter-spacing: .3px; }
.home-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 1px 0; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; user-select: none; transition: background var(--transition), color var(--transition);
}
.home-nav-item .hn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex: 0 0 auto; transition: background var(--transition); }
.home-nav-item:hover { background: var(--primary-light); color: var(--primary); }
.home-nav-item.is-active { background: var(--primary-light); color: var(--primary); }
.home-nav-item.is-active .hn-dot { background: var(--primary); }
/* 层级：一级 / 二级 / 三级 */
.home-nav-item.hn-l1 { font-size: 13px; font-weight: 700; }
.home-nav-item.hn-l2 { font-size: 12.5px; font-weight: 600; padding-left: 22px; }
.home-nav-item.hn-l2 .hn-dot { width: 6px; height: 6px; }
.home-nav-item.hn-l3 { font-size: 12px; font-weight: 500; padding-left: 36px; color: var(--text-secondary); }
.home-nav-item.hn-l3 .hn-dot { width: 5px; height: 5px; }
@media (max-width: 1180px) {
  #view-home.view-active { display: block; }
  .home-nav { display: none; }
}

/* ===== Home month toolbar ===== */
.home-toolbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 20px; box-shadow: var(--shadow);
}

/* ===== Orders toolbar / filters ===== */
.orders-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.of-group { display: flex; flex-direction: column; gap: 5px; }
.of-label { font-size: 11px; font-weight: 600; color: var(--text-tertiary); letter-spacing: .3px; }
.of-seg { display: inline-flex; background: var(--border-light); border-radius: 9px; padding: 3px; }
.of-seg button {
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  padding: 6px 16px; border-radius: 7px; transition: all var(--transition);
}
.of-seg button.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.of-input, .of-select {
  font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 12px; min-width: 130px; cursor: pointer;
}
.of-input:focus, .of-select:focus { outline: none; border-color: var(--primary); }
.of-summary { margin-left: auto; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; text-align: right; }
.of-summary b { color: var(--primary); font-size: 15px; }
.of-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.orders-cap { display: flex; align-items: center; gap: 6px; }
.orders-cap input { width: 56px; }

/* ===== 执行评价 · 关键异常 ===== */
.orders-eval:empty { display: none; }
.oe-wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.oe-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; }
.oe-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.oe-title::before { content: ''; width: 4px; height: 15px; border-radius: 3px; background: var(--primary); }
.oe-block:nth-child(2) .oe-title::before { background: var(--warning); }
.oe-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.oe-table th { text-align: right; font-weight: 600; color: var(--text-tertiary); padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.oe-table th:first-child { text-align: left; }
.oe-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); white-space: nowrap; }
.oe-table tbody tr:last-child td { border-bottom: none; }
.oe-name { text-align: left !important; font-weight: 700; color: var(--text); }
.oe-rq { font-weight: 700; }
.oe-rq.ok { color: #059669; } .oe-rq.warn { color: var(--warning); } .oe-rq.bad { color: var(--danger); }
.oe-c-act { color: #c2410c; font-weight: 700; } .oe-c-blk { color: var(--danger); font-weight: 700; }
.oe-c-warn { color: var(--warning); font-weight: 700; } .oe-c-mute { color: var(--text-tertiary); }
.oe-note { margin-top: 9px; font-size: 11px; color: var(--text-tertiary); line-height: 1.5; }
.oe-anom { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.oe-anom li { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.oe-anom li b { color: var(--text); }
.oe-good { color: #059669 !important; font-weight: 600; }
.oe-tag { display: inline-block; margin-right: 7px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.oe-tag.bad { background: var(--danger-light); color: var(--danger); }
.oe-tag.blk { background: var(--danger-light); color: #b91c1c; }
.oe-tag.warn { background: var(--warning-light); color: var(--warning); }
@media (max-width: 900px) { .oe-wrap { grid-template-columns: 1fr; } }

/* ===== Map layout ===== */
.orders-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.orders-side {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; max-height: 660px; overflow-y: auto;
}
.side-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 12px 14px 8px; position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border-light); }
.day-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; cursor: pointer; border-left: 3px solid transparent;
  transition: background var(--transition); border-bottom: 1px solid var(--border-light);
}
.day-item .di-flags { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.day-item .di-flag { font-size: 10px; font-weight: 700; border-radius: 6px; padding: 1px 6px; line-height: 1.6; white-space: nowrap; }
.day-item .di-flag.flag-am { color: #9a3412; background: #ffedd5; }
.day-item .di-flag.flag-pm { color: #92400e; background: #fef3c7; }
.day-item .di-flag.flag-low { color: #b91c1c; background: #fee2e2; }
.day-item .di-flag.flag-night { color: #3730a3; background: #e0e7ff; }
/* ---- 工单计划：日历/日列表/停靠卡 ---- */
.day-item.plan-item { flex-direction: column; align-items: stretch; gap: 6px; }
.day-item.plan-item .pi-head { display: flex; align-items: center; gap: 8px; }
.day-item.plan-item .pi-rate { margin-left: auto; font-size: 11px; font-weight: 700; }
.day-item .pi-nums { display: flex; flex-wrap: wrap; gap: 6px; }
.day-item .pi-n { font-size: 11px; font-weight: 600; color: var(--text-secondary); background: var(--bg-subtle, #f1f5f9); border-radius: 6px; padding: 1px 6px; }
.pi-on { color: #16a34a; } .pi-off { color: #d97706; } .pi-miss { color: #64748b; }
.pr-good { color: #16a34a; } .pr-warn { color: #d97706; } .pr-bad { color: #dc2626; }
.cal-cell .cc-plan { font-size: 10.5px; margin-top: 2px; display: flex; gap: 5px; flex-wrap: wrap; }
.cal-cell .cc-rate { font-size: 10.5px; font-weight: 700; margin-top: 2px; }
.plan-tag { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; border-radius: 5px; padding: 0 6px; margin-left: 6px; vertical-align: middle; }
.day-item:hover { background: var(--border-light); }
.day-item.on { background: var(--primary-light); border-left-color: var(--primary); }
.day-item .di-date { font-size: 13px; font-weight: 600; color: var(--text); }
.day-item .di-week { font-size: 11px; color: var(--text-tertiary); margin-left: 4px; font-weight: 500; }
.day-item .di-count { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-light); border-radius: 20px; padding: 2px 9px; }
.orders-main { min-width: 0; }
.order-map { height: 560px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; z-index: 1; }
.orders-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; }
.leg-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.leg-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Map markers */
.om-marker {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.35); font-weight: 800; font-size: 12px; color: #fff;
}
.om-marker span { transform: rotate(45deg); }
.om-pop b { font-size: 13px; }
.om-pop .pp-row { font-size: 12px; color: #4b5563; margin-top: 3px; }

/* Legend: 顺路口径（统一「工程师评价」）*/
.leg-sep { width: 1px; height: 14px; background: var(--border); margin: 0 2px; }
.leg-line { width: 18px; height: 0; flex-shrink: 0; }
.leg-line.actual { border-top: 3px solid #2563eb; }
.leg-line.suggest { border-top: 2px dashed #16a34a; }
.leg-flag { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; background: #fff; font-size: 11px; font-weight: 900; line-height: 1; display: flex; align-items: center; justify-content: center; }
.leg-flag.actionable { border: 2px solid #f97316; color: #c2410c; }
.leg-flag.blocked { border: 2px solid #dc2626; color: #b91c1c; }

/* 顺路候选 marker（橙=可顺路，红=无法顺路）*/
.om-cand {
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  font-weight: 900; font-size: 15px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.om-cand.actionable { border: 2px solid #f97316; color: #c2410c; }
.om-cand.blocked { border: 2px solid #dc2626; color: #b91c1c; }

/* 实际路线相邻两点之间的距离标注 */
.om-dist {
  display: inline-block; padding: 1px 5px; border-radius: 8px; white-space: nowrap;
  font-size: 11px; font-weight: 700; line-height: 14px; color: #1d4ed8;
  background: rgba(255,255,255,.9); border: 1px solid #bfdbfe;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* 路线顺路执行 banner */
.sug-banner { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0 4px; }
.sug-title { font-size: 13px; font-weight: 800; color: #15803d; margin-bottom: 6px; }
.sug-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.sug-chip { font-size: 12px; border-radius: 14px; padding: 2px 10px; display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); }
.sug-chip.actionable { color: #9a3412; border-color: #fdba74; background: #fff7ed; }
.sug-chip.blocked { color: #991b1b; border-color: #fca5a5; background: #fef2f2; }
.sug-chip .sug-km { font-size: 10.5px; font-weight: 700; opacity: .8; }

.di-sug { font-size: 11px; font-weight: 800; color: #9a3412; background: #ffedd5; border-radius: 10px; padding: 1px 6px; margin-right: 5px; }
.cc-sug { font-size: 10px; font-weight: 800; color: #9a3412; background: #ffedd5; border-radius: 8px; padding: 0 4px; margin-right: 3px; }

/* Efficiency banner (arrived) */
.eff-banner { background: #fff8ec; border: 1px solid #f9d38a; border-radius: var(--radius-sm); padding: 10px 14px; margin: 14px 0 4px; }
.eff-title { font-size: 13px; font-weight: 800; color: #b45309; margin-bottom: 6px; }
.eff-line { font-size: 12.5px; color: #7c4a11; line-height: 1.7; }
.eff-line b { color: #92400e; }

/* Stop flags */
.stop-flag { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: middle; }
.stop-flag.detour { color: #b45309; background: #fef3c7; }
.stop-flag.over { color: #b91c1c; background: #fee2e2; }
.stop-card.bad-detour { border-color: #f9d38a; background: #fffdf7; }
.stop-card.bad-over { border-color: #f6b4b4; background: #fffbfb; }

/* Warning badges */
.di-warn { font-size: 11px; font-weight: 800; color: #b45309; background: #fef3c7; border-radius: 10px; padding: 1px 6px; margin-right: 5px; }
.cc-warn { font-size: 10px; font-weight: 800; color: #b45309; background: #fef3c7; border-radius: 8px; padding: 0 4px; margin-right: 3px; }
.cal-cell.has-warn { border-color: #f9d38a; }

.orders-stops { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.stop-card {
  display: flex; align-items: flex-start; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; box-shadow: var(--shadow);
}
.stop-seq { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stop-body { min-width: 0; }
.stop-store { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
.stop-meta.stop-meta-sub { font-size: 11px; color: var(--text-quaternary, #9aa1ab); }

/* ===== Calendar ===== */
.order-calendar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; overflow: hidden;
}
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-tertiary); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 92px; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 6px 7px; background: #fbfbfd; display: flex; flex-direction: column; gap: 4px;
  transition: all var(--transition);
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.has { cursor: pointer; background: var(--surface); }
.cal-cell.has:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary); }
.cal-cell.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.cal-cell.today .cc-day { color: var(--primary); }
.cc-day { font-size: 12px; font-weight: 700; color: var(--text-secondary); display: flex; justify-content: space-between; align-items: center; }
.cc-total { font-size: 11px; font-weight: 800; color: #fff; background: var(--primary); border-radius: 10px; padding: 1px 7px; }
.cc-bars { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cc-bar { height: 6px; border-radius: 3px; min-width: 6px; flex: 1; }
.cc-eng { font-size: 10.5px; color: var(--text-tertiary); line-height: 1.4; overflow: hidden; }
.cal-weekend { background: #f7f8fb; }

.cal-day-detail { margin-top: 16px; }
.cal-dd-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.cal-dd-title .go-map { font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer; background: var(--primary-light); padding: 4px 12px; border-radius: 8px; }

.orders-empty { padding: 60px 20px; text-align: center; color: var(--text-tertiary); font-size: 14px; }

@media (max-width: 900px) {
  .orders-layout { grid-template-columns: 1fr; }
  .orders-side { max-height: 220px; }
  .tab-nav { top: 56px; padding: 0 12px; overflow-x: auto; }
  .of-summary { margin-left: 0; width: 100%; text-align: left; }
}
