.inventory-type-selector { margin-bottom: 16px; }
.inventory-type-selector .inventory-tabs { padding: 0; border: 0; background: transparent; }
.inventory-analytics { border: 1px solid var(--border-light); border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; background: white; box-shadow: 0 2px 5px rgba(25,35,50,.025); min-width: 0; }
.inventory-analytics [hidden] { display: none !important; }
.inv-viz-heading, .inv-viz-chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inv-viz-heading > div:first-child { min-width: 0; }
.inv-viz-heading h3 { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 650; color: var(--text-primary); }
.inv-viz-heading h3 i { color: var(--brand-orange); margin-right: 8px; }
.inv-viz-scope, .inv-viz-note { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.6; }
.inv-viz-scope { margin-top: 4px; overflow-wrap: anywhere; }
.inv-viz-heading-actions { display: flex; gap: 8px; flex-shrink: 0; }
.inv-viz-button { background: white; color: #596272; border: 1px solid var(--border-medium); border-radius: 7px; padding: 6px 10px; font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; white-space: nowrap; }
.inv-viz-button i { margin-right: 6px; }
.inv-viz-button:hover:not(:disabled) { color: var(--brand-orange-dark); border-color: var(--brand-orange); background: #fffaf6; }
.inv-viz-button:disabled { opacity: .4; cursor: default; }
.inventory-analytics button:focus-visible, .inv-viz-data summary:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 3px; }
.inv-viz-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; }
.inv-viz-stat { display: block; text-align: left; min-width: 0; padding: 10px 12px; border: 1px solid #e9ecf0; border-radius: 8px; background: #fafbfc; color: var(--text-primary); font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.inv-viz-stat:hover { background: #fff9f4; border-color: #f2b384; }
.inv-viz-stat:first-child { background: #fff8f2; border-color: #ffdfc6; }
.inv-viz-stat-label { display: flex; justify-content: space-between; gap: 8px; color: #596272; font-size: 12px; line-height: 1.4; }
.inv-viz-stat-label span { color: #7b818a; font-size: 11px; }
.inv-viz-stat-value { display: block; font-size: clamp(20px, 2vw, 24px); font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; margin: 3px 0; }
.inv-viz-stat:first-child .inv-viz-stat-value { color: #d65b0b; }
.inv-viz-stat-hint { display: flex; justify-content: space-between; gap: 6px; color: #76808e; font-size: 11px; line-height: 1.4; }
.inv-viz-stat-hint span { color: #d65b0b; font-size: 12px; }
#inventoryAnalyticsBody { min-width: 0; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.inv-viz-view-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.inv-viz-view-tabs button { flex: 0 1 auto; min-width: 0; border: 1px solid transparent; border-radius: 6px; padding: 6px 11px; background: #f5f6f8; color: #65707e; font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; }
.inv-viz-view-tabs button:hover { color: #b94b0a; background: #fff8f2; }
.inv-viz-view-tabs button[aria-selected="true"] { border-color: #ffdcc0; background: #fff4e9; color: #bd500d; font-weight: 600; }
.inv-viz-trend { min-width: 0; padding: 0; }
.inv-viz-chart-heading { flex-wrap: wrap; gap: 6px 12px; }
.inv-viz-chart-heading h4 { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 650; color: var(--text-primary); }
.inv-viz-periods { display: flex; gap: 3px; background: #f5f6f8; padding: 3px; border-radius: 7px; flex-shrink: 0; }
.inv-viz-periods button { border: 0; background: transparent; border-radius: 5px; padding: 4px 10px; font: inherit; font-size: 12px; line-height: 1.5; color: #68717e; cursor: pointer; }
.inv-viz-periods button[aria-pressed="true"] { background: #fff; color: #c9550d; box-shadow: 0 1px 4px #dfe2e7; font-weight: 600; }
.inv-viz-trend-summary { display: flex; gap: 28px; margin: 10px 0 4px; flex-wrap: wrap; }
.inv-viz-trend-summary > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inv-viz-trend-summary > div > span { color: #737d8b; font-size: 11px; line-height: 1.4; }
.inv-viz-trend-summary strong, .inv-viz-trend-summary button { color: #424b59; font-size: 14px; line-height: 1.5; font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-viz-canvas { height: 180px; width: 100%; min-width: 0; margin-top: 6px; }
.inv-viz-history-canvas { height: 180px; }
.inv-viz-charts { display: block; min-width: 0; }
.inv-viz-chart { min-width: 0; padding: 0; }
.inv-viz-message { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; font-size: 13px; line-height: 1.7; color: #77818f; background: #fafbfc; margin-top: 6px; border-radius: 7px; }
.inv-viz-status { padding: 14px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.inv-viz-data { margin-top: 6px; font-size: 12px; color: #68717d; }
.inv-viz-data summary { cursor: pointer; width: fit-content; padding: 3px 0; line-height: 1.5; }
.inv-viz-data-scroll { overflow: auto; max-height: 220px; margin-top: 6px; }
.inv-viz-data table { width: 100%; border-collapse: collapse; }
.inv-viz-data th, .inv-viz-data td { border-bottom: 1px solid var(--border-light); padding: 9px 8px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-viz-data th:first-child, .inv-viz-data td:first-child { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.inv-viz-data th { font-weight: 500; background: #f8f9fb; }
.inv-viz-value-link { padding: 0; border: 0; background: transparent; font: inherit; color: #ba4b0a; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.inv-viz-value-link:hover { color: #963b07; text-decoration: underline; }
.inv-viz-footnote { margin-top: 10px; font-size: 11px; }
.inv-viz-dialog { width: min(1160px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 64px); padding: 0; border: 1px solid #e2e6ec; border-radius: 14px; color: #303945; background: #fff; box-shadow: 0 24px 80px #15203333; margin: auto; }
.inv-viz-dialog::backdrop { background: rgba(20,29,40,.38); }
.inv-viz-dialog[open] { display: flex; flex-direction: column; }
.inv-viz-dialog-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 22px 24px 18px; border-bottom: 1px solid #e9ecf0; flex-shrink: 0; }
.inv-viz-dialog-heading h3 { font-size: 18px; line-height: 1.5; font-weight: 650; overflow-wrap: anywhere; margin-top: 4px; }
.inv-viz-dialog-heading .inv-viz-button { flex-shrink: 0; }
.inv-viz-detail-summary { margin: 18px 24px 6px; font-size: 19px; font-weight: 600; color: #c45510; font-variant-numeric: tabular-nums; }
.inv-viz-detail-note { margin: 0 24px 18px; color: #76808d; font-size: 12px; line-height: 1.7; }
.inv-viz-detail-scroll { margin: 0 24px; overflow: auto; min-height: 100px; overscroll-behavior: contain; }
.inv-viz-detail-scroll table { width: 100%; border-collapse: collapse; font-size: 12px; }
.inv-viz-detail-scroll[data-kind="current"] table { min-width: 1100px; table-layout: fixed; }
.inv-viz-detail-scroll[data-kind="current"] th:first-child { width: 74px; }
.inv-viz-detail-scroll[data-kind="current"] th:nth-child(2) { width: 175px; }
.inv-viz-detail-scroll[data-kind="current"] th:nth-child(3) { width: 106px; }
.inv-viz-detail-scroll th { position: sticky; top: 0; z-index: 1; background: #f4f6f8; color: #67717e; font-weight: 500; text-align: left; white-space: nowrap; padding: 12px; border-bottom: 1px solid #e4e8ed; }
.inv-viz-detail-scroll td { padding: 12px; border-bottom: 1px solid #edf0f3; line-height: 1.6; max-width: 270px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.inv-viz-detail-scroll tr:hover td { background: #fffaf6; }
.inv-viz-detail-footer { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-shrink: 0; color: #77808d; font-size: 12px; }
.inv-viz-detail-footer > div { display: flex; gap: 8px; }
@media (max-width: 760px) {
    .inv-viz-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .inventory-analytics { padding: 14px 12px; border-radius: 10px; }
    .inv-viz-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; }
    .inv-viz-heading > div:first-child { display: contents; }
    .inv-viz-heading h3 { grid-column: 1; grid-row: 1; font-size: 15px; }
    .inv-viz-heading .inv-viz-scope { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
    .inv-viz-heading-actions { grid-column: 2; grid-row: 1; gap: 6px; margin-left: 0; }
    .inv-viz-heading-actions .inv-viz-button { padding: 5px 8px; }
    .inv-viz-stats { gap: 8px; margin-top: 12px; }
    .inv-viz-stat { padding: 9px 10px; }
    .inv-viz-stat-value { font-size: 20px; margin: 4px 0; }
    .inv-viz-stat-label { font-size: 12px; gap: 4px; }
    .inv-viz-stat-hint { font-size: 11px; }
    .inv-viz-view-tabs { gap: 6px; }
    .inv-viz-view-tabs button { padding: 6px 9px; }
    .inv-viz-trend-summary { gap: 8px 16px; }
    .inv-viz-trend-summary strong, .inv-viz-trend-summary button { font-size: 13px; }
    .inv-viz-periods button { padding: 4px 8px; }
    .inv-viz-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 32px); border-radius: 10px; }
    .inv-viz-dialog-heading { padding: 16px; gap: 10px; }
    .inv-viz-dialog-heading h3 { font-size: 16px; }
    .inv-viz-detail-summary { margin: 14px 16px 6px; font-size: 17px; }
    .inv-viz-detail-note { margin: 0 16px 14px; }
    .inv-viz-detail-scroll { margin: 0 16px; }
    .inv-viz-detail-footer { padding: 14px 16px; flex-wrap: wrap; }
}
@media (max-width: 340px) {
    .inv-viz-heading { grid-template-columns: minmax(0, 1fr); }
    .inv-viz-heading-actions { grid-column: 1; grid-row: 3; justify-self: start; }
}
