@layer components {
  .topbar--report { flex-wrap: wrap; gap: .75rem 1rem; }
  .topbar--report .topbar-title { flex: 1 1 180px; min-width: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
  .report-back-link { display: inline-flex; align-items: center; min-height: 34px; white-space: nowrap; }
  .report-review-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .report-document, .report-worksheet { min-width: 0; }
  .report-worksheet .report-document-toolbar h2 { font-size: .8rem; line-height: 1.5; }
  .report-worksheet-body { height: clamp(480px, 75dvh, 850px); overflow: auto; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; }
  .report-worksheet-body .detail-panel { padding: .8rem; margin-bottom: .8rem; }
  .report-worksheet-body .detail-grid { gap: .7rem 1rem; }
  .report-worksheet-body .detail-grid dd { font-size: .8rem; }
  .report-worksheet-body .inspection-output { margin-top: .8rem; }
  .report-worksheet-body .inspection-output h3 { padding-inline: .8rem; }
  .report-worksheet-body .inspection-output .detail-grid { padding: .8rem; }
  .report-worksheet-body .table-scroll table { min-width: 500px; }
  @media (max-width: 1000px) { .report-review-layout { grid-template-columns: minmax(0, 1fr); } .report-worksheet-body { height: auto; max-height: 75dvh; } }
  .report-document-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: .8rem; font-size: .8rem; }
  .report-document-toolbar > div { display: flex; flex-wrap: wrap; gap: 1rem; }
  .report-pdf-frame { display: block; width: 100%; height: clamp(480px, 75dvh, 850px); border: 1px solid var(--line); border-radius: 6px; background: white; }
  .report-detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
  .report-detail-actions form { margin: 0; }
  .report-detail-actions .button { gap: .4rem; }
  .report-action-icon { display: block; flex: 0 0 14px; }
  .report-approval-menu { position: relative; }
  .report-approval-menu summary { cursor: pointer; list-style: none; }
  .report-approval-options { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 30; width: min(340px, calc(100vw - 30px)); padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); box-shadow: 0 8px 24px #00182230; font-size: .8rem; }
  .report-approval-options h2 { font-size: .9rem; }
  .report-approval-options p, .report-approval-options .field { margin: .75rem 0; }
  .report-approval-options select { width: 100%; }
  .report-approval-signature { max-width: 240px; max-height: 90px; margin: 1rem 0; }
  .report-approval-confirmation > p { margin: 1rem 0; }
  @media (max-width: 650px) { .report-approval-options { position: fixed; top: auto; left: 15px; right: 15px; max-height: 65vh; overflow: auto; } }
  .report-action-placeholder:disabled { cursor: not-allowed; opacity: .65; gap: .4rem; }
  .report-action-soon { font-size: .6rem; font-weight: 400; }
  .report-audit-trail, .report-ai-review { margin-top: 1.25rem; }
  .report-audit-trail h2, .report-ai-review h2 { font-size: .9rem; }
  .report-audit-placeholder, .report-review-placeholder { padding: 1.2rem 1.4rem; font-size: .8rem; }
  .report-audit-placeholder p + p, .report-review-placeholder p + p { margin-top: .5rem; }
  .report-quick-filters { display: flex; flex-wrap: wrap; gap: .4rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
  .report-quick-filter { display: inline-flex; align-items: center; min-height: 36px; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 5px; font-size: .8rem; color: var(--ink); background: var(--canvas); }
  .report-quick-filter:hover, .report-quick-filter[aria-current=true] { color: var(--accent); border-color: var(--accent); text-decoration: none; }
  .report-quick-filter[aria-current=true] { box-shadow: inset 0 -2px var(--accent); font-weight: 600; }
  .dashboard-charts[hidden], [data-report-filters-target="overview"][hidden] { display: none; }
  .reports-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
  .reports-section-heading h2 { font-size: 1rem; }
  .reports-section-heading .muted { font-size: .8rem; }
  .report-stats { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: .75rem; margin-bottom: 1rem; }
  .report-stats .metric { padding: 1rem; }
  .report-stats .metric strong { font-size: 1.65rem; margin: .4rem 0 0; }
  .reports-page .dashboard-chart--authors { grid-column: 1 / -1; }
  .reports-page .chart-canvas, .reports-page .chart-empty { height: 210px; }
  .report-filters { position: relative; display: grid; grid-template-columns: minmax(140px,1.4fr) minmax(110px,1fr) 100px minmax(110px,1fr) minmax(110px,1fr) minmax(110px,1fr) auto; align-items: end; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
  .report-filters > div { min-width: 0; }
  .report-filters--client { grid-template-columns: minmax(140px,1.4fr) minmax(110px,1fr) 100px minmax(110px,1fr) minmax(110px,1fr) auto; }
  .client-reports { margin-top: 1.5rem; }
  .report-filters label { display: block; font-size: .72rem; font-weight: 600; margin-bottom: .35rem; color: var(--muted); }
  .report-filters :is(input:not([type=submit]),select) { width: 100%; min-width: 0; }
  .report-filter-actions { display: flex; align-items: center; gap: .65rem; height: calc(2.25rem + 2px); font-size: .82rem; white-space: nowrap; }
  .workspace[data-theme=dark] .report-filter-extra { background: #122c3a; }
  .report-filter-more summary { cursor: pointer; color: var(--accent); }
  .report-filter-extra { position: absolute; z-index: 10; right: 1rem; top: calc(100% - 1px); width: min(560px,calc(100% - 2rem)); display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 0 0 6px 6px; box-shadow: 0 8px 18px #00182220; }
  .reports-table { min-width: 1200px; table-layout: fixed; }
  .reports-table :is(th,td) { font-size: .8rem; padding: .8rem .7rem; }
  .report-number { display: inline-block; padding: .25rem .4rem; border: 1px solid var(--method-border); border-radius: 4px; background: var(--method-bg); color: var(--method-ink); font-size: .73rem; font-weight: 600; white-space: nowrap; }
  .report-number:hover { color: var(--method-ink); filter: brightness(.95); text-decoration: none; }
  .report-number--ut { --method-bg: #dcf5e9; --method-border: #74ad92; --method-ink: #205f41; }
  .report-number--mt { --method-bg: #e4e9ef; --method-border: #9aa9ba; --method-ink: #384957; }
  .report-number--pt { --method-bg: #fce3e6; --method-border: #d79aa4; --method-ink: #913844; }
  .report-number--rt { --method-bg: #fff0d4; --method-border: #ccaa69; --method-ink: #805715; }
  .report-number--vt { --method-bg: #dfedff; --method-border: #8faed6; --method-ink: #335b91; }
  .report-number--et { --method-bg: #ede3fc; --method-border: #b49bcf; --method-ink: #694291; }
  .report-preview-trigger { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 5px; color: var(--accent); background: transparent; cursor: pointer; }
  .report-preview-trigger:hover, .report-preview-trigger[aria-expanded=true] { background: var(--canvas); border-color: var(--line); }
  .report-preview-trigger > svg { display: block; width: 16px; height: 16px; }
  .report-email-unavailable { display: flex; gap: .3rem; align-items: center; color: var(--muted); }
  .report-author { display: flex; gap: .5rem; align-items: center; }
  .report-author-avatar { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--canvas); border: 1px solid var(--line); color: var(--accent); font-size: .65rem; font-weight: 600; }
  .report-date { white-space: nowrap; color: var(--muted); }
  .tippy-box[data-theme=report-preview] { background: #fff; color: #173441; border: 1px solid #cad9df; border-radius: 8px; box-shadow: 0 8px 30px #00182230; }
  .tippy-box[data-theme=report-preview] > .tippy-arrow { color: #fff; }
  .report-preview-content { padding: .85rem; line-height: 1.5; overflow-wrap: anywhere; font-size: .82rem; }
  .report-preview-content h3 { margin: .35rem 0; font-size: 1rem; }
  .report-preview-content p { margin: .5rem 0; }
  .report-preview-content dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: .8rem 0; }
  .report-preview-content dt { font-weight: 600; }
  .report-preview-content dd { margin: 0; }
  .workspace[data-theme=dark] .tippy-box[data-theme=report-preview] { background: #173442; border-color: #45616f; color: #e6eff4; }
  .workspace[data-theme=dark] .tippy-box[data-theme=report-preview] > .tippy-arrow { color: #173442; }
  @media (max-width: 1200px) { .report-stats { grid-template-columns: repeat(3,minmax(0,1fr)); } }
  @media (max-width: 1150px) { .report-filters { grid-template-columns: repeat(3,minmax(0,1fr)); } }
  @media (max-width: 650px) { .report-stats, .report-filters { grid-template-columns: repeat(2,minmax(0,1fr)); } .report-filter-search, .report-filter-actions { grid-column: 1 / -1; } }
}

@layer components {
  .new-report-trigger { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; }
  .new-report-caret { display: block; flex: 0 0 12px; }
}

@layer components {
  .new-report-menu .report-type-icon { display: block; flex: 0 0 16px; width: 16px; height: 16px; opacity: .8; }
}

@layer components {
  .report-preview-actions { display: flex; gap: .15rem; }
  .tippy-box[data-theme=pdf-preview] { background: #fff; color: #173441; border: 1px solid #cad9df; border-radius: 8px; box-shadow: 0 8px 30px #00182230; }
  .tippy-box[data-theme=pdf-preview] > .tippy-arrow { color: #fff; }
  .pdf-preview-content { width: 400px; max-width: calc(100vw - 54px); padding: .4rem; }
  .pdf-preview-heading, .pdf-preview-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .2rem; font-size: .8rem; }
  .pdf-preview-image { display: block; width: 100%; height: auto; max-height: 65vh; object-fit: contain; background: white; border: 1px solid #dde5e8; }
  .pdf-preview-image[hidden] { display: none; }
  .pdf-preview-status { padding: 2rem 1rem; font-size: .85rem; }
  .pdf-preview-retry { border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
  .workspace[data-theme=dark] .tippy-box[data-theme=pdf-preview] { background: #173442; border-color: #45616f; color: #e6eff4; }
  .workspace[data-theme=dark] .tippy-box[data-theme=pdf-preview] > .tippy-arrow { color: #173442; }
}

@layer components {
  .report-filter-feedback { padding: .65rem 1.2rem; margin: 0; color: var(--muted); font-size: .8rem; }
}

.audit-events { display: grid; gap: .75rem; list-style: none; margin: 1rem 0 0; padding: 0; }
.audit-event { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); }
.audit-event-heading { display: flex; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.audit-event-heading time { font-size: .8rem; color: var(--muted, #64748b); }
.audit-event p { margin: .3rem 0 .6rem; }
.audit-event-changes summary { cursor: pointer; font-size: .8rem; color: var(--ink); padding: .25rem 0; }
.audit-event-changes[open] summary { margin-bottom: .5rem; }
.audit-event-changes summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.audit-changes { font-size: .85rem; }
.audit-changes > div { padding: .5rem 0; }
.audit-changes dt { font-weight: 600; }
.audit-changes dd { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-audit-body { padding: 1rem 1.25rem; }
.report-audit-body > p { margin: 0; }

.audit-changes dd.audit-diff { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: .75rem; padding: .6rem .75rem; border-left: 3px solid; border-radius: 4px; white-space: pre-wrap; }
.audit-diff-label { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.audit-diff--removed { background: #fff1f0; color: #9b2929; border-color: #d56868; }
.audit-diff--added { background: #edf9f0; color: #216336; border-color: #65a879; }
.workspace[data-theme=dark] .audit-diff--removed { background: #3c242b; color: #ffc3c3; border-color: #cf7777; }
.workspace[data-theme=dark] .audit-diff--added { background: #1d352c; color: #b7e8c5; border-color: #65a879; }
@media (max-width: 600px) {
  .audit-changes dd.audit-diff { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}
.report-title-status { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.report-title-status .badge { border: 1px solid currentColor; font-size: .7rem; font-weight: 500; letter-spacing: normal; }

.report-stat { align-content: start; }
.report-stat-heading { display: flex; align-items: center; gap: .6rem; }
.report-stat-icon { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.report-stat-icon svg { width: 16px; height: 16px; fill: currentColor; }
.report-stat-icon--blue { background: #e2efff; color: #2863ad; }
.report-stat-icon--violet { background: #eee7fc; color: #7652a6; }
.report-stat-icon--teal { background: #ddf3f2; color: #207a79; }
.report-stat-icon--green { background: #e3f3e7; color: #347349; }
.report-stat-icon--amber { background: #fff0d4; color: #986512; }
.report-stat-icon--slate { background: #e8eef3; color: #4b6578; }
.report-stat-trend { display: flex; align-items: flex-start; gap: .35rem; margin-top: .4rem; font-size: .75rem; }
.report-stat-trend svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; margin-top: .15rem; }
.report-stat-trend--up { color: #287043; }
.report-stat-trend--down { color: #ab4141; }
.report-stat-trend--flat { color: var(--muted); }
.report-stat-comparison { display: block; color: var(--muted); font-size: .68rem; margin-top: .15rem; }
.workspace[data-theme=dark] .report-stat-trend--up { color: #92d7a9; }
.workspace[data-theme=dark] .report-stat-trend--down { color: #f4aaaa; }
.report-versions-table { min-width: 760px; }
.report-versions-table td, .report-versions-table th { vertical-align: top; }
.new-report-trigger .report-menu-label { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.new-report-trigger { flex-wrap: nowrap; }
.new-report-caret { flex-shrink: 0; }
.new-report-menu .account-menu-item { font-size: .75rem; }
@layer components {
  .pagination--numbered { gap:.35rem; align-items:center; flex-wrap:wrap; }
  .pagination--numbered a,.pagination-current { display:inline-flex; align-items:center; justify-content:center; min-width:2.2rem; min-height:2.2rem; padding:.35rem .65rem; border:1px solid var(--line); border-radius:5px; font-size:.8rem; font-weight:600; }
  .pagination--numbered a:hover { background:var(--canvas); text-decoration:none; }
  .pagination-current { background:var(--navy); color:white; border-color:var(--navy); }
  .pagination-gap { padding:.25rem; color:var(--muted); }
}

.content.content--full-width { max-width: none; width: 100%; }

.workspace .report-filter-toggle { display: none; }
@media (max-width: 1400px) {
  .report-filters, .report-filters--client { grid-template-columns: minmax(140px,1.4fr) minmax(140px,1fr) 100px auto; }
  .report-filters .report-filter-secondary { display: none; }
  .workspace .report-filter-toggle { display: inline-flex; }
  .report-filters--expanded .report-filter-secondary { display: block; grid-row: 2; }
}
@media (max-width: 650px) {
  .report-filters, .report-filters--client { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-filters--expanded .report-filter-secondary { grid-row: auto; }
  .report-filter-actions { grid-row: 3; }
}

.audit-event-actor { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }

.audit-trail-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.audit-trail-title > span { font-size: .75rem; font-weight: 400; }

.inventory-calibration { margin-top: 1.25rem; }

.user-row-actions { position: relative; }
.user-row-menu { display: grid; gap: .6rem; padding: .75rem 0; min-width: 0; }
.user-row-menu a, .user-row-menu button { font-size: .8rem; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.user-editor-dialog { width: min(720px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--canvas); }
.user-editor-dialog::backdrop { background: #0007; }
.user-editor-dialog h2 { margin: 1rem 0; font-size: 1rem; }

.workspace .user-action-trigger { font-size: .72rem; padding: .3rem .5rem; min-height: 0; gap: .3rem; }
.user-row-menu { padding: .4rem; min-width: 135px; gap: .2rem; }
.user-row-menu :is(a, button) { display: block; width: 100%; padding: .4rem .5rem; font-size: .75rem; border-radius: 4px; }
.user-row-menu :is(a, button):hover, .user-row-menu :is(a, button):focus-visible { background: var(--line); }

.user-row-menu a, .user-row-menu a:hover, .user-row-menu a:focus-visible { text-decoration: none; }

.user-action-caret { font-size: 1rem; line-height: .75; margin-inline-start: .1rem; }

.user-row-menu .user-menu-delete:is(:hover, :focus-visible) { color: #9c3737; background: #fcecec; }
.workspace[data-theme=dark] .user-row-menu .user-menu-delete:is(:hover, :focus-visible) { color: #ffbac1; background: #4a2c35; }

.user-list-identity { display: flex; align-items: center; gap: .65rem; }
.user-list-avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; background: var(--line); color: var(--ink); font-size: .72rem; font-weight: 600; }
.user-list-avatar img { width: 100%; height: 100%; object-fit: cover; }

.review-comment { white-space: pre-wrap; margin: .75rem 0; }
.user-access-section { border-top: 1px solid var(--line); padding-top: 1rem; }
