/* 库存看板样式 */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #1f2937;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #1e40af;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topbar h1 { font-size: 20px; margin: 0; }

.actions { display: flex; gap: 12px; }

.upload-btn,
.ghost-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.upload-btn {
  background: #fff;
  color: #1e40af;
  font-weight: 500;
}

.upload-btn:hover { background: #f0f4ff; }

.ghost-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.ghost-btn:hover { background: rgba(255, 255, 255, 0.1); }

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ============ 首页全局控件栏 ============ */
.global-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.control-group.right { margin-left: auto; }
.control-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}
.control-range-text {
  font-size: 12px;
  color: #4b5563;
  font-family: ui-monospace, monospace;
}
.sales-status-mini {
  font-size: 12px;
  color: #6b7280;
  padding: 4px 10px;
  background: #f3f4f6;
  border-radius: 12px;
}

/* ============ 一级品类 tab ============ */
.category-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.category-tab {
  padding: 10px 24px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.15s;
}
.category-tab:hover { border-color: #1e40af; color: #1e40af; }
.category-tab.active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}

/* ============ 子分类 tab ============ */
.subcat-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: #f9fafb;
  border-left: 2px solid #1e40af;
  border-radius: 0 6px 6px 0;
  margin-bottom: 16px;
}
.subcat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.subcat-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-right: 6px;
  min-width: 48px;
}
.subcat-tab {
  padding: 5px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.subcat-tab:hover { border-color: #1e40af; color: #1e40af; }
.subcat-tab.active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}
.subcat-tab .color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ============ 模块入口卡片 ============ */
.module-entries {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.module-entries h2 { margin: 0 0 16px; font-size: 16px; color: #1f2937; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.module-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  color: #1f2937;
  transition: all 0.2s;
}
.module-card:hover {
  border-color: #1e40af;
  background: #f0f4ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.1);
}
.module-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.module-icon { font-size: 28px; }
.module-title { font-size: 15px; font-weight: 600; color: #1e40af; }
.module-desc { font-size: 12px; color: #6b7280; line-height: 1.5; }

.kpi-card .label { color: #6b7280; font-size: 13px; }
.kpi-card .value { font-size: 24px; font-weight: 600; margin-top: 6px; color: #111827; }

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
}

.chart-card,
.table-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chart-card h2,
.table-card h2 { font-size: 16px; margin: 0 0 12px; color: #1f2937; }

.chart { width: 100%; height: 360px; }

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#tableFilter {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  width: 240px;
}

.table-wrap { overflow-x: auto; max-height: 480px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th { background: #f9fafb; font-weight: 600; color: #4b5563; position: sticky; top: 0; }

td.numeric { text-align: right; font-variant-numeric: tabular-nums; }

td.empty { text-align: center; color: #9ca3af; padding: 40px 0; }

.footer {
  text-align: center;
  padding: 16px;
  color: #6b7280;
  font-size: 12px;
}

.footer .dot { margin: 0 8px; }

/* ============== 色系看板（color-dashboard.html）============== */

.topbar-left { display: flex; align-items: center; gap: 16px; }

.back-link {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  transition: background 0.2s;
}
.back-link:hover { background: rgba(255, 255, 255, 0.15); }

.link-out {
  display: inline-block;
  margin-left: 12px;
  padding: 4px 10px;
  background: #fff;
  color: #1e40af;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.2s;
}
.link-out:hover { background: #f0f4ff; }

.heatmap-card { padding: 20px; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 16px; color: #1f2937; }

.legend-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.legend-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.chip-0    { background: #fee2e2; color: #991b1b; }
.chip-low  { background: #fef3c7; color: #92400e; }
.chip-mid  { background: #bbf7d0; color: #166534; }
.chip-high { background: #16a34a; color: #fff; }

.type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.type-tab {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.type-tab:hover { border-color: #1e40af; color: #1e40af; }
.type-tab.active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}

.tab-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}

.chart-tall { height: 460px; }

.kpi-warn .value { color: #b91c1c; }
.kpi-gray { background: #f3f4f6; }
.kpi-gray .label { color: #6b7280; }
.kpi-gray .value { color: #4b5563; }

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.locs { font-size: 12px; color: #4b5563; }
.loc-zero { color: #dc2626; font-weight: 500; }

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  color: #1f2937;
}

/* ============== 密码门（password.html）============== */

body.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  padding: 20px;
}

.auth-wrap {
  width: 100%;
  max-width: 380px;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.auth-logo {
  font-size: 28px;
  font-weight: 600;
  color: #1e40af;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 18px;
  margin: 0 0 4px;
  color: #111827;
}

.auth-hint {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 20px;
}

.auth-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-card input[type="password"]:focus {
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.auth-submit {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: #1e40af;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-submit:hover { background: #1e3a8a; }
.auth-submit:disabled { background: #9ca3af; cursor: not-allowed; }

.auth-error {
  color: #dc2626;
  font-size: 13px;
  margin: 12px 0 0;
  min-height: 1em;
}

.auth-tip {
  color: #9ca3af;
  font-size: 12px;
  margin: 18px 0 0;
}
