/* Reporting workspace (reporting-workspace-build-plan.md). Everything is scoped to the rw-
   prefix so no other page is touched. Colors and radii come from the Calm Workspace tokens
   in calm-workspace.css; nothing here depends on a dark theme, and every state that uses
   color also says what it is in words. */

/* ---- Navigator (inside the section panel) ------------------------------------------- */
.rw-nav { display: flex; flex-direction: column; gap: .15rem; }
.rw-find { padding: 0 .15rem .6rem; }
.rw-find[hidden] { display: none; }
.rw-find-input { width: 100%; min-height: 2.5rem; border: 1px solid var(--cw-border); border-radius: .6rem; background: #fff; padding: 0 .7rem; color: var(--cw-text); font-size: .875rem; }
.rw-find-input::placeholder { color: #8a9692; }
.rw-nav-empty { margin: .25rem .5rem .75rem; color: var(--cw-muted); font-size: .8125rem; }
.rw-nav-empty[hidden] { display: none; }
.rw-group[hidden], .rw-group-list > li[hidden] { display: none; }
.rw-group-summary { display: flex; min-height: 2.25rem; cursor: pointer; align-items: center; justify-content: space-between; gap: .5rem; border-radius: .5rem; padding: .3rem .6rem; color: #6f7c78; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; list-style: none; }
.rw-group-summary::-webkit-details-marker { display: none; }
.rw-group-summary::after { content: ""; flex: none; width: .45rem; height: .45rem; border-right: 1.5px solid #8a9692; border-bottom: 1.5px solid #8a9692; transform: rotate(-45deg); transition: transform .12s ease; }
.rw-group[open] > .rw-group-summary::after { transform: rotate(45deg); }
.rw-group-summary:hover { background: #f0f4f2; color: var(--cw-text); }
.rw-group-count { margin-left: auto; margin-right: .35rem; color: #9aa5a1; font-size: .6875rem; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.rw-group-list { margin: 0 0 .5rem; padding: 0; list-style: none; }
.rw-report-link { display: flex; min-height: 2.25rem; flex-direction: column; justify-content: center; border-radius: .5rem; padding: .35rem .75rem; color: #53615e; font-size: .875rem; font-weight: 500; line-height: 1.25; }
.rw-report-link:hover { background: #f0f4f2; color: var(--cw-text); }
.rw-report-link[aria-current="page"] { background: var(--cw-teal-soft); color: var(--cw-teal-dark); font-weight: 650; }
.rw-report-hint { color: #8a9692; font-size: .6875rem; font-weight: 500; }

/* ---- Page header -------------------------------------------------------------------- */
.rw { min-width: 0; }
.rw-head { margin-bottom: .55rem; }
.rw-title { margin: 0; color: var(--cw-text); font-size: 1.375rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
.rw-lede { margin: 0; max-width: 46rem; color: var(--cw-muted); font-size: .8125rem; line-height: 1.4; }
.rw-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; margin-top: .2rem; }
.rw-source { display: inline-block; margin: 0; color: #8a9692; font-size: .6875rem; line-height: 1.4; }
/* Compact only report heading space; other workspaces and filter controls stay intact. */
.cw-workspace:has(> [data-report-workspace], > [data-report-heading]) { padding-top: .75rem !important; }
.cw-workspace:has(> [data-report-workspace], > [data-report-heading]) > .ankro-tap { margin-bottom: .3rem; font-size: .75rem; }
.rw-head .rw-choose { margin-bottom: .45rem; }
@media (max-width: 639px) {
  .rw-meta { gap: .15rem .6rem; }
  .rw-title { font-size: 1.25rem; }
}
.rw-choose { display: flex; width: 100%; min-height: 2.75rem; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; border: 1px solid #cfd8d4; border-radius: .6rem; background: #fff; padding: 0 .85rem; color: #53615e; font-size: .8125rem; font-weight: 600; text-align: left; }
.rw-choose strong { min-width: 0; overflow: hidden; color: var(--cw-text); font-size: .9375rem; text-overflow: ellipsis; white-space: nowrap; }
.rw-expand { display: none; }
@media (min-width: 1024px) {
  .rw-choose { display: none; }
  body.ankro-sidebar-collapsed .rw-expand { display: flex; max-width: 24rem; }
}

/* ---- Filters ------------------------------------------------------------------------ */
.rw-filters { padding: 1rem 1.1rem 1.1rem; margin-bottom: 1.25rem; }
.rw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); align-items: end; gap: .9rem 1rem; }
.rw-field { min-width: 0; }
.rw-field--wide { grid-column: span 2; }
.rw-field--full { grid-column: 1 / -1; margin-bottom: -.35rem; }
.rw-field > label, .rw-label { display: block; margin-bottom: .3rem; color: #53615e; font-size: .75rem; font-weight: 650; }
.rw-hint { margin: .3rem 0 0; color: #8a9692; font-size: .75rem; line-height: 1.35; }
.rw-input { width: 100%; min-height: 2.5rem; border: 1px solid #cfd8d4; border-radius: .55rem; background: #fff; padding: 0 .7rem; color: var(--cw-text); font-size: .875rem; }
.rw-input:focus { border-color: var(--cw-teal); }
.rw-seg { display: inline-flex; min-height: 2.5rem; overflow: hidden; border: 1px solid #cfd8d4; border-radius: .55rem; background: #fff; font-size: .8125rem; font-weight: 600; }
.rw-seg > label, .rw-seg > button { display: flex; align-items: center; padding: 0 .8rem; color: #33413e; cursor: pointer; }
.rw-seg > * + * { border-left: 1px solid #cfd8d4; }
.rw-seg > label:hover, .rw-seg > button:hover { background: #f0f4f2; }
.rw-seg > label:has(input:checked), .rw-seg > button[aria-pressed="true"] { background: var(--cw-teal); color: #fff; }
.rw-seg > label:has(input:focus-visible) { outline: 2px solid var(--cw-teal); outline-offset: 2px; }
.rw-seg > label { position: relative; }
.rw-seg input { position: absolute; opacity: 0; pointer-events: none; }
.rw-seg--fixed { min-height: 2.5rem; align-items: center; padding: 0 .8rem; color: #53615e; }
.rw-presets[hidden] { display: none; }
.rw-presets { margin-bottom: .55rem; }
.rw-more { margin-top: .9rem; border-top: 1px solid #eef1ef; padding-top: .75rem; }
.rw-more > summary { display: inline-flex; min-height: 2.25rem; cursor: pointer; align-items: center; gap: .5rem; color: var(--cw-teal-dark); font-size: .8125rem; font-weight: 650; }
.rw-more-summary { color: #8a9692; font-weight: 500; }
.rw-more[open] > summary { margin-bottom: .6rem; }
.rw-check { display: flex; min-height: 2.5rem; align-items: center; gap: .5rem; color: #33413e; font-size: .875rem; cursor: pointer; }
.rw-runbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1rem; }
.rw-btn { display: inline-flex; min-height: 2.5rem; align-items: center; justify-content: center; gap: .4rem; border: 1px solid #cfd8d4; border-radius: .55rem; background: #fff; padding: 0 1rem; color: #33413e; font-size: .875rem; font-weight: 600; cursor: pointer; }
.rw-btn:hover { background: #f0f4f2; }
.rw-btn--primary { border-color: var(--cw-teal); background: var(--cw-teal); color: #fff; }
.rw-btn--primary:hover { background: var(--cw-teal-dark); }
.rw-btn[disabled], .rw-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.rw-status { flex: 1 1 14rem; margin: 0; border-radius: .5rem; padding: .45rem .75rem; background: #f0f4f2; color: #33413e; font-size: .8125rem; font-weight: 600; }
.rw-status[hidden] { display: none; }
.rw-status[data-state="dirty"] { background: #fff7e0; color: #7a5b00; }
.rw-status[data-state="busy"] { background: #eef4fb; color: #24507e; }
.rw-status[data-state="failed"] { background: #fdeaea; color: #a12626; }
.rw-status button { margin-left: .5rem; border: 0; background: none; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---- Result ------------------------------------------------------------------------- */
.rw-result { min-width: 0; }
.rw-result[aria-busy="true"] { opacity: .5; pointer-events: none; transition: opacity 120ms ease; }
.rw-result[data-rw-stale="true"] .rw-applied::after { content: " · previous results"; color: #a12626; font-weight: 650; }
.rw-result-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: .9rem; }
.rw-applied { min-width: 0; }
.rw-applied-title { margin: 0; color: var(--cw-text); font-size: 1.0625rem; font-weight: 650; overflow-wrap: anywhere; }
.rw-applied-detail { margin: .15rem 0 0; color: var(--cw-muted); font-size: .8125rem; overflow-wrap: anywhere; }
.rw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-left: auto; }
.rw-output[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.rw-state { margin: 0 0 1rem; border: 1px solid var(--cw-border); border-radius: .7rem; background: #fff; padding: .9rem 1.1rem; color: #33413e; font-size: .875rem; line-height: 1.45; }
.rw-state > strong { display: block; margin-bottom: .15rem; color: var(--cw-text); font-size: .875rem; }
.rw-state--required, .rw-state--empty { border-style: dashed; padding: 2rem 1.25rem; text-align: center; color: #66736f; }
.rw-state--required > strong, .rw-state--empty > strong { display: block; }
.rw-state--blocked, .rw-state--error { border-color: #f0b8b8; background: #fdf3f3; color: #8a1f1f; }
.rw-state--partial, .rw-state--warning { border-color: #ecd68a; background: #fffbea; color: #6e5300; }
.rw-state--info { border-color: #cfe0ea; background: #f3f8fb; color: #24507e; }
.rw-state ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.rw-notes { margin-top: 1rem; }
.rw-notes p { margin: 0 0 .3rem; color: #8a9692; font-size: .75rem; }
.rw-scroll { max-width: 100%; overflow-x: auto; }
.rw-scroll:focus-visible { outline: 2px solid var(--cw-teal); outline-offset: 2px; }
.rw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 639px) {
  .rw-presets .rw-seg { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .rw-presets .rw-seg > * { justify-content: center; }
  .rw-presets .rw-seg > * + * { border-left: 0; }
  .rw-presets .rw-seg > :nth-child(even) { border-left: 1px solid #cfd8d4; }
  .rw-presets .rw-seg > :nth-child(n+3) { border-top: 1px solid #cfd8d4; }
  .rw-filters { padding: .9rem; }
  .rw-grid { grid-template-columns: 1fr; }
  .rw-field--wide { grid-column: auto; }
  .rw-seg { max-width: 100%; flex-wrap: wrap; }
  .rw-seg > label, .rw-seg > button { min-height: 2.5rem; }
  .rw-btn, .rw-input { min-height: 2.75rem; }
  .rw-actions { width: 100%; margin-left: 0; }
  .rw-actions .rw-btn { flex: 1 1 auto; }
  .rw-runbar .rw-btn--primary { width: 100%; }
}
/* Compact filter rows keep useful controls together instead of stretching fields
   across the entire workspace. Advanced fields retain their original grid. */
.rw-filters { padding: .8rem .9rem; margin-bottom: 1rem; }
.rw-grid--primary { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .65rem .8rem; }
.rw-grid--primary > .rw-field { flex: 0 1 10rem; max-width: 100%; }
.rw-grid--primary > .rw-field--wide { flex-basis: 14rem; }
.rw-grid--primary > .rw-field--full { flex: 0 1 auto; margin: 0; }
.rw-grid--primary > .rw-field:has(.rw-seg):not(.rw-field--full) { flex: 0 1 auto; }
.rw-grid--primary > .rw-field:has(input[type=date]) { flex-basis: 8.5rem; }
.rw-filters .rw-field > label, .rw-filters .rw-label { margin-bottom: .25rem; font-size: .6875rem; }
.rw-filters .rw-input { min-height: 2.25rem; font-size: .8125rem; padding: 0 .55rem; }
.rw-filters .rw-seg { min-height: 2.25rem; font-size: .75rem; }
.rw-filters .rw-seg > label, .rw-filters .rw-seg > button { padding: 0 .6rem; white-space: nowrap; }
.rw-filters .rw-seg--fixed { min-height: 2.25rem; }
.rw-filters .rw-presets { margin: 0; }
.rw-filters .rw-hint { font-size: .6875rem; margin-top: .25rem; }
.rw-filters [data-checklist-toggle] { min-height: 2.25rem; padding: .4rem .6rem; font-size: .8125rem; }
.rw-filters [data-checklist-dropdown] { width: 100%; min-width: 14rem; max-width: calc(100vw - 4rem); }
.rw-filter-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .65rem; padding-top: .6rem; border-top: 1px solid var(--cw-border); }
.rw-filter-footer .rw-more { margin: 0; border: 0; padding: 0; }
.rw-filter-footer .rw-more > summary { min-height: 2.25rem; font-size: .75rem; }
.rw-filter-footer .rw-more[open] { flex: 1 1 30rem; min-width: 0; max-width: 100%; }
.rw-filter-footer .rw-more[open] > summary { margin-bottom: .25rem; }
.rw-filter-footer .rw-more[open] + .rw-runbar { align-self: flex-start; }
.rw-filter-footer .rw-more[open] .rw-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem .65rem; }
.rw-filter-footer .rw-more[open] .rw-field { flex: 0 1 11rem; max-width: 100%; }
.rw-filter-footer .rw-more[open] .rw-check { min-height: 2.25rem; }
.rw-filter-footer .rw-more[open] .rw-field--wide { flex-basis: 22rem; }
.rw-filter-footer .rw-more[open] .rw-field--full { flex-basis: 100%; }
.rw-filter-footer .rw-runbar { margin: 0; gap: .6rem; }
.rw-filters .rw-btn { min-height: 2.25rem; padding: 0 .8rem; font-size: .8125rem; }
.rw-filter-footer .rw-status { flex-basis: 12rem; padding: .35rem .6rem; font-size: .75rem; }
@media (max-width: 639px) {
  .rw-filters { padding: .75rem; }
  .rw-grid--primary { gap: .65rem .6rem; }
  .rw-grid--primary > .rw-field { flex: 1 1 calc(50% - .6rem); }
  .rw-grid--primary > .rw-field--wide, .rw-grid--primary > .rw-field--full { flex-basis: 100%; }
  .rw-grid--primary > .rw-field:has(input[type=date]) { flex-basis: calc(50% - .6rem); }
  .rw-grid--primary > .rw-field:has(.rw-seg):not(.rw-field--full) { flex-basis: 100%; }
  .rw-filters .rw-input, .rw-filters .rw-seg, .rw-filters [data-checklist-toggle], .rw-filters .rw-btn { min-height: 2.75rem; }
  .rw-filters .rw-presets .rw-seg { display: flex; flex-wrap: wrap; }
  .rw-filters .rw-presets .rw-seg > button { flex: 1 1 auto; min-height: 2.75rem; padding: 0 .45rem; font-size: .6875rem; }
  .rw-filters .rw-presets .rw-seg > * + * { border-left: 1px solid #cfd8d4; }
  .rw-filters .rw-presets .rw-seg > :nth-child(n+3) { border-top: 0; }
  .rw-filters [data-checklist-dropdown] { min-width: 0; max-width: 100%; }
  .rw-filter-footer .rw-runbar { flex: 1 1 100%; }
  .rw-filter-footer .rw-more[open] { flex-basis: 100%; }
  .rw-filter-footer .rw-more[open] .rw-check { min-height: 2.75rem; }
  .rw-filter-footer .rw-runbar .rw-btn--primary { width: auto; }
  .rw-filter-footer .rw-more[open] .rw-field { flex: 1 1 calc(50% - .8rem); }
  .rw-filter-footer .rw-more[open] .rw-field--wide, .rw-filter-footer .rw-more[open] .rw-field--full { flex-basis: 100%; }
}
@media (max-width: 380px) {
  .rw-filters .rw-presets .rw-seg { display: grid; grid-template-columns: 1fr 1fr; }
  .rw-filters .rw-presets .rw-seg > :nth-child(odd) { border-left: 0; }
  .rw-filters .rw-presets .rw-seg > :nth-child(n+3) { border-top: 1px solid #cfd8d4; }
}

@media print { .rw-nav, .rw-filters, .rw-choose, .rw-actions { display: none !important; } }

@media (max-width: 767px) {
  .cw-workspace:has(> [data-report-workspace], > [data-report-heading]) > .ankro-tap { margin-bottom: .75rem; }
}

/* Keep account names and debit/credit figures together on wide monitors. */
.rw-trial-balance-columns { max-width: 44rem; }
.rw-trial-balance-columns table { table-layout: fixed; min-width: 32rem; }
.rw-trial-balance-columns th:first-child { width: 50%; }
.rw-trial-balance-columns th:not(:first-child) { width: 25%; }
.rw-trial-balance-columns td:first-child { white-space: normal; overflow-wrap: anywhere; }
