#tab-history .hist-display-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 760px; min-height: 54px; margin: .75rem auto .65rem; padding: .35rem .5rem .35rem .8rem;
  border: 1px solid rgba(148,163,184,.17); border-radius: 13px;
  background: rgba(15,23,42,.54); color: #e2e8f0;
}
#tab-history .hist-display-intro { display: flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 750; letter-spacing: .015em; }
#tab-history .hist-display-spark { color: #fb7185; font-size: 1rem; }
#tab-history .hist-display-toggle { display: flex; gap: .15rem; padding: .2rem; border: 1px solid rgba(148,163,184,.15); border-radius: 10px; background: rgba(2,6,23,.5); }
#tab-history .hist-display-toggle button { border: 0; border-radius: 7px; background: transparent; color: #94a3b8; padding: .4rem .62rem; font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer; }
#tab-history .hist-display-toggle button:hover { color: #fff; }
#tab-history .hist-display-toggle button.active { color: #fff; background: linear-gradient(135deg,#e85d65,#c93853); box-shadow: 0 4px 14px rgba(225,66,89,.25); }
#tab-history .hist-display-toggle button:focus-visible,
#tab-history .hist-range-tabs button:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }

#tab-history .hist-analytics { max-width: 1180px; margin: 0 auto; padding: clamp(1rem,2.5vw,1.6rem); border: 1px solid #263349; border-radius: 22px; background: radial-gradient(circle at 83% -12%,rgba(225,72,100,.18),transparent 36%),radial-gradient(circle at 6% 20%,rgba(56,189,248,.08),transparent 38%),#0b1220; color: #f8fafc; box-shadow: 0 24px 70px rgba(0,0,0,.23); }
#tab-history .hist-analytics * { box-sizing: border-box; }
#tab-history .hist-analytics-hero { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1.2rem; margin-bottom: 1.25rem; }
#tab-history .hist-analytics-eyebrow { display: inline-flex; align-items: center; gap: .48rem; color: #fda4af; font-size: .66rem; font-weight: 900; letter-spacing: .16em; }
#tab-history .hist-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px #34d399; }
#tab-history .hist-analytics-hero h2 { margin: .32rem 0 .15rem; color: #fff; font-size: clamp(1.55rem,3.6vw,2.35rem); line-height: 1.12; font-weight: 900; letter-spacing: -.045em; }
#tab-history .hist-analytics-hero h2 span { color: #fb7185; }
#tab-history .hist-analytics-hero p { margin: .3rem 0 0; color: #94a3b8; font-size: .82rem; }
#tab-history .hist-range-tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .3rem; border: 1px solid #334155; border-radius: 12px; background: #111b2b; }
#tab-history .hist-range-tabs button { border: 0; border-radius: 8px; background: transparent; color: #94a3b8; padding: .48rem .68rem; font: inherit; font-size: .76rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
#tab-history .hist-range-tabs button:hover { color: #fff; }
#tab-history .hist-range-tabs button.active { color: #fff; background: #334155; }
#tab-history .hist-analytics-controls { display: flex; flex-direction: column; align-items: flex-end; gap: .55rem; }
#tab-history .hist-analytics-date { display: flex; align-items: center; gap: .55rem; color: #aebdd0; font-size: .72rem; font-weight: 750; }
#tab-history .hist-analytics-date input { min-height: 38px; padding: .3rem .55rem; border: 1px solid #475569; border-radius: 9px; color: #fff; background: #172337; font: inherit; color-scheme: dark; cursor: pointer; }
#tab-history .hist-analytics-date input:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
#tab-history .hist-analytics-date-trigger { position: relative; user-select: none; -webkit-user-select: none; cursor: pointer; }
#tab-history .hist-analytics-date-trigger:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
#tab-history .hist-analytics-date-value { display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; padding: .3rem .55rem; border: 1px solid #475569; border-radius: 9px; color: #fff; background: #172337; font-weight: 800; white-space: nowrap; }
#tab-history .hist-analytics-date-value svg { width: .8rem; height: .8rem; color: #cbd5e1; }
#tab-history .hist-analytics-date-trigger input.hist-date-picker-proxy { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; margin: 0; border: 0; opacity: 0; cursor: pointer; }
#tab-history .hist-analytics [data-hist-tip] { cursor: help; }
#tab-history .hist-analytics [data-hist-tip]:focus-visible { outline: 2px solid #fbbf24; outline-offset: 3px; }

#tab-history .hist-analytics-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; margin-bottom: .75rem; }
#tab-history .hist-analytics-kpi { min-width: 0; padding: 1rem 1.05rem; border: 1px solid #29364a; border-radius: 15px; background: linear-gradient(150deg,#182438,#111b2c); }
#tab-history .hist-analytics-kpi > span { display: block; color: #91a1b7; font-size: .64rem; font-weight: 900; letter-spacing: .1em; }
#tab-history .hist-analytics-kpi strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: .42rem 0 .3rem; color: #fff; font-size: clamp(1.14rem,2.3vw,1.75rem); line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
#tab-history .hist-analytics-kpi small { color: #9caec2; font-size: .69rem; }
#tab-history .hist-analytics-kpi-highlight { border-color: rgba(251,113,133,.38); background: linear-gradient(135deg,rgba(196,50,78,.26),#192138); }
#tab-history .hist-analytics-kpi-highlight strong { color: #fecdd3; }

#tab-history .hist-analytics-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: .75rem; }
#tab-history .hist-analytics-card { min-width: 0; padding: 1.15rem; border: 1px solid #29364a; border-radius: 16px; background: #121d2f; }
#tab-history .hist-analytics-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: 1rem; }
#tab-history .hist-card-overline { color: #fb7185; font-size: .62rem; font-weight: 900; letter-spacing: .12em; }
#tab-history .hist-analytics-card h3 { margin: .18rem 0 0; color: #f8fafc; font-size: 1.02rem; line-height: 1.2; }
#tab-history .hist-card-tag { flex: 0 0 auto; padding: .28rem .48rem; border: 1px solid #334155; border-radius: 6px; color: #94a3b8; background: #182438; font-size: .66rem; font-weight: 700; }
#tab-history .hist-chart-empty { display: grid; min-height: 180px; place-items: center; padding: 1rem; border: 1px dashed #334155; border-radius: 12px; color: #94a3b8; font-size: .82rem; text-align: center; }

#tab-history .hist-trend-wrap { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .6rem; height: 206px; }
#tab-history .hist-trend-axis { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 5px; color: #74849a; font-size: .64rem; font-variant-numeric: tabular-nums; }
#tab-history .hist-trend-svg { width: 100%; height: 196px; overflow: visible; cursor: crosshair; touch-action: pan-y; }
#tab-history .hist-trend-gridline { fill: none; stroke: #334155; stroke-width: 1; stroke-dasharray: 5 6; }
#tab-history .hist-trend-line { fill: none; stroke: #fb7185; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#tab-history .hist-trend-svg circle { fill: #fecdd3; stroke: #e11d48; stroke-width: 2; }
#tab-history .hist-trend-labels { display: flex; justify-content: space-between; margin: -.05rem 0 0 4.6rem; color: #94a3b8; font-size: .68rem; }
#tab-history .hist-chart-hint { margin: .55rem 0 0 4.6rem; color: #7f91a9; font-size: .66rem; }

#tab-history .hist-donut-layout { display: flex; align-items: center; gap: 1rem; min-height: 205px; }
#tab-history .hist-donut { flex: 0 0 clamp(130px,14vw,174px); display: grid; place-items: center; width: clamp(130px,14vw,174px); aspect-ratio: 1; border-radius: 50%; background: var(--donut); box-shadow: 0 0 35px rgba(251,113,133,.12); }
#tab-history .hist-donut { cursor: help; }
#tab-history .hist-donut > div { display: flex; flex-direction: column; justify-content: center; align-items: center; width: 70%; height: 70%; border-radius: 50%; background: #121d2f; }
#tab-history .hist-donut strong { font-size: 1.55rem; line-height: 1; font-variant-numeric: tabular-nums; }
#tab-history .hist-donut span { margin-top: .3rem; color: #94a3b8; font-size: .67rem; }
#tab-history .hist-donut-legend { min-width: 0; flex: 1; display: grid; gap: .55rem; }
#tab-history .hist-donut-legend > div { display: flex; align-items: center; gap: .48rem; min-width: 0; font-size: .72rem; }
#tab-history .hist-donut-legend i { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 2px; }
#tab-history .hist-donut-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cbd5e1; }
#tab-history .hist-donut-legend strong { margin-left: auto; color: #fff; font-variant-numeric: tabular-nums; }

#tab-history .hist-product-bars { display: grid; gap: .88rem; padding: .2rem 0 .3rem; }
#tab-history .hist-product-row { display: flex; align-items: center; gap: .72rem; min-width: 0; }
#tab-history .hist-product-rank { color: #64748b; font-size: .74rem; font-weight: 900; }
#tab-history .hist-product-info { flex: 1; min-width: 0; }
#tab-history .hist-product-info > div:first-child { display: flex; justify-content: space-between; gap: .6rem; margin-bottom: .36rem; font-size: .77rem; }
#tab-history .hist-product-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e2e8f0; }
#tab-history .hist-product-info > div:first-child span { flex: 0 0 auto; color: #94a3b8; font-variant-numeric: tabular-nums; }
#tab-history .hist-product-track { height: 7px; overflow: hidden; border-radius: 99px; background: #263246; }
#tab-history .hist-product-track > span { display: block; height: 100%; border-radius: inherit; }

