/* Shared History presentation. Scoped to History; inherits LIVE typography and site theme. */
#history.history-modern{--hm-temp:var(--kpi-temp,#ef4444);--hm-rain:var(--kpi-prec,#0ea5e9);--hist-border:var(--border);--hist-th-bg:color-mix(in srgb,var(--brand) 6%,var(--card));--hist-row-alt:var(--card);--hist-row-hover:color-mix(in srgb,var(--brand) 5%,var(--card));--hist-shadow:var(--shadow-1);--hist-files-bg:var(--card)}
#history.history-modern .history-head{margin:4px 0 18px}
#history.history-modern .hm-query{padding:0;overflow:hidden;margin-bottom:18px}
#history.history-modern #hist-nav{gap:6px;padding:10px;border-bottom:1px solid var(--border);margin:0}
#history.history-modern #hist-nav .btn{padding:10px 18px;background:transparent;color:var(--fg);box-shadow:none;border:1px solid transparent;font-size:.9rem;font-weight:500}
#history.history-modern #hist-nav .btn.active{background:linear-gradient(180deg,var(--brand),var(--brand-strong));color:#fff;outline:none;box-shadow:inset 0 1px #ffffff40;border-color:transparent}
#history.history-modern #hist-nav .btn:focus-visible,#history.history-modern summary:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
#history.history-modern .controls{padding:16px 18px;margin:0;gap:12px}
#history.history-modern .ctrl .select,#history.history-modern .ctrl .input{min-height:40px;background:var(--card);color:var(--fg);border:1px solid var(--border);border-radius:10px;padding:7px 10px;font:inherit;font-size:.9rem;max-width:100%}
#history.history-modern .history-table-top{padding:0 18px 16px;margin:0;justify-content:flex-start}
#history.history-modern .history-top-actions{justify-content:flex-start;gap:8px}
#history.history-modern .hm-range-note{border-top:1px solid var(--border);margin:0;padding:10px 18px;color:var(--muted);font-size:.8rem;background:color-mix(in srgb,var(--brand) 4%,var(--card))}
#history.history-modern .hm-period-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:0 0 24px}
#history.history-modern .hm-period-summary[hidden]{display:none!important}
#history.history-modern .hm-stat{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-1);padding:16px;min-width:0;display:flex;flex-direction:column;gap:7px}
#history.history-modern .hm-stat-label{font-size:.86rem;font-weight:600;color:var(--muted)}
#history.history-modern .hm-stat-value{font-family:var(--jd-font);font-size:clamp(1.3rem,2.4vw,1.9rem);font-weight:400;letter-spacing:normal;line-height:1.2;font-variant-numeric:tabular-nums}
#history.history-modern .hm-stat small{color:var(--muted);font-size:.77rem;line-height:1.5}
#history.history-modern .hm-result-head{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:14px}
#history.history-modern .hm-result-head h3{font-size:1.12rem;margin:0 0 4px}
#history.history-modern .hm-result-head p{color:var(--muted);font-size:.85rem;margin:0}
#history.history-modern #hist-output.card{background:var(--card);box-shadow:var(--shadow-1);border-color:var(--border);border-radius:var(--radius);padding:12px}
#history.history-modern .table-wrap:not(.evo-host){max-height:660px;overflow:auto;overscroll-behavior:contain}
#history.history-modern .table-wrap table{min-width:0;width:100%;font-size:.9rem;font-variant-numeric:tabular-nums;border-collapse:separate;border-spacing:0}
#history.history-modern .table-wrap:not(.evo-host) :is(th,td){padding:12px 14px;text-align:right;white-space:nowrap;border-bottom:1px solid var(--border);border-right:0;background:var(--card);color:var(--fg)}
#history.history-modern .table-wrap:not(.evo-host) thead th{position:sticky;top:0;background:var(--hist-th-bg);font-size:.78rem;color:var(--muted);backdrop-filter:none;z-index:2}
#history.history-modern .table-wrap:not(.evo-host) :is(th,td):first-child{position:sticky;left:0;text-align:left;z-index:1;background:var(--card)}
#history.history-modern .table-wrap:not(.evo-host) thead th:first-child{z-index:3;background:var(--hist-th-bg)}
#history.history-modern .table-wrap:not(.evo-host) tbody tr:hover td{background:var(--hist-row-hover)}
#history.history-modern .table-wrap:not(.evo-host) th::before{content:none}
#history.history-modern .table-wrap .th-icon{display:none}
#history.history-modern .hm-col-unit{display:block;font-size:.72rem;font-weight:400;line-height:1.5}
#history.history-modern .table-wrap.hm-compact:not(.evo-host) :is(td,th){padding:7px 12px}
#history.history-modern .table-wrap:not(.evo-host) td.hm-rain{color:color-mix(in srgb,var(--hm-rain) 75%,var(--fg));font-weight:400}
#history.history-modern .hm-data-note{color:var(--muted);font-size:.78rem;line-height:1.5;margin:12px 2px 22px}
#history.history-modern .evo-content{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
#history.history-modern .evo-card{min-width:0;align-self:start;margin:0;padding:16px;border-color:var(--border);border-radius:var(--radius);background:var(--card)}
#history.history-modern .evo-chart-actions h3{font-size:1.05rem}
#history.history-modern .evo-chart-actions button{font-size:.8rem;font-weight:500}
#history.history-modern .evo-reference{border-left:2px solid var(--brand);background:var(--hist-th-bg);color:var(--muted);font-size:.8rem;margin:12px 0;padding:10px;gap:5px}
#history.history-modern .evo-reference strong{color:var(--fg);font-weight:500}
#history.history-modern .evo-chart-scroll{background:transparent;border-radius:0}
#history.history-modern .evo-chart-scroll svg{min-width:0;max-width:none;width:auto;height:auto}
#history.history-modern .evo-scroll-hint{display:none}
#history.history-modern .chart-selection{font-size:.8rem;color:var(--muted);line-height:1.5;min-height:20px;margin:8px 0 0}
#history.history-modern .chart-mark{cursor:pointer}
#history.history-modern .chart-mark:focus{outline:2px solid var(--brand)}
#history.history-modern :is(.evo-table-wrap,.hm-method,.evo-export-status){grid-column:1/-1}
#history.history-modern .evo-table-wrap{max-height:600px;overflow:auto}
#history.history-modern .evo-table{min-width:740px}
#history.history-modern .evo-table :is(td,th){background:var(--card);color:var(--fg);border-bottom:1px solid var(--border)}
#history.history-modern .evo-table thead th{background:var(--hist-th-bg);position:sticky;top:0;font-size:.8rem}
#history.history-modern .hm-method{border-top:1px solid var(--border);padding:14px 0}
#history.history-modern .hm-method summary{cursor:pointer;font-size:.86rem;font-weight:600}
#history.history-modern .hm-method .evo-notes{margin:10px 0 0;color:var(--muted);opacity:1;font-size:.84rem}
#history.history-modern .hm-empty-help{color:var(--muted);line-height:1.6;padding:16px}
#history.history-modern .hist-files{background:var(--card);border-color:var(--border);box-shadow:var(--shadow-1)}
#history.history-modern .hm-noaa-title{margin:0 0 16px;font-size:1.1rem}
@media(max-width:850px){#history.history-modern .evo-content{grid-template-columns:1fr}#history.history-modern .hm-stat{padding:14px}#history.history-modern .hm-stat-value{font-size:1.45rem}}
@media(max-width:600px){#history.history-modern #hist-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(48px,auto);gap:8px}#history.history-modern #hist-nav .btn{min-width:0;width:100%;height:100%;min-height:48px;padding:10px 8px;line-height:1.3;white-space:normal;display:flex;align-items:center;justify-content:center;background:var(--card);border-color:var(--border)}#history.history-modern #hist-nav .btn.active{transform:none;background:linear-gradient(180deg,var(--brand),var(--brand-strong));border-color:transparent}#history.history-modern .controls{padding:14px}#history.history-modern .controls .ctrl{flex-wrap:wrap;row-gap:10px}#history.history-modern .ctrl .select,#history.history-modern .ctrl .input{font-size:1rem}#history.history-modern .ctrl-evolution .select{max-width:155px}#history.history-modern .history-table-top{padding:0 14px 14px}#history.history-modern .history-top-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px}#history.history-modern .history-top-actions .history-episodes-btn{grid-column:1/-1}#history.history-modern .history-top-actions .btn{min-width:0;width:100%;font-size:.82rem;min-height:44px;height:auto;padding:10px 8px;line-height:1.3;white-space:normal}#history.history-modern .history-top-actions [hidden]{display:none!important}#history.history-modern .hm-period-summary{grid-template-columns:1fr;gap:10px;margin-bottom:20px}#history.history-modern .hm-stat{padding:12px 14px;gap:5px}#history.history-modern .hm-stat-value{font-size:1.5rem}#history.history-modern .hm-result-head{align-items:flex-start}#history.history-modern #hist-output.card{padding:8px}#history.history-modern .table-wrap:not(.evo-host) :is(td,th){padding:10px 12px}#history.history-modern .evo-card{padding:12px}#history.history-modern .evo-chart-actions h3{font-size:1rem}#history.history-modern .hm-range-note{font-size:.75rem;padding:10px 14px}}
@media print{#history.history-modern :is(.hm-query,.hm-data-note){display:none!important}#history.history-modern .table-wrap [data-secondary=true]{display:table-cell!important}#history.history-modern .table-wrap:not(.evo-host){max-height:none;overflow:visible}#history.history-modern .table-wrap:not(.evo-host) :is(th,td){position:static}#history.history-modern .hm-period-summary,#history.history-modern .evo-content{display:block}#history.history-modern .hm-stat,#history.history-modern .evo-card{break-inside:avoid;box-shadow:none;margin-bottom:12px}}
