/* Cash Flow Approval – frontend styles (scoped to .cfa-app) */

.cfa-app {
  --cfa-ink: #1B2430;
  --cfa-ink-2: #333D4D;
  --cfa-muted: #5A6577;
  --cfa-line: #E3E7EE;
  --cfa-line-2: #EEF1F5;
  --cfa-field: #CBD2DC;
  --cfa-bg: #F4F6FA;
  --cfa-card: #FFFFFF;
  --cfa-nav: #13203A;
  --cfa-nav-active: #22345A;
  --cfa-blue: #1D4ED8;
  --cfa-blue-bg: #EEF3FF;
  --cfa-in: #0B6E64;
  --cfa-in-bg: #ECF8F5;
  --cfa-out: #B4410E;
  --cfa-out-bg: #FFF4EC;
  --cfa-red: #A1281B;
  --cfa-purple: #6B21A8;
  --cfa-chart-in: #0F8F80;
  --cfa-chart-out: #D9661A;
  font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--cfa-ink);
  font-size: 15px;
  line-height: 1.5;
  position: relative;
}
.cfa-app *, .cfa-app *::before, .cfa-app *::after { box-sizing: border-box; }
.cfa-app h1, .cfa-app h2, .cfa-app h3, .cfa-app p { margin: 0; font-family: inherit; color: inherit; letter-spacing: normal; }
.cfa-app button, .cfa-app input, .cfa-app select, .cfa-app textarea { font: inherit; letter-spacing: normal; text-transform: none; }
.cfa-app svg { flex: none; }
.cfa-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cfa-muted { color: var(--cfa-muted); }
.cfa-xs { font-size: 12.5px; }
.cfa-r { text-align: right !important; }

