.history-app-header { position: sticky; z-index: 20; top: 0; color: var(--ink); }
.history-app-header-inner { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; width: min(var(--page-width), 100%); min-height: 56px; margin-inline: auto; padding: 4px 12px; border-bottom: 3px double var(--gold); background-color: var(--paper); background-image: var(--paper-texture, none); }
.history-app-header strong { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
.history-back { display: flex; min-height: 44px; align-items: center; font-size: 14px; }
.history-page-shell { width: min(var(--page-width), 100%); min-height: calc(100vh - 140px); margin: 0 auto; background-color: var(--paper); background-image: var(--paper-texture, none); }
.history-filter-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); min-height: 48px; border-bottom: 1px solid var(--line); }
.history-filter-row > strong { display: grid; place-items: center; background: var(--yellow); font-size: 14px; }
.history-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; }
.history-condition-chips { min-width: 0; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; }
.history-condition-group { display: none; }
[data-history-trend="sx"] [data-history-condition-group="sx"],
[data-history-trend="wx"] [data-history-condition-group="wx"],
[data-history-trend="tail"] [data-history-condition-group="tail"] { display: contents; }
.history-chip { display: inline-flex; flex: none; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); font-size: 14px; }
.history-chip:hover { border-color: var(--rose); }
.history-chip.is-active { border-color: var(--gold); background: linear-gradient(105deg, #791511, #a91d18 60%, #861511); color: #ffe2a0; box-shadow: inset 0 1px #e3b465, inset 0 -2px #caa051; }
.history-log-card { margin-top: 14px; }
.history-log-scroll { overflow-x: auto; overscroll-behavior-inline: contain; }
.history-log-list { min-width: 344px; font-variant-numeric: tabular-nums; }
.history-log-header, .history-log-row { display: grid; grid-template-columns: minmax(62px, 1.18fr) repeat(7, minmax(40px, 1fr)); }
.history-log-header { min-height: 42px; border-block: 1px solid var(--gold); background: #e5d5b5b3; }
.history-log-heading { display: grid; place-items: center; padding: 7px 2px; border-right: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.history-log-body { position: relative; }
.history-log-row { min-height: 66px; border-bottom: 1px solid var(--line); }
.history-issue-cell, .history-ball-cell { position: relative; z-index: 2; display: grid; align-content: center; justify-items: center; min-width: 0; padding: 6px 2px; border-right: 1px solid var(--line); }
.history-issue-cell { background: var(--surface); }
.history-issue-cell strong { font-size: 12px; white-space: nowrap; }
.history-special-heading, .history-ball-cell.is-special-cell { border-left: 1px solid var(--cinnabar); }
.history-ball { --sphere-light: #e6ddc8; --sphere-mid: #b8a98c; --sphere-dark: #8c7b60; --sphere-edge: #867456; position: relative; display: grid; width: clamp(27px, 7.4vw, 38px); aspect-ratio: 1; place-items: center; border: 1px solid var(--sphere-edge); border-radius: 50%; background: radial-gradient(circle at 32% 20%, var(--sphere-light), var(--sphere-mid) 48%, var(--sphere-dark)); box-shadow: inset 0 1px 1px #ffffffb3, inset 0 -1px 2px #00000026, 0 1px 2px #45291333; color: #fff; font-family: "Arial Narrow", Arial, sans-serif; font-stretch: condensed; font-size: clamp(15px, 3.7vw, 20px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.035em; text-shadow: 0 1px #0002; }
.history-ball::after { position: absolute; inset: 2px; border: 1px solid #ffffff70; border-radius: 50%; pointer-events: none; content: ""; }
.history-ball-red { --sphere-light: #e04a42; --sphere-mid: #c21d20; --sphere-dark: #8a0c11; --sphere-edge: #9b2420; }
.history-ball-blue { --sphere-light: #4e94dd; --sphere-mid: #0760b9; --sphere-dark: #064180; --sphere-edge: #245d96; }
.history-ball-green { --sphere-light: #47a96a; --sphere-mid: #07894a; --sphere-dark: #035832; --sphere-edge: #267549; }
.history-ball-pending, .history-ball-sealed { --sphere-light: #faf4e7; --sphere-mid: #e0d3b9; --sphere-dark: #beac89; --sphere-edge: #aa9775; color: #6f5537; }
.history-ball-cell small { margin-top: 3px; font-size: 11px; line-height: 1.1; white-space: nowrap; }
.history-ball.is-trend-match { outline: 2px solid var(--cinnabar); outline-offset: 2px; }
.history-trend-canvas { position: absolute; z-index: 1; inset: 0 auto auto 0; pointer-events: none; }
.history-empty { display: grid; min-height: 160px; place-items: center; color: var(--muted); }
.history-load-zone { padding: 12px; text-align: center; }
.history-load-more { width: 100%; min-height: 40px; border: 1px solid var(--gold); background-color: var(--paper); background-image: var(--paper-texture, none); color: var(--cinnabar); }
.history-load-more:disabled { cursor: wait; opacity: .6; }
.history-load-status { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.history-pagination { display: flex; justify-content: center; gap: 16px; padding: 12px; }
.history-page-shell.is-enhanced .history-pagination { display: none; }
.history-footer { width: min(var(--page-width), 100%); margin-inline: auto; padding: 24px 12px; border-top: 1px solid var(--ink); background: var(--paper); color: var(--ink); text-align: center; font-size: 12px; }
