.gold-section-head {
  align-items: center;
}

.gold-refresh-btn {
  flex-shrink: 0;
}

.gold-live-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  gap: 12px;
  margin-bottom: 14px;
}

.gold-live-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.gold-live-metrics article,
.gold-live-status {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.48);
}

.gold-live-metrics article {
  padding: 12px;
}

.gold-live-metrics strong {
  display: block;
  font-family: var(--font-number);
  font-size: 24px;
  line-height: 1;
}

.gold-live-metrics span,
.gold-live-status span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.gold-live-status {
  padding: 12px;
}

.gold-live-status strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
}

.promotion-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.fetch-state {
  margin: 18px 0 0;
  font-weight: 700;
}

.fetch-state.loading {
  color: var(--brand-deep);
}

.fetch-state.success {
  color: #20663b;
}

.fetch-state.error {
  color: #9e3b28;
}

.history-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.history-panel,
.history-sidecard {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
}

.history-panel,
.history-sidecard {
  padding: 22px;
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(140px, 180px));
  gap: 14px;
  margin-bottom: 18px;
}

.history-field {
  display: grid;
  gap: 8px;
}

.history-field span,
.history-summary dt {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
}

.history-chart-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(249, 240, 227, 0.72));
}

.history-chart {
  position: relative;
  min-height: 180px;
  padding: 18px;
}

.history-chart.empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.history-chart-head strong {
  font-size: 22px;
}

.history-chart-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.history-chart-head span {
  color: var(--muted);
  font-size: 14px;
}

.history-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.history-grid line {
  stroke: rgba(87, 63, 35, 0.14);
  stroke-width: 1;
}

.history-grid text,
.history-labels text {
  fill: rgba(87, 63, 35, 0.78);
  font-size: 12px;
  font-weight: 600;
}

.history-grid text {
  text-anchor: start;
}

.history-labels text {
  text-anchor: middle;
}

.history-area {
  fill: rgba(171, 106, 27, 0.1);
}

.history-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-hover-line {
  stroke: rgba(171, 106, 27, 0.38);
  stroke-width: 1.4;
  stroke-dasharray: 6 6;
  opacity: 0;
  pointer-events: none;
}

.history-hover-dot {
  fill: #fffaf3;
  stroke: var(--brand);
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
}

.history-dot-marker {
  fill: #fffaf3;
  stroke: var(--brand);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform-origin: center;
  pointer-events: none;
}

.history-dot-marker.is-visible {
  opacity: 1;
}

.history-dot-hit {
  fill: transparent;
  stroke: transparent;
}

.history-dot-group:hover .history-dot-marker,
.history-dot-group:focus-within .history-dot-marker {
  opacity: 1;
}

.history-hover-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid rgba(171, 106, 27, 0.16);
  border-radius: 12px;
  background: rgba(255, 250, 243, 0.95);
  box-shadow: 0 12px 28px rgba(87, 63, 35, 0.12);
  pointer-events: none;
  z-index: 2;
}

.history-hover-tooltip.is-visible {
  display: grid;
  gap: 4px;
}

.history-hover-tooltip strong {
  font-size: 16px;
  line-height: 1.2;
}

.history-hover-tooltip span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.history-summary {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.history-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.36);
}

.history-summary dd {
  margin: 8px 0 0;
  font-family: var(--font-number);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums lining-nums;
}

.calculator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.calculator-panel,
.calculator-sidecard {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
}

.calculator-panel {
  padding: 22px;
}

.calculator-topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.calculator-topbar h3,
.calculator-sidecard h3 {
  margin: 0;
  font-size: 28px;
}

.calculator-copy,
.calculator-hint {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.calculator-grid {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.36);
}

.calculator-grid-head,
.calculator-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(100px, 0.9fr) minmax(120px, 1fr);
  gap: 0;
}

.calculator-grid-head {
  background: rgba(171, 106, 27, 0.08);
  color: var(--brand-deep);
  font-weight: 700;
}

.calculator-grid-head span,
.calculator-row span,
.calculator-row label {
  padding: 14px 16px;
}

.calculator-row + .calculator-row {
  border-top: 1px solid var(--line);
}

.calculator-row span {
  font-weight: 700;
}

.calculator-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-family: var(--font-number);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums lining-nums;
}

.calculator-sidecard {
  padding: 22px;
}

.calculator-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.calculator-field span,
.calculator-summary dt {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculator-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
}

.calculator-summary {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.calculator-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.36);
}

.calculator-summary dd {
  margin: 8px 0 0;
  font-family: var(--font-number);
  font-size: 33px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums lining-nums;
}

.promotion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.promotion-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border-radius: var(--radius-md);
}

.promotion-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.promotion-card-head > div {
  min-width: 0;
  flex: 1;
}

.promotion-card h3 {
  margin: 0;
  font-size: 26px;
}

.brand-badge,
.promo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 92px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-badge.live,
.promo-badge.available {
  color: #1f6a37;
  background: rgba(31, 106, 55, 0.12);
}

.brand-badge.partial,
.promo-badge.partial {
  color: #8a5b16;
  background: rgba(180, 131, 36, 0.12);
}

.brand-badge.error,
.promo-badge.none {
  color: #973825;
  background: rgba(151, 56, 37, 0.12);
}

.promotion-meta {
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: break-word;
}

.promo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.promo-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.promo-tag:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.82);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.3);
}

/* ── Brand Comparison Table ──────────────────────────────────────────── */

.brand-compare-wrap {
  overflow-x: auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
}
.brand-compare-wrap::-webkit-scrollbar { height: 4px; }
.brand-compare-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }

