:root {
  --bg: #f4f7fb;
  --card: #fff;
  --text: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #2754c5;
  --primary-dark: #1e429f;
  --danger: #b42318;
  --warning: #b54708;
  --success: #027a48;
  --returned: #6941c6;
  --shadow: 0 8px 30px rgba(16, 24, 40, .06);
  --chart-1: #2754c5;
  --chart-2: #0e7490;
  --chart-3: #b54708;
  --chart-4: #7a5af8;
  --chart-5: #027a48;
  --chart-6: #b42318;
  --chart-grid: #dfe5ee;
  --income: #067647;
  --income-soft: #ecfdf3;
  --expense: #b42318;
  --expense-soft: #fef3f2;
  --recurring: #2754c5;
  --recurring-soft: #eef4ff;
  --one-off: #b54708;
  --one-off-soft: #fff7ed;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html[lang^="zh-hant" i] body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

a { color: #244ba8; }

.topbar {
  min-height: 64px;
  padding: 0 28px;
  background: #111c36;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 19px;
  font-weight: 750;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.topbar nav a, .user-menu a, .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #d7e0f4;
  text-decoration: none;
  padding: 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.topbar nav a:hover, .user-menu a:hover, .link-button:hover { background: #263556; color: #fff; }
.user-menu { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.user-menu form { margin: 0; }
.link-button { border: 0; background: transparent; font: inherit; cursor: pointer; }
.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid #445477;
  border-radius: 9px;
  background: #0b1429;
}
.language-option {
  min-height: 38px;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d7e0f4;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.language-option:hover, .language-option:focus-visible { background: #263556; color: #fff; }
.language-option[aria-pressed="true"] { background: #fff; color: #172033; font-weight: 700; }

.container { max-width: 1440px; margin: 0 auto; padding: 28px; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 3px; font-size: 27px; }
.page-head p, .muted { color: var(--muted); margin: 0; }
.section-head { margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 2px 0 0; }
.actions { display: flex; gap: 9px; align-items: center; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  background: #fff;
  color: #27364f;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.button:hover { background: #f8fafc; }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.danger-button { color: #fff; background: var(--danger); border-color: var(--danger); }
.small-button { min-height: 44px; padding: 7px 10px; }

.card, .metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.card { padding: 20px; margin-bottom: 20px; }
.compact-card { padding: 14px; }
.card h2 { margin: 0 0 16px; font-size: 18px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric { padding: 18px; text-decoration: none; color: inherit; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: 22px; margin-top: 8px; }
.metric small { display: block; color: var(--muted); margin-top: 6px; }
.metric.warning { border-left: 4px solid #f79009; }
.metric.danger { border-left: 4px solid #f04438; }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.inflow, .inflow { color: var(--success); }
.money.outflow, .outflow { color: var(--danger); }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  font-size: 12px;
  white-space: nowrap;
}
.status-approved { color: var(--success); background: #ecfdf3; }
.status-submitted { color: var(--warning); background: #fffaeb; }
.status-returned { color: var(--returned); background: #f4f3ff; }
.status-void { color: var(--danger); background: #fef3f2; }
.status-draft { color: #344054; }
.direction-inflow { color: var(--success); background: #ecfdf3; }
.direction-outflow { color: var(--danger); background: #fef3f2; }
.danger-text, .error { color: var(--danger); }
.warning-text { color: var(--warning); }
.empty { text-align: center; color: var(--muted); padding: 26px; }

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
}
.filter-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-field > span, .filter-field > label, .filter-field label { color: var(--muted); font-size: 12px; font-weight: 650; }
.filter-wide { grid-column: span 2; }
.filter-actions { display: flex; align-items: center; gap: 8px; }
.filter-bar input, .filter-bar select, .report-filter input, .report-filter select {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.quick-filters { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }
.quick-filters a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  color: #344054;
}
.quick-filters a.active { background: #e8efff; color: var(--primary-dark); border-color: #a9bff4; font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; max-width: 1050px; }
.field.full, .form-errors.full, .form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 650; margin-bottom: 6px; }
.field input:not([type=checkbox]), .field select, .field textarea, .inline-form input, .decision-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
.field input[type=file] { width: 100%; padding: 14px; border: 1px dashed #98a2b3; border-radius: 8px; background: #f9fafb; }
.field input[type=checkbox] { width: 18px; height: 18px; }
.help { display: block; color: var(--muted); margin-top: 5px; }
.errorlist, .form-errors { color: var(--danger); background: #fef3f2; padding: 10px 14px; border-radius: 8px; }

.payer-choice-fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid #b9c9ed;
  border-radius: 10px;
  background: #f7f9ff;
}
.payer-choice-fieldset legend { padding: 0 6px; font-weight: 700; }
.payer-options > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.payer-options > div > div { min-width: 0; }
.payer-options label {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid #cbd5e8;
  border-radius: 9px;
  background: #fff;
  font-weight: 650;
  cursor: pointer;
}
.payer-options input[type=radio] { width: 18px; height: 18px; flex: 0 0 auto; }
.payer-options label:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(39, 84, 197, .12); }
.payer-guidance { min-height: 21px; margin: 10px 0 0; color: var(--muted); }
.payer-account-field { align-self: start; }

.managed-payer-panel {
  display: grid;
  grid-template-columns: minmax(230px, .8fr) minmax(420px, 1.2fr);
  gap: 16px 20px;
  padding: 16px;
  border: 1px solid #b9c9ed;
  border-radius: 10px;
  background: #fbfcff;
}
.managed-balance-preview {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.managed-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.managed-preview-head strong, .managed-preview-head span { display: block; }
.managed-preview-head span:not(.badge) { color: var(--muted); margin-top: 2px; }
.managed-balance-grid, .managed-split-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.managed-balance-grid > div, .managed-split-grid > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}
.managed-balance-grid span, .managed-split-grid span { display: block; color: var(--muted); font-size: 12px; }
.managed-balance-grid strong, .managed-split-grid strong { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.managed-split-grid { grid-template-columns: 1fr 1fr; margin-top: 10px; }
.managed-split-company { border-color: #abefc6 !important; background: #f6fef9 !important; }
.managed-split-personal { border-color: #fedf89 !important; background: #fffcf5 !important; }
.managed-preview-message { margin-bottom: 0; }
.managed-fallback-account { margin: 8px 0 0; color: var(--warning); font-weight: 650; }
.managed-shortfall-confirm { grid-column: 1 / -1; padding: 12px 14px; border: 1px solid #fedf89; border-radius: 9px; background: #fffaeb; }
.managed-shortfall-confirm label { display: flex; align-items: flex-start; gap: 9px; margin: 0; cursor: pointer; }
.managed-shortfall-confirm input[type=checkbox] { flex: 0 0 18px; margin-top: 2px; }

.subscription-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #b9c9ed;
  border-radius: 10px;
  background: #f7f9ff;
}
.subscription-summary strong, .subscription-summary span { display: block; }
.subscription-summary span { color: var(--muted); margin-top: 2px; }

.subscription-dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(16, 24, 40, .24);
  overflow: auto;
}
.subscription-dialog::backdrop { background: rgba(17, 28, 54, .56); }
.subscription-dialog[open]:not(:modal) {
  position: static;
  grid-column: 1 / -1;
  width: 100%;
  max-height: none;
  margin: 0;
  box-shadow: none;
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { margin: 0 0 4px; font-size: 20px; }
.dialog-head p { margin: 0; color: var(--muted); }
.dialog-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475467;
  font: 28px/1 system-ui, sans-serif;
  cursor: pointer;
}
.dialog-close:hover { background: #f2f4f7; }
.subscription-new-panel { padding: 20px 22px 4px; }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.dialog-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.details { display: grid; grid-template-columns: 130px 1fr; gap: 10px 18px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 8px; margin-top: 16px; }
.inline-form input { max-width: 420px; }

.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.attachment {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}
.attachment img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; background: #eef2f6; }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment small { color: var(--muted); }
.timeline { padding-left: 19px; margin: 0; }
.timeline li { margin: 8px 0; }

.notice { display: flex; gap: 10px; padding: 13px 15px; border-radius: 10px; margin-bottom: 18px; }
.notice strong { white-space: nowrap; }
.warning-notice { color: #7a2e0e; background: #fffaeb; border: 1px solid #fedf89; }
.success-notice { color: #05603a; background: #ecfdf3; border: 1px solid #abefc6; }
.privacy-notice { color: #344054; background: #f2f4f7; border: 1px solid #d0d5dd; }
.ledger-rule-notice span { max-width: 980px; }
.redacted { color: #475467; font-style: italic; }
.review-panel { border-color: #b9c9ed; background: #fbfcff; }
.review-panel > div:first-child { margin-bottom: 15px; }
.decision-grid { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); gap: 24px; align-items: end; }
.decision-form, .review-form { display: flex; flex-direction: column; gap: 8px; }
.decision-form label { font-weight: 650; }
.review-form .field { margin-bottom: 6px; }
.danger-zone { border-color: #fecdca; box-shadow: none; }
.danger-zone h2 { color: var(--danger); }

.whatsapp-binding-grid { align-items: start; max-width: 980px; }
.whatsapp-binding-actions { margin-top: 20px; flex-wrap: wrap; }
.whatsapp-binding-actions form { margin: 0; }
.whatsapp-binding-form { display: grid; gap: 16px; }
.whatsapp-binding-warning { line-height: 1.55; }
.whatsapp-binding-empty { margin: 0; border: 1px dashed var(--line); border-radius: 8px; }

.account-position-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.position-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: inherit; text-decoration: none; }
.position-card:hover { border-color: #b4c4e8; background: #f9fbff; }
.position-card span, .position-card small { display: block; color: var(--muted); }
.position-card strong { display: block; font-size: 19px; margin: 7px 0; }
.position-card em { font-style: normal; }

.advance-settlement-card { border-color: #b9c9ed; }
.advance-metrics { margin-bottom: 18px; }
.advance-metrics .metric { box-shadow: none; }
.linked-record-card { border-color: #b9c9ed; background: #fbfcff; }
.linked-record-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.linked-record-summary > div { min-width: 0; padding: 12px; border-radius: 9px; background: #fff; border: 1px solid var(--line); }
.linked-record-summary span, .linked-record-summary small { display: block; color: var(--muted); }
.linked-record-summary strong { display: block; margin: 5px 0 2px; overflow-wrap: anywhere; }
.reimbursement-form { margin-left: 0; }
.advance-table td { vertical-align: middle; }

.managed-expense-funding-card { border-color: #b9c9ed; }
.managed-account-metrics .metric { box-shadow: none; }
.managed-dashboard-card { border-color: #c8d5f0; }
.managed-activity-table .badge, .company-settlement-table .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.direction-outbound { color: var(--danger); background: #fef3f2; }
.direction-return { color: var(--success); background: #ecfdf3; }

.settlement-allocation-field { padding: 14px; border: 1px solid #c8d5f0; border-radius: 10px; background: #f7f9ff; }
.company-settlement-form [data-settlement-field="direction"] > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.company-settlement-form [data-settlement-field="direction"] > div > div { min-width: 0; }
.company-settlement-form [data-settlement-field="direction"] label:has(input[type=radio]) {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 9px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cbd5e8;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}
.company-settlement-form [data-settlement-field="direction"] input[type=radio] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 18px;
}
.company-settlement-form [data-settlement-field="direction"] label:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(39, 84, 197, .12); }
.settlement-live-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid #b9c9ed;
  border-radius: 10px;
  background: #fbfcff;
}
.settlement-live-summary > div { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.settlement-live-summary span { display: block; color: var(--muted); font-size: 12px; }
.settlement-live-summary strong { display: block; margin-top: 5px; font-size: 18px; }
.settlement-live-summary p { grid-column: 1 / -1; margin: 0; }
.fifo-preview-card { border-color: #c8d5f0; }
.settlement-allocation-table td { vertical-align: middle; }

.report-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; align-items: end; }
.report-filter .full { grid-column: 1 / -1; }
.report-view-tabs {
  display: inline-flex;
  gap: 4px;
  margin: -4px 0 16px;
  padding: 4px;
  border: 1px solid #d8dfeb;
  border-radius: 10px;
  background: #eaf0f8;
}
.report-view-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 7px;
  color: #41516b;
  font-weight: 650;
  text-decoration: none;
}
.report-view-tabs a:hover { background: rgba(255, 255, 255, .6); }
.report-view-tabs a.active { background: #fff; color: #173d96; box-shadow: 0 2px 8px rgba(16, 24, 40, .08); }
.report-eyebrow {
  margin-bottom: 5px;
  color: #476791;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
}
.report-period-picker { margin-bottom: 14px; }
.report-period-tabs { margin-bottom: 10px; }
.report-period-tabs a { flex: 1 1 150px; justify-content: center; text-align: center; }
.report-period-range { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; color: var(--muted); }
.report-period-range strong { color: var(--text); }
.report-layout { align-items: start; }
.report-chart-groups { display: grid; gap: 18px; min-width: 0; }
.report-chart-panel { min-width: 0; margin: 0; }
.report-chart-panel + .report-chart-panel { padding-top: 18px; border-top: 1px solid var(--line); }
.report-chart-panel h3 { margin: 0 0 13px; font-size: 15px; }
.report-donut-layout { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(0, 1.2fr); align-items: center; gap: 18px; }
.report-donut { display: block; width: min(180px, 100%); height: auto; margin: 0 auto; overflow: visible; }
.report-donut-track, .report-donut-segment { fill: none; stroke-width: 15; }
.report-donut-track { stroke: #edf1f7; }
.report-donut-segment { stroke: var(--chart-color); transform: rotate(-90deg); transform-origin: 50% 50%; }
.report-donut-center-label, .report-donut-center-value, .report-donut-center-currency { fill: var(--text); text-anchor: middle; }
.report-donut-center-label, .report-donut-center-currency { fill: var(--muted); font-size: 8px; }
.report-donut-center-value { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-chart-legend { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.report-chart-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: start; gap: 9px; }
.report-chart-swatch { width: 11px; height: 11px; margin-top: 4px; border-radius: 3px; background: var(--chart-color); }
.report-chart-legend-text { display: grid; min-width: 0; gap: 1px; }
.report-chart-legend-name { overflow-wrap: anywhere; }
.report-chart-legend-value { color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 650; }
.chart-series-1 { --chart-color: var(--chart-1); }
.chart-series-2 { --chart-color: var(--chart-2); }
.chart-series-3 { --chart-color: var(--chart-3); }
.chart-series-4 { --chart-color: var(--chart-4); }
.chart-series-5 { --chart-color: var(--chart-5); }
.chart-series-6 { --chart-color: var(--chart-6); }
.report-line-chart { display: block; width: 100%; height: auto; overflow: visible; }
.report-line-grid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.report-line-path { fill: none; stroke: var(--chart-1); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.report-line-point { fill: var(--card); stroke: var(--chart-1); stroke-width: 2; vector-effect: non-scaling-stroke; }
.report-line-axis-label, .report-line-unit { fill: var(--muted); font-size: 12px; }
.report-line-unit { font-weight: 650; }
.chart-data-details { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); }
.chart-data-details summary { width: fit-content; min-height: 36px; padding: 7px 2px; color: #244ba8; cursor: pointer; }
.chart-data-details[open] summary { margin-bottom: 8px; }
.vendor-bar-chart { gap: 13px; }
.chart-overflow-note { margin-top: 12px; font-size: 12px; }
.bar-chart { display: flex; flex-direction: column; gap: 15px; }
.bar-row { display: grid; gap: 6px; }
.bar-label { display: flex; min-width: 0; justify-content: space-between; gap: 12px; }
.bar-label span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.bar-label strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 12px; border-radius: 999px; background: #edf1f7; overflow: hidden; }
.bar-fill { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #406ed7, #7d9dea); }

.financial-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--muted);
  font-size: 13px;
}
.financial-page-head {
  position: relative;
  padding: 4px 0 4px 18px;
}
.financial-page-head::before {
  position: absolute;
  inset: 3px auto 3px 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), #7a5af8);
  content: "";
}
.financial-page-head h1 { margin-bottom: 3px; letter-spacing: -.02em; }
.financial-report-meta span { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.financial-report-meta strong { color: var(--text); }
.financial-methodology,
.financial-quality-warning {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #c7d6ed;
  border-radius: 12px;
  background: #f5f8fe;
}
.financial-methodology-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #dce8fb;
  color: #1f4ba5;
  font-weight: 800;
}
.financial-methodology p,
.financial-quality-warning span { margin: 2px 0 0; color: #4c5f7c; }
.financial-quality-warning {
  border-color: #f5cf8e;
  background: #fffaeb;
  color: #8a4b0f;
}
.financial-quality-warning strong { white-space: nowrap; }
.financial-summary-stack { display: grid; gap: 16px; margin: 18px 0; }
.financial-currency-summary { padding: 20px; overflow: hidden; }
.financial-currency-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}
.financial-currency-head > div { display: flex; align-items: center; gap: 10px; }
.financial-currency-head h2 { margin: 0; font-size: 18px; }
.currency-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #c4d1e6;
  border-radius: 999px;
  background: #eef3fb;
  color: #244ba8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.financial-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.financial-kpi {
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid #e0e6ef;
  border-radius: 12px;
  background: #fbfcfe;
  overflow: hidden;
}
.financial-kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #8fa2bf;
  content: "";
}
.financial-kpi > span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.financial-kpi > strong {
  display: block;
  margin: 7px 0 3px;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.financial-kpi strong small { font-size: 11px; letter-spacing: .04em; }
.financial-kpi p { margin: 0; color: var(--muted); font-size: 11px; }
.financial-kpi.income { background: linear-gradient(145deg, #fff 35%, var(--income-soft)); }
.financial-kpi.income::before { background: var(--income); }
.financial-kpi.income > strong,
.financial-income-text { color: var(--income); }
.financial-kpi.expense { background: linear-gradient(145deg, #fff 35%, var(--expense-soft)); }
.financial-kpi.expense::before { background: var(--expense); }
.financial-kpi.expense > strong,
.financial-expense-text { color: var(--expense); }
.financial-kpi.net-positive::before { background: var(--income); }
.financial-kpi.net-positive > strong { color: var(--income); }
.financial-kpi.net-negative::before { background: var(--expense); }
.financial-kpi.net-negative > strong { color: var(--expense); }
.financial-kpi.coverage::before { background: var(--primary); }
.financial-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.financial-insight-grid article {
  display: grid;
  grid-template-columns: minmax(110px, .35fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.financial-insight-grid span { color: var(--muted); font-size: 12px; }
.financial-insight-grid strong { min-width: 0; overflow-wrap: anywhere; }
.financial-insight-grid p { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.financial-empty-overview { text-align: center; padding: 34px 18px; }
.financial-empty-overview p { margin-top: 5px; }
.financial-executive-section,
.financial-analysis-section,
.financial-decision-layout { margin-top: 16px; }
.financial-executive-section {
  border-top: 3px solid #2754c5;
  background:
    radial-gradient(circle at 100% 0, rgba(39, 84, 197, .08), transparent 32%),
    #fff;
}
.financial-executive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: 14px;
}
.financial-executive-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #d9e2f3;
  border-radius: 12px;
  background: rgba(255, 255, 255, .88);
}
.financial-executive-card > header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}
.financial-executive-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
}
.financial-executive-metrics > div {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 112px;
  padding: 13px;
  background: #fff;
}
.financial-executive-metrics dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.financial-executive-metrics dd {
  margin: 7px 0 3px;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.financial-executive-metrics small {
  align-self: end;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.financial-analysis-section { overflow: hidden; }
.financial-nature-section {
  background:
    linear-gradient(120deg, rgba(39, 84, 197, .035), transparent 38%),
    #fff;
}
.financial-nature-chart-groups {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 370px), 1fr));
}
.financial-nature-chart-groups .report-chart-panel + .report-chart-panel {
  padding-top: 0;
  padding-left: 18px;
  border-top: 0;
  border-left: 1px solid var(--line);
}
.financial-nature-series-1 { --chart-color: var(--recurring); }
.financial-nature-series-2 { --chart-color: var(--one-off); }
.financial-nature-series-3 { --chart-color: #667085; }
.financial-nature-series-4 { --chart-color: #0e7490; }
.financial-nature-series-5 { --chart-color: #7a5af8; }
.financial-nature-series-6 { --chart-color: #475467; }
.financial-definition-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #98a2b3;
  background: #f8fafc;
  color: #596780;
  font-size: 12px;
}
.financial-chart-layout,
.financial-ranking-layout,
.financial-adjustment-layout { margin-top: 16px; }
.financial-trend-card { margin-top: 16px; }
.financial-chart-key { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; }
.financial-chart-key span { display: inline-flex; align-items: center; gap: 6px; }
.financial-chart-key span::before {
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  content: "";
}
.financial-chart-key .income::before { background: var(--income); }
.financial-chart-key .expense::before { background: var(--expense); }
.financial-chart-key .net::before {
  height: 0;
  border-top: 3px dashed var(--primary);
}
.financial-line-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.financial-line-path.financial-line-income { stroke: var(--income); }
.financial-line-path.financial-line-expense { stroke: var(--expense); }
.financial-line-path.financial-line-net { stroke: var(--primary); stroke-dasharray: 8 5; }
.financial-line-point {
  fill: var(--card);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.financial-line-point.financial-line-income { stroke: var(--income); }
.financial-line-point.financial-line-expense { stroke: var(--expense); }
.financial-line-point.financial-line-net { stroke: var(--primary); }
.financial-line-point:focus { outline: none; stroke-width: 4; }
.financial-zero-line { stroke: #7d8ca5; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.financial-category-trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}
.financial-category-trend-grid > .empty { grid-column: 1 / -1; }
.financial-category-trend-card {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #fbfcfe;
  overflow: hidden;
}
.financial-category-trend-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.financial-category-trend-card > header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.financial-category-trend-card h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}
.financial-category-total {
  color: #243b66;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.financial-category-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}
.financial-category-metrics > div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: #fff;
}
.financial-category-metrics dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}
.financial-category-metrics dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.financial-category-metrics .is-up dd { color: var(--expense); }
.financial-category-metrics .is-down dd { color: var(--income); }
.financial-category-line-chart { min-width: 0; }
.financial-category-line-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.financial-category-line-point {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.financial-category-line-point:focus {
  outline: none;
  fill: var(--recurring-soft);
  stroke-width: 4;
}
.financial-income-series-1 { --chart-color: #067647; }
.financial-income-series-2 { --chart-color: #0e7490; }
.financial-income-series-3 { --chart-color: #2e90fa; }
.financial-income-series-4 { --chart-color: #667085; }
.financial-income-series-5 { --chart-color: #7a5af8; }
.financial-income-series-6 { --chart-color: #475467; }
.financial-expense-series-1 { --chart-color: #b42318; }
.financial-expense-series-2 { --chart-color: #d92d20; }
.financial-expense-series-3 { --chart-color: #f79009; }
.financial-expense-series-4 { --chart-color: #b54708; }
.financial-expense-series-5 { --chart-color: #7a5af8; }
.financial-expense-series-6 { --chart-color: #475467; }
.financial-ranking.income-ranking .bar-fill { background: linear-gradient(90deg, #067647, #5bc39a); }
.financial-ranking.expense-ranking .bar-fill { background: linear-gradient(90deg, #b42318, #f97066); }
.financial-supplier-list { display: grid; gap: 10px; }
.financial-supplier-list article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.financial-supplier-list article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.financial-supplier-list article > header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.financial-supplier-list article > header strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}
.financial-supplier-list article > header > span {
  color: #244ba8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.financial-supplier-list dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.financial-supplier-list dl div {
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.financial-supplier-list dt { color: var(--muted); font-size: 10px; }
.financial-supplier-list dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.financial-analysis-table td { vertical-align: top; }
.financial-largest-table td:nth-child(2) { min-width: 150px; }
.financial-largest-table td small {
  display: block;
  max-width: 260px;
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.financial-largest-table td.money { white-space: nowrap; }
.financial-subheading { margin: 18px 0 8px; font-size: 14px; }
.financial-subheading:first-of-type { margin-top: 0; }
.other-fund-summary-grid { display: grid; gap: 10px; }
.other-fund-summary-grid article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.other-fund-summary-grid dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.other-fund-summary-grid dl div { min-width: 0; }
.other-fund-summary-grid dt { color: var(--muted); font-size: 11px; }
.other-fund-summary-grid dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 700; font-variant-numeric: tabular-nums; }
.financial-report-footer { margin: 18px 0 4px; color: var(--muted); font-size: 12px; text-align: right; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 0 22px; }
.pagination-summary { color: var(--muted); }
.pagination-links { display: flex; align-items: center; gap: 6px; }
.page-link, .page-current { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; color: #344054; }
.page-current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.page-link.disabled { color: #98a2b3; background: #f7f8fa; }

.message { padding: 12px 14px; border-radius: 9px; margin-bottom: 14px; background: #eef2f6; }
.message.success { background: #ecfdf3; color: #05603a; }
.message.error { background: #fef3f2; color: #912018; }
.login-card { max-width: 430px; margin: 70px auto; }
.stack-form p { display: flex; flex-direction: column; gap: 5px; }
.stack-form input { padding: 10px 11px; border: 1px solid #cfd5df; border-radius: 8px; }

.customer-billing-head .actions form { margin: 0; }
.customer-billing-notice { margin-bottom: 20px; }
.customer-billing-sync-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.customer-billing-sync-card h2 { margin-bottom: 8px; }
.customer-billing-sync-card p { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 3px 0; }
.customer-billing-sync-card p strong { min-width: 76px; }
.customer-billing-sync-state { display: grid; justify-items: end; gap: 6px; color: var(--muted); }
.customer-billing-periods { margin-bottom: 20px; }
.customer-billing-periods a { min-width: 104px; justify-content: center; }
.customer-billing-paid { border-left: 4px solid var(--success); }
.customer-billing-unpaid { border-left: 4px solid #f79009; }
.customer-billing-filter-card { position: sticky; top: 76px; z-index: 10; }
.customer-billing-filter-result {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  white-space: nowrap;
}
.customer-billing-filter-result [data-billing-visible-count] { color: var(--text); font-weight: 750; }
.customer-billing-table-card { padding-bottom: 10px; }
.customer-billing-table { min-width: 1060px; }
.customer-billing-table td:nth-child(1) { width: 74px; }
.customer-billing-table td:nth-child(2) { min-width: 190px; }
.customer-billing-table td:nth-child(3) { min-width: 150px; }
.customer-billing-table td:nth-child(4) { min-width: 112px; }
.customer-billing-table td:nth-child(5) { min-width: 96px; }
.customer-billing-table td:nth-child(6) { min-width: 145px; }
.customer-billing-table td:nth-child(7) { min-width: 180px; max-width: 300px; overflow-wrap: anywhere; }
.customer-billing-group { color: var(--primary-dark); }
.customer-billing-date { display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.customer-billing-date + .customer-billing-date { margin-top: 3px; }
.customer-billing-date small { margin: 0; }
.customer-billing-allocations { margin-top: 6px; }
.customer-billing-allocations summary { color: #244ba8; cursor: pointer; }
.customer-billing-allocations dl { display: grid; gap: 2px; margin: 6px 0 0; }
.customer-billing-allocations dl div { display: flex; justify-content: space-between; gap: 12px; }
.customer-billing-allocations dt { color: var(--muted); }
.customer-billing-allocations dd { margin: 0; font-variant-numeric: tabular-nums; }
.customer-billing-empty h2 { margin-bottom: 5px; }
.customer-billing-empty p { margin: 0; }
.customer-billing-disclaimer { margin: 0 0 20px; text-align: right; }

.salary-ledger-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.salary-ledger-status-card h2 { margin-bottom: 8px; }
.salary-ledger-status-card p { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 3px 0; }
.salary-ledger-status-card p strong { min-width: 76px; }
.salary-ledger-status-state { display: grid; justify-items: end; gap: 6px; color: var(--muted); text-align: right; }
.salary-payment-summary-card { margin-bottom: 20px; padding-bottom: 12px; }
.salary-payment-summary-card .table-wrap:focus-visible,
.payroll-reconciliation-card .table-wrap:focus-visible {
  outline: 3px solid rgba(39, 84, 197, .3);
  outline-offset: 3px;
}
.salary-payment-summary-table { min-width: 850px; }
.salary-payment-summary-table td:nth-child(5),
.salary-payment-summary-table td:nth-child(6) { min-width: 115px; }
.salary-payment-summary-note,
.payroll-reconciliation-note { margin: 12px 0 0; }
.salary-ledger-periods { margin-bottom: 20px; }
.salary-ledger-periods a {
  min-width: 104px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.salary-ledger-periods a small { color: var(--muted); font-size: 11px; }
.salary-ledger-periods a.active small { color: inherit; }
.salary-ledger-approved { border-left: 4px solid var(--success); }
.salary-ledger-pending { border-left: 4px solid #f79009; }
.salary-ledger-incomplete { border-left: 4px solid #7f56d9; }
.salary-ledger-filter-card { position: sticky; top: 76px; z-index: 10; }
.salary-ledger-filter-result {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  white-space: nowrap;
}
.salary-ledger-filter-result [data-salary-visible-count] { color: var(--text); font-weight: 750; }
.salary-ledger-table-card { padding-bottom: 10px; }
.salary-ledger-table-card .table-wrap:focus-visible {
  outline: 3px solid rgba(39, 84, 197, .3);
  outline-offset: 3px;
}
.salary-ledger-table { min-width: 1040px; }
.salary-ledger-table td:nth-child(1) { min-width: 220px; max-width: 320px; overflow-wrap: anywhere; }
.salary-ledger-table td:nth-child(2) { min-width: 150px; }
.salary-ledger-table td:nth-child(3) { min-width: 110px; }
.salary-ledger-table td:nth-child(4) { min-width: 130px; }
.salary-ledger-table td:nth-child(5) { min-width: 100px; }
.salary-ledger-table td:nth-child(6) { min-width: 95px; }
.salary-ledger-table td:nth-child(7) { min-width: 160px; }
.salary-ledger-empty h2 { margin-bottom: 5px; }
.salary-ledger-empty p { margin: 8px 0 0; }
.salary-ledger-disclaimer { margin: 0 0 20px; text-align: right; }

.payroll-sheet-notice { margin-bottom: 20px; }
.payroll-sheet-sync-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.payroll-sheet-sync-card h2 { margin-bottom: 8px; }
.payroll-sheet-sync-card p { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 3px 0; }
.payroll-sheet-sync-card p strong { min-width: 76px; }
.payroll-sheet-sync-state {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: var(--muted);
  text-align: right;
}
.payroll-sheet-periods { margin-bottom: 20px; }
.payroll-sheet-periods a {
  min-width: 76px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.payroll-sheet-periods a small { color: var(--muted); font-size: 11px; }
.payroll-sheet-periods a.active small { color: inherit; }
.payroll-sheet-net { border-left: 4px solid var(--success); }
.payroll-sheet-metrics .metric-date { font-size: 21px; }
.payroll-sheet-filter-card { position: sticky; top: 76px; z-index: 10; }
.payroll-sheet-filter-result {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  white-space: nowrap;
}
.payroll-sheet-filter-result [data-payroll-visible-count] {
  color: var(--text);
  font-weight: 750;
}
.payroll-sheet-table-card { padding-bottom: 10px; }
.payroll-sheet-table-card .table-wrap:focus-visible {
  outline: 3px solid rgba(39, 84, 197, .3);
  outline-offset: 3px;
}
.payroll-sheet-table { min-width: 1260px; }
.payroll-sheet-table td:nth-child(1) { width: 70px; }
.payroll-sheet-table td:nth-child(2) { min-width: 175px; }
.payroll-sheet-table td:nth-child(3) { min-width: 118px; }
.payroll-sheet-table td:nth-child(4) { min-width: 155px; }
.payroll-sheet-table td:nth-child(5) { min-width: 180px; }
.payroll-sheet-table td:nth-child(6) { min-width: 112px; }
.payroll-sheet-table td:nth-child(7) { min-width: 130px; }
.payroll-sheet-table td:nth-child(8) {
  min-width: 210px;
  max-width: 340px;
  overflow-wrap: anywhere;
}
.payroll-sheet-breakdown > span,
.payroll-sheet-breakdown > small { display: block; }
.payroll-sheet-breakdown > small { margin-top: 3px; }
.payroll-sheet-missing { color: var(--muted); font-weight: 500; }
.payroll-sheet-net-amount strong { color: #067647; }
.payroll-reconciliation-card { margin-top: 20px; padding-bottom: 12px; }
.payroll-reconciliation-table { min-width: 980px; }
.payroll-reconciliation-table td:nth-child(3),
.payroll-reconciliation-table td:nth-child(4),
.payroll-reconciliation-table td:nth-child(5) { min-width: 145px; }
.payroll-reconciliation-difference strong { color: #b54708; }
.payroll-sheet-empty h2 { margin-bottom: 5px; }
.payroll-sheet-empty p { margin: 8px 0 0; }
.payroll-sheet-disclaimer { margin: 0 0 20px; text-align: right; }

@media (max-width: 1000px) {
  .topbar { padding: 12px 16px; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .topbar nav {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .user-menu { margin-left: auto; }
  .container { padding: 18px; }
  .two-column { grid-template-columns: 1fr; }
  .linked-record-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .managed-payer-panel { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-errors.full, .form-grid .full { grid-column: auto; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .details { grid-template-columns: 110px 1fr; }
  .financial-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .financial-insight-grid { grid-template-columns: 1fr; }
  .financial-executive-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-billing-filter-card { top: 132px; }
  .salary-ledger-filter-card { top: 132px; }
  .payroll-sheet-filter-card { top: 132px; }
}

@media (max-width: 700px) {
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { display: none; }
  .responsive-table tbody tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .responsive-table tbody tr:last-child { border-bottom: 0; }
  .responsive-table td { position: relative; min-height: 34px; border: 0; padding: 6px 0 6px 43%; overflow-wrap: anywhere; }
  .responsive-table td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 39%; color: var(--muted); font-size: 12px; font-weight: 650; }
  .responsive-table td.empty { padding: 26px 8px; }
  .responsive-table td.empty::before { content: none; }
  .decision-grid { grid-template-columns: 1fr; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination-links { justify-content: space-between; }
  .page-link, .page-current { min-width: 0; flex: 1; }
  .customer-billing-table { min-width: 0; }
  .customer-billing-table td:nth-child(n) { width: auto; min-width: 0; max-width: none; }
  .salary-payment-summary-table { min-width: 0; }
  .salary-payment-summary-table td:nth-child(n) { width: auto; min-width: 0; max-width: none; }
  .salary-ledger-table { min-width: 0; }
  .salary-ledger-table td:nth-child(n) { width: auto; min-width: 0; max-width: none; }
  .payroll-reconciliation-table { min-width: 0; }
  .payroll-reconciliation-table td:nth-child(n) { width: auto; min-width: 0; max-width: none; }
  .payroll-sheet-table { min-width: 0; }
  .payroll-sheet-table td:nth-child(n) { width: auto; min-width: 0; max-width: none; }
  .financial-category-trend-grid { grid-template-columns: 1fr; }
  .financial-nature-chart-groups { grid-template-columns: 1fr; }
  .financial-nature-chart-groups .report-chart-panel + .report-chart-panel {
    padding-top: 18px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 560px) {
  .container { padding: 12px; }
  .topbar nav a { padding: 8px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { padding: 14px; }
  .metric strong { font-size: 18px; }
  .card { padding: 14px; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dt { margin-top: 9px; }
  .actions { width: 100%; flex-wrap: wrap; }
  .actions .button { flex: 1 1 140px; }
  .user-menu span { display: none; }
  .language-option { min-width: 44px; min-height: 44px; padding: 7px 8px; }
  .filter-wide { grid-column: auto; }
  .filter-bar, .report-filter { grid-template-columns: 1fr; }
  .payer-options > div, .linked-record-summary { grid-template-columns: 1fr; }
  .managed-balance-grid, .managed-split-grid, .settlement-live-summary { grid-template-columns: 1fr; }
  .company-settlement-form [data-settlement-field="direction"] > div { grid-template-columns: 1fr; }
  .managed-account-metrics, .managed-summary-grid, .company-settlement-summary { grid-template-columns: 1fr; }
  .settlement-live-summary p { grid-column: auto; }
  .filter-actions .button { flex: 1; }
  .inline-form { flex-direction: column; }
  .inline-form input { max-width: none; }
  .notice { flex-direction: column; gap: 3px; }
  .bar-label { align-items: flex-start; flex-direction: column; gap: 2px; }
  .report-donut-layout { grid-template-columns: 1fr; }
  .report-chart-legend { width: 100%; }
  .responsive-table td { padding-left: 40%; }
  .responsive-table td::before { width: 36%; }
  .subscription-summary { align-items: stretch; flex-direction: column; }
  .subscription-summary .button { width: 100%; }
  .dialog-head, .subscription-new-panel { padding-left: 16px; padding-right: 16px; }
  .dialog-grid { grid-template-columns: 1fr; }
  .dialog-actions { padding: 14px 16px 16px; }
  .dialog-actions .button { flex: 1; }
  .report-view-tabs { display: flex; }
  .report-view-tabs a { flex: 1; justify-content: center; }
  .financial-currency-head { align-items: flex-start; flex-direction: column; }
  .financial-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .financial-kpi { padding: 13px; }
  .financial-kpi > strong { font-size: clamp(17px, 6vw, 23px); }
  .financial-insight-grid article { grid-template-columns: 1fr; }
  .financial-insight-grid p { text-align: left; }
  .financial-page-head { padding-left: 14px; }
  .financial-executive-section,
  .financial-analysis-section { padding: 14px; }
  .financial-executive-metrics { grid-template-columns: 1fr; }
  .financial-executive-metrics > div { min-height: 0; }
  .financial-category-trend-card { padding: 12px; }
  .financial-category-trend-card > header { align-items: flex-start; flex-direction: column; }
  .financial-category-total { white-space: normal; }
  .financial-category-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .financial-supplier-list article > header { align-items: flex-start; flex-direction: column; }
  .financial-supplier-list article > header > span { white-space: normal; }
  .financial-supplier-list dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .financial-methodology,
  .financial-quality-warning { align-items: flex-start; }
  .financial-quality-warning { flex-direction: column; }
  .financial-trend-card .section-head { align-items: flex-start; flex-direction: column; }
  .other-fund-summary-grid article { grid-template-columns: 1fr; }
  .other-fund-summary-grid dl { grid-template-columns: 1fr; }
  .customer-billing-sync-card { align-items: flex-start; flex-direction: column; }
  .customer-billing-sync-state { justify-items: start; }
  .customer-billing-filter-card { position: static; }
  .customer-billing-filter-result { justify-content: flex-start; }
  .customer-billing-disclaimer { text-align: left; }
  .salary-ledger-status-card { align-items: flex-start; flex-direction: column; }
  .salary-ledger-status-state { justify-items: start; text-align: left; }
  .salary-ledger-filter-card { position: static; }
  .salary-ledger-filter-result { justify-content: flex-start; }
  .salary-ledger-disclaimer { text-align: left; }
  .payroll-sheet-sync-card { align-items: flex-start; flex-direction: column; }
  .payroll-sheet-sync-state { justify-items: start; text-align: left; }
  .payroll-sheet-filter-card { position: static; }
  .payroll-sheet-filter-result { justify-content: flex-start; }
  .payroll-sheet-disclaimer { text-align: left; }
}

@media (max-width: 400px) {
  .metric-grid { grid-template-columns: 1fr; }
  .financial-kpi-grid { grid-template-columns: 1fr; }
  .financial-category-metrics,
  .financial-supplier-list dl { grid-template-columns: 1fr; }
}

@media print {
  @page { margin: 12mm; size: A4 landscape; }
  body { background: #fff; color: #111827; font-size: 11px; }
  .topbar,
  .no-print,
  .message { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card,
  .financial-methodology,
  .financial-quality-warning {
    break-inside: avoid;
    box-shadow: none;
  }
  .financial-page-head { display: block; margin-bottom: 10px; }
  .financial-page-head::before { display: none; }
  .financial-page-head h1 { font-size: 22px; }
  .financial-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .financial-executive-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .financial-category-trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  details { break-inside: avoid; }
  details:not([open]) > *:not(summary) { display: none !important; }
  .financial-report-footer { margin-top: 8px; }
}
