* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f5f7; color: #1d1d1f; padding: 2rem; }
h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.subtitle { color: #86868b; margin-bottom: 2rem; font-size: 0.95rem; }
.section-note { color: #86868b; font-size: 0.85rem; margin-bottom: 1rem; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.chart-card { background: #fff; border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.chart-card h2 { font-size: 1.1rem; margin-bottom: 1rem; }
canvas { width: 100% !important; }
.full-width { grid-column: 1 / -1; }
.table-card { background: #fff; border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow-x: auto; }
.table-card h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.controls { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chip-btn { border: 1px solid #d2d2d7; background: #fff; border-radius: 20px; padding: 0.35rem 0.9rem; cursor: pointer; font-size: 0.85rem; transition: all 0.15s; }
.chip-btn.active { background: #0071e3; color: #fff; border-color: #0071e3; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 2px solid #e5e5e5; cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { color: #0071e3; }
th .arrow { font-size: 0.7rem; margin-left: 0.25rem; }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f0f0f0; }
tr:hover td { background: #f5f5f7; }
.savings { color: #34c759; font-weight: 600; }

/* Chip tags */
.chip-tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.chip-M4 { background: #e8f5e9; color: #2e7d32; }
.chip-M4-Pro { background: #e3f2fd; color: #1565c0; }
.chip-M2 { background: #fff3e0; color: #e65100; }
.chip-M2-Pro { background: #fce4ec; color: #c62828; }
.chip-M1 { background: #f3e5f5; color: #6a1b9a; }
.chip-Intel { background: #eceff1; color: #455a64; }

/* Freshness badges */
.fresh-badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 8px; font-size: 0.7rem; font-weight: 600; }
.fresh-now { background: #e8f5e9; color: #2e7d32; }
.fresh-recent { background: #fff8e1; color: #f57f17; }
.fresh-stale { background: #fce4ec; color: #c62828; }
.fresh-old { background: #eceff1; color: #78909c; }

/* Availability bar */
.avail-bar { display: inline-flex; align-items: center; gap: 0.4rem; }
.avail-bar-track { width: 50px; height: 6px; background: #e5e5e5; border-radius: 3px; overflow: hidden; }
.avail-bar-fill { height: 100%; border-radius: 3px; }

/* Sparkline */
.sparkline { vertical-align: middle; }

/* Config heatmap */
.heatmap { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.heatmap-chip { flex: 1; min-width: 200px; }
.heatmap-chip h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.hm-grid { display: grid; gap: 2px; font-size: 0.7rem; }
.hm-cell { padding: 0.3rem 0.25rem; text-align: center; border-radius: 3px; min-width: 38px; }
.hm-header { font-weight: 600; background: none; color: #86868b; }
.hm-row-label { font-weight: 600; text-align: right; padding-right: 0.4rem; background: none; color: #86868b; }
.hm-empty { background: #f5f5f7; color: #ccc; }

/* Timeline heatmap */
.timeline-grid { font-size: 0.65rem; }
.timeline-grid table { border-collapse: collapse; }
.timeline-grid th, .timeline-grid td { padding: 2px; text-align: center; min-width: 18px; }
.timeline-grid th { font-size: 0.6rem; color: #86868b; font-weight: 500; border-bottom: none; cursor: default; }
.timeline-grid td.tl-label { text-align: right; padding-right: 0.5rem; white-space: nowrap; font-size: 0.7rem; color: #1d1d1f; max-width: 200px; overflow: hidden; text-overflow: ellipsis; border-bottom: none; }
.timeline-grid td.tl-cell { width: 18px; height: 18px; padding: 0; border-radius: 2px; border-bottom: none; }

/* Price history cards */
.price-card { background: #fafafa; border-radius: 8px; padding: 1rem; margin-bottom: 0.75rem; }
.price-card h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.price-card canvas { height: 120px !important; }
.price-no-data { color: #86868b; font-style: italic; font-size: 0.85rem; padding: 2rem; text-align: center; }

/* Scrape calendar */
.scrape-calendar { overflow-x: auto; }
.sc-row { display: flex; gap: 2px; }
.sc-row.sc-header { margin-bottom: 2px; }
.sc-day-label { width: 22px; min-width: 22px; text-align: right; font-size: 0.6rem; color: #86868b; padding-right: 4px; line-height: 16px; }
.sc-month-label { width: 16px; min-width: 16px; text-align: center; font-size: 0.55rem; font-weight: 600; color: #86868b; }
.sc-cell { width: 16px; min-width: 16px; height: 16px; border-radius: 2px; }
.sc-empty { background: #f0f0f0; }
.sc-na { background: none; }

@media (max-width: 768px) { .charts { grid-template-columns: 1fr; } }