#tab-history .hist-heat-layout { display: flex; gap: .55rem; min-width: 0; }
#tab-history .hist-heat-weekdays { display: grid; grid-template-rows: repeat(7,15px); gap: 4px; color: #64748b; font-size: .6rem; line-height: 15px; }
#tab-history .hist-heat-scroll { max-width: 100%; overflow-x: auto; padding-bottom: .3rem; }
#tab-history .hist-heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7,15px); grid-auto-columns: 15px; gap: 4px; width: max-content; }
#tab-history .hist-heat-cell { display: block; width: 15px; height: 15px; padding: 0; border: 0; border-radius: 3px; background: #253246; }
#tab-history .hist-heat-grid button.hist-heat-cell { min-height: 0; }
#tab-history button.hist-heat-cell { cursor: pointer; }
#tab-history button.hist-heat-cell:hover, #tab-history button.hist-heat-cell:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#tab-history .hist-heat-cell.level-1 { background: #674357; }
#tab-history .hist-heat-cell.level-2 { background: #a14d62; }
#tab-history .hist-heat-cell.level-3 { background: #e26a7a; }
#tab-history .hist-heat-cell.level-4 { background: #fda4af; }
#tab-history .hist-heat-cell.is-spacer { background: transparent; }
#tab-history .hist-heat-footer { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: .75rem; color: #94a3b8; font-size: .62rem; }
#tab-history .hist-heat-footer span:first-child { margin-right: .25rem; }
#tab-history .hist-heat-footer span:last-child { margin-left: .25rem; }
#tab-history .hist-heat-footer i { width: 11px; height: 11px; }
#tab-history .hist-hourly-bars { display: flex; gap: 3px; align-items: flex-end; min-height: 180px; overflow-x: auto; padding: 10px 1px 0; }
#tab-history .hist-hourly-bar { position: relative; display: flex; flex: 1 0 24px; min-width: 24px; height: 155px; align-items: flex-end; justify-content: center; padding: 0 0 25px; border: 0; border-bottom: 1px solid #334155; background: transparent; cursor: pointer; }
#tab-history .hist-hourly-bar > span { width: 72%; min-height: 3px; border-radius: 5px 5px 0 0; background: linear-gradient(#fda4af,#e94566); }
#tab-history .hist-hourly-bar:hover > span, #tab-history .hist-hourly-bar:focus-visible > span { background: #fbbf24; }
#tab-history .hist-hourly-bar small { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%) rotate(-40deg); transform-origin: center; color: #91a1b7; font-size: .58rem; white-space: nowrap; }
#tab-history .hist-hourly-note { margin: .6rem 0 0; color: #91a1b7; font-size: .69rem; }
#histAnalyticsTooltip { position: fixed; z-index: 100000; display: flex; flex-direction: column; gap: .35rem; width: min(260px,calc(100vw - 16px)); padding: .75rem .85rem; border: 1px solid #fb7185; border-radius: 11px; background: #101827; color: #e2e8f0; box-shadow: 0 14px 40px rgba(0,0,0,.5); font: 12px/1.4 system-ui,sans-serif; pointer-events: none; }
#histAnalyticsTooltip strong { color: #fff; font-size: .82rem; }
#histAnalyticsTooltip button { align-self: flex-start; padding: .3rem .5rem; border: 1px solid #495a70; border-radius: 6px; background: #27364d; color: #fff; font: inherit; cursor: pointer; }
#histAnalyticsTooltip .hist-tip-close { align-self: flex-end; }
#histAnalyticsTooltip.is-pinned { pointer-events: auto; }
#histAnalyticsTooltip[hidden] { display: none; }

#tab-history .hist-analytics-foot { display: grid; grid-template-columns: minmax(0,1fr) minmax(160px,1fr); align-items: center; gap: .65rem 1rem; margin-top: .75rem; padding: .9rem 1rem; border: 1px solid #29364a; border-radius: 13px; background: #111b2b; }
#tab-history .hist-analytics-foot > div:first-child { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; }
#tab-history .hist-analytics-foot strong { color: #fda4af; font-size: .66rem; letter-spacing: .08em; }
#tab-history .hist-analytics-foot span { color: #cbd5e1; font-size: .75rem; }
#tab-history .hist-pay-split { height: 7px; border-radius: 99px; background: #38bdf8; overflow: hidden; }
#tab-history .hist-pay-split.is-empty { background: #334155; }
#tab-history .hist-pay-split span { display: block; height: 100%; background: #fbbf24; }
#tab-history .hist-analytics-foot small { grid-column: 1 / -1; color: #8192a8; font-size: .68rem; }

/* Bitácora de cambios: lectura rápida de quién hizo qué y cuándo. */
#tab-history .audit-panel { max-width: 1180px; margin: 1rem auto 0; padding: clamp(1rem,2.5vw,1.55rem); border: 1px solid #263349; border-radius: 22px; background: radial-gradient(circle at 92% -15%,rgba(225,72,100,.2),transparent 34%),radial-gradient(circle at 5% 20%,rgba(56,189,248,.07),transparent 35%),#0b1220; color: #f8fafc; box-shadow: 0 24px 70px rgba(0,0,0,.2); }
#tab-history .audit-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
#tab-history .audit-eyebrow { color: #fda4af; font-size: .62rem; font-weight: 900; letter-spacing: .16em; }
#tab-history .audit-hero h2 { margin: .3rem 0 .2rem; font-size: clamp(1.5rem,3vw,2.15rem); letter-spacing: -.045em; line-height: 1.12; }
#tab-history .audit-hero h2 span { color: #fb7185; }
#tab-history .audit-hero p { margin: 0; color: #94a3b8; font-size: .8rem; }
#tab-history .audit-last-seen { min-width: 180px; padding: .72rem .85rem; border: 1px solid #334155; border-radius: 12px; background: #111b2b; text-align: right; }
#tab-history .audit-last-seen span, #tab-history .audit-last-seen small { display: block; color: #8192a8; font-size: .63rem; }
#tab-history .audit-last-seen strong { display: block; margin: .2rem 0; color: #fff; font-size: .78rem; text-transform: capitalize; }
#tab-history .audit-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; margin-bottom: .8rem; }
#tab-history .audit-kpis > div { min-width: 0; padding: .85rem .9rem; border: 1px solid #29364a; border-radius: 14px; background: linear-gradient(150deg,#182438,#111b2c); }
#tab-history .audit-kpis > div.is-danger { border-color: rgba(248,113,113,.35); }
#tab-history .audit-kpis span, #tab-history .audit-kpis small { display: block; color: #91a1b7; font-size: .64rem; }
#tab-history .audit-kpis strong { display: block; margin: .25rem 0; color: #fff; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
#tab-history .audit-kpis .is-danger strong { color: #fda4af; }
#tab-history .audit-filters { display: flex; align-items: flex-end; gap: .55rem; flex-wrap: wrap; padding: .7rem; margin-bottom: .65rem; border: 1px solid #29364a; border-radius: 13px; background: #111b2b; }
#tab-history .audit-filters label { display: grid; gap: .25rem; color: #91a1b7; font-size: .62rem; font-weight: 800; }
#tab-history .audit-filters select, #tab-history .audit-search { min-height: 38px; border: 1px solid #3b4b61; border-radius: 9px; color: #e2e8f0; background: #172337; font: inherit; font-size: .74rem; }
#tab-history .audit-filters select { min-width: 150px; padding: .35rem .55rem; }
#tab-history .audit-search { display: flex; align-items: center; gap: .4rem; flex: 1 1 250px; padding: 0 .6rem; }
#tab-history .audit-search span { color: #fda4af; font-size: 1.15rem; line-height: 1; }
#tab-history .audit-search input { width: 100%; border: 0; outline: 0; color: #fff; background: transparent; font: inherit; font-size: .76rem; }
#tab-history .audit-search input::placeholder { color: #718198; }
#tab-history .audit-clear-filters { min-height: 38px; padding: .35rem .7rem; border: 1px solid #64748b; border-radius: 9px; color: #e2e8f0; background: transparent; font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
#tab-history .audit-clear-filters:hover { border-color: #fda4af; color: #fff; }
#tab-history .audit-results-meta { margin: .7rem 0 .55rem; color: #8192a8; font-size: .7rem; }
#tab-history .audit-results-meta strong { color: #fda4af; }
#tab-history .audit-event-list { display: grid; gap: .65rem; }
#tab-history .audit-event-card { display: grid; grid-template-columns: 16px minmax(0,1fr); gap: .7rem; min-width: 0; }
#tab-history .audit-event-rail { position: relative; display: flex; justify-content: center; }
#tab-history .audit-event-dot { z-index: 1; width: 12px; height: 12px; margin-top: 1.25rem; border: 3px solid #0b1220; border-radius: 50%; background: var(--audit-accent); box-shadow: 0 0 0 1px var(--audit-accent),0 0 14px color-mix(in srgb,var(--audit-accent) 35%,transparent); }
#tab-history .audit-event-line { position: absolute; top: 1.8rem; bottom: -.65rem; width: 1px; background: #334155; }
#tab-history .audit-event-card:last-child .audit-event-line { display: none; }
#tab-history .audit-event-main { min-width: 0; padding: .85rem 1rem; border: 1px solid #29364a; border-radius: 14px; background: #121d2f; }
#tab-history .audit-event-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
#tab-history .audit-action-pill { display: inline-flex; padding: .26rem .48rem; border: 1px solid color-mix(in srgb,var(--audit-accent) 55%,#334155); border-radius: 6px; color: var(--audit-accent); background: color-mix(in srgb,var(--audit-accent) 10%,transparent); font-size: .62rem; font-weight: 900; }
#tab-history .audit-event-head h4 { margin: .35rem 0 0; color: #f8fafc; font-size: .92rem; }
#tab-history .audit-event-date { flex: 0 0 auto; text-align: right; }
#tab-history .audit-event-date strong, #tab-history .audit-event-date span { display: block; }
#tab-history .audit-event-date strong { color: #fff; font-size: .78rem; font-variant-numeric: tabular-nums; }
#tab-history .audit-event-date span { margin-top: .18rem; color: #8192a8; font-size: .66rem; text-transform: capitalize; }
#tab-history .audit-actor { display: flex; align-items: center; gap: .48rem; margin: .7rem 0 .65rem; padding-bottom: .6rem; border-bottom: 1px solid rgba(148,163,184,.13); }
#tab-history .audit-actor-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: linear-gradient(135deg,#e85d65,#8b3e62); font-size: .64rem; font-weight: 900; }
#tab-history .audit-actor strong, #tab-history .audit-actor small { display: block; }
#tab-history .audit-actor strong { color: #e2e8f0; font-size: .76rem; }
#tab-history .audit-actor small { margin-top: .1rem; color: #8192a8; font-size: .64rem; }
#tab-history .audit-change-list { display: grid; gap: .3rem; }
#tab-history .audit-change-row { display: grid; grid-template-columns: minmax(90px,.55fr) minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: .45rem; padding: .35rem .45rem; border-radius: 7px; background: rgba(15,23,42,.48); font-size: .7rem; }
#tab-history .audit-change-field { color: #cbd5e1; font-weight: 800; }
#tab-history .audit-change-before { overflow: hidden; color: #94a3b8; text-overflow: ellipsis; white-space: nowrap; }
#tab-history .audit-change-arrow { color: #fbbf24; font-weight: 900; }
#tab-history .audit-change-after { overflow: hidden; color: #86efac; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
#tab-history .audit-change-empty, #tab-history .audit-more-changes { color: #94a3b8; font-size: .7rem; }
#tab-history .audit-more-changes { margin-top: .4rem; color: #fda4af; font-weight: 800; }
#tab-history .audit-filter-empty { padding: 2.25rem 1rem; border: 1px dashed #3b4b61; border-radius: 14px; color: #94a3b8; text-align: center; }
#tab-history .audit-filter-empty > span { display: block; color: #fda4af; font-size: 2rem; }
#tab-history .audit-filter-empty strong { display: block; margin-top: .35rem; color: #e2e8f0; font-size: .9rem; }
#tab-history .audit-filter-empty p { margin: .3rem 0 .8rem; font-size: .72rem; }
#tab-history .audit-filter-empty button { padding: .45rem .7rem; border: 1px solid #64748b; border-radius: 8px; color: #fff; background: transparent; font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
#tab-history .audit-load-more { display: block; width: 100%; margin-top: .7rem; padding: .65rem .8rem; border: 1px solid #3b4b61; border-radius: 10px; color: #fda4af; background: #111b2b; font: inherit; font-size: .72rem; font-weight: 900; cursor: pointer; }
#tab-history .audit-load-more:hover { border-color: #fda4af; background: #182438; }
#tab-history .audit-load-more span { color: #8192a8; font-weight: 700; }
#tab-history .audit-retention { margin-top: .8rem; color: #718198; font-size: .66rem; }

