/* ============================================================
 * 工商业电价查看器 · 样式（tariff-view.js 配套）
 * 2026-10-28
 * ============================================================ */
.tv-btn {
  display: inline-flex; align-items: center; gap: 5px;
  grid-column: 1 / -1; justify-self: start;
  margin-top: 4px; padding: 5px 11px;
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: #1B6FE0; background: #F2F7FF;
  border: 1px solid #C7DCFB; border-radius: 8px;
  cursor: pointer; transition: background .18s, border-color .18s;
  white-space: nowrap;
}
.tv-btn:hover { background: #E4EFFF; border-color: #9CC2F5; }
.tv-btn .tv-ic { font-size: 13px; }

.tv-hours {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  grid-column: 1 / -1;
  margin-top: 6px; font-size: 12px; color: #64748B; line-height: 1.6;
  min-width: 0;
}
.tv-hours b { color: #0A2540; font-weight: 700; }
.tv-hours .tv-hchip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  background: #F4F8FC; border: 1px solid #E3EAF2;
  white-space: nowrap; flex: none;
}
.tv-hours .tv-hchip.pv { background: #FFF7EC; border-color: #FFE0BC; }
.tv-hours .tv-hchip.wind { background: #EFF8FF; border-color: #CDE7FB; }
.tv-hours .tv-hint { color: #93A5B8; font-size: 11.5px; white-space: nowrap; }

/* 测算结果区的「h/年」小标注 */
.tv-h-inline { color: #8296AB; font-weight: 600; white-space: nowrap; }

/* ---- 弹窗 ---- */
.tv-mask {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(8, 24, 40, .48);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow: auto;
}
.tv-mask[hidden] { display: none; }

.tv-modal {
  width: min(760px, 100%); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 70px rgba(6, 25, 43, .32);
  font-family: inherit; color: #0E1F2E;
}

.tv-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 14px;
  background: linear-gradient(96deg, #0A2540, #14456F);
  color: #fff; border-radius: 16px 16px 0 0;
}
.tv-head h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.tv-head p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; color: #B9D2EA; }
.tv-close {
  margin-left: auto; flex: none;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.12); color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
}
.tv-close:hover { background: rgba(255,255,255,.24); }

.tv-body { padding: 16px 20px 22px; }

.tv-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.tv-meta > div {
  background: #F7FAFD; border: 1px solid #E6EEF7; border-radius: 10px;
  padding: 8px 11px; font-size: 12px; color: #64748B; line-height: 1.5;
}
.tv-meta b { display: block; font-size: 14px; color: #0A2540; margin-top: 2px; }

.tv-sec-title {
  display: flex; align-items: center; gap: 7px;
  margin: 16px 0 8px; font-size: 13px; font-weight: 700; color: #0A2540;
}
.tv-sec-title::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px; background: #1B6FE0;
}
.tv-sec-title span { font-weight: 500; color: #8296AB; font-size: 11.5px; }

/* 24 小时格子 */
.tv-grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px;
}
.tv-cell {
  border-radius: 7px; padding: 5px 3px 4px; text-align: center;
  border: 1px solid #E6EEF7; background: #FBFDFF; line-height: 1.25;
}
.tv-cell .tv-h { font-size: 10.5px; color: #8296AB; font-variant-numeric: tabular-nums; }
.tv-cell .tv-p { font-size: 11.5px; font-weight: 700; margin: 1px 0; font-variant-numeric: tabular-nums; }
.tv-cell .tv-s { font-size: 10px; font-weight: 600; }
.tv-cell.s-sharp { background: #FEF2F2; border-color: #FBD5D5; }
.tv-cell.s-peak  { background: #FFF7ED; border-color: #FDE0C2; }
.tv-cell.s-flat  { background: #F3F8FF; border-color: #D6E6FB; }
.tv-cell.s-valley{ background: #F0FDF6; border-color: #CBEEDC; }
.tv-cell.s-deep  { background: #F6F3FF; border-color: #E0D6FA; }

/* 汇总表 */
.tv-sum { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tv-sum th, .tv-sum td {
  padding: 7px 9px; border-bottom: 1px solid #EDF3F9; text-align: right;
  font-variant-numeric: tabular-nums;
}
.tv-sum th { background: #F7FAFD; color: #64748B; font-weight: 600; font-size: 11.5px; }
.tv-sum th:first-child, .tv-sum td:first-child { text-align: left; }
.tv-sum tbody tr:last-child td { border-bottom: 0; }
.tv-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px;
}

.tv-note {
  margin-top: 14px; padding: 10px 12px;
  background: #F7FAFD; border: 1px solid #E6EEF7; border-left: 3px solid #FFA033;
  border-radius: 8px; font-size: 11.5px; line-height: 1.75; color: #64748B;
}
.tv-note b { color: #0E1F2E; }

.tv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tv-tag {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: #F2F7FF; border: 1px solid #D6E6FB; color: #1B6FE0;
}
.tv-tag b { color: #0A2540; }

@media (max-width: 640px) {
  .tv-grid { grid-template-columns: repeat(6, 1fr); }
  .tv-head { padding: 15px 15px 12px; }
  .tv-body { padding: 13px 14px 18px; }
  .tv-modal { border-radius: 14px; }
  .tv-head { border-radius: 14px 14px 0 0; }
  .tv-sum { font-size: 12px; }
  .tv-sum th, .tv-sum td { padding: 6px 5px; }
  /* 时段名 / 时长 / 电价 不折行，只有「时间范围」允许换行 */
  .tv-sum th:nth-child(1), .tv-sum td:nth-child(1),
  .tv-sum th:nth-child(2), .tv-sum td:nth-child(2),
  .tv-sum th:nth-child(4), .tv-sum td:nth-child(4) { white-space: nowrap; }
  .tv-sum td:nth-child(4) { font-size: 11.5px; }
  .tv-hours .tv-hint { display: none; }
}

@media print {
  .tv-mask { position: static; background: #fff; padding: 0; }
  .tv-close { display: none; }
  .tv-modal { box-shadow: none; max-height: none; width: 100%; }
}
