/* 河南心连心化工 PoC - 前端样式
   调性：稳重 / B2B / 化工行业
   配色：暖白底 + 钢蓝主色 + 旺季橙强调
*/

:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --line: #e6e3da;
  --line-soft: #f0ede4;
  --text: #14171e;
  --body: #3a4256;
  --muted: #7c7a72;
  --primary: #1b4d8e;
  --primary-soft: rgba(27, 77, 142, 0.08);
  --primary-line: rgba(27, 77, 142, 0.2);
  --peak: #d97706;
  --peak-soft: rgba(217, 119, 6, 0.12);
  --warning: #c97b3f;
  --warning-soft: rgba(201, 123, 63, 0.08);
  --danger: #b06367;
  --positive: #2f6f5e;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ Topbar ============ */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.badge-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.countdown {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.countdown-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.countdown-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.contact {
  font-size: 12.5px;
  color: var(--muted);
}

/* ============ Layout ============ */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: calc(100vh - 56px - 36px);
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-item:hover {
  background: var(--line-soft);
  text-decoration: none;
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.info-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  gap: 8px;
}
.info-line span { color: var(--muted); }
.info-line strong { color: var(--text); font-weight: 500; }
.peak { color: var(--peak) !important; }
.status-ok { color: var(--positive) !important; }

/* ============ Main ============ */
.main {
  padding: 28px 36px;
  max-width: 1200px;
}
.view { display: none; }
.view.active { display: block; }
.view-header { margin-bottom: 24px; }
.view-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.view-subtitle {
  font-size: 13.5px;
  color: var(--muted);
}

/* ============ Stat grid ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.2;
}
.stat-trend {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* ============ Card ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.muted { color: var(--muted); font-size: 12.5px; }

/* ============ Alert ============ */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}
.alert-warn {
  background: var(--warning-soft);
  border-left: 3px solid var(--warning);
  color: #6e3f1c;
}
.alert strong { font-weight: 600; }

/* ============ Assumption list ============ */
.assumption-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.assumption-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  font-size: 13.5px;
  color: var(--body);
}
.assumption-list li::before {
  content: "▸";
  color: var(--primary);
  font-weight: 600;
  flex-shrink: 0;
}

/* ============ Chart ============ */
.chart-container {
  min-height: 220px;
  padding: 8px 0;
}
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.chart-bar .bar {
  flex: 1;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  position: relative;
  transition: opacity 0.15s;
  opacity: 0.85;
}
.chart-bar .bar:hover { opacity: 1; }
.chart-bar .bar.forecast { background: var(--peak); }
.chart-bar .bar.peak { background: var(--peak); }
.chart-labels {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.chart-labels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ============ Filter bar ============ */
.filter-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-wrap: wrap;
}
.filter-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--body);
}
.filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn-primary, .btn-secondary {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: #163d72; }
.btn-secondary {
  background: var(--surface);
  color: var(--body);
  border-color: var(--line);
}
.btn-secondary:hover { background: var(--line-soft); }

/* ============ Table ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.02em;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--body);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.priority-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.priority-p0 { background: rgba(176, 99, 103, 0.12); color: var(--danger); }
.priority-p1 { background: var(--peak-soft); color: var(--peak); }
.priority-p2 { background: var(--primary-soft); color: var(--primary); }
.tag-peak {
  display: inline-block;
  background: var(--peak-soft);
  color: var(--peak);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}

/* ============ Data summary ============ */
.data-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.data-summary .item {
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line-soft);
}
.data-summary .item-label {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.data-summary .item-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============ Footer ============ */
.footer {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .data-summary { grid-template-columns: 1fr; }
}
