.audit-chart-dialog { width: min(1100px, calc(100vw - 40px)); max-height: calc(100dvh - 40px); margin: auto; max-width: none; padding: 0; border: 0; border-radius: 12px; color: var(--text-primary, #213047); background: var(--card-bg, #fff); box-shadow: 0 18px 60px #17273c33; font: inherit; overflow-y: auto; }
.audit-chart-dialog::backdrop { background: #17273c66; }
.audit-chart-dialog * { box-sizing: border-box; }
.audit-chart-dialog ::selection { background: var(--visual-accent-soft,#e7efff); color: var(--visual-accent-deep,#173f9f); }
.audit-chart-dialog :is(button,input,select,summary,[tabindex]):focus-visible { outline: 3px solid var(--primary, #244bc2); outline-offset: 3px; }
.audit-chart-dialog :is(input,select) { caret-color: var(--primary,#244bc2); }
.audit-chart-dialog .btn { min-height: 38px; font-size: 14px; white-space: normal; }
.audit-chart-dialog .btn:disabled { opacity: .55; cursor: not-allowed; }
.ac-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 22px 28px; border-bottom: 1px solid var(--border-color, #e1e6ed); position: sticky; top: 0; background: var(--card-bg, #fff); z-index: 2; }
.ac-header h2 { font-size: 22px; line-height: 1.5; margin: 0; }
.ac-header p { margin: 4px 0 0; color: var(--text-secondary, #57667a); overflow-wrap: anywhere; font-size: 14px; }
.ac-content { padding: 20px 28px 28px; }
.ac-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.ac-saved-history { margin: -8px 0 16px; border-top: 1px solid var(--border-color, #e1e6ed); color: var(--text-secondary, #57667a); }
.ac-saved-history > summary { font-size: 13px; }
.ac-saved-history ul { display: grid; gap: 6px; max-height: 180px; overflow: auto; list-style: none; margin: 0 0 8px; padding: 0; }
.ac-saved-history li { min-width: 0; }
.ac-saved-history .btn { width: 100%; min-height: 0; padding: 8px 10px; text-align: left; overflow-wrap: anywhere; }
.ac-field { display: grid; align-content: start; gap: 8px; min-width: 0; font-size: 14px; }
.ac-field > :is(input,select) { width: 100%; min-width: 0; height: 40px; border: 1px solid var(--border-color, #c5cfdd); border-radius: 6px; padding: 8px 10px; color: inherit; background: var(--card-bg, #fff); font: inherit; }
.ac-field input::placeholder { color: var(--text-secondary,#57667a); opacity: 1; }
.ac-form { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin: 16px 0; }
.audit-chart-dialog summary { cursor: pointer; font-size: 14px; padding: 12px 0; color: var(--text-primary, #213047); }
.ac-settings > summary { font-weight: 600; font-size: 16px; }
.ac-settings { border-block: 1px solid var(--border-color, #e1e6ed); padding: 4px 0 16px; }
.ac-scope, .ac-basis { margin: 8px 0 16px; }
.audit-chart-dialog :is(p,dd) { line-height: 1.75; max-width: 75ch; overflow-wrap: anywhere; }
.ac-scope p, .ac-caption, .ac-basis { color: var(--text-secondary, #57667a); font-size: 13px; }
.ac-confirm { display: flex; align-items: start; gap: 8px; font-size: 14px; line-height: 1.65; margin: 20px 0; }
.ac-confirm input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary,#244bc2); flex: 0 0 auto; }
.ac-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.ac-actions > span { font-size: 12px; color: var(--text-secondary, #57667a); }
.ac-error { background: #fff4ef; border: 1px solid #e2b7a2; border-radius: 6px; padding: 12px 16px; color: #782d1c; margin: 14px 0; font-size: 14px; }
.ac-error p { margin: 0; }
.ac-error ul { max-height: 200px; overflow-y: auto; padding-left: 24px; }
.ac-error li { margin: 6px 0; }
.ac-error .btn { min-height: 28px; padding: 2px 10px; }
.ac-progress, .ac-message { font-size: 14px; padding: 12px 0; color: var(--visual-accent-deep,#173f9f); }
.ac-source-warning { margin: 16px 0 0; padding: 12px 16px; border: 1px solid #d4ad80; border-radius: 6px; background: #fff8ed; color: #704812; font-size: 14px; }
.ac-source-warning p { margin: 4px 0 10px; }
.ac-result { padding-top: 24px; }
.ac-result-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.ac-result h3, .ac-source h3 { font-size: 20px; margin: 0; line-height: 1.5; }
.ac-result-heading p { margin: 6px 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.ac-result-heading > span { font-size: 12px; color: var(--text-secondary, #57667a); white-space: nowrap; }
.ac-chart { background: var(--card-bg,#fff); border-bottom: 1px solid var(--border-color, #e1e6ed); margin-top: 10px; overflow-x: auto; scrollbar-color: var(--visual-line,#d3deea) var(--visual-surface-soft,#f1f5fa); }
.ac-chart svg { display: block; width: 100%; height: auto; }
.ac-kind-switch { display: flex; width: fit-content; max-width: 100%; border-bottom: 1px solid var(--border-color,#c5cfdd); gap: 18px; }
.ac-kind-switch button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-secondary,#57667a); padding: 10px 2px; font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; }
.ac-kind-switch button[aria-pressed="true"] { color: var(--visual-accent-deep,#173f9f); border-bottom-color: var(--primary,#244bc2); font-weight: 600; }
.ac-kind-switch button:hover { color: var(--visual-accent-deep,#173f9f); background: var(--visual-accent-soft,#e7efff); }
.ac-kind-switch button:disabled { cursor: progress; }
.ac-switch-status { min-height: 22px; margin: 4px 0 12px; font-size: 13px; color: var(--visual-accent-deep,#173f9f); }
.ac-period, .ac-concentration-summary { font-size: 13px; color: var(--text-secondary,#57667a); margin: 0 0 10px; }
.ac-concentration-summary strong { color: var(--text-primary,#213047); font-variant-numeric: tabular-nums; }
.ac-quick-field { display: flex; align-items: end; gap: 12px; padding: 12px 0 20px; }
.ac-quick-field label { display: grid; gap: 8px; min-width: 0; font-size: 14px; }
.ac-quick-field select { min-height: 40px; max-width: 100%; padding: 8px; color: var(--text-primary,#213047); background: var(--card-bg,#fff); border: 1px solid var(--border-color,#c5cfdd); border-radius: 6px; font: inherit; }
.ac-mobile-hint { display: none; }
.ac-caption { margin: 12px 0; }
.ac-basis dl { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; }
.ac-basis dt { font-weight: 600; }
.ac-basis dd { margin: 0; overflow-wrap: anywhere; }
.ac-table { max-width: 100%; overflow: auto; margin-top: 20px; scrollbar-color: var(--visual-line,#d3deea) var(--visual-surface-soft,#f1f5fa); }
.ac-table table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; font-variant-numeric: tabular-nums; }
.ac-table caption { text-align: left; font-size: 16px; font-weight: 600; padding-bottom: 12px; }
.ac-table :is(td,th) { border-bottom: 1px solid var(--border-color, #e1e6ed); padding: 10px 12px; white-space: nowrap; }
.ac-table thead { background: var(--visual-surface-soft, #f5f7fa); }
.ac-table tbody th { font-weight: 500; }
.ac-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 16px; font-size: 13px; }
.ac-source { position: absolute; inset: 0; z-index: 3; background: var(--card-bg, #fff); padding: 24px 28px; overflow: auto; min-height: 100%; }
.ac-source header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.ac-source header p { font-size: 14px; color: var(--text-secondary, #57667a); }
@media(max-width: 700px) { .ac-mobile-hint { display: block; font-size: 12px; color: var(--text-secondary,#57667a); } .audit-chart-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); } .ac-header { padding: 16px; } .ac-content { padding: 16px; } .ac-toolbar, .ac-form { grid-template-columns: 1fr; gap: 14px; } .ac-result-heading { flex-direction: column; gap: 0; } .ac-result h3 { font-size: 18px; } .ac-source { padding: 16px; } .ac-actions { gap: 8px; } .ac-actions > .btn { flex: 1 1 auto; } .ac-basis dl { grid-template-columns: 1fr; } .ac-basis dd { margin-bottom: 8px; } }

/* Host theme only: standalone SVG exports retain their explicit portable palette. */
.ac-chart svg [fill="white"] { fill:var(--card-bg,#fff); }
.ac-chart svg [fill="#213047"] { fill:var(--text-primary,#213047); }
.ac-chart svg [fill="#57667a"] { fill:var(--text-secondary,#57667a); }
.ac-chart svg [fill="#244bc2"] { fill:var(--primary,#244bc2); }
.ac-chart svg [stroke="#244bc2"] { stroke:var(--primary,#244bc2); }
.ac-chart svg [stroke="#57667a"] { stroke:var(--text-secondary,#57667a); }
.ac-chart svg [stroke="#e1e6ed"] { stroke:var(--border-color,#e1e6ed); }
