/* TOC: History controls and summaries; chart; calendar and day details; table and export; responsive layouts. */
.history-panel{background:var(--white);border:1px solid var(--line);border-radius:14px;overflow:hidden}
.history-controls{padding:25px 28px 23px}
.control-topline{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:23px}
.period-tabs{display:flex;flex-wrap:wrap;min-width:0;gap:3px;background:#f0f2ea;padding:4px;border-radius:8px}
.period-tabs button{border:0;border-radius:5px;background:transparent;padding:7px 17px;font-size:11px;white-space:nowrap}
.period-tabs button[aria-pressed=true]{background:var(--ink);color:white;box-shadow:0 2px 5px #153c3520}
.period-tabs button:not([aria-pressed=true]):hover{background:#e0e6da}
.archive-range{font-size:10px;text-align:right;max-width:240px}
.date-controls{display:flex;align-items:flex-end;gap:15px}
.date-controls label{display:flex;flex-direction:column;gap:7px;font-size:10px;flex:1;color:var(--muted);min-width:0}
.date-controls input,.date-controls select{height:42px;width:100%;border:1px solid var(--line);border-radius:6px;background:var(--white);color:var(--ink);padding:8px 11px;font-size:12px;min-width:0}
.date-controls .group-control{max-width:150px;margin-left:7px}
.date-arrow{padding-bottom:10px;color:var(--muted)}
.button-primary{height:42px;padding:0 21px;border:0;border-radius:6px;background:var(--ink);color:white;font-size:11px;display:flex;gap:25px;align-items:center;justify-content:center;white-space:nowrap}
.button-primary:hover{background:#28564b}
.history-status{font-size:11px;margin:0 28px 20px;padding:11px 13px;background:#f3f4ed;border-left:2px solid #b8c4ae;color:#56624f}
.history-status.is-error{background:#fff0e5;border-left-color:var(--orange);color:#894525}
.history-status:empty{display:none}
.summary-grid{display:grid;grid-template-columns:repeat(4,1fr);padding:23px 28px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);background:#fbfcf6}
.summary-grid>div{padding:0 23px;border-left:1px solid var(--line);min-width:0}
.summary-grid>div:first-child{padding-left:0;border:0}
.summary-grid>div:last-child{padding-right:0}
.summary-grid .mini-label{font-size:10px;margin-bottom:11px;letter-spacing:.2px}
.summary-grid strong{font-size:35px;font-weight:500;letter-spacing:-1.2px;line-height:1.1;display:block;font-variant-numeric:tabular-nums}
.summary-grid>div>span:last-child{display:block;font-size:9px;color:var(--muted);margin-top:8px;line-height:1.5}
.chart-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:27px 28px 0}
.chart-heading h3{font-size:19px;letter-spacing:-.5px}
.chart-heading p{font-size:10px;margin-top:8px}
.chart-key{display:flex;gap:6px;align-items:center;font-size:9px;color:var(--muted);white-space:nowrap}
.chart-key-dot{width:6px;height:6px;background:var(--ink);border-radius:50%}
.chart-key-dash{width:15px;border-top:1px dashed #94ac8d;margin-left:10px}
.history-chart{width:100%;padding:6px 24px 0;min-height:245px;position:relative}
.history-chart svg{width:100%;height:auto;overflow:visible}
.chart-empty{height:225px;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--muted);font-size:13px;text-align:center;gap:9px;padding:24px}
.chart-empty strong{font-size:19px;font-weight:500;color:var(--ink);letter-spacing:-.5px}
.chart-note{font-size:10px;padding:0 28px 25px;border-bottom:1px solid var(--line)}
.chart-svg-text{font-family:"Helvetica Neue",Arial,sans-serif;fill:#6a786d;font-size:10px}
.chart-point{cursor:pointer;stroke:var(--white);stroke-width:2}
.chart-point:focus,.chart-point:hover{stroke:var(--ink);stroke-width:3;outline:none}
.chart-tooltip{position:absolute;pointer-events:none;background:var(--ink);color:white;padding:9px 12px;border-radius:6px;font-size:11px;z-index:2;max-width:220px;box-shadow:0 3px 12px #173c3520}
.calendar-section{padding-bottom:24px;border-bottom:1px solid var(--line)}
.calendar-section .chart-heading{padding-top:24px;align-items:flex-start}
.heatmap-legend{display:flex;align-items:center;gap:4px;font-size:8px;color:var(--muted);padding-top:5px;white-space:nowrap}
.heatmap-legend i{height:9px;width:9px;border-radius:2px;display:block}
.heatmap-legend span:first-child{margin-right:4px}
.heatmap-legend span:nth-last-child(3){margin:0 6px 0 4px}
.heatmap-legend .heat-missing{margin-left:6px;border:1px solid #dce2d7}
.calendar-scroll{padding:23px 28px 3px;overflow-x:auto;scrollbar-width:thin}
.calendar-months{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:20px 25px}
.calendar-month{min-width:0}
.calendar-month h4{margin:0 0 11px;font-size:11px;font-weight:500}
.calendar-weekdays,.calendar-days{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.calendar-weekdays{margin-bottom:6px;font-size:8px;color:var(--muted);text-align:center}
.calendar-day,.calendar-blank{aspect-ratio:1;min-width:0;max-height:28px}
.calendar-day{border:0;border-radius:3px;font-size:9px;padding:0;color:#153c35;position:relative;min-height:22px}
.calendar-day.heat-good,.calendar-day.heat-unhealthy,.calendar-day.heat-very,.calendar-day.heat-hazardous{color:white}
.calendar-day.heat-missing{color:#747b72;box-shadow:inset 0 0 0 1px #dce2d755}
.calendar-day[aria-pressed=true]{outline:2px solid var(--ink);outline-offset:2px;z-index:1}
.calendar-day.is-partial::after{content:"";height:3px;width:3px;background:currentColor;position:absolute;right:3px;bottom:3px;border-radius:50%}
.calendar-day:hover{filter:brightness(.9)}
.calendar-summary-note{font-size:10px;margin-top:15px}
.selected-day{padding:23px 28px;display:flex;gap:35px;align-items:center;background:#f4f6ed;border-bottom:1px solid var(--line);min-height:101px}
.selected-day>div:first-child{min-width:170px}
.selected-day .eyebrow{font-size:8px;letter-spacing:1.3px;margin-bottom:9px}
.selected-day h3{font-size:19px}
.selected-day>p{font-size:12px;max-width:620px}
.day-detail-stats{display:flex;flex-wrap:wrap;gap:17px 35px}
.day-detail-stats>div{display:flex;flex-direction:column;gap:4px}
.day-detail-stats strong{font-size:20px;font-weight:500;letter-spacing:-.5px}
.day-detail-stats span{font-size:9px;color:var(--muted)}
.day-detail-note{font-size:10px;color:var(--muted);margin-top:9px}
.history-actions{position:relative;min-height:64px;padding:0 28px}
.history-actions summary{font-size:11px;cursor:pointer;list-style:none;padding:23px 0;display:inline-flex;gap:18px}
.history-actions summary::-webkit-details-marker{display:none}
.history-actions details[open] summary>span{transform:rotate(180deg)}
.export-actions{display:flex;gap:23px;position:absolute;right:28px;top:22px}
.export-actions .text-link{font-size:11px;gap:10px}
.table-scroll{overflow-x:auto;margin:0 0 25px}
table{width:100%;text-align:left;border-collapse:collapse;font-size:11px;white-space:nowrap}
caption{text-align:left;color:var(--muted);font-size:10px;padding:0 0 12px}
th{font-weight:500;padding:11px 10px;background:#f1f3eb;border-bottom:1px solid var(--line)}
th span{font-size:9px;color:var(--muted)}
td{padding:11px 10px;border-bottom:1px solid #e8ece2}
td .table-date{border:0;background:none;font-size:11px;padding:0;text-decoration:underline;text-underline-offset:3px}
.table-category{display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:7px}
.history-results-loading{opacity:.5}
@media(min-width:1100px){
.calendar-months:has(.calendar-month:nth-child(7)){grid-template-columns:repeat(6,1fr);gap:24px 18px}
.calendar-months:has(.calendar-month:nth-child(7)) .calendar-day{font-size:8px;min-height:18px}
}
@media(max-width:1100px){
.history-controls{padding:23px}
.summary-grid{padding:23px}
.summary-grid>div{padding:0 17px}
.chart-heading{padding-left:23px;padding-right:23px}
.chart-key{font-size:8px}
.chart-key-dash{margin-left:4px}
.calendar-section .chart-heading{flex-direction:column;gap:12px}
.calendar-scroll{padding-left:23px;padding-right:23px}
.selected-day{padding:23px}
.day-detail-stats{gap:15px 25px}
.history-actions{padding:0 23px}
.export-actions{right:23px}
.control-topline{gap:12px}
.period-tabs button{padding:7px 14px}
.archive-range{font-size:9px;max-width:185px}
.date-controls{gap:12px}
.date-controls .group-control{max-width:115px;margin-left:0}
.button-primary{padding:0 14px;gap:15px}
.chart-note{padding-left:23px;padding-right:23px}
.history-status{margin-left:23px;margin-right:23px}
}
@media(max-width:800px){
.control-topline{flex-wrap:wrap;gap:13px}
.archive-range{text-align:left;max-width:none;width:100%}
.date-controls{flex-wrap:wrap;gap:15px 12px}
.date-controls label{flex-basis:40%}
.date-controls .group-control{flex-basis:45%;max-width:none}
.date-controls .button-primary{flex:1;min-width:180px}
.date-arrow{padding-left:1px;padding-right:1px}
.summary-grid>div{padding:0 13px}
.summary-grid .mini-label{font-size:9px}
.summary-grid strong{font-size:31px}
.chart-heading{align-items:flex-start;gap:13px;flex-direction:column}
.history-chart{padding:8px 15px 0;min-height:200px}
.selected-day{gap:20px;align-items:flex-start}
.selected-day>div:first-child{min-width:155px}
.day-detail-stats{gap:15px 24px}
.history-actions summary{font-size:10px}
.export-actions{gap:17px}
.export-actions .text-link{font-size:10px}
.calendar-months{grid-template-columns:repeat(3,1fr);gap:22px 20px}
.calendar-day{min-height:20px;font-size:8px}
}
@media(max-width:520px){
.history-controls{padding:19px 16px}
.control-topline{margin-bottom:17px}
.period-tabs{width:100%;justify-content:space-between;gap:1px}
.period-tabs button{padding:7px 11px;font-size:10px}
.archive-range{font-size:9px}
.date-controls{gap:13px 9px}
.date-controls label{font-size:9px;gap:6px;flex-basis:40%}
.date-controls input,.date-controls select{padding:8px;font-size:11px;height:41px}
.date-arrow{font-size:12px}
.date-controls .button-primary{min-width:145px;height:41px;font-size:10px;gap:15px}
.date-controls .group-control{flex-basis:38%}
.history-status{margin:0 16px 17px;font-size:10px;padding:10px}
.summary-grid{padding:19px 16px;grid-template-columns:repeat(2,1fr);row-gap:22px}
.summary-grid>div{padding:0 0 0 19px}
.summary-grid>div:nth-child(3){padding-left:0;border:0}
.summary-grid .mini-label{font-size:9px;margin-bottom:8px}
.summary-grid strong{font-size:33px}
.summary-grid>div>span:last-child{font-size:8px;margin-top:6px}
.chart-heading{padding:22px 16px 0}
.chart-heading h3{font-size:18px}
.chart-heading p{font-size:9px;line-height:1.5;margin-top:6px}
.chart-key{font-size:8px}
.history-chart{min-height:180px;padding:13px 8px 0}
.history-chart svg{min-height:170px}
.chart-empty{height:200px;font-size:11px}
.chart-empty strong{font-size:17px}
.chart-note{font-size:9px;padding:0 16px 20px}
.calendar-section .chart-heading{padding:20px 16px 0}
.heatmap-legend{font-size:7px;gap:3px;flex-wrap:wrap;white-space:normal}
.heatmap-legend i{width:8px;height:8px}
.calendar-scroll{padding:20px 16px 3px}
.calendar-months{grid-template-columns:repeat(2,1fr);gap:23px 20px}
.calendar-month h4{font-size:10px;margin-bottom:9px}
.calendar-days,.calendar-weekdays{gap:3px}
.calendar-day{min-height:20px;max-height:26px}
.calendar-summary-note{font-size:9px}
.selected-day{padding:20px 16px;flex-direction:column;gap:17px}
.selected-day .eyebrow{margin-bottom:7px}
.selected-day h3{font-size:20px}
.day-detail-stats{gap:12px 28px}
.day-detail-stats strong{font-size:21px}
.day-detail-stats span{font-size:9px}
.selected-day>p{font-size:11px}
.history-actions{padding:0 16px;min-height:103px;padding-top:43px}
.history-actions summary{padding:18px 0 20px}
.export-actions{top:18px;left:16px;right:auto;gap:24px}
.export-actions .text-link{font-size:10px}
.table-scroll{margin-bottom:20px}
.history-actions details{border-top:1px solid var(--line)}
table{font-size:10px}
th,td{padding:10px 8px}
.history-panel{border-radius:10px}
}
@media(max-width:440px){
.calendar-months{grid-template-columns:1fr;gap:23px}
.calendar-month{max-width:360px}
.calendar-day{font-size:10px;min-height:28px;max-height:32px}
.calendar-weekdays{font-size:9px}
.calendar-month h4{font-size:12px}
}

/* Keep the full season labels readable on small screens. */
@media(max-width:520px){.history-controls .period-tabs button[data-range=season],.history-controls .period-tabs button[data-range=lowseason]{flex:1 1 calc(50% - 6px);white-space:normal;line-height:1.5}}

/* Calendar color choice is independent of the displayed measurement. */
.calendar-display-options{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px}
.calendar-gradient-toggle{display:flex;align-items:center;gap:7px;min-height:40px;font-size:11px;cursor:pointer;white-space:nowrap}
.calendar-gradient-toggle input{width:16px;height:16px;margin:0;accent-color:var(--ink);cursor:pointer}
.calendar-section [hidden]{display:none!important}
.calendar-section .category-legend{display:flex;flex-wrap:wrap;gap:8px 12px;max-width:280px;white-space:normal}
.calendar-section .category-legend span{display:flex;align-items:center;gap:5px;margin:0;font-size:9px}
.calendar-section .category-legend i{margin:0;flex-shrink:0}
.calendar-day.heat-sensitive{color:#000}