body:not(.dark-mode) #tab-history .hist-display-toolbar { background: #fff; color: #273746; border-color: #d8e0e7; }
body:not(.dark-mode) #tab-history .hist-display-toggle { background: #eef2f6; border-color: #d8e0e7; }
body:not(.dark-mode) #tab-history .hist-display-toggle button:not(.active) { color: #536371; }
body:not(.dark-mode) #tab-history .audit-panel { border-color: #d8e0e7; background: radial-gradient(circle at 92% -15%,rgba(225,72,100,.1),transparent 34%),#f7f9fb; color: #273746; }
body:not(.dark-mode) #tab-history .audit-last-seen, body:not(.dark-mode) #tab-history .audit-filters { border-color: #d8e0e7; background: #fff; }
body:not(.dark-mode) #tab-history .audit-kpis > div, body:not(.dark-mode) #tab-history .audit-event-main { border-color: #d8e0e7; background: #fff; }
body:not(.dark-mode) #tab-history .audit-filters select, body:not(.dark-mode) #tab-history .audit-search { border-color: #c4d0dc; color: #273746; background: #f7f9fb; }
body:not(.dark-mode) #tab-history .audit-search input { color: #273746; }
body:not(.dark-mode) #tab-history .audit-event-head h4, body:not(.dark-mode) #tab-history .audit-kpis strong { color: #273746; }
body:not(.dark-mode) #tab-history .audit-event-date strong, body:not(.dark-mode) #tab-history .audit-actor strong { color: #344451; }
body:not(.dark-mode) #tab-history .audit-change-row { background: #f1f5f8; }
body:not(.dark-mode) #tab-history .audit-load-more { border-color: #c4d0dc; background: #fff; }

@media (max-width: 900px) {
  #tab-history .hist-analytics-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #tab-history .hist-analytics-grid { grid-template-columns: 1fr; }
  #tab-history .audit-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #tab-history .audit-filters { align-items: stretch; }
  #tab-history .audit-filters label { flex: 1 1 140px; }
  #tab-history .audit-filters select { width: 100%; }
}
@media (max-width: 560px) {
  #tab-history .hist-display-toolbar { padding: .5rem; }
  #tab-history .hist-display-intro { font-size: .72rem; }
  #tab-history .hist-display-toggle button { padding: .5rem .55rem; font-size: .74rem; }
  #tab-history .hist-analytics { padding: .8rem; border-radius: 16px; }
  #tab-history .hist-analytics-hero { align-items: flex-start; }
  #tab-history .hist-analytics-controls { align-items: stretch; width: 100%; }
  #tab-history .hist-range-tabs { display: grid; grid-template-columns: repeat(5,1fr); width: 100%; }
  #tab-history .hist-range-tabs button { padding: .55rem .2rem; font-size: .69rem; }
  #tab-history .hist-analytics-date { justify-content: space-between; }
  #tab-history .hist-analytics-kpi { padding: .82rem; }
  #tab-history .hist-analytics-kpi strong { font-size: 1.17rem; }
  #tab-history .hist-analytics-card { padding: .85rem; }
  #tab-history .hist-donut-layout { gap: .6rem; }
  #tab-history .hist-donut { flex-basis: 128px; width: 128px; }
  #tab-history .hist-heat-weekdays { grid-template-rows: repeat(7,24px); }
  #tab-history .hist-heat-grid { grid-template-rows: repeat(7,24px); grid-auto-columns: 24px; }
  #tab-history .hist-heat-grid .hist-heat-cell { width: 24px; height: 24px; }
  #tab-history .hist-analytics-foot { grid-template-columns: 1fr; }
  #tab-history .hist-analytics-foot small { grid-column: 1; }
  #tab-history .audit-panel { padding: .8rem; border-radius: 16px; }
  #tab-history .audit-kpis { gap: .45rem; }
  #tab-history .audit-kpis > div { padding: .7rem; }
  #tab-history .audit-kpis strong { font-size: 1.2rem; }
  #tab-history .audit-event-main { padding: .75rem; }
  #tab-history .audit-event-head { display: block; }
  #tab-history .audit-event-date { margin-top: .55rem; text-align: left; }
  #tab-history .audit-change-row { grid-template-columns: minmax(75px,.55fr) minmax(0,1fr) auto minmax(0,1fr); gap: .3rem; font-size: .65rem; }
}