.brand-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

.brand-compare-label-head,
.brand-compare-label {
  position: sticky;
  left: 0;
  background: #fffaf3;
  width: 170px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
}
.brand-compare-label-head { white-space: nowrap; }

.brand-compare-brand-head {
  padding: 12px 16px;
  text-align: center;
  background: var(--brand-soft);
  border-bottom: 2px solid var(--brand);
  font-weight: 700;
  color: var(--brand-deep);
}

.brand-compare-brand-label a {
  display: inline;
  font-weight: 700;
  color: var(--brand-deep);
  text-decoration: none;
}
.brand-compare-brand-label a:hover { text-decoration: underline; }

.brand-compare-cell {
  padding: 10px 16px;
  text-align: center;
  font-family: var(--font-number);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.brand-compare-empty {
  color: var(--muted);
  text-align: center;
}
.cell-best {
  color: #1a5c34;
  background: rgba(26, 92, 52, 0.07);
  font-weight: 700;
}

.brand-compare-table tbody tr:nth-child(even) .brand-compare-cell,
.brand-compare-table tbody tr:nth-child(even) .brand-compare-label {
  background: rgba(255, 250, 242, 0.8);
}

/* ─── ≤720px: tablet / large phone ───────────────────────────────── */
@media (max-width: 720px) {
  .gold-live-strip {
    grid-template-columns: 1fr;
  }

  /* Promotion cards */
  .promotion-card {
    padding: 16px;
    gap: 12px;
  }
  .promotion-card h3 { font-size: 20px; }

  /* Brand compare table: tighter on tablet */
  .brand-compare-cell { padding: 8px 12px; }
  .brand-compare-label { padding: 8px 12px; }

  /* Layout shells: stack */
  .history-shell,
  .calculator-shell {
    grid-template-columns: 1fr;
  }

  /* History toolbar: series full-width, two range selects side-by-side */
  .history-toolbar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  .history-toolbar .history-field:not(.history-field-compact) {
    grid-column: 1 / -1;
  }

  /* History panels */
  .history-panel,
  .history-sidecard { padding: 18px; }
  .history-summary dd { font-size: 22px; }
  .history-chart-head strong { font-size: 18px; }
  .history-chart-meta { gap: 8px; }

  .history-chart {
    min-height: 160px;
    padding: 14px;
  }

  /* Calculator */
  .calculator-topbar {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
  }
  .calculator-topbar h3,
  .calculator-sidecard h3 { font-size: 22px; }
  .calculator-panel,
  .calculator-sidecard { padding: 18px; }
  .calculator-summary dd { font-size: 26px; }

  /* Calculator grid: keep 3 columns, compact sizing */
  .calculator-grid-head,
  .calculator-row {
    grid-template-columns: minmax(56px, 0.85fr) 1fr 1.1fr;
  }
  .calculator-grid-head span,
  .calculator-row span,
  .calculator-row label {
    padding: 10px 8px;
  }
  .calculator-input {
    min-height: 40px;
    font-size: 16px; /* prevent iOS auto-zoom */
    padding: 0 8px;
  }
}

/* ─── ≤600px: phone — brand comparison table ─────────────────────── */
@media (max-width: 600px) {
  #brands.content-panel {
    margin-top: 8px;
    padding: 12px;
  }

  #brands .section-head {
    flex-direction: row;
    align-items: center;
    margin-bottom: 8px;
  }

  #brands .section-head h2 {
    font-size: 20px;
  }

  .gold-refresh-btn {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
  }

  .gold-live-strip {
    gap: 8px;
    margin-bottom: 10px;
  }

  .gold-live-metrics {
    gap: 6px;
  }

  .gold-live-metrics article {
    padding: 8px;
    border-radius: 12px;
  }

  .gold-live-metrics strong {
    font-size: 18px;
  }

  .gold-live-metrics span {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.25;
  }

  .gold-live-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .gold-live-status span,
  .gold-live-status strong,
  .gold-live-status .fetch-state {
    margin: 0;
  }

  .gold-live-status span {
    flex-shrink: 0;
    font-size: 11px;
  }

  .gold-live-status strong {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .gold-live-status .fetch-state {
    display: none;
  }

  /* Category column headers */
  .brand-compare-brand-head {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* Sticky brand name column */
  .brand-compare-label-head,
  .brand-compare-label {
    width: 110px;
    padding: 7px 10px;
    font-size: 12px;
  }

  /* Data cells */
  .brand-compare-cell { padding: 7px 8px; font-size: 12px; }

  /* Right-edge gradient cues horizontal scroll */
  .brand-compare-wrap {
    -webkit-overflow-scrolling: touch;
    box-shadow: inset -40px 0 24px -20px rgba(253, 248, 240, 0.95);
  }
}

/* ─── ≤480px: small phone ─────────────────────────────────────────── */
@media (max-width: 480px) {

  /* Tighter panel padding (brand/hero-panel handled by base.css ≤480px) */
  .history-panel,
  .history-sidecard,
  .calculator-panel,
  .calculator-sidecard { padding: 14px; }

  /* Summary numbers: smaller */
  .history-summary dd { font-size: 20px; }
  .calculator-summary dd { font-size: 22px; }

  /* Calculator grid: tighter */
  .calculator-grid-head span,
  .calculator-row span,
  .calculator-row label { padding: 8px 6px; }
  .calculator-input {
    min-height: 36px;
    padding: 0 6px;
  }

  /* Badges: compact */
  .brand-badge,
  .promo-badge {
    min-width: 72px;
    padding: 0 10px;
    font-size: 11px;
  }
}