/* ---------- shell & nav */
.cfa-cq { container-type: inline-size; container-name: cfa; width: 100%; }
.cfa-shell { background: var(--cfa-bg); border-radius: 14px; overflow: hidden; }
.cfa-shell--nav { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 640px; }
.cfa-main { min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.cfa-nav { min-width: 0; background: var(--cfa-nav); color: #D6DDEA; padding: 24px 14px; display: flex; flex-direction: column; gap: 4px; }

/* full-screen page template */
body.cfa-fullscreen { margin: 0; background: #F4F6FA; }
.cfa-fullscreen .cfa-app { max-width: none; margin: 0; }
.cfa-fullscreen .cfa-shell { border-radius: 0; }
.cfa-fullscreen .cfa-shell--nav { min-height: 100vh; }
.admin-bar.cfa-fullscreen .cfa-shell--nav { min-height: calc(100vh - 32px); }
.cfa-fullscreen .cfa-main { padding: 32px 40px 48px; }
.cfa-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.cfa-logo { width: 36px; height: 36px; border-radius: 9px; background: #2DD4BF; color: #0B2B28; display: flex; align-items: center; justify-content: center; }
.cfa-brand__text, .cfa-user__text { display: flex; flex-direction: column; min-width: 0; }
.cfa-brand__text b, .cfa-user__text b { color: #FFFFFF; font-size: 15px; }
.cfa-brand__text small, .cfa-user__text small { color: #A9B4C8; font-size: 12px; }
.cfa-app .cfa-nav__item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #D6DDEA; font-size: 15px; text-align: left; cursor: pointer; box-shadow: none; }
.cfa-app .cfa-nav__item:hover { background: #1B2B4C; color: #FFFFFF; }
.cfa-app .cfa-nav__item.is-active { background: var(--cfa-nav-active); color: #FFFFFF; font-weight: 600; }
.cfa-app .cfa-nav__item:focus-visible { outline: 2px solid #2DD4BF; outline-offset: 2px; }
.cfa-badge { margin-left: auto; background: #F59E0B; color: #1F1400; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.cfa-badge[hidden] { display: none; }
.cfa-user { margin-top: auto; border-top: 1px solid var(--cfa-nav-active); padding: 16px 10px 0; display: flex; align-items: center; gap: 10px; }
.cfa-avatar { width: 36px; height: 36px; border-radius: 50%; background: #3B4E78; color: #FFFFFF; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex: none; }

/* ---------- headings */
.cfa-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.cfa-head h1 { font-size: 26px; font-weight: 700; line-height: 1.3; }
.cfa-head__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cfa-crumb, .cfa-sub-title { font-size: 14px; color: var(--cfa-muted); margin-top: 2px; }

/* ---------- cards & layout */
.cfa-card { background: var(--cfa-card); border: 1px solid var(--cfa-line); border-radius: 12px; padding: 20px; }
.cfa-card--flush { padding: 0; overflow: hidden; }
.cfa-card__title { font-size: 17px; font-weight: 600; margin-bottom: 14px !important; }
.cfa-split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cfa-split > .cfa-form { flex: 2 1 520px; min-width: 0; }
.cfa-aside { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cfa-aside__note { font-size: 13px; padding: 0 4px; }

/* ---------- pills & amounts */
.cfa-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.cfa-pill--draft { background: #EEF0F3; color: #3A4352; }
.cfa-pill--pending { background: #FFF1CC; color: #6E4600; }
.cfa-pill--returned { background: #F1E6FD; color: var(--cfa-purple); }
.cfa-pill--rejected { background: #FDE4E1; color: var(--cfa-red); }
.cfa-pill--approved { background: #E3EDFF; color: var(--cfa-blue); }
.cfa-pill--posted { background: #DDF3EE; color: #0B5F57; }
.cfa-pill--void { background: #EEF0F3; color: #5A6577; text-decoration: line-through; }
.cfa-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfa-amt--in { color: var(--cfa-in); }
.cfa-amt--out { color: var(--cfa-out); }
.cfa-docno, .cfa-doc { font-weight: 600; color: var(--cfa-blue); white-space: nowrap; }

/* ---------- buttons */
.cfa-app .cfa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1.5px solid transparent; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; background: transparent; color: var(--cfa-ink); box-shadow: none; line-height: 1.2; }
.cfa-app .cfa-btn:disabled { opacity: .55; cursor: not-allowed; }
.cfa-app .cfa-btn:focus-visible, .cfa-app .cfa-link:focus-visible, .cfa-app .cfa-tab:focus-visible { outline: 2px solid var(--cfa-blue); outline-offset: 2px; }
.cfa-app .cfa-btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.cfa-app .cfa-btn--primary { background: var(--cfa-blue); color: #FFFFFF; }
.cfa-app .cfa-btn--primary:hover:not(:disabled) { background: #1639A6; }
.cfa-app .cfa-btn--success { background: var(--cfa-in); color: #FFFFFF; }
.cfa-app .cfa-btn--success:hover:not(:disabled) { background: #08564E; }
.cfa-app .cfa-btn--outline { border-color: #AEB8C6; background: #FFFFFF; }
.cfa-app .cfa-btn--outline:hover:not(:disabled) { border-color: var(--cfa-muted); }
.cfa-app .cfa-btn--outline-danger { border-color: var(--cfa-red); color: var(--cfa-red); background: #FFFFFF; }
.cfa-app .cfa-btn--outline-purple { border-color: var(--cfa-purple); color: var(--cfa-purple); background: #FFFFFF; }
.cfa-app .cfa-btn--text { color: var(--cfa-ink-2); font-weight: 500; }
.cfa-app .cfa-btn--text-danger { color: var(--cfa-red); font-weight: 500; margin-right: auto; }
.cfa-app .cfa-link { border: 0; background: none; padding: 6px 8px; min-height: 36px; color: var(--cfa-blue); font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: none; }
.cfa-app .cfa-link:hover { text-decoration: underline; }
.cfa-app .cfa-link--danger { color: var(--cfa-red); }
.cfa-app .cfa-icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 8px; color: var(--cfa-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; box-shadow: none; }
.cfa-app .cfa-icon-btn:hover { background: var(--cfa-line-2); }

/* ---------- form */
.cfa-form { display: flex; flex-direction: column; gap: 22px; padding: 24px; }
.cfa-dir { border: 0; padding: 0; margin: 0; min-width: 0; }
.cfa-dir legend { font-size: 14px; font-weight: 600; color: var(--cfa-ink-2); padding: 0; margin-bottom: 10px; }
.cfa-dir__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cfa-dir__opt { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; border: 1.5px solid var(--cfa-field); border-radius: 10px; cursor: pointer; background: #FFFFFF; }
.cfa-dir__opt input { width: 18px; height: 18px; margin: 0; flex: none; }
.cfa-dir__opt span { display: flex; flex-direction: column; }
.cfa-dir__opt b { font-size: 16px; }
.cfa-dir__opt small { font-size: 13px; color: var(--cfa-muted); }
.cfa-dir__opt--in b { color: var(--cfa-in); }
.cfa-dir__opt--in input { accent-color: var(--cfa-in); }
.cfa-dir__opt--out b { color: var(--cfa-out); }
.cfa-dir__opt--out input { accent-color: var(--cfa-out); }
.cfa-form.is-in .cfa-dir__opt--in { border: 2px solid var(--cfa-in); background: var(--cfa-in-bg); }
.cfa-form.is-out .cfa-dir__opt--out { border: 2px solid var(--cfa-out); background: var(--cfa-out-bg); }
.cfa-form.is-in .cfa-input--amount { color: var(--cfa-in); }
.cfa-form.is-out .cfa-input--amount { color: var(--cfa-out); }

.cfa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 20px; }
.cfa-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--cfa-ink-2); min-width: 0; }
.cfa-field small { font-weight: 400; color: var(--cfa-muted); font-size: 12.5px; }
.cfa-field--full { grid-column: 1 / -1; }
.cfa-app .cfa-field input, .cfa-app .cfa-field select, .cfa-app .cfa-field textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; margin: 0;
  border: 1px solid var(--cfa-field); border-radius: 8px; background: #FFFFFF; color: var(--cfa-ink);
  font-size: 15px; font-weight: 400; box-shadow: none; max-width: none;
}
.cfa-app .cfa-field textarea { resize: vertical; line-height: 1.5; }
.cfa-app .cfa-field input:focus, .cfa-app .cfa-field select:focus, .cfa-app .cfa-field textarea:focus { outline: 2px solid #93B4F5; outline-offset: 0; border-color: var(--cfa-blue); }
.cfa-app .cfa-input--amount { font-size: 18px !important; font-weight: 700 !important; text-align: right; font-variant-numeric: tabular-nums; }
.cfa-hint:empty { display: none; }

.cfa-attach { display: flex; flex-direction: column; gap: 10px; }
.cfa-attach__label { font-size: 14px; font-weight: 600; color: var(--cfa-ink-2); }
.cfa-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; border: 1.5px dashed #AEB8C6; border-radius: 10px; background: #F8FAFC; cursor: pointer; text-align: center; color: var(--cfa-muted); position: relative; }
.cfa-drop span { color: var(--cfa-ink); font-weight: 500; }
.cfa-drop u { color: var(--cfa-blue); }
.cfa-drop small { font-size: 13px; }
.cfa-drop.is-over { border-color: var(--cfa-blue); background: var(--cfa-blue-bg); }
.cfa-drop:focus-within { outline: 2px solid var(--cfa-blue); outline-offset: 2px; }
.cfa-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cfa-file { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border: 1px solid var(--cfa-line); border-radius: 8px; color: var(--cfa-red); flex-wrap: wrap; }
.cfa-file--queued { border-style: dashed; }
.cfa-file__name { flex: 1; min-width: 0; color: var(--cfa-ink); font-size: 14px; word-break: break-all; }
.cfa-file__name small { color: var(--cfa-muted); }
.cfa-file a { font-size: 14px; font-weight: 600; color: var(--cfa-blue); padding: 8px; }

.cfa-form-error { background: #FDE4E1; color: var(--cfa-red); border-radius: 8px; padding: 10px 14px; font-size: 14px; font-weight: 500; }
.cfa-form-error[hidden] { display: none; }
.cfa-form__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--cfa-line-2); }

.cfa-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cfa-steps li { display: flex; gap: 12px; align-items: flex-start; }
.cfa-steps li > span:last-child { display: flex; flex-direction: column; font-size: 14px; }
.cfa-steps small { color: var(--cfa-muted); font-size: 13px; }
.cfa-steps__n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #E3EDFF; color: var(--cfa-blue); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cfa-steps__n--done { background: #DDF3EE; color: #0B5F57; }
.cfa-steps__n--muted { background: #EEF0F3; color: #3A4352; }

.cfa-card__title--sm { font-size: 15px; margin-bottom: 10px !important; }
.cfa-chain-sum { font-size: 14px; color: var(--cfa-ink-2); margin-bottom: 14px !important; }
.cfa-rules { display: flex; flex-direction: column; gap: 4px; }
.cfa-rule { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 7px 10px; border-radius: 6px; color: var(--cfa-ink-2); }
.cfa-rule span:last-child { color: var(--cfa-muted); white-space: nowrap; }
.cfa-rule.is-active { background: var(--cfa-blue-bg); font-weight: 600; color: var(--cfa-ink); }
.cfa-rule.is-active span:last-child { color: var(--cfa-blue); }

/* approval path in detail */
.cfa-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.cfa-chain__item { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.cfa-chain__item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.cfa-chain__item small { color: var(--cfa-muted); font-size: 12.5px; }
.cfa-chain__n { flex: none; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; background: #EEF0F3; color: #3A4352; }
.cfa-chain__item--done .cfa-chain__n { background: #DDF3EE; color: #0B5F57; }
.cfa-chain__item--current .cfa-chain__n { background: var(--cfa-blue); color: #FFFFFF; }
.cfa-chain__item--rejected .cfa-chain__n { background: #FDE4E1; color: var(--cfa-red); }
.cfa-chain__item--returned .cfa-chain__n { background: #F1E6FD; color: var(--cfa-purple); }
.cfa-chain__item--waiting b { color: var(--cfa-ink-2); font-weight: 500; }

/* ---------- notices, toasts, empty */
.cfa-notice { background: #FFFFFF; border: 1px solid var(--cfa-line); border-radius: 10px; padding: 14px 16px; font-size: 14px; }
.cfa-notice--error { background: #FDE4E1; border-color: #F5B7AE; color: #7F1D12; }
.cfa-notice--returned { background: #F6EEFE; border-color: #DCC4F7; color: #4C1680; }
.cfa-note { font-size: 14px; color: var(--cfa-muted); background: #F8FAFC; border-radius: 8px; padding: 12px 14px; margin-top: 16px !important; }
.cfa-loading, .cfa-empty { padding: 32px 16px; text-align: center; color: var(--cfa-muted); font-size: 14px; }
.cfa-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.cfa-toast { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; color: #FFFFFF; background: #13203A; box-shadow: 0 6px 20px rgba(19, 32, 58, .25); }
.cfa-toast--error { background: var(--cfa-red); }

/* ---------- tabs & table */
.cfa-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: #E8ECF2; padding: 4px; border-radius: 10px; align-self: flex-start; max-width: 100%; }
.cfa-app .cfa-tab { min-height: 38px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--cfa-ink-2); font-size: 14px; cursor: pointer; box-shadow: none; }
.cfa-app .cfa-tab[aria-pressed="true"] { background: #FFFFFF; color: var(--cfa-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(19, 32, 58, .08); }
.cfa-table-wrap { overflow-x: auto; }
.cfa-app .cfa-table { width: 100%; border-collapse: collapse; margin: 0; border: 0; }
.cfa-app .cfa-table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--cfa-muted); padding: 10px 14px; border: 0; border-bottom: 1px solid var(--cfa-line); background: #F8FAFC; white-space: nowrap; }
.cfa-app .cfa-table td { padding: 10px 14px; border: 0; border-bottom: 1px solid var(--cfa-line-2); font-size: 14px; vertical-align: middle; background: transparent; }
.cfa-app .cfa-table td small { display: block; color: var(--cfa-muted); font-size: 12.5px; }
.cfa-app .cfa-table tr.is-void td { color: var(--cfa-muted); }
.cfa-app .cfa-table tr.is-void .cfa-cell-title { text-decoration: line-through; }
.cfa-cell-title { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfa-row-acts { white-space: nowrap; text-align: right; }
.cfa-pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; }
.cfa-pager > span:last-child { display: flex; gap: 8px; }

.cfa-bulk { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; background: var(--cfa-blue-bg); border: 1px solid #C9D7FB; border-radius: 10px; flex-wrap: wrap; font-size: 14px; color: #1E3A8A; font-weight: 500; }
.cfa-bulk[hidden] { display: none; }

/* ---------- KPIs */
.cfa-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.cfa-kpis:empty { display: none; }
.cfa-kpi { background: #FFFFFF; border: 1px solid var(--cfa-line); border-radius: 12px; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.cfa-kpi__label { font-size: 13px; color: var(--cfa-muted); }
.cfa-kpi__value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cfa-kpi__sub { font-size: 12.5px; color: var(--cfa-muted); }
.cfa-kpi--dark { background: var(--cfa-nav); border-color: var(--cfa-nav); }
.cfa-kpi--dark .cfa-kpi__label, .cfa-kpi--dark .cfa-kpi__sub { color: #C3CCDB; }
.cfa-kpi--dark .cfa-kpi__value { color: #FFFFFF; }

/* ---------- inbox */
.cfa-inbox { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cfa-inbox__list { display: flex; flex-direction: column; gap: 10px; }
.cfa-inbox__detail { flex: 1.6 1 440px; min-width: 0; padding: 24px; }
.cfa-icard { display: flex; gap: 4px; border: 1px solid var(--cfa-line); border-radius: 10px; background: #FFFFFF; }
.cfa-icard.is-selected { border: 2px solid var(--cfa-blue); background: #F5F8FF; }
.cfa-icard__check { display: flex; align-items: flex-start; padding: 16px 0 0 14px; cursor: pointer; }
.cfa-icard__check input { width: 18px; height: 18px; margin: 0; accent-color: var(--cfa-blue); }
.cfa-app .cfa-icard__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 12px 16px 12px 10px; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--cfa-ink); box-shadow: none; border-radius: 0 10px 10px 0; }
.cfa-app .cfa-icard__body:focus-visible { outline: 2px solid var(--cfa-blue); outline-offset: -2px; }
.cfa-icard__row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.cfa-icard__title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- detail */
.cfa-detail { display: flex; flex-direction: column; gap: 18px; }
.cfa-detail__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.cfa-detail__meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; margin-bottom: 4px; }
.cfa-detail h2 { font-size: 21px; font-weight: 700; line-height: 1.35; }
.cfa-detail__amt { text-align: right; display: flex; flex-direction: column; }
.cfa-detail__amt small { font-size: 13px; color: var(--cfa-muted); }
.cfa-detail__amt .cfa-amt { font-size: 26px; }
.cfa-dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; padding: 16px; background: #F8FAFC; border-radius: 10px; }
.cfa-dl dt { font-size: 13px; color: var(--cfa-muted); margin: 0; font-weight: 400; }
.cfa-dl dd { font-size: 15px; margin: 2px 0 0; color: var(--cfa-ink); white-space: pre-line; word-break: break-word; }
.cfa-dl__full { grid-column: 1 / -1; }
.cfa-sub { display: flex; flex-direction: column; gap: 8px; }
.cfa-sub h3 { font-size: 15px; font-weight: 600; }
.cfa-tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.cfa-tl__item { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.cfa-tl__item small { display: block; color: var(--cfa-muted); font-size: 12.5px; }
.cfa-tl__item p { margin-top: 4px !important; background: #F8FAFC; border-radius: 6px; padding: 6px 10px; color: var(--cfa-ink-2); white-space: pre-line; }
.cfa-tl__dot { flex: none; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: #0B5F57; }
.cfa-tl__item--reject .cfa-tl__dot, .cfa-tl__item--void .cfa-tl__dot { background: var(--cfa-red); }
.cfa-tl__item--return .cfa-tl__dot { background: var(--cfa-purple); }
.cfa-tl__item--submit .cfa-tl__dot { background: var(--cfa-blue); }
.cfa-tl__item--next .cfa-tl__dot { background: #FFFFFF; border: 2px solid #AEB8C6; }
.cfa-actbox { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--cfa-line-2); }
.cfa-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* ---------- modal */
.cfa-overlay { position: fixed; inset: 0; z-index: 99999; background: rgba(19, 32, 58, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.cfa-modal { position: relative; width: 100%; max-width: 760px; background: #FFFFFF; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(19, 32, 58, .3); }
.cfa-app .cfa-modal__close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--cfa-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; box-shadow: none; }
.cfa-app .cfa-modal__close:hover { background: var(--cfa-line-2); }

/* ================================================= Phase 3: reports */
.cfa-head__tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.cfa-field--inline { flex-direction: row; align-items: center; gap: 8px; }
.cfa-app .cfa-field--inline input { width: auto; min-width: 170px; }
.cfa-app .cfa-btn--outline-out { border-color: var(--cfa-out); color: var(--cfa-out); background: #FFFFFF; }
.cfa-app .cfa-btn svg { margin-right: 2px; }
.cfa-app .cfa-inline-link { border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; box-shadow: none; }
.cfa-app .cfa-inline-link:focus-visible { outline: 2px solid var(--cfa-blue); outline-offset: 2px; }
.cfa-app .cfa-card__head .cfa-inline-link { color: var(--cfa-blue); text-decoration: none; font-size: 14px; }
.cfa-notice--info { background: var(--cfa-blue-bg); border-color: #C9D7FB; color: #1E3A8A; }
.cfa-kpi--warn { background: #FFF8E6; border-color: #F2D48A; }
.cfa-kpi--warn .cfa-kpi__label, .cfa-kpi--warn .cfa-kpi__sub { color: #6E4600; }
.cfa-kpi--warn .cfa-kpi__value { color: #4A2F00; }
.cfa-kpi__value.cfa-amt--in { color: var(--cfa-in); }
.cfa-kpi__value.cfa-amt--out { color: var(--cfa-out); }
.cfa-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfa-kpis--5 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cfa-app .cfa-link--doc { white-space: nowrap; }
.cfa-app .cfa-table--ledger td:first-child, .cfa-app .cfa-row .cfa-table td:nth-child(2) { white-space: nowrap; }

.cfa-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.cfa-row__main { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; }
.cfa-row__side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; }
.cfa-row__main > .cfa-card, .cfa-row__side > .cfa-card { flex: 1; }
.cfa-card__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.cfa-card__head .cfa-card__title { margin-bottom: 0 !important; }
.cfa-card__head--pad { padding: 18px 20px 0; }
.cfa-stack { display: flex; flex-direction: column; gap: 16px; }

/* legend + swatches */
.cfa-legend { display: flex; gap: 16px; font-size: 13px; color: var(--cfa-ink-2); }
.cfa-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cfa-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cfa-sw--in { background: var(--cfa-chart-in); }
.cfa-sw--out { background: var(--cfa-chart-out); }

/* grouped bar chart */
.cfa-chart { position: relative; padding-left: 44px; }
.cfa-chart__plot { position: absolute; left: 44px; right: 0; top: 0; pointer-events: none; }
.cfa-chart__grid { position: absolute; left: 0; right: 0; border-top: 1px solid #EEF1F5; }
.cfa-chart__grid:last-child { border-top-color: #CBD2DC; }
.cfa-chart__grid span { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 11.5px; color: var(--cfa-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cfa-chart__groups { position: relative; display: flex; gap: 6px; }
.cfa-app .cfa-chart__group { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 0 4px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; box-shadow: none; color: var(--cfa-muted); font: inherit; }
.cfa-app .cfa-chart__group:hover, .cfa-app .cfa-chart__group:focus-visible { background: rgba(19, 32, 58, .04); outline: none; }
.cfa-app .cfa-chart__group:focus-visible { box-shadow: 0 0 0 2px var(--cfa-blue); }
.cfa-chart__bars { display: flex; align-items: flex-end; gap: 2px; }
.cfa-chart__bar { display: block; width: clamp(10px, 2.2vw, 20px); border-radius: 4px 4px 0 0; }
.cfa-chart__bar--in { background: var(--cfa-chart-in); }
.cfa-chart__bar--out { background: var(--cfa-chart-out); }
.cfa-chart__label { font-size: 13px; white-space: nowrap; }
.cfa-chart__group.is-current .cfa-chart__label { color: var(--cfa-ink); font-weight: 700; }
.cfa-chart__group.is-current::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: 0; height: 3px; border-radius: 2px; background: var(--cfa-ink); }
.cfa-tip { position: absolute; z-index: 5; bottom: calc(100% - 24px); left: 50%; transform: translateX(-50%); min-width: 190px; padding: 10px 12px; border-radius: 10px; background: #13203A; color: #FFFFFF; font-size: 13px; text-align: left; display: none; flex-direction: column; gap: 4px; box-shadow: 0 8px 20px rgba(19, 32, 58, .25); pointer-events: none; }
.cfa-tip span { display: flex; align-items: center; gap: 6px; }
.cfa-tip em { margin-left: auto; padding-left: 12px; font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.cfa-tip__net { border-top: 1px solid #2D3E63; padding-top: 4px; margin-top: 2px; }
.cfa-chart__group:hover .cfa-tip, .cfa-chart__group:focus-visible .cfa-tip { display: flex; }
.cfa-chart__group:first-child .cfa-tip { left: 0; transform: none; }
.cfa-chart__group:last-child .cfa-tip { left: auto; right: 0; transform: none; }

/* account balances */
.cfa-acc { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--cfa-line-2); }
.cfa-acc > div { display: flex; flex-direction: column; min-width: 0; }
.cfa-acc b { font-weight: 500; }
.cfa-acc small { font-size: 13px; color: var(--cfa-muted); }
.cfa-acc__amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfa-acc--total { border-bottom: 0; padding-top: 14px; }
.cfa-acc--total b, .cfa-acc--total .cfa-acc__amt { font-weight: 700; font-size: 16px; }

/* horizontal bars */
.cfa-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.cfa-hbars li { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(60px, 1.2fr) auto; align-items: center; gap: 10px; font-size: 14px; }
.cfa-hbars__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfa-hbars__track, .cfa-share__track { display: block; height: 10px; background: #F1F3F7; border-radius: 0 4px 4px 0; overflow: hidden; }
.cfa-hbars__fill, .cfa-share__fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--cfa-chart-out); }
.cfa-share__fill--in { background: var(--cfa-chart-in); }
.cfa-hbars__val { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; text-align: right; }
.cfa-hbars__val small { font-weight: 400; color: var(--cfa-muted); }
.cfa-share { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.cfa-share__track { flex: 1; }
.cfa-share > span:last-child { width: 48px; text-align: right; font-variant-numeric: tabular-nums; color: var(--cfa-ink-2); }
.cfa-share-h { width: 200px; }

/* filters + export */
.cfa-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px 18px; }
.cfa-filters .cfa-field { flex: 1 1 150px; }
.cfa-filters .cfa-filters__acc { flex: 2 1 240px; }
.cfa-filters__preset { max-width: 200px; }
.cfa-export { display: flex; gap: 8px; flex-wrap: wrap; }

/* tables (reports) */
.cfa-app .cfa-link--doc { padding: 4px 0; min-height: 0; font-weight: 600; }
.cfa-tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #EEF0F3; color: #3A4352; vertical-align: 1px; }
.cfa-tag--void { background: #FDE4E1; color: var(--cfa-red); }
.cfa-app .cfa-table tr.is-sub td { background: #F8FAFC; }
.cfa-app .cfa-table tr.is-total td { background: #F1F4F9; font-weight: 700; border-bottom: 0; }
.cfa-app .cfa-table tr.is-section td { background: var(--cfa-blue-bg); font-weight: 700; color: var(--cfa-ink); }
.cfa-app .cfa-table tr.is-grand td { font-weight: 700; border-top: 1.5px solid #9CA3AF; }
.cfa-app .cfa-table td.cfa-indent { padding-left: 32px; }
.cfa-app .cfa-table--ledger td { vertical-align: top; }
.cfa-app .cfa-table--ledger tr.is-void .cfa-amt { color: var(--cfa-muted); text-decoration: line-through; }
.cfa-app .cfa-table--stmt td:first-child { white-space: normal; }

/* ---------- narrow containers: menu moves to a top bar only when there is truly no room */
@container cfa (max-width: 720px) {
  .cfa-shell--nav { grid-template-columns: minmax(0, 1fr); }
  .cfa-chart { padding-left: 36px; }
  .cfa-chart__plot { left: 36px; }
  .cfa-chart__label { font-size: 11.5px; }
  .cfa-filters__preset { max-width: none; }
  .cfa-hbars li { grid-template-columns: minmax(70px, 1fr) auto; }
  .cfa-hbars__track { grid-column: 1 / -1; grid-row: 2; }
  .cfa-nav { flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .cfa-brand { padding: 0 6px 8px; width: 100%; }
  .cfa-app .cfa-nav__item { width: auto; flex: 1 1 auto; }
  .cfa-user { display: none; }
  .cfa-main, .cfa-fullscreen .cfa-main { padding: 20px 16px 32px; }
  .cfa-form, .cfa-inbox__detail { padding: 18px; }
  .cfa-dir__grid { grid-template-columns: minmax(0, 1fr); }
  .cfa-detail__amt { text-align: left; }
}
@media (max-width: 640px) {
  .cfa-modal { padding: 18px; }
}

.cfa-row .cfa-cell-title { max-width: 210px; }