/* Cierre de caja integrado al resumen gráfico de una jornada. */
#tab-history .hist-shift-close {
  display: grid; grid-template-columns: minmax(150px,.8fr) minmax(0,3fr) auto; align-items: center; gap: .8rem 1.15rem;
  margin: 0 0 .8rem; padding: .9rem 1rem; border: 1px solid rgba(251,191,36,.25); border-radius: 14px;
  background: linear-gradient(105deg,rgba(251,191,36,.08),rgba(17,27,43,.94) 38%); color: #f8fafc;
}
#tab-history .hist-shift-close-heading { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
#tab-history .hist-shift-close-heading h3 { margin: .18rem 0 0; font-size: .95rem; }
#tab-history .hist-shift-close-state { display: inline-flex; align-items: center; gap: .35rem; font-size: .7rem; font-weight: 850; white-space: nowrap; }
#tab-history .hist-shift-close-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fbbf24; }
#tab-history .hist-shift-close-state.is-exact { color: #6ee7b7; }
#tab-history .hist-shift-close-state.is-exact::before { background: #34d399; }
#tab-history .hist-shift-close-state.is-diff { color: #fca5a5; }
#tab-history .hist-shift-close-state.is-diff::before { background: #fb7185; }
#tab-history .hist-shift-close-values { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: center; }
#tab-history .hist-shift-close-value { display: grid; gap: .22rem; padding: .1rem .75rem; border-left: 1px solid rgba(148,163,184,.17); }
#tab-history .hist-shift-close-value:first-child { border-left: 0; }
#tab-history .hist-shift-close-value span { color: #94a3b8; font-size: .65rem; font-weight: 750; }
#tab-history .hist-shift-close-value strong { color: #e2e8f0; font-size: .86rem; font-weight: 850; white-space: nowrap; }
#tab-history .hist-shift-close-value.is-exact strong { color: #6ee7b7; }
#tab-history .hist-shift-close-value.is-diff strong { color: #fda4af; }
#tab-history .hist-shift-close-value.is-sales strong { color: var(--color-primary-hover); }
#tab-history .hist-shift-close-detail { justify-self: end; border: 0; background: transparent; color: #fbbf24; font: inherit; font-size: .72rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
#tab-history .hist-shift-close-detail:hover { color: #fde68a; }
#tab-history .hist-shift-close-detail span { padding-left: .2rem; font-size: 1rem; }
#tab-history .hist-shift-close-note { grid-column: 2 / -1; margin: -.2rem 0 0; color: #94a3b8; font-size: .72rem; }
@media (max-width: 800px) {
  #tab-history .hist-shift-close { grid-template-columns: 1fr auto; gap: .7rem; }
  #tab-history .hist-shift-close-heading { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  #tab-history .hist-shift-close-values { grid-column: 1 / -1; grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: .65rem; }
  #tab-history .hist-shift-close-value:nth-child(odd) { border-left: 0; padding-left: 0; }
  #tab-history .hist-shift-close-detail { grid-column: 1 / -1; justify-self: start; padding: .2rem 0; }
  #tab-history .hist-shift-close-note { grid-column: 1 / -1; }
}
/* Historial comparte el sistema del POS: ritmo de 4 px, controles de 40 px,
   superficies neutras y el coral de marca reservado para el estado activo. */
