:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #18181b;
  --card: #ffffff;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-foreground: #fafafa;
  --success: #166534;
  --success-bg: #f0fdf4;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --radius: 10px;
  --sidebar-width: 256px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--foreground); background: var(--background); font-size: 16px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.app-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: #fafafa; z-index: 20; }
.brand { min-height: 72px; display: flex; align-items: center; padding: 8px 18px; color: var(--foreground); text-decoration: none; }
.brand-logo { display: block; width: 128px; height: auto; }

.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-label { margin: 0 10px 8px; color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.nav-item { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: #52525b; background: transparent; border: 0; border-radius: 7px; text-align: left; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-item.is-active { color: var(--foreground); background: #e9e9ec; }
.nav-item.is-disabled { opacity: .6; cursor: default; }
.nav-item svg { width: 17px; height: 17px; }
.sidebar-footer { min-height: 72px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; color: #3f3f46; background: #e4e4e7; border-radius: 50%; font-size: 12px; font-weight: 700; }
.user-copy { min-width: 0; display: grid; flex: 1; }
.user-copy strong { font-size: 13px; font-weight: 600; }
.user-copy small { overflow: hidden; color: var(--muted-foreground); font-size: 11px; text-overflow: ellipsis; }
.chevron { color: var(--muted-foreground); }

.app-main { min-width: 0; }
.topbar { height: 49px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 0 24px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; font-size: 15px; font-weight: 550; }
.sidebar-toggle { display: none; width: 32px; height: 32px; place-items: center; color: var(--muted-foreground); background: transparent; border: 0; border-radius: 6px; }
.mobile-logo { display: none; width: 72px; height: auto; }
.topbar-divider { width: 1px; height: 17px; background: var(--border); }
.demo-badge { margin-left: auto; padding: 4px 8px; color: #52525b; background: var(--muted); border: 1px solid var(--border); border-radius: 6px; font-size: 11px; font-weight: 600; }

.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 34px 32px 64px; }
.catalog-view, .wizard-view, .documents-view, .report-view { display: grid; gap: 28px; }
.page-heading, .wizard-heading { display: flex; align-items: center; gap: 13px; }
.heading-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; color: var(--muted-foreground); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.heading-icon svg { width: 20px; height: 20px; }
.page-heading h2, .wizard-heading h2 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.025em; }
.page-heading p, .wizard-heading p { margin: 5px 0 0; color: var(--muted-foreground); font-size: 14px; }

.dashboard-heading { justify-content: space-between; gap: 24px; }
.dashboard-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.compact-button { min-height: 33px; padding: 6px 10px; font-size: 11px; }
.eyebrow { display: block; margin-bottom: 6px; color: #52525b; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.period-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: #52525b; background: #fafafa; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; white-space: nowrap; }
.period-chip > span { width: 7px; height: 7px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 3px #dcfce7; }
.period-chip b { font-size: 11px; }
.period-chip select { width: auto; min-height: 0; padding: 0 20px 0 0; color: #52525b; background: transparent; border: 0; border-radius: 0; font-size: 11px; }
.period-chip select:focus { box-shadow: none; }
.account-picker { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; color: #52525b; background: white; border: 1px solid var(--border); border-radius: 7px; white-space: nowrap; }
.account-picker b { font-size: 10px; }
.account-picker select { width: auto; max-width: 190px; min-height: 0; padding: 0 21px 0 0; background: transparent; border: 0; border-radius: 0; font-size: 11px; }
.account-picker select:focus { box-shadow: none; }
.selected-account-summary { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(340px, 1.35fr) minmax(180px, .7fr); overflow: hidden; background: white; border: 1px solid #a1a1aa; border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.04); }
.selected-account-main, .selected-account-next { padding: 17px 18px; }
.selected-account-main { background: #fafafa; border-right: 1px solid var(--border); }
.selected-account-main h3 { margin: 0; font-size: 15px; }
.selected-account-main p { margin: 5px 0 0; color: var(--muted-foreground); font-size: 10px; }
.selected-account-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.selected-account-facts div { display: grid; align-content: center; gap: 5px; padding: 14px 16px; border-right: 1px solid var(--border); }
.selected-account-facts span, .selected-account-next > span { color: var(--muted-foreground); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.selected-account-facts strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.selected-account-next { display: grid; align-content: center; gap: 5px; }
.selected-account-next strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.selected-account-next .primary-button { width: fit-content; margin-top: 5px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-width: 0; padding: 18px 19px 16px; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.metric-card.is-clickable { cursor: pointer; transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
.metric-card.is-clickable:hover, .metric-card.is-clickable:focus-visible { transform: translateY(-1px); border-color: #b8b8be; box-shadow: 0 6px 18px rgba(0,0,0,.05); outline: none; }
.metric-card.is-clickable.is-selected { border-color: #71717a; box-shadow: inset 0 -3px 0 #18181b, 0 4px 14px rgba(0,0,0,.04); }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label span { color: #3f3f46; font-size: 12px; font-weight: 700; }
.metric-label small { overflow: hidden; color: var(--muted-foreground); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.metric-card > strong { display: block; margin-top: 15px; font-size: 25px; line-height: 1.1; letter-spacing: -.035em; }
.metric-card > strong em { color: var(--muted-foreground); font-size: 12px; font-style: normal; font-weight: 500; letter-spacing: 0; }
.metric-trend { margin-top: 9px; overflow: hidden; color: var(--muted-foreground); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.metric-trend.is-warning { color: #a16207; }
.metric-trend.is-positive { color: #15803d; }

.dashboard-insight { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); overflow: hidden; background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius); }
.insight-copy { padding: 22px 24px; }
.insight-copy h3 { margin: 0; font-size: 18px; letter-spacing: -.018em; }
.insight-copy > p { max-width: 680px; margin: 8px 0 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.55; }
.insight-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.insight-facts > div { min-width: 140px; display: grid; gap: 3px; padding: 10px 12px; background: white; border: 1px solid var(--border); border-radius: 7px; }
.insight-facts span { color: var(--muted-foreground); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.insight-facts strong { font-size: 12px; }
.insight-copy .text-button { margin-top: 12px; font-size: 11px; }
.insight-visual { display: grid; align-content: center; padding: 20px 24px; background: white; border-left: 1px solid var(--border); }
.insight-visual-header { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; color: var(--muted-foreground); font-size: 10px; }
.insight-visual-header strong { color: var(--foreground); font-size: 13px; }
.insight-bars { height: 120px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 18px; margin-top: 12px; }
.insight-bars > div { height: 100%; display: grid; grid-template-rows: 18px 1fr 16px; align-items: end; text-align: center; }
.insight-bars strong { color: var(--muted-foreground); font-size: 9px; font-weight: 600; }
.insight-bars i { height: 100%; display: flex; align-items: end; justify-content: center; background: linear-gradient(to top, #f4f4f5, transparent); border-bottom: 1px solid var(--border); }
.insight-bars b { width: min(34px, 62%); display: block; background: #a1a1aa; border-radius: 4px 4px 0 0; transition: height 220ms ease; }
.insight-bars span { color: var(--muted-foreground); font-size: 9px; }
.insight-bars .is-active b { background: #18181b; }
.insight-bars .is-active strong, .insight-bars .is-active span { color: var(--foreground); font-weight: 750; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .9fr); gap: 16px; }
.overview-card { overflow: hidden; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.overview-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 15px; border-bottom: 1px solid var(--border); }
.overview-card h3 { margin: 0; font-size: 15px; }
.overview-card header p, .section-heading div > p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 11px; line-height: 1.4; }
.quiet-button { padding: 0; color: var(--muted-foreground); background: transparent; border: 0; font-size: 11px; }
.quiet-button:hover { color: var(--foreground); text-decoration: underline; }
.aging-total { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 20px 8px; }
.aging-total span { color: var(--muted-foreground); font-size: 11px; }
.aging-total strong { font-size: 16px; }
.aging-bars { display: grid; gap: 12px; padding: 10px 20px 21px; }
.aging-row { display: grid; grid-template-columns: 56px minmax(90px, 1fr) 72px; align-items: center; gap: 12px; font-size: 11px; }
.aging-row > span { color: #52525b; }
.aging-row > div { height: 7px; overflow: hidden; background: #f1f1f3; border-radius: 999px; }
.aging-row i { display: block; height: 100%; min-width: 6px; background: #52525b; border-radius: inherit; }
.aging-row i.is-amber { background: #d6a11d; }
.aging-row i.is-orange { background: #d97706; }
.aging-row i.is-red { background: #dc2626; }
.aging-row strong { font-size: 11px; text-align: right; }
.count-badge { padding: 3px 7px; color: #52525b; background: var(--muted); border-radius: 99px; font-size: 10px; font-weight: 600; }
.action-list { padding: 5px 18px; }
.action-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f0f0f1; }
.action-row:last-child { border-bottom: 0; }
.action-row.is-clickable { cursor: pointer; border-radius: 7px; transition: background 130ms ease, padding 130ms ease; }
.action-row.is-clickable:hover, .action-row.is-clickable:focus-visible { padding-left: 8px; padding-right: 8px; background: #fafafa; outline: none; }
.action-icon { width: 27px; height: 27px; display: grid; place-items: center; color: #52525b; background: #f4f4f5; border-radius: 7px; font-size: 10px; font-weight: 800; }
.action-icon.is-red { color: #b91c1c; background: #fef2f2; }
.action-icon.is-amber { color: #a16207; background: #fffbeb; }
.action-icon.is-neutral { color: #166534; background: #f0fdf4; }
.action-row > div { min-width: 0; display: grid; gap: 3px; }
.action-row strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.action-row small, .action-row > span:last-child { color: var(--muted-foreground); font-size: 10px; }

.accounts-section { display: grid; gap: 14px; }
.accounts-section .section-heading { padding-bottom: 0; border-bottom: 0; }
.section-heading > div { min-width: 0; }
.table-card { overflow-x: auto; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 10px 14px; color: var(--muted-foreground); background: #fafafa; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 650; text-align: left; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #f0f0f1; color: #3f3f46; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-account-row] { cursor: pointer; transition: background 130ms ease, box-shadow 130ms ease; }
tbody tr[data-account-row]:hover, tbody tr[data-account-row]:focus-visible { background: #fafafa; outline: none; }
tbody tr[data-account-row].is-selected { background: #fafafa; box-shadow: inset 3px 0 0 #18181b; }
td:first-child { min-width: 166px; }
td:first-child strong, td:first-child small { display: block; }
td:first-child strong { color: var(--foreground); font-size: 11px; }
td:first-child small { margin-top: 3px; color: var(--muted-foreground); font-size: 9px; }
.status-pill { display: inline-flex; padding: 4px 7px; border-radius: 99px; font-size: 9px; font-weight: 650; }
.status-pill.is-red { color: #b91c1c; background: #fef2f2; }
.status-pill.is-amber { color: #a16207; background: #fffbeb; }
.status-pill.is-green { color: #166534; background: #f0fdf4; }
.table-action { padding: 4px 0; color: #18181b; background: transparent; border: 0; font-size: 10px; font-weight: 650; }
.table-action:not(:disabled):hover { text-decoration: underline; }
.table-action:disabled { color: #a1a1aa; cursor: default; }
.format-pill { display: inline-flex; padding: 4px 7px; color: #3f3f46; background: #f4f4f5; border: 1px solid var(--border); border-radius: 5px; font-size: 9px; font-weight: 750; }

.documents-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 18px; background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius); }
.documents-summary-copy { display: flex; align-items: baseline; gap: 9px; }
.documents-summary-copy span { color: #3f3f46; font-size: 12px; font-weight: 650; }
.documents-summary-copy strong { font-size: 20px; }
.documents-summary-copy small { color: var(--muted-foreground); font-size: 10px; }
.documents-empty { min-height: 340px; display: grid; place-items: center; align-content: center; padding: 44px 24px; text-align: center; background: white; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; color: #71717a; background: #fafafa; border: 1px solid var(--border); border-radius: 12px; }
.documents-empty h3 { margin: 16px 0 0; font-size: 16px; }
.documents-empty p { max-width: 430px; margin: 7px 0 19px; color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }
.documents-content { display: grid; gap: 14px; }
.documents-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.documents-sort-controls { display: flex; align-items: center; gap: 9px; }
.documents-sort-controls label { color: #3f3f46; font-size: 11px; font-weight: 650; }
.documents-sort-controls select { width: auto; min-width: 140px; min-height: 33px; padding: 6px 30px 6px 10px; font-size: 11px; }
.documents-toolbar-meta { display: flex; align-items: center; gap: 10px; }
.document-result-count { color: var(--muted-foreground); font-size: 11px; }
.documents-table-desktop table { min-width: 1120px; }
.documents-table-desktop th { height: 42px; padding-top: 11px; padding-bottom: 11px; }
.documents-table-desktop td { height: 66px; }
.document-name-cell { display: flex; align-items: center; gap: 10px; }
.document-file-icon { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; color: #52525b; background: #fafafa; border: 1px solid var(--border); border-radius: 7px; }
.document-file-icon svg { width: 15px; height: 15px; }
.approval-pill { display: inline-flex; padding: 4px 7px; color: #52525b; background: white; border: 1px solid var(--border); border-radius: 99px; font-size: 9px; font-weight: 650; }
.approval-pill.is-approved { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.approval-pill.is-pending { color: #a16207; background: #fffbeb; border-color: #fde68a; }
.approval-pill.is-not-approved, .approval-pill.is-cancelled { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.approval-controls { display: grid; gap: 7px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.document-actions { min-width: 220px; display: flex; flex-wrap: wrap; gap: 6px; }
.document-actions .outline-button { min-width: 58px; }
.outline-button.is-danger { color: #b91c1c; border-color: #fecaca; }
.primary-button.is-danger { background: #b91c1c; }
.document-cards { display: none; }
.document-dialog-facts strong { display: flex; align-items: center; gap: 7px; }
.document-ready-dot { width: 7px; height: 7px; display: inline-block; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 3px #dcfce7; }
.document-session-note { display: flex; gap: 12px; margin: 19px 24px 0; padding: 15px; background: #fafafa; border: 1px solid var(--border); border-radius: 8px; }
.document-session-note .action-icon { flex: 0 0 auto; }
.document-session-note h3 { margin-top: 1px; }
.document-session-note p { margin-top: 5px; }

.activity-section { display: grid; gap: 14px; }
.activity-section .section-heading { padding-bottom: 0; border-bottom: 0; }
.activity-list { overflow: hidden; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
.activity-item { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 13px 16px; border-bottom: 1px solid #f0f0f1; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; background: #a1a1aa; border-radius: 50%; }
.activity-dot.is-red { background: #dc2626; }
.activity-dot.is-amber { background: #d97706; }
.activity-dot.is-green { background: #16a34a; }
.activity-item > div { min-width: 0; display: grid; gap: 3px; }
.activity-item strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.activity-item small, .activity-item time { color: var(--muted-foreground); font-size: 10px; }

.report-heading { justify-content: space-between; gap: 24px; }
.report-actions { display: flex; align-items: center; gap: 9px; }
.report-actions select { width: auto; min-width: 160px; min-height: 37px; font-size: 12px; }
.report-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.report-kpis article { display: grid; gap: 7px; padding: 17px 18px; background: #18181b; border: 1px solid #18181b; border-radius: var(--radius); }
.report-kpis span { color: #d4d4d8; font-size: 10px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.report-kpis strong { color: white; font-size: 20px; letter-spacing: -.025em; }
.report-kpis small { color: #a1a1aa; font-size: 10px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 16px; }
.report-card { overflow: hidden; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.report-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--border); }
.report-card h3 { margin: 0; font-size: 14px; }
.report-card header p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 11px; }
.legend { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-foreground); font-size: 10px; }
.legend i { width: 8px; height: 8px; background: #52525b; border-radius: 2px; }
.dso-chart { display: grid; gap: 17px; padding: 26px 20px 24px; }
.dso-chart-row { display: grid; grid-template-columns: 30px minmax(100px, 1fr) 34px; align-items: center; gap: 10px; color: var(--muted-foreground); font-size: 10px; }
.dso-chart-row > div { height: 12px; position: relative; background: #f4f4f5; border-radius: 3px; }
.dso-chart-row i { display: block; height: 100%; background: #a1a1aa; border-radius: inherit; }
.dso-chart-row b { width: 2px; height: 20px; position: absolute; left: 60%; top: -4px; background: #22c55e; border-radius: 2px; }
.dso-chart-row strong { color: #52525b; font-size: 11px; text-align: right; }
.dso-chart-row.is-active i { background: #18181b; }
.dso-chart-row.is-active span, .dso-chart-row.is-active strong { color: var(--foreground); font-weight: 750; }
.report-aging { display: grid; gap: 16px; padding: 21px 19px 22px; }
.report-aging-row { display: grid; gap: 7px; }
.report-aging-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 10px; }
.report-aging-row strong { font-size: 10px; }
.aging-track { height: 7px; overflow: hidden; background: #f1f1f3; border-radius: 99px; }
.aging-track i { display: block; height: 100%; background: #52525b; border-radius: inherit; }
.report-aging-row small { color: var(--muted-foreground); font-size: 9px; text-align: right; }
.recovery-card { display: grid; }
.report-table-wrap { border: 0; border-radius: 0; }

.account-dialog { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; overflow: auto; color: var(--foreground); background: white; border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.account-dialog::backdrop { background: rgba(24,24,27,.36); backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 24px 19px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.dialog-header p { margin: 5px 0 0; color: var(--muted-foreground); font-size: 11px; }
.dialog-close { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; color: #71717a; background: #fafafa; border: 1px solid var(--border); border-radius: 7px; font-size: 20px; line-height: 1; }
.dialog-balance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); }
.dialog-balance > div { display: grid; gap: 5px; padding: 15px 18px; background: #fafafa; }
.dialog-balance span { color: var(--muted-foreground); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.dialog-balance strong { font-size: 12px; }
.dialog-section { padding: 19px 24px 0; }
.dialog-section h3 { margin: 0; font-size: 12px; }
.dialog-section p { margin: 7px 0 0; color: #52525b; font-size: 12px; line-height: 1.55; }
.next-step-section { display: flex; gap: 12px; margin: 19px 24px 0; padding: 15px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
.next-step-section .action-icon { flex: 0 0 auto; }
.next-step-section h3 { margin-top: 1px; }
.next-step-section p { margin-top: 5px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding: 15px 24px; background: #fafafa; border-top: 1px solid var(--border); }

.catalog-section { display: grid; gap: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.section-heading h3 { margin: 0; font-size: 19px; letter-spacing: -.015em; }
.section-heading span { color: var(--muted-foreground); font-size: 12px; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.template-card { min-height: 224px; display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.025); transition: border-color 150ms ease, box-shadow 150ms ease; }
.template-card:hover { border-color: #b6b6bc; box-shadow: 0 3px 14px rgba(0,0,0,.04); }
.template-card-body { flex: 1; padding: 24px; }
.template-title-row { display: flex; align-items: flex-start; gap: 13px; }
.template-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; color: var(--muted-foreground); background: #fafafa; border: 1px solid var(--border); border-radius: 9px; }
.template-title-row h4 { margin: 9px 0 0; font-size: 16px; line-height: 1.4; }
.template-card-body > p { max-width: 560px; margin: 18px 0 0; color: var(--muted-foreground); font-size: 14px; line-height: 1.55; }
.template-card-footer { min-height: 62px; display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: #fafafa; border-top: 1px solid var(--border); }
.template-card-footer > span { color: var(--muted-foreground); font-size: 12px; }
.template-card-footer .primary-button { margin-left: auto; }
.demo-note { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; color: #52525b; background: #fafafa; border: 1px dashed var(--border-strong); border-radius: 8px; font-size: 13px; }
.demo-note strong { color: var(--foreground); }

.primary-button, .outline-button, .text-button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 7px; padding: 8px 13px; font-size: 13px; font-weight: 600; transition: background 140ms ease, border-color 140ms ease; }
.primary-button { color: var(--primary-foreground); background: var(--primary); border: 1px solid var(--primary); }
.primary-button:hover { background: var(--primary-hover); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.outline-button { color: var(--foreground); background: white; border: 1px solid var(--border-strong); }
.outline-button:hover { background: var(--muted); }
.outline-button:disabled { opacity: .45; cursor: default; }
.text-button { color: var(--muted-foreground); background: transparent; border: 0; padding-left: 0; }
.text-button:hover { color: var(--foreground); }
.primary-button svg, .outline-button svg, .text-button svg { width: 16px; height: 16px; }

.wizard-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: -10px; }
.wizard-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.question-card, .answers-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.025); }
.question-card { overflow: hidden; }
.question-header { padding: 24px 26px 20px; }
.progress-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; color: #3f3f46; background: white; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-weight: 600; }
.question-divider { height: 1px; margin: 18px 0; background: var(--border); }
.question-header h3 { margin: 0; font-size: 21px; line-height: 1.3; letter-spacing: -.02em; }
.question-header p { margin: 7px 0 0; color: var(--muted-foreground); font-size: 14px; line-height: 1.5; }
.question-control, .review-panel { min-height: 184px; padding: 8px 26px 26px; }
.question-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-wrapper { min-width: 0; }
.field-wrapper.is-wide { grid-column: 1 / -1; }
.field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
input, textarea, select { width: 100%; min-height: 40px; padding: 9px 11px; color: var(--foreground); background: white; border: 1px solid var(--border-strong); border-radius: 7px; outline: none; transition: border-color 130ms ease, box-shadow 130ms ease; }
textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: #71717a; box-shadow: 0 0 0 3px rgba(24,24,27,.08); }
.field-hint { display: block; margin-top: 8px; color: var(--muted-foreground); font-size: 12px; line-height: 1.45; }
.review-callout { display: grid; gap: 5px; margin-bottom: 22px; padding: 16px; background: var(--muted); border: 1px solid var(--border); border-radius: 8px; }
.review-callout strong { font-size: 14px; }
.review-callout span { color: var(--muted-foreground); font-size: 13px; line-height: 1.45; }
.review-panel select { max-width: 210px; }
.question-actions { display: flex; gap: 9px; padding: 16px 26px; background: #fafafa; border-top: 1px solid var(--border); }
.question-actions .primary-button { margin-left: auto; }

.answers-card { overflow: hidden; position: sticky; top: 74px; }
.answers-card > header { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.answers-card h3 { margin: 0; font-size: 15px; }
.answers-card header span { color: var(--muted-foreground); font-size: 11px; }
.answer-list { max-height: 510px; overflow: auto; padding: 10px; }
.answer-item { width: 100%; display: grid; gap: 4px; padding: 10px 11px; color: var(--foreground); background: transparent; border: 1px solid transparent; border-radius: 7px; text-align: left; transition: background 130ms ease, border-color 130ms ease; }
.answer-item:hover { background: var(--muted); }
.answer-item.is-current { background: #fafafa; border-color: var(--border-strong); }
.answer-item strong { overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.answer-item span { min-height: 16px; overflow: hidden; color: var(--muted-foreground); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.answer-item.is-complete span { color: #3f3f46; }
.answer-item.review-item { margin-top: 6px; border-top-color: var(--border); }

.status { min-width: min(360px, calc(100vw - 28px)); max-width: 520px; position: fixed; right: 20px; bottom: 20px; z-index: 80; margin: 0; padding: 13px 15px; border-radius: 8px; box-shadow: 0 12px 34px rgba(0,0,0,.14); font-size: 13px; font-weight: 550; }
.status.is-working { color: #3f3f46; background: var(--muted); border: 1px solid var(--border); }
.status.is-error { color: var(--error); background: var(--error-bg); border: 1px solid #fecaca; }
.status.is-success { color: var(--success); background: var(--success-bg); border: 1px solid #bbf7d0; }

@media (max-width: 940px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { width: min(286px, 86vw); position: fixed; left: 0; transform: translateX(-102%); box-shadow: 16px 0 40px rgba(0,0,0,.12); transition: transform 180ms ease; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-toggle { display: grid; }
  .mobile-logo { display: block; }
  .content { padding: 28px 22px 56px; }
  .wizard-layout { grid-template-columns: 1fr; }
  .answers-card { position: static; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .selected-account-summary { grid-template-columns: 1fr; }
  .selected-account-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .selected-account-next { border-top: 1px solid var(--border); }
  .dashboard-insight { grid-template-columns: 1fr; }
  .insight-visual { border-top: 1px solid var(--border); border-left: 0; }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { padding: 0 14px; }
  .demo-badge { display: none; }
  .content { padding: 24px 14px 44px; }
  .template-grid { grid-template-columns: 1fr; }
  .template-card-footer { align-items: stretch; flex-direction: column; }
  .template-card-footer .primary-button { width: 100%; margin-left: 0; }
  .demo-note { align-items: flex-start; flex-direction: column; }
  .documents-summary { align-items: stretch; flex-direction: column; }
  .documents-summary .primary-button { width: 100%; }
  .documents-summary-copy { flex-wrap: wrap; }
  .documents-summary-copy small { width: 100%; }
  .documents-toolbar, .documents-sort-controls { align-items: stretch; flex-direction: column; }
  .documents-sort-controls select, .documents-sort-controls .outline-button { width: 100%; }
  .documents-toolbar-meta { justify-content: flex-end; }
  .document-result-count { margin-right: auto; }
  .documents-table-desktop { display: none; }
  .document-cards { display: grid; gap: 12px; }
  .document-card { display: grid; gap: 15px; padding: 16px; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
  .document-card header { min-width: 0; display: flex; align-items: flex-start; gap: 11px; }
  .document-card header div { min-width: 0; }
  .document-card h3 { overflow: hidden; margin: 1px 0 0; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .document-card header p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 10px; }
  .document-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
  .document-card-meta time { width: 100%; margin-top: 2px; color: var(--muted-foreground); font-size: 10px; }
  .document-card dl { display: grid; gap: 9px; margin: 0; padding: 12px; background: #fafafa; border-radius: 7px; }
  .document-card dl div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 9px; }
  .document-card dt { color: var(--muted-foreground); font-size: 9px; }
  .document-card dd { margin: 0; color: #3f3f46; font-size: 10px; }
  .document-card footer { display: block; }
  .document-card footer .document-actions { min-width: 0; }
  .mobile-approval-actions:empty { display: none; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .account-picker { justify-content: space-between; }
  .account-picker select { max-width: none; flex: 1; }
  .period-chip { width: 100%; }
  .period-chip select { flex: 1; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { padding: 16px; }
  .selected-account-facts { grid-template-columns: 1fr; }
  .selected-account-facts div { border-right: 0; border-bottom: 1px solid var(--border); }
  .selected-account-facts div:last-child { border-bottom: 0; }
  .selected-account-next .primary-button { width: 100%; }
  .status { right: 14px; bottom: 14px; }
  .aging-row { grid-template-columns: 52px minmax(70px, 1fr) 65px; gap: 8px; }
  .report-heading, .report-actions { align-items: stretch; flex-direction: column; }
  .report-actions select, .report-actions .outline-button { width: 100%; }
  .report-kpis { grid-template-columns: 1fr; }
  .dialog-balance { grid-template-columns: 1fr; }
  .dialog-footer { align-items: stretch; flex-direction: column-reverse; }
  .dialog-footer .primary-button, .dialog-footer .outline-button { width: 100%; }
  .wizard-heading { align-items: flex-start; }
  .wizard-toolbar { align-items: stretch; flex-direction: column; }
  .wizard-toolbar .outline-button { width: 100%; }
  .question-header, .question-control, .review-panel { padding-left: 19px; padding-right: 19px; }
  .question-control { grid-template-columns: 1fr; }
  .field-wrapper.is-wide { grid-column: auto; }
  .question-actions { padding: 14px 19px; }
}
.workflow-only #collections-nav,
.workflow-only #reporting-nav,
.workflow-only .dashboard-only,
.workflow-only #report-view {
  display: none !important;
}

.sign-out-link {
  margin-left: auto;
  color: inherit;
  font-size: 12px;
  text-decoration: none;
}

.sign-out-link:hover {
  text-decoration: underline;
}
