.page-tabs { flex-wrap: wrap; }
.content-wrap:has(.history-panel:not([hidden])) { width: min(1920px,calc(100% - 48px)); padding-top: 24px; }
.history-panel { --history-purple: #b5a4f5; font-size: 16px; }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 12px; }
.history-heading h1 { margin: 4px 0 0; font-size: 34px; letter-spacing: -.04em; }
.history-detail-eyebrow { color: var(--faint); font: 12px var(--mono); letter-spacing: .14em; }
.history-heading-tools { display: flex; align-items: center; gap: 24px; }
.history-meta { color: var(--muted); font: 12px/1.5 var(--mono); }
.history-notice { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.history-notice.is-demo { color: var(--history-purple); }
.history-notice.is-limited { color: #e7ba76; }
.history-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.history-controls label { display: grid; gap: 6px; flex: 1 1 130px; color: var(--muted); font-size: 14px; }
.history-controls .history-search-field { flex: 2 1 200px; }
.history-controls input,.history-controls select,.history-observation-picker select { width: 100%; min-width: 0; padding: 8px 10px; min-height: 38px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; color-scheme: dark; font-size: 14px; }
.history-panel :is(input,select,button):focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
.history-button { padding: 8px 12px; min-height: 38px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--text); font-size: 14px; }
.history-button:hover:not(:disabled) { border-color: var(--acid); color: var(--acid); }
.history-button:disabled { opacity: .35; cursor: default; }
.history-message { padding: 28px; margin-top: 16px; border: 1px solid var(--line); color: var(--muted); line-height: 1.6; }
.history-message strong { display: block; color: var(--text); margin-bottom: 8px; }
.history-message button { margin: 12px 0 0; }
.history-metrics { display: flex; flex-wrap: wrap; gap: 18px 32px; padding: 17px 0; margin-bottom: 12px; }
.history-metrics > div { display: flex; gap: 10px; align-items: baseline; }
.history-metrics span { font-size: 14px; color: var(--muted); }
.history-metrics strong { order: -1; font: 600 22px var(--mono); }
#history-detected-count { color: var(--red); } #history-not-detected-count { color: var(--green); } #history-environment-count { color: var(--history-purple); }
.history-view-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.history-view-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.history-workspace { display: grid; gap: 16px; scroll-margin-top: 12px; grid-template-columns: minmax(0,1fr) clamp(360px,27vw,440px); height: max(520px,calc(100dvh - 24px)); }
.history-workspace .history-timeline-view { min-height: 0; overflow: auto; scrollbar-gutter: stable; scrollbar-color: var(--line-bright) var(--surface); }
.history-workspace :is(.history-node,.history-env-node) { scroll-margin-left: 270px; }
.history-timeline-view { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.history-timeline-header { position: sticky; top: 0; z-index: 30; overflow: hidden; border-radius: 8px 8px 0 0; background: var(--surface); border-bottom: 1px solid var(--line-bright); box-shadow: 0 4px 12px #0004; }
.history-window { padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--line); font: 12px var(--mono); color: var(--muted); }
.history-window > div { display: flex; gap: 8px; }
.history-window .history-button { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.history-line-scroll,.history-axis-scroll { overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--line-bright) var(--surface); }
.history-axis-scroll { scrollbar-width: thin; }
.history-axis-scroll:focus-visible,.history-line-scroll:focus-visible { outline: 1px solid var(--acid); outline-offset: -1px; }
.history-line-chart { min-width: 960px; padding-right: 28px; }
.history-lane { display: grid; grid-template-columns: 240px minmax(0,1fr); }
.history-lane-label { position: sticky; left: 0; z-index: 3; background: var(--surface); padding: 12px 18px; align-content: center; color: var(--text); font-size: 14px; }
.history-axis-label { font: 12px var(--mono); color: var(--faint); letter-spacing: .04em; }
.history-track { position: relative; min-width: 0; align-self: center; }
.history-guide { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(145,165,164,.09); pointer-events: none; }
.history-date-label { display: flex; align-items: center; position: absolute; top: 0; transform: translateX(-50%); height: 42px; padding: 0 4px; border: 0; color: var(--muted); background: transparent; font: 12px var(--mono); white-space: nowrap; }
.history-environment-group { --history-environment-bg: #11171e; margin: 8px 0 12px; padding-bottom: 8px; background: var(--history-environment-bg); box-shadow: inset 2px 0 rgba(181,164,245,.5); }
.history-environment-group + .history-environment-group { margin-top: 16px; border-top: 1px solid rgba(181,164,245,.18); }
.history-environment-group .history-lane-label { background: var(--history-environment-bg); box-shadow: inset 2px 0 rgba(181,164,245,.5); }
.history-environment-heading .history-lane-label { margin: 0; padding: 12px 18px 6px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.history-environment-lane .history-lane-label { color: var(--muted); padding: 4px 18px 15px 36px; }
.history-env-icon { color: var(--history-purple); margin-right: 10px; }
.history-environment-rail { position: absolute; height: 2px; background: rgba(181,164,245,.25); }
.history-env-node { position: absolute; transform: translate(-50%,-50%); width: 32px; height: 32px; border: 0; padding: 0; background: transparent; color: var(--history-purple); z-index: 1; }
.history-env-dot { display: block; width: 9px; height: 9px; margin: auto; background: var(--surface); border: 2px solid var(--history-purple); border-radius: 2px; transform: rotate(45deg); }
.history-env-node.is-updated .history-env-dot { background: var(--history-purple); }
.history-version-label { position: absolute; top: 31px; left: 50%; transform: translateX(-50%); display: block; width: 116px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 12px var(--mono); }
.history-env-node:hover .history-version-label { color: var(--text); }
.history-lane-divider { padding: 16px 18px 8px; border-top: 1px solid var(--line); margin-top: 10px; font: 12px var(--mono); letter-spacing: .07em; color: var(--faint); }
.history-recipe-lane:hover,.history-recipe-lane:hover .history-lane-label { background: #101a1d; }
.history-recipe-lane .history-lane-label { padding-top: 10px; padding-bottom: 10px; }
.history-recipe-combination { display: block; font-size: 14px; font-weight: 400; line-height: 1.55; overflow-wrap: anywhere; }
.history-lane-label small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.history-connections { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.history-connections line { stroke: var(--line-bright); stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-connections .is-detected { stroke: #ab625b; } .history-connections .is-not-detected { stroke: #4d937c; }
.history-connections .is-transition { stroke: #708985; stroke-dasharray: 4 5; }
.history-node { position: absolute; transform: translate(-50%,-50%); width: 38px; height: 38px; border: 0; padding: 0; background: transparent; color: var(--muted); border-radius: 50%; z-index: 1; scroll-margin: 145px 30px 35px; }
.history-node-dot { display: grid; place-items: center; width: 12px; height: 12px; margin: auto; border-radius: 50%; border: 2px solid var(--surface); background: var(--muted); box-shadow: 0 0 0 1px currentColor; font: 12px var(--mono); }
.history-node.is-detected { color: var(--red); } .history-node.is-detected .history-node-dot { background: var(--red); }
.history-node.is-not-detected { color: var(--green); } .history-node.is-not-detected .history-node-dot { background: var(--green); }
.history-node:is(.is-incomplete,.is-mixed) { color: #e7ba76; }
.history-node:is(.is-incomplete,.is-mixed,.is-unverified) .history-node-dot { background: var(--surface); width: 17px; height: 17px; border: 1px dashed currentColor; box-shadow: none; }
.history-node.has-transition .history-node-dot { box-shadow: 0 0 0 1px var(--surface),0 0 0 4px currentColor; }
.history-node[aria-pressed=true] { outline: 1px solid var(--text); outline-offset: -3px; background: rgba(255,255,255,.04); }
.history-node:hover { z-index: 5; }
.history-node-tooltip { display: none; position: absolute; bottom: 39px; left: 50%; transform: translateX(-50%); background: #1b292e; border: 1px solid var(--line-bright); border-radius: 5px; box-shadow: 0 8px 20px #0005; padding: 9px 12px; color: var(--text); font: 14px var(--sans); white-space: nowrap; pointer-events: none; }
.history-node-tooltip small { display: block; margin-top: 4px; color: var(--muted); font: 12px var(--mono); }
.history-node:hover .history-node-tooltip,.history-node:focus-visible .history-node-tooltip { display: block; }
.history-node-count { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); font: 12px var(--mono); }
.history-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 16px 18px; margin-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.history-legend > span { display: flex; align-items: center; gap: 8px; }
.history-legend > small { font-size: 12px; margin-left: 0; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.legend-dot.is-detected { background: var(--red); } .legend-dot.is-not-detected { background: var(--green); }
.legend-dot.is-incomplete { background: transparent; border: 1px dashed #e7ba76; }
.legend-dot.has-transition { background: transparent; border: 1px solid var(--muted); outline: 1px solid var(--muted); outline-offset: 2px; }
.history-detail { position: relative; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 20px; border: 1px solid var(--line-bright); border-radius: 8px; background: #0c161a; scrollbar-gutter: stable; scrollbar-color: var(--line-bright) var(--surface); }
.history-detail-close { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; background: transparent; color: var(--muted); border: 0; font-size: 26px; }
.history-detail-top { display: flex; flex-wrap: wrap; align-items: start; gap: 16px; padding-right: 18px; }
.history-detail h2 { font-size: 18px; line-height: 1.5; margin: 12px 0 8px; overflow-wrap: anywhere; }
.history-detail h3 { font-size: 15px; margin: 22px 0 10px; }
.history-outcome { display: block; font-size: 20px; line-height: 1.5; margin: 22px 0 8px; }
.history-detail-note { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.history-observation-picker { display: grid; gap: 6px; font-size: 13px; color: var(--muted); max-width: 100%; }
.history-record-picker { margin-top: 16px; }
.history-diff-scroll { overflow-x: auto; }
.history-diff { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.history-diff th,.history-diff td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); line-height: 1.5; overflow-wrap: anywhere; }
.history-diff th { color: var(--muted); font-weight: 500; }
.history-diff .has-change td:last-child { color: var(--history-purple); background: #b5a4f508; }
.history-diff[aria-label="Detection comparison"] .has-change th { color: var(--history-purple); background: #b5a4f510; box-shadow: inset 3px 0 var(--history-purple); padding-left: 10px; font-weight: 650; }
.history-detection-state { display: inline-block; padding: 3px 6px; margin-bottom: 3px; border: 1px solid currentColor; border-radius: 4px; font-weight: 650; }
.history-detection-state.is-detected { color: var(--red); background: #ff746815; }
.history-detection-state.is-not-detected { color: var(--green); background: #86dc9815; }
.history-detection-state.is-unknown { color: #e7ba76; background: #e7ba7615; }
.history-detection-state.is-previous { background: transparent; font-weight: 400; opacity: .8; }
.history-source { font: 12px/1.6 var(--mono); color: var(--muted); overflow-wrap: anywhere; margin-top: 18px; }
@media (max-width:1240px) {
  .history-workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(230px,1.2fr) minmax(230px,1fr); }
}
@media (max-width:850px) { .history-heading-tools { gap: 12px; flex-wrap: wrap; justify-content: end; }.history-heading-tools .history-meta { display: none; }}

@media (pointer:coarse) { .history-node { width: 44px; height: 44px; }.history-panel :is(input,select,.history-button) { min-height: 44px; } }


.history-filter-groups { flex: 1 1 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.history-filter-note { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.history-controls .active-filters { flex: 1 1 100%; padding: 12px 0 0; }
.history-filter-value { position: relative; display: inline-flex; max-width: 100%; min-width: 46px; padding: 2px 3px; border-radius: 2px; vertical-align: middle; outline: none; }
.history-filter-value:hover,.history-filter-value:focus-within { background: rgba(185,243,108,.07); box-shadow: 0 0 0 1px var(--line-bright); }
.history-filter-value.is-included { background: rgba(185,243,108,.14); box-shadow: 0 0 0 1px rgba(185,243,108,.65); }
.history-filter-value.is-excluded { background: rgba(255,116,104,.12); box-shadow: 0 0 0 1px rgba(255,116,104,.65); }
.history-filter-value:hover > .table-filter-overlay,.history-filter-value:focus-within > .table-filter-overlay { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.history-recipe-separator { color: var(--faint); }


.history-env-node { scroll-margin: 145px 30px 35px; }
.history-env-node[aria-pressed=true] { outline: 1px solid var(--history-purple); outline-offset: 1px; border-radius: 4px; background: rgba(181,164,245,.1); }
.history-environment-value { display: block; margin: 22px 0 12px; color: var(--history-purple); font: 16px/1.6 var(--mono); overflow-wrap: anywhere; }
.history-environment-sources { margin-top: 20px; }
.history-environment-sources summary { color: var(--muted); font-size: 13px; }
.history-environment-sources summary::before { content: "+ "; color: var(--history-purple); }
.history-environment-sources[open] summary::before { content: "− "; }
.history-environment-sources ul { padding-left: 18px; }
.history-environment-sources li + li { margin-top: 12px; }

.history-diff .history-environment-section th { padding-top: 20px; color: var(--text); font-weight: 600; }
.history-diff .is-focused-field { background: rgba(181,164,245,.06); }
.history-diff .is-focused-field th { color: var(--history-purple); box-shadow: inset 2px 0 var(--history-purple); padding-left: 10px; }
.history-field-focus { display: block; margin-top: 4px; font-size: 10px; line-height: 1.4; font-weight: 400; }

.history-change-label { display: block; margin-top: 5px; font-size: 10px; line-height: 1.4; color: var(--history-purple); }
.history-meta.history-changed-value { color: var(--history-purple); }

.history-detail-empty p { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }

@media (max-width:560px) {
  .history-heading h1 { font-size: 30px; }
  .history-controls input,.history-controls select { font-size: 16px; }
  .history-controls .history-search-field { flex-basis: 100%; }
  .history-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .history-metrics > div { gap: 8px; }
  .history-metrics span { font-size: 12px; }
  .history-detail { padding: 22px 16px; }
  .history-lane { grid-template-columns: 180px minmax(0,1fr); }
  .history-lane-label { padding-left: 12px; }
  .content-wrap:has(.history-panel:not([hidden])) { width: calc(100% - 24px); }
  .history-workspace { gap: 10px; }
  .history-workspace :is(.history-node,.history-env-node) { scroll-margin-left: 210px; }
  .history-filter-groups { grid-template-columns: 1fr; }
}