#tab-history .history-workspace { width: min(100%, 1560px); margin: 0 auto; padding: 12px 24px 32px; color: var(--color-text-primary); box-sizing: border-box; }
#tab-history .history-workspace *, #tab-history .history-workspace *::before, #tab-history .history-workspace *::after { box-sizing: border-box; }
#tab-history .history-workspace-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; min-width:0; margin:0 0 12px; border-bottom:1px solid var(--color-border); }
#tab-history .history-workspace-toolbar > .export-backup-menu { flex:0 0 auto; margin:0 0 4px 12px; }
#tab-history .history-section-nav { display:flex; align-items:center; gap:4px; width:auto; min-width:0; margin:0; padding:4px 0; border:0; background:transparent; }
#tab-history .history-section-link { position:relative; min-height:40px; padding:8px 14px; border:0; border-radius:8px 8px 0 0; color:var(--color-text-secondary); background:transparent; font:inherit; font-size:14px; font-weight:600; line-height:1.2; cursor:pointer; }
#tab-history .history-section-link:hover { color:var(--color-text-primary); background:var(--color-surface-hover); }
#tab-history .history-section-link.is-active { color:var(--color-primary-hover); background:transparent; }
#tab-history .history-section-link.is-active::after { position:absolute; right:10px; bottom:-5px; left:10px; height:2px; border-radius:2px; background:var(--color-primary); content:""; }
#tab-history .history-section-link:focus-visible, #tab-history .history-sale-detail:focus-visible, #tab-history .history-sale-actions summary:focus-visible, #tab-history .history-search input:focus-visible, #tab-history .history-payment-filters button:focus-visible { outline:2px solid var(--color-focus); outline-offset:2px; }
#tab-history .history-workspace-content { min-width:0; }
#tab-history .history-view-description { margin:0 0 12px; color:var(--color-text-muted); font-size:13px; line-height:1.5; }
#tab-history .hist-compact-layout { width:100%; max-width:none; margin:0; }
#tab-history .hist-date-bar { display:flex; justify-content:flex-start; width:100%; max-width:none; margin:0 0 16px; padding:0; }
#tab-history .hist-date-actions { display:flex; align-items:center; gap:8px; }
#tab-history .hist-datepicker-wrap { min-height:40px; border:1px solid var(--color-border-strong); border-radius:8px; background:var(--color-surface); box-shadow:none; }
#tab-history .hist-datepicker-wrap:focus-within { outline:2px solid var(--color-focus); outline-offset:2px; }
#tab-history .history-sales-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:0 0 20px; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
#tab-history .history-sales-summary > div { display:grid; gap:4px; min-width:0; padding:12px 16px; border-right:1px solid var(--color-border); }
#tab-history .history-sales-summary > div:last-child { border-right:0; }
#tab-history .history-sales-summary span { color:var(--color-text-muted); font-size:12px; font-weight:600; }
#tab-history .history-sales-summary strong { color:var(--color-text-primary); font-size:18px; line-height:1.25; font-weight:700; font-variant-numeric:tabular-nums; }
#tab-history .history-sales-summary small { color:var(--color-text-muted); font-size:12px; }
#tab-history .history-list-controls { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 8px; }
#tab-history .history-list-label { color:var(--color-text-primary); font-size:15px; font-weight:700; }
#tab-history .history-payment-filters { display:flex; align-items:center; gap:4px; }
#tab-history .history-payment-filters button { min-height:36px; padding:6px 12px; border:1px solid transparent; border-radius:7px; color:var(--color-text-secondary); background:transparent; font:inherit; font-size:13px; font-weight:600; line-height:1.2; cursor:pointer; }
#tab-history .history-payment-filters button:hover { background:var(--color-surface-hover); color:var(--color-text-primary); }
#tab-history .history-payment-filters button.is-active { border-color:var(--color-border); color:var(--color-text-primary); background:var(--color-surface-raised); }
#tab-history .history-records-panel { border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
#tab-history .history-records-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; border-bottom:1px solid var(--color-border); }
#tab-history .history-records-toolbar > span { flex:0 0 auto; color:var(--color-text-muted); font-size:12px; font-variant-numeric:tabular-nums; }
#tab-history .history-search { display:block; width:min(100%,380px); }
#tab-history .history-search input { width:100%; min-height:40px; padding:8px 12px; border:1px solid var(--color-border-strong); border-radius:8px; color:var(--color-text-primary); background:var(--color-input); font:inherit; font-size:14px; font-weight:400; line-height:1.2; }
#tab-history .history-search input::placeholder { color:var(--color-text-muted); }
#tab-history .history-table-wrap { width:100%; overflow-x:auto; }
#tab-history #historySalesTable { width:100%; min-width:1000px; border-collapse:collapse; table-layout:fixed; }
#tab-history #historySalesTable col.history-col-time { width:72px; }
#tab-history #historySalesTable col.history-col-order { width:300px; }
#tab-history #historySalesTable col.history-col-mode { width:112px; }
#tab-history #historySalesTable col.history-col-payment { width:128px; }
#tab-history #historySalesTable col.history-col-status { width:100px; }
#tab-history #historySalesTable col.history-col-amount { width:145px; }
#tab-history #historySalesTable col.history-col-actions { width:143px; }
#tab-history #historySalesTable th { height:40px; padding:8px 12px; border-bottom:1px solid var(--color-border); color:var(--color-text-muted); background:var(--color-surface-raised); font-size:11px; font-weight:700; text-align:left; white-space:nowrap; }
#tab-history #historySalesTable td { padding:11px 12px; border-bottom:1px solid var(--color-border); color:var(--color-text-secondary); font-size:13px; vertical-align:middle; }
#tab-history #historySalesTable tbody tr:last-child td { border-bottom:0; }
#tab-history #historySalesTable tbody tr[data-search]:hover { background:var(--color-surface-hover); }
#tab-history #historySalesTable td:first-child { color:var(--color-text-muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
#tab-history #historySalesTable td:nth-child(2) { min-width:220px; }
#tab-history #historySalesTable td:nth-child(2) strong, #tab-history #historySalesTable td:nth-child(2) small { display:block; }
#tab-history #historySalesTable td:nth-child(2) strong { overflow:hidden; color:var(--color-text-primary); font-size:13px; font-weight:650; text-overflow:ellipsis; white-space:nowrap; }
#tab-history #historySalesTable td:nth-child(2) small { overflow:hidden; max-width:440px; margin-top:3px; color:var(--color-text-muted); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
#tab-history #historySalesTable .history-amount { min-width:120px; color:var(--color-text-primary); font-size:14px; font-weight:700; text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#tab-history #historySalesTable th.history-amount { text-align:right; }
#tab-history .history-payment-label { color:var(--color-text-secondary); }
#tab-history .history-status { display:inline-flex; padding:3px 7px; border:1px solid var(--color-border); border-radius:5px; color:var(--color-text-secondary); background:transparent; font-size:11px; font-weight:600; white-space:nowrap; }
#tab-history .history-status.is-paid { color:var(--color-success); border-color:color-mix(in srgb,var(--color-success) 28%,var(--color-border)); }
#tab-history .history-status.is-pending { color:var(--color-warning); border-color:color-mix(in srgb,var(--color-warning) 32%,var(--color-border)); }
#tab-history td.history-record-actions { display:table-cell; padding-right:16px; text-align:right; vertical-align:middle; white-space:nowrap; }
#tab-history .history-row-actions { display:inline-flex; align-items:center; justify-content:flex-end; gap:6px; min-width:0; max-width:100%; white-space:nowrap; }
#tab-history .history-sale-detail, #tab-history .history-icon-action { min-height:34px; padding:6px 10px; border:1px solid var(--color-border); border-radius:7px; color:var(--color-text-secondary); background:transparent; font:inherit; font-size:12px; font-weight:600; line-height:1.2; cursor:pointer; }
#tab-history .history-sale-detail:hover, #tab-history .history-icon-action:hover { color:var(--color-text-primary); background:var(--color-surface-hover); }
#tab-history .history-sale-actions { position:relative; }
#tab-history .history-sale-actions summary { display:grid; width:34px; min-height:34px; place-items:center; border:1px solid var(--color-border); border-radius:7px; color:var(--color-text-secondary); cursor:pointer; list-style:none; }
#tab-history .history-sale-actions summary::marker, #tab-history .history-sale-actions summary::-webkit-details-marker { display:none; content:""; }
#tab-history .history-sale-actions > div { position:absolute; z-index:20; top:calc(100% + 5px); right:0; min-width:148px; padding:4px; border:1px solid var(--color-border); border-radius:8px; background:var(--color-surface); box-shadow:var(--elevation-md); }
#tab-history .history-sale-actions button { width:100%; min-height:36px; padding:8px; border:0; border-radius:5px; color:var(--color-danger); background:transparent; text-align:left; font:inherit; font-size:13px; font-weight:500; line-height:1.2; cursor:pointer; }
#tab-history .history-sale-actions button:hover { background:var(--color-surface-hover); }
#tab-history .history-list-empty { display:grid; gap:5px; justify-items:center; padding:40px 16px; color:var(--color-text-muted); text-align:center; }
#tab-history .history-list-empty strong { color:var(--color-text-primary); font-size:14px; }
#tab-history .history-list-empty span, #tab-history .history-search-empty { color:var(--color-text-muted); font-size:13px; }
#tab-history .history-search-empty { margin:0; padding:18px; text-align:center; }
#tab-history .history-search-empty[hidden] { display:none; }
#tab-history #historySalesTable tr[hidden] { display:none; }
#tab-history .history-cash-close-view { display:grid; gap:12px; }
#tab-history .history-close-note { margin:0; color:var(--color-text-muted); font-size:13px; }
#tab-history .history-cash-close-view .hist-shift-close { margin:0; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); color:var(--color-text-primary); box-shadow:none; }
#tab-history .history-cash-close-view .hist-shift-close-value span, #tab-history .history-cash-close-view .hist-shift-close-note { color:var(--color-text-muted); }
#tab-history .history-cash-close-view .hist-shift-close-value strong { color:var(--color-text-primary); }
#tab-history .history-cash-close-view .hist-shift-close-detail { color:var(--color-primary-hover); }
#tab-history .hist-analytics, #tab-history .audit-panel { width:100%; max-width:none; margin:0; padding:20px; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); color:var(--color-text-primary); box-shadow:none; }
#tab-history .hist-analytics-hero h2, #tab-history .audit-hero h2 { color:var(--color-text-primary); font-size:22px; letter-spacing:0; }
#tab-history .hist-analytics-hero h2 span, #tab-history .audit-hero h2 span { color:var(--color-primary); }
#tab-history .hist-analytics-eyebrow, #tab-history .hist-card-overline, #tab-history .audit-eyebrow { color:var(--color-text-muted); letter-spacing:.08em; }
#tab-history .hist-range-tabs, #tab-history .hist-analytics-date-value, #tab-history .hist-analytics-date input { border-color:var(--color-border-strong); border-radius:8px; color:var(--color-text-secondary); background:var(--color-surface-raised); }
#tab-history .hist-range-tabs button.active { color:var(--color-text-primary); background:var(--color-surface-hover); }
#tab-history .hist-analytics-kpi, #tab-history .hist-analytics-card, #tab-history .audit-kpis > div, #tab-history .audit-event-main { border-color:var(--color-border); border-radius:9px; background:var(--color-surface-raised); box-shadow:none; }
#tab-history .hist-analytics-kpi > span, #tab-history .hist-analytics-kpi small, #tab-history .hist-analytics-card h3, #tab-history .audit-kpis span, #tab-history .audit-kpis small, #tab-history .audit-event-head h4 { color:var(--color-text-secondary); }
#tab-history .hist-analytics-kpi strong, #tab-history .audit-kpis strong { color:var(--color-text-primary); font-variant-numeric:tabular-nums; }
#tab-history .hist-analytics-kpi-highlight { border-color:var(--color-border); background:var(--color-surface-raised); }
#tab-history .hist-analytics-kpi-highlight strong { color:var(--color-primary-hover); }
#tab-history .hist-chart-empty, #tab-history .hist-analytics-card, #tab-history .audit-filters { border-color:var(--color-border); background:var(--color-surface-raised); }
#tab-history .hist-live-dot { background:var(--color-success); box-shadow:none; }
#tab-history .audit-event-date strong, #tab-history .audit-last-seen strong { color:var(--color-text-primary); }
#tab-history .history-workspace :where(button, input, select, [tabindex]):focus-visible, #tab-history .hist-analytics :focus-visible { outline:2px solid var(--color-focus); outline-offset:2px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (max-width: 1048px) {
 #tab-history .history-workspace { padding:12px 16px 88px; }
 #tab-history .history-workspace-toolbar { flex-wrap:wrap; }
 #tab-history .history-section-nav { flex-wrap:wrap; overflow:visible; }
 #tab-history .history-section-link { flex:0 0 auto; }
 #tab-history .history-sales-summary > div { padding:10px 12px; }
 #tab-history #historySalesTable, #tab-history #historySalesTable tbody { display:block; }
 #tab-history .history-records-panel, #tab-history .history-table-wrap,
 #tab-history #historySalesTable, #tab-history #historySalesTable tbody,
 #tab-history #historySalesTable tbody tr[data-search] { width:100%; min-width:0; max-width:100%; }
 #tab-history .history-table-wrap { overflow:visible; }
 #tab-history #historySalesTable { table-layout:auto; }
 #tab-history #historySalesTable thead { display:none; }
 #tab-history #historySalesTable tbody { display:grid; gap:8px; padding:8px; }
 #tab-history #historySalesTable tbody tr[data-search] { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; padding:12px; border:1px solid var(--color-border); border-radius:9px; background:var(--color-surface); }
 #tab-history #historySalesTable tbody tr[data-search] td { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:8px; min-width:0; max-width:100%; padding:0; border:0; text-align:right; overflow-wrap:anywhere; }
 #tab-history #historySalesTable tbody tr[data-search] td::before { content:attr(data-label); color:var(--color-text-muted); font-size:11px; text-align:left; }
 #tab-history #historySalesTable tbody tr[data-search] td:first-child { grid-row:2; }
 #tab-history #historySalesTable tbody tr[data-search] td:nth-child(2) { grid-column:1 / -1; grid-row:1; display:block; padding-bottom:8px; border-bottom:1px solid var(--color-border); text-align:left; }
 #tab-history #historySalesTable tbody tr[data-search] td:nth-child(2)::before { display:none; }
 #tab-history #historySalesTable tbody tr[data-search] td:nth-child(6) { color:var(--color-text-primary); }
 #tab-history #historySalesTable tbody tr[data-search] td:nth-child(7) { grid-column:1 / -1; justify-content:flex-end; }
 #tab-history #historySalesTable tbody tr[data-search] td.history-record-actions { justify-items:stretch; }
 #tab-history #historySalesTable tbody tr[data-search] td.history-record-actions .history-row-actions { justify-self:end; flex-wrap:wrap; }
 #tab-history #historySalesTable td:nth-child(2) strong { overflow-wrap:anywhere; white-space:normal; }
 #tab-history #historySalesTable td:nth-child(2) small { max-width:none; white-space:normal; }
 #tab-history #historySalesTable tbody tr:not([data-search]) { display:table-row; }
 #tab-history #historySalesTable tbody tr:not([data-search]) td { display:table-cell; }
 #tab-history .history-cash-close-view .hist-shift-close { grid-template-columns:1fr; }
 #tab-history .hist-analytics-grid { grid-template-columns:minmax(0,1fr); }
 #tab-history .hist-analytics-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 480px) {
 #tab-history .history-workspace { padding:10px 12px 88px; }
 #tab-history .history-workspace-toolbar { align-items:flex-start; gap:4px; }
 #tab-history .history-section-nav { flex:1 1 100%; width:100%; }
 #tab-history .history-workspace-toolbar > .export-backup-menu { margin:0 0 8px auto; }
 #tab-history .history-sales-summary > div { padding:9px 8px; }
 #tab-history .history-sales-summary strong { font-size:15px; }
 #tab-history .history-sales-summary span, #tab-history .history-sales-summary small { font-size:10px; }
 #tab-history .history-list-controls { align-items:flex-start; flex-direction:column; gap:6px; }
 #tab-history .history-payment-filters { width:100%; }
 #tab-history .history-payment-filters button { flex:1; }
 #tab-history .history-records-toolbar { padding:10px; }
 #tab-history .history-search { width:100%; }
 #tab-history .history-search input { min-height:40px; }
 #tab-history .history-records-toolbar > span { display:none; }
 #tab-history #historySalesTable tbody tr[data-search] { gap:10px 8px; padding:10px; }
 #tab-history #historySalesTable tbody tr[data-search] td:nth-child(2) { min-width:0; }
 #tab-history .hist-analytics, #tab-history .audit-panel { padding:14px; }
 #tab-history .hist-analytics-kpis { grid-template-columns:minmax(0,1fr); }
}
body:not(.dark-mode) #tab-history .history-section-link.is-active { color:var(--color-primary-strong); }
body:not(.dark-mode) #tab-history .history-payment-filters button.is-active { color:var(--color-primary-strong); }

