/* Accounting shares the application's typography and tokens. */
#accounting-view { --acc-gap: 18px; }
.acc-role { margin: -3px 0 18px; }
.acc-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin: 20px 0; }
.acc-tabs .button { padding: 10px 14px; }
.acc-tabs .button[aria-pressed="true"], .acc-tabs .button[aria-pressed="true"]:hover { background: var(--navy); color: white; border-color: var(--navy); }
.acc-pad, .acc-setup { padding: 25px; }
.acc-setup { max-width: 820px; }
.acc-setup p:not(.eyebrow) { max-width: 690px; color: var(--muted); }
.acc-toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 20px 25px; margin-bottom: 20px; }
.acc-toolbar > .field { flex: 0 1 200px; min-width: 160px; }
.acc-toolbar > .field-full { flex: 1 1 400px; }
.acc-toolbar > .field-hint { flex: 1 1 270px; padding-bottom: 5px; }
.acc-toolbar input, .acc-toolbar select { width: 100%; }
#accounting-view section > .content-card + .content-card, .acc-preview { margin-top: 20px; }
.acc-equation { padding: 26px; display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 20px; background: #102c39; color: white; }
.acc-equation .eyebrow { color: #acd3c8; }
.acc-equation .subtle { color: #bccfd3; margin-bottom: 0; font-size: 12px; }
.acc-equation .status { white-space: normal; }
.acc-equation-values { flex: 1 0 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; padding-top: 18px; border-top: 1px solid #35505d; }
.acc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.acc-stat { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.acc-stats > .acc-stat { padding: 19px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.acc-stat > span { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }
.acc-stat > strong { font-size: clamp(17px, 1.65vw, 23px); letter-spacing: -.035em; overflow-wrap: anywhere; }
.acc-stat > small { color: var(--muted); font-size: 11px; }
.acc-equation-values .acc-stat > span, .acc-equation-values .acc-stat > small { color: #bfd3d6; }
.acc-cycle { padding: 25px; }
.acc-cycle ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; margin: 20px 0 0; padding-left: 20px; color: var(--teal); }
.acc-cycle li { padding-left: 3px; }
.acc-cycle strong { display: block; color: var(--ink); }
.acc-cycle span { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.acc-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.acc-actions.acc-pad { margin-top: 0; padding-top: 0; }
#accounting-view .settings-fieldset { min-width: 0; }
#acc-operation-fields, #acc-manual-fields { margin-top: 22px; }
#acc-purchase-fields, #acc-amount-fields { margin-top: 20px; }
.acc-purchase-line, .acc-manual-line { display: grid; gap: 12px; padding: 17px 0; border-bottom: 1px solid var(--line); align-items: end; }
.acc-purchase-line { grid-template-columns: minmax(180px, 2fr) 75px minmax(90px, 1fr) minmax(90px, 1fr) minmax(115px, 1fr) auto; }
.acc-manual-line { grid-template-columns: minmax(180px, 2fr) minmax(130px, 1.4fr) minmax(90px, 1fr) minmax(90px, 1fr) auto; }
#accounting-view .field > input, #accounting-view .field > select { width: 100%; min-width: 0; }
#acc-add-purchase, #acc-add-manual { margin-top: 16px; }
.acc-other-tax { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
#accounting-view summary { cursor: pointer; font-weight: 700; }
#accounting-view details[open] > summary { margin-bottom: 20px; }
#accounting-view tfoot { background: #eef5f2; font-weight: 700; }
#accounting-view tfoot td { border-top: 1px solid var(--line); }
#accounting-view table { font-variant-numeric: tabular-nums; }
#acc-preview-accounts:empty, #acc-preview-warnings:empty { display: none; }
.acc-pagination { display: flex; flex-wrap: wrap; justify-content: end; align-items: center; gap: 12px; padding: 20px 25px; }
.acc-pagination > p { margin: 0 auto 0 0; }
#acc-entry-detail:not([hidden]) { border-top: 1px solid var(--line); }
#acc-projection-form > button { margin-top: 20px; }
#acc-projection-chart { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; margin: 20px 0; background: #fbfdfc; }
#acc-projection-chart svg { display: block; width: 100%; }
.acc-stage-note { margin: 24px 0 5px; }
.accounting-invoice-note { margin: 0 0 20px; }
@media (max-width: 1100px) {
  .acc-purchase-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .acc-purchase-line > :first-child { grid-column: span 2; }
  .acc-manual-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .acc-pad, .acc-setup, .acc-equation, .acc-cycle, .acc-toolbar { padding: 19px; }
  .acc-equation-values, .acc-cycle ol { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .acc-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 7px; }
  .acc-tabs > button { flex-shrink: 0; }
  .acc-toolbar > .field { flex: 1 1 130px; }
  .acc-purchase-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acc-stats { gap: 10px; }
  .acc-stats > .acc-stat { padding: 14px; }
}

/* Books keep the accounting movement and its context on the same reading line. */
.acc-book-heading, .acc-entry-heading { display:flex; align-items:start; justify-content:space-between; gap:20px; }
.acc-book-heading .acc-actions { margin:0; justify-content:flex-end; }
#acc-book-heading { margin:0 0 20px; border-left:4px solid var(--teal); }
#acc-book-heading h2 { margin:5px 0; }
#acc-book-heading > .field-hint { margin-bottom:0; }
#acc-book-message { margin-bottom:0; }
#acc-journal-filters { border-top:1px solid var(--line); border-bottom:1px solid var(--line); margin-bottom:0; background:#fbfdfc; }
#acc-journal-filters .field:nth-child(2) { flex:1 1 270px; }
#acc-journal-totals { margin:0; padding-bottom:20px; }
#acc-journal-totals .acc-stat { background:#f6f9f8; }
.acc-journal-entry { margin:0 25px 22px; border:1px solid var(--line); border-radius:9px; overflow:hidden; }
.acc-entry-heading { padding:17px 20px; background:#f3f7f6; }
.acc-entry-heading h3 { margin:0 0 5px; font-size:15px; }
.acc-entry-heading p { margin:0; }
.acc-entry-heading > button { flex-shrink:0; }
.acc-adjustment-entry { border-left:4px solid var(--teal); }
.acc-adjustment-entry .acc-entry-heading { background:#eaf4ef; }
.acc-journal-entry table { min-width:0; width:100%; table-layout:fixed; }
.acc-journal-entry th:first-child { width:58%; }
.acc-journal-entry th:not(:first-child), .acc-journal-entry td:not(:first-child) { text-align:right; }
.acc-journal-entry td, .acc-journal-entry th { padding:13px 20px; }
.acc-journal-entry td:first-child { white-space:normal; overflow-wrap:anywhere; }
.acc-journal-entry .field-hint { margin:4px 0 0; }
.acc-entry-rationale { padding:14px 20px; margin:0; border-top:1px solid var(--line); font-size:12px; background:#fbfcfc; line-height:1.6; }
.acc-account-link { display:inline; white-space:normal; text-align:left; }
.acc-balance-cell { display:flex; flex-direction:column; gap:3px; white-space:nowrap; }
#acc-ledger-table table, #acc-trial-table table, #adj-trial-table table { min-width:0; width:100%; }
#acc-ledger-table td, #acc-trial-table td, #adj-trial-table td { padding:14px 18px; }
#acc-ledger-table th, #acc-trial-table th, #adj-trial-table th { white-space:normal; padding:13px 18px; }
#acc-ledger-table td:nth-child(n+3), #acc-trial-table td:nth-child(n+2), #adj-trial-table td:nth-child(n+2) { text-align:right; font-variant-numeric:tabular-nums; }
#acc-ledger-table td:nth-child(2) { white-space:normal; min-width:200px; max-width:430px; }
#acc-ledger-table td:first-child .table-action { display:block; margin-top:5px; }
#acc-ledger-table td p { margin:5px 0; }
#acc-ledger-table td small { color:var(--muted); }
.acc-adjustment-label { padding-left:10px; border-left:3px solid var(--teal); }
.acc-provenance { margin-top:24px; padding:20px; border:1px solid var(--line); border-left:4px solid var(--teal); border-radius:8px; background:#f7faf8; }
.acc-provenance .table-action { margin:5px 18px 5px 0; }
#acc-entry-detail { scroll-margin-top:20px; }
#acc-entry-detail > .table-action:first-child { float:right; }
@media (max-width: 800px) {
  .acc-book-heading, .acc-entry-heading { flex-direction:column; gap:10px; }
  .acc-book-heading .acc-actions { justify-content:flex-start; }
  .acc-journal-entry { margin-left:14px; margin-right:14px; }
  .acc-journal-entry td, .acc-journal-entry th { padding:12px; font-size:12px; }
  .acc-journal-entry th:first-child { width:46%; }
  #acc-ledger-table table, #acc-trial-table table, #adj-trial-table table { min-width:620px; }
}

/* Keep the scope next to the figures so period activity cannot be read as accumulated balances. */
.acc-context { display:flex; justify-content:space-between; align-items:center; gap:24px; padding:22px 25px; margin:20px 0; border-left:4px solid var(--teal); }
.acc-context h2 { margin:5px 0; font-size:20px; }
.acc-context p { margin:4px 0; }
.acc-context > p { max-width:340px; }
.acc-three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.acc-check-note { flex:1 0 100%; margin:0; color:#bfd3d6; font-size:12px; line-height:1.6; }
.acc-register-guide { padding-bottom:0; }
.acc-register-guide .message { margin-top:0; }
.acc-account-filters { padding-top:0; padding-bottom:0; }
#acc-account-count { padding-top:12px; padding-bottom:12px; margin:0; }
#acc-accounts-table table { min-width:760px; }
#acc-accounts-table td:nth-child(2), #acc-accounts-table td:nth-child(5) { white-space:normal; min-width:140px; }
#acc-preview-lines table, #acc-tax-reconciliation table { min-width:620px; width:100%; }
#acc-preview-lines th:nth-child(n+3), #acc-preview-lines td:nth-child(n+3), #acc-tax-reconciliation th:nth-child(n+2), #acc-tax-reconciliation td:nth-child(n+2) { text-align:right; font-variant-numeric:tabular-nums; }
#acc-preview-lines td:first-child { white-space:normal; }
#acc-preview-lines td:nth-child(2) { color:var(--teal); white-space:normal; }
#acc-tax-status { margin:16px 0; }
#acc-preview-summary { margin:0; }
.acc-scenario-assumptions { border:1px solid var(--line); border-radius:8px; padding:18px 20px; background:#f6faf8; margin:20px 0; }
.acc-scenario-assumptions p { margin-bottom:0; line-height:1.6; }
#acc-period-activity .acc-stat:last-child { border-left:3px solid var(--teal); }
#acc-tax-reconciliation td:first-child { white-space:normal; }
@media (max-width:800px) {
  .acc-context { flex-direction:column; align-items:flex-start; gap:8px; }
  .acc-context > p { max-width:none; }
  .acc-three { grid-template-columns:1fr; }
}