/* Nueva consulta de caja y posventa: estilos limitados al Historial. */
#tab-history .history-workspace-header { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:0; margin:0 0 12px; }
#tab-history .history-workspace-header h2 { margin:0; }
#tab-history .history-workspace-toolbar { align-items:center; }
#tab-history .history-workspace-toolbar > .export-backup-menu { margin:0 0 0 auto; }
#tab-history .history-section-link { min-height:44px; }
#tab-history .history-pos-sale-error { margin:0 0 12px; padding:10px 12px; border:1px solid color-mix(in srgb,var(--color-warning) 40%,var(--color-border)); border-radius:8px; color:var(--color-text-primary); background:var(--color-surface-raised); font-size:13px; }
#tab-history .history-workspace-header > div { min-width:0; }
#tab-history .history-eyebrow { margin:0 0 4px; color:var(--color-text-muted); font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
#tab-history .history-workspace-header h2 { margin:0; color:var(--color-text-primary); font-size:20px; line-height:1.25; font-weight:700; }
#tab-history .history-workspace-header .export-backup-menu { flex:0 0 auto; }
#tab-history .history-period-row { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:0 0 16px; }
#tab-history .history-period-options { display:flex; flex-wrap:wrap; gap:4px; }
#tab-history .history-period-options button, #tab-history .history-custom-dates input { min-height:44px; padding:8px 12px; border:1px solid var(--color-border); border-radius:8px; color:var(--color-text-secondary); background:var(--color-surface); font:inherit; font-size:13px; }
#tab-history .history-period-options button.is-active { border-color:var(--color-primary); color:var(--color-primary-strong); background:var(--color-surface-raised); font-weight:700; }
#tab-history .history-period-label { color:var(--color-text-muted); font-size:13px; }
#tab-history .history-custom-dates { display:flex; gap:8px; flex-wrap:wrap; }
#tab-history .history-custom-dates label, #tab-history .history-filter-panel label { display:grid; gap:4px; color:var(--color-text-muted); font-size:12px; font-weight:600; }
#tab-history .history-custom-dates input, #tab-history .history-filter-panel input, #tab-history .history-filter-panel select { min-width:0; min-height:44px; padding:8px 10px; border:1px solid var(--color-border-strong); border-radius:8px; color:var(--color-text-primary); background:var(--color-input); font:inherit; font-size:14px; }
#tab-history .history-cash-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0 0 24px; }
#tab-history .history-cash-card { min-width:0; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
#tab-history .history-cash-card summary { display:grid; gap:8px; min-height:108px; align-content:space-between; padding:14px; cursor:pointer; list-style:none; }
#tab-history .history-cash-card summary::-webkit-details-marker, #tab-history .history-cash-card summary::marker { display:none; content:""; }
#tab-history .history-cash-card summary span { color:var(--color-text-muted); font-size:13px; font-weight:600; }
#tab-history .history-cash-card summary strong { color:var(--color-text-primary); font-size:21px; font-variant-numeric:tabular-nums; }
#tab-history .history-cash-card p { margin:0; padding:0 14px 14px; color:var(--color-text-secondary); font-size:13px; line-height:1.5; }
#tab-history .history-section-heading { margin:24px 0 12px; font-size:18px; }
#tab-history .history-summary-view .hist-analytics-controls { display:none; }
#tab-history .history-filter-panel { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); align-items:end; gap:8px; margin-bottom:12px; padding:12px; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
#tab-history .history-filter-panel label:first-child { grid-column:span 2; }
#tab-history .history-filter-actions { display:flex; grid-column:1/-1; justify-content:flex-end; flex-wrap:wrap; gap:8px; }
#tab-history .history-action-secondary, #tab-history .history-action-primary { display:inline-flex; min-height:44px; align-items:center; justify-content:center; gap:8px; padding:9px 14px; border:1px solid var(--color-border-strong); border-radius:8px; color:var(--color-text-primary); background:var(--color-surface); font:inherit; font-size:14px; font-weight:600; line-height:1.2; cursor:pointer; }
#tab-history .history-action-secondary:hover { background:var(--color-surface-hover); }
#tab-history .history-action-primary { border-color:var(--color-primary); color:var(--color-primary-contrast,#fff); background:var(--color-primary); }
#tab-history .history-filter-summary { display:flex; justify-content:space-between; gap:12px; padding:8px 2px; color:var(--color-text-muted); font-size:13px; }
#tab-history .history-filter-summary strong { color:var(--color-text-primary); font-variant-numeric:tabular-nums; }
#tab-history .history-period-sales { display:grid; gap:8px; }
#tab-history .history-sale-card { display:grid; grid-template-columns:minmax(140px,1.3fr) minmax(140px,1fr) minmax(130px,1fr) auto; align-items:center; gap:12px; min-width:0; padding:12px 14px; border:1px solid var(--color-border); border-radius:9px; color:var(--color-text-secondary); background:var(--color-surface); font:inherit; text-align:left; cursor:pointer; }
#tab-history .history-sale-card:hover { background:var(--color-surface-hover); }
#tab-history .history-sale-card > span { min-width:0; }
#tab-history .history-sale-card strong, #tab-history .history-sale-card small { display:block; overflow-wrap:anywhere; }
#tab-history .history-sale-card > span:first-child strong { color:var(--color-text-primary); }
#tab-history .history-sale-card small { margin-top:4px; color:var(--color-text-muted); }
#tab-history .history-sale-card > strong { color:var(--color-text-primary); text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#tab-history .history-empty-state { margin:0; padding:28px; border:1px dashed var(--color-border-strong); border-radius:10px; color:var(--color-text-muted); text-align:center; }
#tab-history .history-closure-card { margin-bottom:8px; padding:14px; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
#tab-history .history-closure-card header, #tab-history .history-closure-card header > div { display:flex; align-items:center; justify-content:space-between; gap:12px; }
#tab-history .history-closure-card header > div { align-items:flex-start; flex-direction:column; gap:4px; }
#tab-history .history-closure-card header span, #tab-history .history-closure-card p { color:var(--color-text-muted); font-size:13px; }
#tab-history .history-closure-card > div { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:12px; }
#tab-history .history-closure-card > div span { display:grid; gap:4px; color:var(--color-text-muted); font-size:12px; }
#tab-history .history-closure-card > div strong { color:var(--color-text-primary); font-size:16px; font-variant-numeric:tabular-nums; }
#tab-history .history-closure-card .is-difference strong { color:var(--color-warning); }
#tab-history .history-activity-list { display:grid; gap:8px; }
#tab-history .history-activity-list article { display:grid; grid-template-columns:minmax(130px,auto) minmax(120px,auto) minmax(120px,1fr) minmax(120px,auto) auto; align-items:center; gap:12px; min-width:0; padding:12px; border:1px solid var(--color-border); border-radius:9px; background:var(--color-surface); font-size:13px; }
#tab-history .history-activity-list time, #tab-history .history-activity-list article span { color:var(--color-text-muted); }
#tab-history .history-activity-list b { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.history-detail-backdrop { position:fixed; inset:0; z-index:1300; display:flex; justify-content:flex-end; background:rgba(15,23,42,.48); }
.history-detail-drawer { display:flex; width:min(100%,520px); height:100%; flex-direction:column; overflow:auto; border-left:1px solid var(--color-border); color:var(--color-text-primary); background:var(--color-surface); box-shadow:var(--elevation-lg); }
.history-detail-drawer > header { position:sticky; top:0; z-index:1; display:flex; justify-content:space-between; align-items:center; gap:12px; padding:16px; border-bottom:1px solid var(--color-border); background:var(--color-surface); }
.history-detail-drawer > header p, .history-detail-drawer > header h2 { margin:0; }
.history-detail-drawer > header p { color:var(--color-text-muted); font-size:12px; }
.history-detail-drawer > header button { width:44px; height:44px; border:1px solid var(--color-border); border-radius:8px; color:var(--color-text-primary); background:var(--color-surface); font-size:24px; }
.history-detail-body { display:grid; align-content:start; gap:18px; padding:16px; }
.history-detail-body section { display:grid; gap:8px; }
.history-detail-body h3, .history-detail-body p { margin:0; }
.history-detail-line { display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid var(--color-border); color:var(--color-text-secondary); font-size:13px; }
.history-detail-line strong { color:var(--color-text-primary); white-space:nowrap; font-variant-numeric:tabular-nums; }
.history-refund-card { display:grid; gap:6px; padding:10px; border:1px solid var(--color-border); border-radius:8px; background:var(--color-surface-raised); }
.history-refund-card span, .history-refund-card small { color:var(--color-text-muted); }
.history-refund-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.history-refund-form { display:grid; gap:12px; width:min(100% - 24px,560px); max-height:calc(100dvh - 24px); overflow:auto; align-self:center; margin:auto; padding:18px; border:1px solid var(--color-border); border-radius:12px; color:var(--color-text-primary); background:var(--color-surface); }
.history-refund-form h2 { margin:0; }
.history-refund-form > label { display:grid; gap:5px; color:var(--color-text-secondary); font-size:13px; }
.history-refund-form input:not([type=checkbox]), .history-refund-form select, .history-refund-form textarea { min-height:44px; padding:9px; border:1px solid var(--color-border-strong); border-radius:8px; color:var(--color-text-primary); background:var(--color-input); font:inherit; }
.history-refund-form textarea { min-height:72px; }
.history-refund-form fieldset { display:grid; gap:8px; border:1px solid var(--color-border); border-radius:8px; }
.history-refund-item { display:grid; grid-template-columns:24px 1fr 80px; align-items:center; gap:8px; }
.history-refund-item input { min-height:40px; width:100%; }
.history-refund-preview { margin:0; color:var(--color-text-muted); font-size:12px; }
.history-refund-form [role=status] { margin:0; color:var(--color-danger); }
@media (max-width: 768px) {
 #tab-history .history-cash-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
 #tab-history .history-workspace-header { align-items:flex-start; flex-wrap:wrap; }
 #tab-history .history-filter-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
 #tab-history .history-filter-panel label:first-child { grid-column:1/-1; }
 #tab-history .history-sale-card { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
 #tab-history .history-sale-card > span:nth-child(2), #tab-history .history-sale-card > span:nth-child(3) { grid-column:1/-1; }
 #tab-history .history-sale-card > strong { grid-column:2; grid-row:1; }
 #tab-history .history-activity-list article { grid-template-columns:1fr auto; }
 #tab-history .history-activity-list article time, #tab-history .history-activity-list article span { grid-column:1/-1; }
 #tab-history .history-activity-list b { grid-column:2; grid-row:2; }
}
@media (max-width: 480px) {
 #tab-history .history-workspace-header { gap:8px; }
 #tab-history .history-workspace-toolbar { align-items:flex-start; flex-wrap:wrap; }
 #tab-history .history-workspace-toolbar > .export-backup-menu { margin:0 0 8px auto; }
 #tab-history .history-workspace-header h2 { font-size:18px; }
 #tab-history .history-period-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; }
 #tab-history .history-period-options button { padding-inline:8px; }
 #tab-history .history-cash-summary { grid-template-columns:1fr; }
 #tab-history .history-cash-card summary { min-height:84px; }
 #tab-history .history-filter-panel { grid-template-columns:1fr; }
 #tab-history .history-filter-panel label:first-child { grid-column:auto; }
 #tab-history .history-filter-actions { justify-content:stretch; }
 #tab-history .history-filter-actions button { flex:1; }
 #tab-history .history-closure-card header { align-items:flex-start; flex-direction:column; }
 #tab-history .history-closure-card > div { grid-template-columns:1fr; }
 .history-detail-backdrop { justify-content:stretch; }
 .history-detail-drawer { width:100%; border-left:0; }
 .history-refund-form { max-height:100dvh; width:100%; border-radius:0; }
}
#tab-history .history-active-filters { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin:0 0 8px; color:var(--color-text-muted); font-size:12px; }
#tab-history .history-active-filters span { padding:5px 8px; border:1px solid var(--color-border); border-radius:999px; color:var(--color-text-secondary); background:var(--color-surface-raised); }
#tab-history .history-period-table-wrap { width:100%; overflow:visible; border:1px solid var(--color-border); border-radius:10px; background:var(--color-surface); }
#tab-history .history-period-table { width:100%; border-collapse:collapse; table-layout:fixed; }
#tab-history .history-period-table th { padding:10px 8px; border-bottom:1px solid var(--color-border); color:var(--color-text-muted); background:var(--color-surface-raised); font-size:11px; text-align:left; }
#tab-history .history-period-table th:nth-child(1) { width:9%; }
#tab-history .history-period-table th:nth-child(2) { width:24%; }
#tab-history .history-period-table th:nth-child(3) { width:12%; }
#tab-history .history-period-table th:nth-child(4) { width:11%; }
#tab-history .history-period-table th:nth-child(5) { width:15%; }
#tab-history .history-period-table th:nth-child(6) { width:10%; }
#tab-history .history-period-table th:nth-child(7) { width:11%; }
#tab-history .history-period-table th:nth-child(8) { width:8%; }
#tab-history .history-period-table td { padding:10px 8px; border-bottom:1px solid var(--color-border); color:var(--color-text-secondary); font-size:12px; vertical-align:middle; overflow-wrap:anywhere; }
#tab-history .history-period-table tbody tr:last-child td { border-bottom:0; }
#tab-history .history-period-table tbody tr:hover { background:var(--color-surface-hover); }
#tab-history .history-period-table td strong, #tab-history .history-period-table td small { display:block; }
#tab-history .history-period-table td strong { color:var(--color-text-primary); }
#tab-history .history-period-table td small { margin-top:4px; color:var(--color-text-muted); }
#tab-history .history-period-table .history-table-amount { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#tab-history .history-sales-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 10px; }
#tab-history .history-sales-heading h2, #tab-history .history-sales-heading p { margin:0; }
#tab-history .history-sales-heading h2 { color:var(--color-text-primary); font-size:20px; line-height:1.25; }
#tab-history .history-sales-heading p { margin-top:3px; color:var(--color-text-muted); font-size:14px; }
#tab-history .history-export-action { display:flex; align-items:center; gap:8px; }
#tab-history .history-export-hint { color:var(--color-text-muted); font-size:12px; }
#tab-history .history-search-row { display:flex; align-items:end; flex-wrap:wrap; gap:8px; margin:0 0 8px; }
#tab-history .history-search-row > label { display:grid; flex:1 1 360px; gap:4px; color:var(--color-text-primary); font-size:13px; font-weight:600; }
#tab-history .history-search-row input { box-sizing:border-box; width:100%; min-height:42px; padding:8px 10px; border:1px solid var(--color-border-strong); border-radius:8px; color:var(--color-text-primary); background:var(--color-input); font:inherit; font-size:14px; }
#tab-history .history-search-row input:focus-visible, #tab-history .history-filter-disclosure summary:focus-visible, #tab-history .history-clear-filters:focus-visible, #tab-history .history-active-filters button:focus-visible, #tab-history .history-period-table button:focus-visible { outline:2px solid var(--color-primary); outline-offset:2px; }
#tab-history .history-filter-disclosure { position:relative; flex:0 0 auto; }
#tab-history .history-filter-disclosure > summary { display:flex; min-height:42px; align-items:center; gap:8px; padding:8px 12px; border:1px solid var(--color-border-strong); border-radius:8px; color:var(--color-text-primary); background:var(--color-surface); font-size:14px; font-weight:600; cursor:pointer; list-style:none; }
#tab-history .history-filter-disclosure > summary::-webkit-details-marker { display:none; }
#tab-history .history-filter-disclosure > summary::after { content:"⌄"; }
#tab-history .history-filter-disclosure[open] > summary::after { content:"⌃"; }
#tab-history .history-filter-disclosure > summary span { color:var(--color-primary-strong); }
#tab-history .history-filter-disclosure .history-filter-panel { position:absolute; z-index:5; top:calc(100% + 6px); right:0; display:grid; grid-template-columns:repeat(2,minmax(160px,1fr)); width:min(440px,calc(100vw - 32px)); margin:0; padding:12px; box-shadow:var(--elevation-lg); }
#tab-history .history-clear-filters { min-height:42px; padding:8px 10px; border:0; border-radius:7px; color:var(--color-primary-strong); background:transparent; font:inherit; font-size:13px; font-weight:600; cursor:pointer; }
#tab-history .history-active-filters { margin:2px 0 6px; }
#tab-history .history-active-filters button { min-height:30px; padding:4px 9px; border:1px solid var(--color-border); border-radius:999px; color:var(--color-text-secondary); background:var(--color-surface-raised); font:inherit; font-size:12px; cursor:pointer; }
#tab-history .history-active-filters button span { margin-left:4px; font-size:15px; }
#tab-history .history-filter-summary { display:block; margin:4px 0 6px; padding:8px 0; color:var(--color-text-primary); font-size:14px; }
#tab-history .history-filter-summary strong { margin-left:3px; font-size:16px; }
#tab-history .history-period-table-wrap { overflow-x:auto; }
#tab-history .history-period-table { min-width:1050px; }
#tab-history .history-period-table th:nth-child(1) { width:11%; }
#tab-history .history-period-table th:nth-child(2) { width:23%; }
#tab-history .history-period-table th:nth-child(3) { width:13%; }
#tab-history .history-period-table th:nth-child(4) { width:12%; }
#tab-history .history-period-table th:nth-child(5) { width:12%; }
#tab-history .history-period-table th:nth-child(6) { width:10%; }
#tab-history .history-period-table th:nth-child(7) { width:10%; }
#tab-history .history-period-table th:nth-child(8) { width:9%; }
#tab-history .history-period-table td { font-size:13px; }
#tab-history .history-period-table .history-sale-order { font-size:14px; }
#tab-history .history-period-table .history-sale-products { font-size:13px; line-height:1.35; }
.history-detail-drawer > header h2 { overflow-wrap:anywhere; }
.history-detail-drawer > header > div > span { display:block; margin-top:5px; color:var(--color-text-muted); font-size:13px; }
.history-internal-id { color:var(--color-text-muted); font-size:12px; }
.history-internal-id code { display:block; margin-top:6px; overflow-wrap:anywhere; }
@media (max-width:768px) {
 #tab-history .history-period-table { min-width:0; }
 #tab-history .history-period-table td { font-size:13px; }
 #tab-history .history-period-table td:nth-child(1) { grid-column:1/-1; justify-content:start; text-align:left; }
 #tab-history .history-period-table td:nth-child(3), #tab-history .history-period-table td:nth-child(4), #tab-history .history-period-table td:nth-child(5), #tab-history .history-period-table td:nth-child(6) { grid-column:1/-1; }
 #tab-history .history-period-table td:nth-child(7) { grid-column:1/-1; font-size:16px; font-weight:700; }
 #tab-history .history-period-table td:nth-child(8) { grid-column:1/-1; justify-content:stretch; }
 #tab-history .history-period-table td:nth-child(8) button { width:100%; }
}
@media (max-width:480px) {
 #tab-history .history-sales-heading { align-items:flex-start; }
 #tab-history .history-export-action { align-items:flex-end; flex-direction:column; }
 #tab-history .history-export-hint { max-width:150px; text-align:right; }
 #tab-history .history-search-row > label { flex-basis:100%; }
 #tab-history .history-filter-disclosure .history-filter-panel { position:static; grid-template-columns:1fr; width:auto; margin-top:6px; box-shadow:none; }
 #tab-history .history-period-row { align-items:flex-start; }
 #tab-history .history-period-label { flex-basis:100%; }
}
@media (max-width:768px) {
 #tab-history .history-period-table-wrap { border:0; background:transparent; }
 #tab-history .history-period-table, #tab-history .history-period-table tbody { display:block; width:100%; }
 #tab-history .history-period-table thead { display:none; }
 #tab-history .history-period-table tbody { display:grid; gap:8px; }
 #tab-history .history-period-table tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; padding:12px; border:1px solid var(--color-border); border-radius:9px; background:var(--color-surface); }
 #tab-history .history-period-table tbody tr:hover { background:var(--color-surface-hover); }
 #tab-history .history-period-table td { display:grid; grid-template-columns:minmax(64px,auto) minmax(0,1fr); align-items:center; gap:8px; min-width:0; padding:0; border:0; text-align:right; }
 #tab-history .history-period-table td::before { content:attr(data-label); color:var(--color-text-muted); font-size:11px; text-align:left; }
 #tab-history .history-period-table td:nth-child(2) { grid-column:1/-1; padding-bottom:8px; border-bottom:1px solid var(--color-border); text-align:left; }
 #tab-history .history-period-table td:nth-child(2)::before { display:none; }
 #tab-history .history-period-table td:nth-child(7) { color:var(--color-text-primary); }
 #tab-history .history-period-table td:nth-child(8) { grid-column:1/-1; justify-content:flex-end; }
 #tab-history .history-period-table td:nth-child(8) button { min-width:100px; }
}
@media (max-width:480px) {
 #tab-history .history-period-table tbody tr { gap:10px 8px; padding:10px; }
 #tab-history .history-period-table td:nth-child(2) { min-width:0; }
}

/* Resumen del Historial: ventas primero, conciliación de caja como detalle. */
#tab-history .history-summary-view { display:grid; gap:18px; }
#tab-history .history-sales-analytics, #tab-history .history-cash-panel, #tab-history .history-summary-sales { min-width:0; }
#tab-history .history-analytics-intro, #tab-history .history-summary-sales > header { margin:0 0 10px; }
#tab-history .history-analytics-intro h2, #tab-history .history-summary-sales h2 { margin:0; color:var(--color-text-primary); font-size:20px; line-height:1.25; }
#tab-history .history-analytics-intro p, #tab-history .history-summary-sales > header p { margin:4px 0 0; color:var(--color-text-muted); font-size:13px; }
#tab-history .history-summary-view .hist-analytics { margin:0; padding:0; border:0; background:transparent; }
#tab-history .history-summary-view .hist-analytics-hero, #tab-history .history-summary-view .hist-analytics-foot { display:none; }
#tab-history .history-summary-view .hist-analytics-kpis { gap:8px; margin-bottom:8px; }
#tab-history .history-summary-view .hist-analytics-kpi { min-height:92px; padding:12px; }
#tab-history .history-summary-view .hist-analytics-kpi > span { font-size:10px; letter-spacing:.04em; }
#tab-history .history-summary-view .hist-analytics-kpi strong { font-size:20px; }
#tab-history .history-summary-view .hist-analytics-kpi small { font-size:11px; }
#tab-history .history-cash-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); min-height:76px; margin:0; overflow:hidden; border:1px solid var(--color-border); border-radius:9px; background:var(--color-surface); }
#tab-history .history-cash-indicator { display:flex; min-width:0; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; }
#tab-history .history-cash-indicator + .history-cash-indicator { border-left:1px solid var(--color-border); }
#tab-history .history-cash-indicator span { color:var(--color-text-muted); font-size:12px; font-weight:600; line-height:1.3; }
#tab-history .history-cash-indicator strong { color:var(--color-text-primary); font-size:18px; line-height:1.2; text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#tab-history .history-cash-indicator-values { display:flex; align-items:center; justify-content:flex-end; gap:14px; }
#tab-history .history-cash-indicator-values > span { display:grid; gap:2px; color:var(--color-text-muted); font-size:10px; line-height:1.1; text-align:right; }
#tab-history .history-cash-indicator-values strong { font-size:15px; }
#tab-history .history-cash-breakdown { margin-top:6px; }
#tab-history .history-cash-breakdown > summary { display:inline-flex; min-height:36px; align-items:center; gap:7px; padding:4px 2px; color:var(--color-text-secondary); font-size:12px; font-weight:600; cursor:pointer; list-style:none; }
#tab-history .history-cash-breakdown > summary::-webkit-details-marker, #tab-history .history-cash-breakdown > summary::marker { display:none; content:""; }
#tab-history .history-cash-breakdown > summary svg { width:13px; height:13px; transition:transform .16s ease; }
#tab-history .history-cash-breakdown[open] > summary svg { transform:rotate(180deg); }
#tab-history .history-cash-breakdown > summary:focus-visible, #tab-history .history-cash-movement-link:focus-visible { outline:2px solid var(--color-focus); outline-offset:2px; }
#tab-history .history-cash-breakdown-body { display:grid; gap:0; padding:6px 0; border-top:1px solid var(--color-border); }
#tab-history .history-cash-detail-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:12px; min-height:38px; padding:5px 4px; border-bottom:1px solid var(--color-border); color:var(--color-text-secondary); font-size:12px; }
#tab-history .history-cash-detail-row strong { color:var(--color-text-primary); text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#tab-history .history-cash-movement-link { min-height:30px; padding:5px 8px; border:1px solid var(--color-border); border-radius:6px; color:var(--color-primary-strong); background:transparent; font:inherit; font-size:11px; cursor:pointer; }
#tab-history .history-cash-breakdown > p { max-width:760px; margin:8px 0 0; color:var(--color-text-muted); font-size:11px; line-height:1.45; }
#tab-history .history-summary-sales { margin-top:2px; }
#tab-history .history-summary-sales > header { margin-bottom:8px; }
#tab-history .history-summary-sales .history-filter-panel { margin-bottom:8px; }
#tab-history .history-summary-sales .history-filter-summary { justify-content:flex-start; padding-block:4px 8px; }
@media (max-width:768px) {
 #tab-history .history-cash-indicator--outflows { flex-wrap:wrap; justify-content:flex-start; }
 #tab-history .history-cash-indicator--outflows > span { flex:1 0 100%; }
 #tab-history .history-cash-indicator--outflows .history-cash-indicator-values { width:100%; justify-content:space-between; }
 #tab-history .history-cash-indicator-values > span { display:flex; align-items:baseline; justify-content:space-between; gap:8px; text-align:left; }
}
@media (max-width:480px) {
 #tab-history .history-summary-view { gap:14px; }
 #tab-history .history-summary-view .hist-analytics-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
 #tab-history .history-cash-summary { grid-template-columns:1fr; }
 #tab-history .history-cash-indicator { min-height:48px; padding:8px 12px; }
 #tab-history .history-cash-indicator + .history-cash-indicator { border-top:1px solid var(--color-border); border-left:0; }
 #tab-history .history-cash-indicator strong { font-size:16px; }
 #tab-history .history-cash-indicator-values { gap:12px; }
 #tab-history .history-cash-indicator-values strong { font-size:14px; }
 #tab-history .history-cash-detail-row { grid-template-columns:minmax(0,1fr) auto; gap:6px 10px; }
 #tab-history .history-cash-detail-row strong { grid-column:2; grid-row:1; }
 #tab-history .history-cash-movement-link { grid-column:1/-1; justify-self:start; }
}
