/* Shared design tokens: keep this block identical in local/dist/ui-system.css
   and labor_system/public/ui-system.css. Component rules reference these names
   only; a new colour, radius or shadow belongs here, not inside a rule. */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-display: "SF Pro Display", "Segoe UI Variable Display", var(--font-ui);
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Type scale (rem, so the user's display-size setting scales everything). */
  --text-caption: .8125rem;
  --text-body: .875rem;
  --text-label: 1rem;
  --text-heading: 1.125rem;
  --text-title: 1.25rem;
  --text-display: 1.75rem;
  /* Text. */
  --ink: #142b52;
  --ink-2: #1d3b70;
  --ink-3: #243f6b;
  --text: #414d61;
  --muted: #586b87;
  --faint: #8594ad;
  --on-dark: #ffffff;
  --on-dark-muted: #b8c6dc;
  /* Brand blue. */
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --link: #2158b0;
  --focus: #6395ed;
  --accent-300: #8fb4f1;
  --accent-200: #bfdbfe;
  --accent-100: #dbeafe;
  --accent-soft: #e7f0ff;
  --accent-softer: #f2f6fd;
  --accent-line: #cbdcf6;
  /* Status. */
  --red: #ae4a3e;
  --red-strong: #963c31;
  --danger-soft: #f7e3df;
  --danger-softer: #fff4f3;
  --danger-line: #efd4d0;
  --warn: #ad782c;
  --warn-ink: #8a4b0d;
  --warn-soft: #fff4dd;
  --success: #23734c;
  --success-soft: #e4f3eb;
  /* Surfaces and rules. */
  --paper: #f3f6fc;
  --card: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #edf1f8;
  --line: #e3eaf4;
  --line-strong: #cfd8e6;
  /* Shape and elevation. */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 3px rgba(20, 43, 82, .05);
  --shadow-2: 0 8px 24px rgba(20, 43, 82, .10);
  --shadow-3: 0 24px 64px rgba(20, 43, 82, .22);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 transparent,
    0 0 0 1px rgba(20, 43, 82, .08),
    0 3px 6px -2px rgba(20, 43, 82, .17), 0 13px 25px -12px rgba(20, 43, 82, .29);
  --shadow-card-compact: inset 0 1px 0 rgba(255, 255, 255, .85), 0 2px 5px rgba(20, 43, 82, .13);
  --shadow-card-dark: inset 0 1px 0 rgba(223, 238, 255, .24), inset 0 -1px 0 transparent,
    0 3px 0 rgba(8, 24, 53, .22), 0 12px 23px -8px rgba(20, 43, 82, .48);
  --shadow-window: inset 0 1px 0 rgba(255, 255, 255, .95), 0 0 0 1px rgba(20, 43, 82, .15),
    0 9px 18px -6px rgba(14, 33, 65, .30), 0 28px 66px -13px rgba(10, 25, 51, .52);
  /* Match the inset and outer layers across states so each shadow interpolates. */
  --shadow-control: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -1px 0 transparent,
    0 2px 0 rgba(20, 43, 82, .14), 0 3px 6px rgba(20, 43, 82, .09);
  --shadow-control-raised: inset 0 1px 0 rgba(255, 255, 255, .60), inset 0 -1px 0 transparent,
    0 3px 0 rgba(20, 43, 82, .24), 0 8px 14px -3px rgba(20, 43, 82, .35);
  --shadow-control-pressed: inset 0 2px 5px rgba(12, 30, 61, .28),
    inset 0 -1px 0 rgba(255, 255, 255, .27), 0 1px 2px rgba(20, 43, 82, .12);
  --surface-light: linear-gradient(180deg, rgba(236, 245, 255, .48), transparent 68px);
  --surface-light-dark: linear-gradient(180deg, rgba(143, 180, 241, .15), transparent 86px);
  --surface-control-light: linear-gradient(180deg, rgba(255, 255, 255, .17), rgba(8, 24, 53, .10));
  --workspace-light: linear-gradient(155deg, #e7effb 0, var(--paper) 480px);
  --window-scrim: rgba(13, 24, 46, .63);
  --ease-release: cubic-bezier(.2, .75, .28, 1.28);
  --control-lift: 0 -2px;
  --control-press: 0 1px;
  --ring: 0 0 0 3px rgba(37, 99, 235, .16);
  /* Controls. */
  --control-height: 42px;
  --control-height-sm: 36px;
  --control-radius: var(--radius-md);
  /* Names kept for older rules. */
  --green: var(--link);
  --mint: var(--accent-soft);
  --shadow: var(--shadow-2);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;
}
body { font-size: var(--text-body); }
button, input, select, textarea { font-family: var(--font-ui); line-height: 1.5; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, select, textarea { min-width: 0; max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
small { font-size: var(--text-caption); }
h1, h2, h3, h4 { font-family: var(--font-ui); line-height: 1.4; letter-spacing: normal; }
h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-heading); }
h3 { font-size: var(--text-label); }
:is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

/* Consistent page and panel hierarchy. */
.app-shell { grid-template-columns: 242px minmax(0, 1fr); }
.workspace { padding-inline: clamp(20px, 2.5vw, 40px); }
.topbar { min-height: 104px; height: auto; gap: 24px; padding-block: 20px; }
.topbar > div:first-child { min-width: 0; }
.topbar h1 { font-family: var(--font-ui); font-size: 1.5rem; font-weight: 700; overflow-wrap: anywhere; }
.eyebrow { font-size: var(--text-caption); letter-spacing: .06em; }
.top-actions { flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.top-actions .mobile-account-settings { display: none; }
.search { min-height: var(--control-height); }
.search input { font-size: var(--text-body); }
.panel-head { gap: 16px; flex-wrap: wrap; padding: 20px 24px; }
.panel-head > div, .section-toolbar > div, .section-subhead > div { min-width: 0; }
.panel-head h2, .section-toolbar h2, .section-subhead h3,
.labor-system-entry h2, .application-notice h2, .ai-assistant-header h2 {
  font-size: var(--text-heading); font-weight: 700; line-height: 1.5;
}
.panel-head p, .section-toolbar p, .section-subhead p { font-size: var(--text-caption); color: var(--muted); line-height: 1.7; }
.section-toolbar { gap: 20px; flex-wrap: wrap; padding-block: 22px; min-height: 100px; }
.section-subhead { flex-wrap: wrap; }
.panel, .data-panel, .trend-panel, .recent-panel, .import-preview, .import-layout > *,
.finance-summary > article, .metric-grid > article { min-width: 0; }
.recent-expense-action .row-action {
  min-height: max(44px, var(--control-height)); padding: 6px 10px;
  border-radius: var(--control-radius); background: var(--accent-soft); white-space: nowrap;
  transition: background-color .16s ease;
}
.recent-expense-action .row-action:hover { background: var(--surface-3); }
.filter-group { flex-wrap: wrap; align-items: center; max-width: 100%; }
.filter-group input, .filter-group select { min-width: 0; max-width: 100%; }
.result-count { white-space: normal; font-size: var(--text-caption); line-height: 1.7; }
.result-count strong { font-size: var(--text-label); }
.live-data-note { max-width: 100%; line-height: 1.7; }
.live-data-note i { flex-shrink: 0; }

/* One control size, including table actions and links styled as buttons. */
.primary-button, .secondary-button, .filter-reset, .list-more, .project-finance-open,
.labor-entry-login, .developer-clear-button, .developer-confirm-button {
  min-height: var(--control-height); border-radius: var(--control-radius);
  padding: 10px 16px; font-size: var(--text-body); font-weight: 600; line-height: 1.5;
}
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
/* Action rows keep the same columns when buttons wrap or permissions hide one. */
.action-grid, .ledger-toolbar-actions, .preview-actions, .application-category-links,
.project-finance-actions, .modal-actions:not(:has(> :not(button, a))), .labor-entry-actions {
  --action-min-width: 140px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--action-min-width)), 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.action-grid > :is(button, a), .ledger-toolbar-actions > :is(button, a),
.preview-actions > :is(button, a), .application-category-links > :is(button, a),
.project-finance-actions > :is(button, a), .modal-actions:not(:has(> :not(button, a))) > :is(button, a),
.labor-entry-actions > :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: var(--control-height);
  margin: 0;
  padding: 10px 12px;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.section-toolbar.detail-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}
.detail-toolbar > .action-grid { width: 100%; }
.meeting-detail-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.preview-actions { --action-min-width: 180px; }
.labor-entry-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.text-button, .row-action, .confirm-entry, .danger-action, .success-action, .member-remove {
  min-height: 36px; padding: 7px 10px; font-size: var(--text-caption); font-weight: 600; line-height: 1.5;
}
.danger-action, .success-action { margin-left: 0; }
.row-actions { flex-wrap: wrap; gap: 8px; }
.row-actions button, .row-actions a { flex-shrink: 0; }
.approve-button, .reject-button { white-space: normal; }
.reject-button { background: var(--card); color: var(--red); border: 1px solid var(--danger-line); }
.approval-actions { flex-wrap: wrap; }
.approval-actions button { flex: 1 1 110px; }
.sub-tabs button, .trend-controls button { min-height: 36px; font-size: var(--text-caption); }
.status, .role-pill, .source-pill { font-size: var(--text-caption); line-height: 1.5; font-weight: 600; }
.status:before { flex-shrink: 0; }
.status { white-space: nowrap; padding: 4px 9px; }

/* Readable forms without bold entered values or cramped date inputs. */
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.online-meeting-form { min-width: 0; }
.online-meeting-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0; }
.online-meeting-toolbar label { max-width: 140px; }
.online-meeting-card { min-width: 0; border: 1px solid var(--line); border-radius:var(--radius-lg); padding: 18px; margin: 16px 0; background: var(--surface-2); }
.online-meeting-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.online-meeting-card h3 { margin: 0; font-size: var(--text-heading); overflow-wrap: anywhere; }
.online-meeting-card .project-meeting-info { margin-bottom: 0; }
.online-meeting-card small { overflow-wrap: anywhere; }
.form-grid label, .register-grid > label, .login-card form > label,
.ledger-filter-grid label > span, .prompt-editor > span { font-size: var(--text-body); font-weight: 600; }
.form-grid :is(input, select, textarea), .filter-group :is(input, select),
.ledger-filter-grid :is(input, select), .company-directory-head input, .prompt-editor textarea,
.import-customer-input, #majorProjectStatusFilter {
  min-height: var(--control-height); height: auto; border-radius: var(--control-radius);
  font-size: var(--text-body); font-weight: 400; padding: 10px 12px; line-height: 1.5;
}
.form-grid textarea, .prompt-editor textarea { resize: vertical; min-height: 100px; }
.form-grid input:is([type=checkbox], [type=radio]), .register-consent input {
  width: 18px; height: 18px; min-height: 0; padding: 0; flex-shrink: 0; accent-color: var(--accent);
}
.form-grid label > small, .modal-card form > p:not(.ledger-form-error):not(.history-import-error),
.modal-card .form-grid > p { font-size: var(--text-caption); line-height: 1.7; }
.dashboard-range { gap: 10px; font-size: var(--text-caption); }
.dashboard-range input, .dashboard-range button { min-height: var(--control-height); height: auto; padding: 9px 10px; font-size: var(--text-body); }
.dashboard-range label { min-width: 0; }
.login-input { min-width: 0; height: 46px; }
.login-input input { width: 100%; min-width: 0; font-size: var(--text-body); font-weight: 400; }
.login-input input:focus-visible, .search input:focus-visible, .ledger-search input:focus-visible { outline: none; }
.login-card-head h2 { font-family: var(--font-ui); font-size: 1.5rem; font-weight: 700; line-height: 1.4; }
.login-intro h1 { font-family: var(--font-ui); font-weight: 700; line-height:1.4; }
.login-intro .eyebrow { color: var(--accent-200); }
.install-app-button > span { color: var(--on-dark); }
.login-brand span, .login-card-head > span, .security-note { color: var(--muted); }
.login-brand span { color: var(--on-dark-muted); }
.register-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.register-consent { font-size: var(--text-caption) !important; line-height: 1.7; }
.login-error, .ledger-form-error { min-height: 21px; font-size: var(--text-caption); }
.demo-accounts button { min-height: 38px; gap: 12px; flex-wrap: wrap; }
.demo-accounts b { font-size: var(--text-caption); }
.auth-switch, .register-back { min-height: 40px; font-size: var(--text-caption); }

/* Tables retain their columns, with horizontal scrolling contained in the panel. */
.table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
.data-panel { min-height: 0; }
.empty-cell { min-height: 120px; }
.cell-copy { min-width: 180px; max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.invoice-buyer-info { min-width: 240px; max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; }
th, .data-panel th { padding: 13px 18px; font-size: var(--text-caption); font-weight: 600; color: var(--muted); background: var(--surface-2); line-height: 1.6; }
td, .data-panel td { padding: 15px 18px; font-size: var(--text-body); line-height:1.6; vertical-align: middle; }
td small, .user-id, .expense-project, .ledger-invoice, .ledger-id { color: var(--muted); font-size: var(--text-caption); }
tbody tr:hover > td { background-color: var(--surface-2); }
.ledger-results th, .import-table-card th { font-size: var(--text-caption); }
.ledger-results td, .import-table-card td { font-size: var(--text-body); }
.ledger-results tbody td:before, .import-table-card tbody td:before { font-size: var(--text-caption); }
.person-avatar { flex-shrink: 0; }
.amount, .metric-card > strong, .finance-summary strong, .project-finance-stats strong,
.user-summary strong, .company-metric-row strong, .employee-metrics strong, .import-stat-grid strong {
  font-family: var(--font-ui); font-variant-numeric: proportional-nums; letter-spacing: normal;
}
.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
.metric-card { min-width: 0; min-height: 126px; padding: 14px 16px; display: flex; flex-direction: column; }
.metric-card > strong {
  max-width: 100%; min-width: 0; flex-shrink: 0;
  font-size: var(--text-display); line-height:1.4;
  white-space: nowrap; overflow-wrap: normal; margin-top: 10px;
}
/* Font fitting needs immediate measurements, including reduced-motion mode. */
.metric-card > strong, #pendingAmount { transition-property: none; }
.metric-card .metric-value-wrap, #pendingAmount.metric-value-wrap { white-space: normal; overflow-wrap: anywhere; }
.metric-card > p { display: none; }
.metric-card.pending-card > p { display: flex; flex-wrap: wrap; gap: 0 .3em; margin: 4px 0 0; font-size: var(--text-caption); line-height: 1.5; }
#pendingAmount { display: inline-block; min-width: 0; max-width: 100%; white-space: nowrap; }
.metric-link { position: static; align-self: flex-start; margin-top: auto; padding-top: 12px; font-size: var(--text-caption); }
.metric-head { min-width: 0; font-size: var(--text-body); gap: 12px; }
.metric-head > span { min-width: 0; overflow-wrap: anywhere; }
.metric-head i { flex-shrink: 0; }
.finance-summary strong, .user-summary strong, .company-metric-row strong,
.employee-metrics strong, .import-stat-grid strong { font-size: 1.5rem; line-height: 1.4; overflow-wrap: anywhere; }
.finance-summary { gap: 10px; }
.finance-summary article { min-height: 82px; padding: 12px 14px; }
.finance-summary strong { white-space: normal; overflow-wrap: anywhere; margin-top: 6px; }
.meeting-finance-five { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); overflow: visible; padding-bottom: 0; }
.finance-summary span, .user-summary span, .company-metric-row span, .employee-metrics span { font-size: var(--text-body); }
.finance-summary small, .user-summary small, .company-metric-row small, .employee-metrics small { font-size: var(--text-caption); color: var(--muted); }
.finance-summary:not(.document-storage) small { display: none; }
#projectTrueGrossProfitCard small { display: block; }
.finance-summary .dark-summary small { color: var(--on-dark-muted); }
.dark-summary span { color: var(--on-dark-muted); }
.executor-summary { margin: 12px 0 16px; overflow: hidden; }
.executor-summary table { table-layout: fixed; white-space: normal; }
.executor-summary :is(th, td) { padding: 8px 14px; font-size: var(--text-caption); overflow-wrap: anywhere; }
.executor-summary th { background: var(--surface-2); border-top: 0; }
.executor-summary th:not(:first-child), .executor-summary td:not(:first-child) { text-align: right; }
.executor-summary td:first-child { font-weight: 600; }
.project-finance-name { font-size: var(--text-title); font-weight: 700; line-height: 1.5; }
.project-finance-stats strong, .project-finance-stats .project-finance-profit strong { font-size: var(--text-heading); line-height: 1.5; white-space: nowrap; }
.project-meeting-info > div { grid-template-columns: minmax(88px, auto) minmax(0, 1fr); }
.project-meeting-info dt { font-size: var(--text-caption); }
.project-meeting-info dd { font-size: var(--text-body); font-weight: 500; }
#projectDetailView .project-meeting-panel { width: min(680px, 100%); padding: 18px 20px; }
#projectDetailView .project-meeting-panel .panel-head { flex-direction: row; align-items: center; flex-wrap: wrap; padding-bottom: 12px; }
#projectDetailView .project-meeting-panel .panel-head button { width: auto; }
#projectDetailView .project-meeting-info { grid-template-columns: minmax(0, 1fr); gap: 0; }
#projectDetailView .project-meeting-info > div { grid-template-columns: 104px minmax(0, 1fr); min-height: 0; padding: 10px 0; }
.meeting-info-details > summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; padding: 14px 0 0; font-size: var(--text-body); font-weight: 600; }
.meeting-info-details > summary::-webkit-details-marker { display: none; }
.meeting-info-details > summary small { margin-left: auto; font-size: var(--text-caption); font-weight: 400; color: var(--muted); }
.meeting-info-details > summary svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; }
.meeting-info-details .meeting-info-collapse, .meeting-info-details[open] .meeting-info-expand { display: none; }
.meeting-info-details[open] .meeting-info-collapse { display: inline; }
.meeting-info-details[open] > summary { padding-bottom: 8px; }
.meeting-info-details[open] > summary svg { transform: rotate(90deg); }
.meeting-info-details > summary:focus-visible, .meeting-finance-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius:var(--radius-sm); }
.meeting-finance-toolbar { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.meeting-finance-toolbar h2 { margin: 0; font-size: var(--text-body); font-weight: 600; }
.meeting-finance-toggle { display: grid; place-items: center; width: 32px; height: 32px; padding: 6px; border: 1px solid var(--line); border-radius:var(--radius-md); background: var(--card); color: var(--muted); cursor: pointer; }
.meeting-finance-toggle:hover { background: var(--accent-softer); color: var(--accent); }
.meeting-finance-toggle svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.meeting-finance-eye-slash { display: none; }
.meeting-finance-toggle[aria-pressed="true"] .meeting-finance-eye-slash { display: inline; }
#projectFinanceSummary strong > span { display: inline; color: inherit; font: inherit; }
#projectFinanceSummary strong > span[hidden] { display: none !important; }
#projectFinanceSummary .meeting-finance-mask { letter-spacing: .12em; }
.project-finance-identity .status { font-size: var(--text-caption); }
/* Meeting rows stay compact until the user opens their financial details. */
.ledger-results tbody tr.project-finance-row { display: block; padding: 0; border-radius:var(--radius-md); }
.ledger-results tbody tr.project-finance-row > .project-finance-cell { display: block; width: 100%; padding: 0; }
.project-finance-card { min-width: 0; }
.project-finance-summary { display: grid; grid-template-columns: minmax(0, 1fr) 7.5em 5.5em 3.8em; align-items: start; gap: 8px 12px; min-height: 44px; padding: 10px 14px; list-style: none; cursor: pointer; }
.project-finance-summary-info { display: grid; grid-column: 1 / -1; grid-row: 2; grid-template-columns: 4em minmax(0, 1fr) minmax(0, .7fr) minmax(0, 1.1fr); align-items: start; gap: 8px 14px; min-width: 0; color: var(--muted); font-size: var(--text-caption); line-height: 1.6; }
.project-finance-summary-info > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.project-finance-summary::-webkit-details-marker { display: none; }
.project-finance-summary-name { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-size: var(--text-body); font-weight: 600; }
.project-finance-summary-date { color: var(--muted); font-size: var(--text-caption); white-space: nowrap; }
.project-finance-summary .status { justify-self: start; padding: 2px 8px; font-size: var(--text-caption); white-space: nowrap; }
.project-finance-toggle { display: flex; align-items: center; gap: 5px; color: var(--accent); font-size: var(--text-caption); white-space: nowrap; }
.project-finance-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.project-finance-collapse, .project-finance-card[open] .project-finance-expand { display: none; }
.project-finance-card[open] .project-finance-collapse { display: inline; }
.project-finance-card[open] .project-finance-toggle svg { transform: rotate(90deg); }
.project-finance-card[open] > summary { border-bottom: 1px solid var(--line); }
.project-finance-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius:var(--radius-md); }
.project-finance-body { display: grid; grid-template-columns: minmax(220px, 32%) minmax(0, 1fr); gap: 22px; padding: 18px 20px; }
.project-finance-stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); overflow: visible; }
.project-finance-stats strong, .project-finance-stats .project-finance-profit strong { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .project-finance-summary { gap: 6px 8px; padding: 10px; grid-template-columns: minmax(0, 1fr) auto auto; }
  .project-finance-summary-info { grid-row: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
  .project-finance-summary-date { display: block; grid-column: 1 / -1; grid-row: 2; }
  .project-finance-body { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 14px; }
}
.list-pagination { gap: 8px; padding: 10px 12px; font-size: var(--text-caption); line-height: 1.5; }
.list-pagination .secondary-button { min-height: 30px; padding: 4px 10px; border-radius:var(--radius-sm); font-size: var(--text-caption); line-height: 1.5; }
.supplier-form-hint { text-align: left; color: var(--muted); font-size: var(--text-caption); }
.expense-supplier-preview { min-width: 0; border: 1px solid var(--line); border-radius:var(--radius-md); padding: 14px 16px; background: var(--surface-2); }
.expense-supplier-preview h3 { margin: 0 0 10px; font-size: var(--text-body); }
.expense-supplier-preview dl { display: grid; gap: 8px; margin: 0; }
.expense-supplier-preview dl > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; }
.expense-supplier-preview dt { color: var(--muted); font-size: var(--text-caption); }
.expense-supplier-preview dd { margin: 0; overflow-wrap: anywhere; font-size: var(--text-body); }
.supplier-bank-info { display: block; margin-top: 4px; color: var(--muted); font-size: var(--text-caption); overflow-wrap: anywhere; }
.company-submit-card .form-grid label { text-align: left; }
.approval-card-head { gap: 16px; flex-wrap: wrap; }
.approval-card h3 { font-size: var(--text-label); overflow-wrap: anywhere; }
/* Approval rows expose the fields needed to catch a mistaken submission. */
#projectApprovalList { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.project-approval-card { min-width: 0; padding: 0; border: 1px solid var(--line); border-radius:var(--radius-md); box-shadow: none; }
.project-approval-summary { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 3fr) minmax(120px, auto) auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; list-style: none; cursor: pointer; }
.project-approval-summary::-webkit-details-marker { display: none; }
.project-approval-identity { display: grid; gap: 3px; min-width: 0; }
.project-approval-identity > strong { font-size: var(--text-body); overflow-wrap: anywhere; }
.project-approval-identity .id { color: var(--muted); font-size: var(--text-caption); overflow-wrap: anywhere; }
.project-approval-key-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px 12px; min-width: 0; }
.project-approval-key-fields > span { display: flex; align-items: baseline; gap: 5px; min-width: 0; font-size: var(--text-caption); }
.project-approval-key-fields > span > span { flex-shrink: 0; color: var(--muted); }
.project-approval-key-fields b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.project-approval-total { display: grid; gap: 3px; }
.project-approval-total > span { color: var(--muted); font-size: var(--text-caption); }
.project-approval-total > strong { font-size: var(--text-label); white-space: nowrap; }
.project-approval-warnings { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; grid-column: 1 / -1; }
.project-approval-warnings :is(.duplicate-meeting-warning, .expense-review-hint) { margin: 0; font-size: var(--text-caption); }
.project-approval-card[open] > summary { border-bottom: 1px solid var(--line); }
.project-approval-card[open] .project-finance-expand { display: none; }
.project-approval-card[open] .project-finance-collapse { display: inline; }
.project-approval-card[open] > summary .project-finance-toggle svg { transform: rotate(90deg); }
.project-approval-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius:var(--radius-md); }
.project-approval-body { padding: 12px 14px; }
.project-approval-body .approval-meta { margin: 0 0 12px; padding: 10px 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.project-approval-body .approval-meta > div { min-width: 0; }
.project-approval-body .approval-meta b { overflow-wrap: anywhere; }
.project-approval-body .approval-actions { justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.project-approval-body .approval-actions .row-action { margin-right: auto; }
#approvalList, #companyReviewList { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.compact-approval-row { min-width: 0; padding: 0; border: 1px solid var(--line); border-radius:var(--radius-md); box-shadow: none; }
.compact-approval-summary { display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 8px 14px; list-style: none; cursor: pointer; }
.compact-approval-summary::-webkit-details-marker { display: none; }
.compact-approval-summary > :is(strong, span) { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-caption); }
.compact-approval-summary > strong:first-child { flex-grow: 1.6; font-size: var(--text-body); }
.compact-approval-summary > .approval-executor { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.compact-approval-summary > .approval-amount { flex: 0 0 auto; font-size: var(--text-label); }
.compact-approval-summary > :is(.status, .compact-approval-toggle) { flex: 0 0 auto; }
.compact-approval-toggle { color: var(--accent); }
.compact-approval-collapse, .compact-approval-row[open] .compact-approval-expand { display: none; }
.compact-approval-row[open] .compact-approval-collapse { display: inline; }
.compact-approval-row[open] > summary { border-bottom: 1px solid var(--line); }
.compact-approval-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius:var(--radius-md); }
.compact-approval-content { padding: 12px 14px; }
.compact-approval-content .approval-meta { margin: 0 0 12px; padding: 10px 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.compact-approval-content .approval-meta > div { min-width: 0; }
.compact-approval-content .approval-meta b { overflow-wrap: anywhere; }
.compact-approval-content .approval-actions { flex-wrap: wrap; }
/* Accounting uses the same compact meeting rows with read-only file links. */
#accountingMeetingList { display: grid; gap: 10px; }
.accounting-meeting-card { min-width: 0; border: 1px solid var(--line); border-radius:var(--radius-md); background: var(--card); }
.accounting-meeting-summary { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; align-items: center; gap: 16px; min-height: 54px; padding: 9px 14px; list-style: none; cursor: pointer; }
.accounting-meeting-summary::-webkit-details-marker { display: none; }
.accounting-meeting-identity { display: grid; gap: 2px; min-width: 0; }
.accounting-meeting-identity strong { font-size: var(--text-body); overflow-wrap: anywhere; }
.accounting-meeting-identity > span { color: var(--muted); font-size: var(--text-caption); overflow-wrap: anywhere; }
.accounting-meeting-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; min-width: 0; color: var(--muted); font-size: var(--text-caption); }
.accounting-meeting-meta > span { overflow-wrap: anywhere; }
.accounting-meeting-card[open] > summary { border-bottom: 1px solid var(--line); }
.accounting-meeting-card[open] .project-finance-expand { display: none; }
.accounting-meeting-card[open] .project-finance-collapse { display: inline; }
.accounting-meeting-card[open] > summary .project-finance-toggle svg { transform: rotate(90deg); }
.accounting-meeting-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius:var(--radius-md); }
.accounting-meeting-body { padding: 12px 14px; }
.accounting-meeting-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.accounting-meeting-actions .secondary-button { min-height: 34px; padding: 6px 12px; }
.accounting-totals { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 24px; padding: 10px 12px; border-radius:var(--radius-md); background: var(--paper); }
.accounting-totals > span { color: var(--muted); }
.accounting-totals b { margin-left: 6px; color: var(--ink); }
.accounting-section { min-width: 0; margin-top: 16px; }
.accounting-section h3 { margin: 0 0 8px; font-size: var(--text-body); }
.accounting-detail-table { table-layout: fixed; white-space: normal; }
.accounting-detail-table :is(th, td) { padding: 8px 10px; font-size: var(--text-caption); overflow-wrap: anywhere; vertical-align: top; }
.accounting-cell-line { display: block; color: var(--muted); margin-top: 3px; }
.accounting-file-list { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.accounting-file-list li { min-width: 0; overflow-wrap: anywhere; }
.accounting-file-list .row-action { padding: 0; font-size: var(--text-caption); overflow-wrap: anywhere; }
.accounting-file-kind { margin-left: 6px; color: var(--muted); font-size: var(--text-caption); }
.accounting-empty-files { color: var(--muted); font-size: var(--text-caption); }
#projectIncomeInvoiceList { margin: 4px 0 12px; }
#projectIncomeInvoiceUpload { max-width: 100%; margin-right: 8px; }
#projectIncomeInvoiceError { display: block; color: var(--red); font-size: var(--text-caption); margin-top: 8px; }
.accountant-only { display: none; }
.accountant-mode .accountant-only { display: flex; }
.accountant-mode .nav > :not(.accountant-only), .accountant-mode .topbar .search,
.accountant-mode #applicationNoticeBtn, .accountant-mode #applicationNotice,
.accountant-mode #aiAssistantFloat { display: none !important; }
@media (min-width: 761px) {
  .accountant-mode .sidebar .nav { align-content: start; }
  .accountant-mode .sidebar .nav-item { height: 44px; padding-block: 8px; }
}
#accountingView .panel-head .search { display: flex; width: min(420px, 100%); }
#accountingView .panel-head .search input { padding-left: 0; }
#accountingMeetingList { padding: 0 12px 12px; }
#accountingError { margin: 0 14px 12px; }
#accountingError:empty { display: none; }
#accountingStatementFrame { position: fixed; left: -10000px; top: 0; width: 210mm; height: 297mm; border: 0; pointer-events: none; }
.statement-reviewer-mode .nav { align-content: flex-start; }
.statement-reviewer-mode .nav > :not(.statement-review-nav),
.statement-reviewer-mode .topbar .search,
.statement-reviewer-mode #applicationNoticeBtn, .statement-reviewer-mode #applicationNotice,
.statement-reviewer-mode #aiAssistantFloat { display: none !important; }
.statement-review-toolbar {
  gap: 16px;
  min-height: auto;
  margin: 14px 0;
  padding: 18px 22px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-xl);
  background: linear-gradient(110deg, var(--accent-softer), var(--card) 68%);
}
.statement-review-context { display: grid; gap: 4px; }
.statement-review-context p { margin: 0; color: var(--muted); }
.statement-review-total { display: flex; align-items: baseline; gap: 8px; }
.statement-review-total strong {
  color: var(--ink);
  font: 700 var(--text-display) / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}
.statement-review-total span { color: var(--muted); font-size: var(--text-caption); }
.statement-review-filter { align-items: center; flex-wrap: wrap; }
.statement-review-filter button, .statement-review-filter select,
#statementReviewsView .row-action { min-height: 44px; }
.statement-review-panel { border: 1px solid var(--line); overflow: hidden; }
.statement-review-panel th { background: var(--surface-2); border-top: 0; }
.statement-review-panel td { white-space: normal; overflow-wrap: anywhere; transition: background-color .16s ease; }
.statement-review-panel tbody tr:is(:hover,:focus-within) td { background: var(--accent-softer); }
.statement-review-panel .row-action { min-width: 48px; padding-inline: 8px; border-radius: var(--radius-md); font-weight: 650; }
.statement-review-panel .row-action:is(:hover,:focus-visible) { background: var(--accent-soft); }
.statement-review-date-mobile { display: none; }
.statement-invoice-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.statement-invoice-line {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow-wrap: anywhere;
  transition: border-color .16s ease, background-color .16s ease;
}
.statement-invoice-needed { border-inline-start: 3px solid var(--accent); }
.statement-invoice-line:focus-within { border-color: var(--accent); background-color: var(--card); }
.statement-invoice-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.statement-invoice-heading div { display: grid; }
.statement-invoice-heading small { color: var(--muted); }
.statement-invoice-amount { color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.statement-invoice-line label { display: grid; gap: 6px; overflow-wrap: anywhere; }
.statement-invoice-line input:not([type="checkbox"]) { width: 100%; min-height: 44px; background: var(--card); }
.statement-invoice-line input[type="checkbox"] { inline-size: 16px; block-size: 16px; vertical-align: middle; }
.statement-invoice-links { display: grid; gap: 4px; margin: 0; padding-left: 18px; }
.statement-invoice-links a { color: var(--link); overflow-wrap: anywhere; }
.statement-review-detail-card { width: min(820px, 100%); }
.statement-review-submit-card { width: min(720px, 100%); }
.statement-review-detail-card h3 { margin-block: 16px 8px; }
.statement-review-detail-card th, .statement-review-detail-card td { padding: 8px 12px; }
.statement-review-detail-card .approval-meta { margin-block: 12px; }
.statement-review-detail-card .form-grid { margin-top: 20px; }
.statement-review-detail-card p { overflow-wrap: anywhere; }
.statement-review-brief {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; padding: 15px 16px; margin-top: 8px;
  background: var(--accent-softer); border: 1px solid var(--accent-line);
  border-inline-start: 3px solid var(--accent); border-radius: var(--radius-md);
}
.statement-review-brief-copy { min-width: 0; overflow-wrap: anywhere; }
.statement-review-brief-copy > strong { font-size: var(--text-label); }
.statement-review-brief-copy > small { display: block; margin-top: 5px; color: var(--muted); }
.statement-invoice-download {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px;
  padding: 8px 13px; border: 1px solid var(--accent-line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--link); font-weight: 650; text-decoration: none;
}
.statement-invoice-download svg { width: 17px; height: 17px; flex: none; }
.statement-invoice-download:hover { background: var(--accent-soft); border-color: var(--accent-300); }
.statement-invoice-download:focus-visible, .statement-paper-details summary:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.statement-ticket-number { font-family: var(--font-code); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.statement-paper-details { margin-block: 10px; }
.statement-paper-details summary { cursor: pointer; color: var(--link); min-height: 44px; padding-block: 11px; }
.statement-reviewed-frame { width: 100%; min-height: 400px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.statement-review-pagination { align-items: center; gap: 8px; }
@media (max-width: 760px) {
  .statement-review-toolbar { align-items: flex-start; flex-direction: column; padding: 14px 16px; }
  .statement-review-panel :is(th,td) { padding: 8px; }
  .statement-review-panel .statement-review-time { display: none; }
  .statement-review-date-mobile { display: block; color: var(--muted); }
  .statement-review-panel .status { white-space: nowrap; }
}
@media (max-width: 480px) {
  .statement-invoice-download { width: 100%; }
  .statement-review-detail-card .approval-meta { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .statement-review-brief { animation: statement-detail-reveal 190ms ease-out both; }
  .statement-invoice-download { transition: background-color 160ms ease, border-color 160ms ease, transform 100ms ease; }
}
@keyframes statement-detail-reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.approval-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.approval-meta b { font-size: var(--text-body); font-weight: 500; overflow-wrap: anywhere; }
.approval-meta span { font-size: var(--text-caption); }
.y-axis, .x-axis { font-size: .75rem; color: var(--muted); }
.trend-panel .y-axis { width: 72px; flex-shrink: 0; }
.chart-empty { font-size: var(--text-caption); color: var(--muted); text-align: center; padding: 12px; }

/* Modal headings reserve space for a reachable close button. */
.modal { padding: 24px; }
.modal-card { font-size: var(--text-body); line-height: 1.7; max-height: calc(100dvh - 48px); overscroll-behavior: contain; }
.modal-card h2 { font-size: var(--text-title); line-height: 1.5; padding-right: 40px; overflow-wrap: anywhere; }
.modal-close { width: 36px; height: 36px; font-size: 24px; line-height: 1; display: grid; place-items: center; }
.modal-actions { flex-wrap: wrap; align-items: center; }
.confirm-card p { font-size: var(--text-body); line-height: 1.7; overflow-wrap: anywhere; }
.account-settings-card { width: min(580px, 100%); }
.account-section-heading { gap: 12px; flex-wrap: wrap; }
.reimbursement-print-actions { bottom: -28px; }
#invoiceRequestModal .data-panel { min-height: 0; }
#invoiceRequestModal .panel-head { padding: 0 0 18px; }
.document-file-copy strong { font-size: var(--text-body); }
.document-file-copy small { font-size: var(--text-caption); }

/* Navigation uses the same label size; small screens scroll in one row. */
.nav-item { min-height: 44px; font-size: var(--text-body); line-height: 1.5; padding: 11px 13px; color: var(--on-dark-muted); }
.nav .nav-child { font-size: var(--text-caption); }
.nav-item > span:first-child { flex-shrink: 0; }
.nav-item > #dashboardNavLabel { font-size: inherit; }
.nav-item b { font-size: .75rem; min-width: 22px; line-height: 1.4; }
.user-card strong { font-size: var(--text-body); }
.user-card span { font-size: var(--text-caption); color: var(--on-dark-muted); }
.user-card .account-identity { text-align: left; }
.sidebar-foot { padding-top: 16px; }
.sidebar .nav { flex: 1; }

/* Assistant stays readable without forcing its content out of a small window. */
.ai-float-header { height: auto; min-height: 66px; padding-block: 10px; }
.ai-float-header strong { font-size: var(--text-body); font-weight: 600; }
.ai-float-header small { font-size: var(--text-caption); color: var(--on-dark-muted); }
.ai-message { font-size: var(--text-body); font-weight: 400; line-height:1.7; }
.ai-message strong, .ai-message em { font-weight: 600; }
.ai-message .ai-heading { font-size: var(--text-body); font-weight: 600; }
.ai-input-row input { font-size: var(--text-body); font-weight: 400; }
.ai-input-row input::placeholder { font-size: inherit; font-weight: 400; }
.ai-float-window .ai-suggestions { max-height: none; }
.ai-privacy { font-size: var(--text-caption); line-height: 1.6; color: var(--muted); }
.ai-float-launcher { min-height: 48px; }
.ai-float-launcher b { font-size: var(--text-body); }
.ai-assistant-float { max-width: calc(100vw - 24px); }
.ai-chat { overscroll-behavior: contain; }
.ai-assistant-float:not(.collapsed) .ai-float-window { max-height: calc(100dvh - 48px); overflow-y: auto; }
.toast { max-width: min(460px, calc(100vw - 32px)); font-size: var(--text-body); line-height: 1.7; overflow-wrap: anywhere; }
.connection-status { max-width: calc(100vw - 24px); font-size: var(--text-body); }

@media (min-width: 1360px) {
  .meeting-detail-actions { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .top-actions { flex-shrink: 1; }
  .ledger-head-actions { flex-wrap: wrap; flex-shrink: 1; }
  .import-layout { grid-template-columns: minmax(0, 1fr); }
  .project-approval-summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 12px; }
  .project-approval-key-fields { grid-column: 1 / -1; grid-row: 2; }
  .project-approval-body .approval-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-approval-summary { flex-wrap: wrap; gap: 8px 12px; }
  .compact-approval-summary > :is(strong, span) { flex-basis: calc(33.333% - 12px); }
  .compact-approval-content .approval-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --control-height: 44px; }
  .workspace { padding: 0 16px calc(112px + env(safe-area-inset-bottom)); }
  .topbar { padding-block: 18px; min-height: 92px; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  .topbar h1 { font-size: var(--text-title); }
  .top-actions { gap: 8px; }
  .top-actions .mobile-account-settings { display: inline-flex; }
  .top-actions button { padding: 9px 12px; font-size: var(--text-caption); }
  .sidebar {
    height: calc(84px + env(safe-area-inset-bottom)); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto; overflow-y: hidden;
  }
  .sidebar .nav { display: flex; flex: 0 0 auto; width: max-content; min-width: 100%; height: 68px; overflow: visible; }
  .sidebar .nav-item, .sidebar .nav-child {
    flex: 0 0 96px; min-width: 96px; min-height: 64px; padding: 10px 5px 6px;
    font-size: var(--text-caption); gap: 3px; white-space: nowrap;
  }
  .nav-item b { top: 0; right: 10px; }
  .nav-item.active:before { top: -4px; }
  .section-toolbar { flex-direction: column; align-items: stretch; gap: 16px; min-height: 0; }
  .filter-group { width: 100%; align-items: stretch; }
  .filter-group input, .filter-group select { width: 100%; }
  .section-toolbar > .primary-button { align-self: flex-start; }
  .meeting-detail-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .labor-entry-actions { grid-template-columns: minmax(0, 1fr); }
  .panel-head { padding: 18px; }
  .ui-responsive-table, .ui-responsive-table tbody { display: block; width: 100%; white-space: normal; }
  .ui-responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ui-responsive-table tbody { display: grid; gap: 12px; padding: 0 14px 14px; }
  .ui-responsive-table tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
    padding: 16px; border: 1px solid var(--line); border-radius:var(--radius-md);
  }
  .ui-responsive-table tbody td {
    display: block; min-width: 0; max-width: none; width: auto; padding: 0; border: 0;
    white-space: normal; overflow-wrap: anywhere; font-size: var(--text-body);
  }
  .ui-responsive-table td[data-label]:before {
    content: attr(data-label); display: block; font-size: var(--text-caption);
    font-weight: 600; line-height: 1.6; color: var(--muted); margin-bottom: 4px;
  }
  .ui-responsive-table tbody td:is(.cell-copy, .invoice-buyer-info, .amount, [colspan]),
  .ui-responsive-table tbody td:has(.row-actions), .ui-responsive-table tbody td:has(.cell-warning) { grid-column: 1 / -1; }
  .ui-responsive-table tbody td.amount { white-space: nowrap; }
  .ui-responsive-table tbody td[colspan]:before { content: none; }
  .ui-responsive-table .row-actions { justify-content: flex-start; }
  .employee-mode #recentExpenseTable .recent-expense-date { grid-area: 1 / 2; }
  .employee-mode #recentExpenseTable td.amount { grid-column: auto; }
  .ui-responsive-table .recent-expense-action { align-self: end; justify-self: end; }
  .ui-responsive-table .recent-expense-action:empty { display: none; }
  #recentExpenseTable .recent-expense-action::before { content: none; }
  .member-labor-permission { min-width: 0; white-space: normal; }
  .source-pill { max-width: 100%; }
  .form-grid, .register-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid label.full, .register-grid .full { grid-column: 1; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea,
  .form-grid :is(input, select, textarea), .filter-group :is(input, select), .login-input input,
  .ledger-filter-grid :is(input, select), .dashboard-range input, .ai-input-row input,
  .company-directory-head input, .prompt-editor textarea, #majorProjectStatusFilter { font-size: 16px; }
  .dashboard-range { width: 100%; flex-wrap: wrap; }
  .period-row { align-items: stretch; }
  .dashboard-range > span { width: 100%; }
  .dashboard-range label { flex: 1 1 125px; }
  .dashboard-range input { width: 100%; }
  .trend-head { display: flex; align-items: stretch; }
  .trend-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; }
  .trend-controls button { padding-inline: 3px; }
  .finance-summary:not(.meeting-finance-five) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-summary article { padding: 12px 14px; }
  .finance-summary strong { font-size: var(--text-title); }
  .meeting-finance-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .executor-summary :is(th, td) { padding: 8px 7px; }
  .executor-summary :is(th, td):first-child { width: 18%; }
  .metric-card { min-height: 126px; }
  .project-approval-summary { padding: 10px 12px; }
  .project-approval-key-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
  .project-approval-total > strong { font-size: var(--text-body); }
  .project-approval-body { padding: 10px 12px; }
  .project-approval-body .approval-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-approval-body .approval-actions .row-action { grid-column: 1 / -1; margin: 0; }
  .compact-approval-summary { padding: 9px 12px; }
  .compact-approval-summary > :is(strong, span) { flex-basis: calc(50% - 12px); }
  .compact-approval-summary > strong:first-child { flex-basis: 100%; }
  .compact-approval-content { padding: 10px 12px; }
  .compact-approval-content .approval-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accounting-meeting-summary { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; padding: 9px 12px; }
  .accounting-meeting-meta { grid-column: 1 / -1; grid-row: 2; gap: 5px 12px; }
  .accounting-meeting-body { padding: 10px 12px; }
  .accounting-totals { display: grid; gap: 5px; padding: 8px 10px; }
  .accounting-totals > span { display: flex; justify-content: space-between; gap: 12px; }
  .accounting-detail-table { table-layout: auto; }
  .modal { padding: 12px; }
  .modal-card { width: min(620px, 100%); padding: 24px 18px; max-height: calc(100dvh - 24px); }
  .modal-close { top: 16px; right: 14px; }
  .modal-actions > button { flex: 1 1 auto; }
  .reimbursement-print-card { width: 100%; }
  .reimbursement-print-actions { bottom: -24px; }
  .company-row, .company-directory-head { flex-wrap: wrap; }
  .company-row-meta { max-width: 100%; flex-wrap: wrap; }
  .document-toolbar .filter-group select { width: auto; }
  .ai-assistant-float { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .ai-assistant-float:not(.collapsed) .ai-float-window { max-height: calc(100dvh - 124px - env(safe-area-inset-bottom)); }
  .ai-float-window .ai-chat { height: clamp(100px, 24dvh, 190px); }
  .toast, .app-update-notice { bottom: calc(100px + env(safe-area-inset-bottom)); right: 16px; }
  .app-update-notice { flex-wrap: wrap; gap: 10px; }
  .login-screen { padding: 24px 18px; }
  .login-layout { padding-top: 28px; }
  #registerCard { margin-top: 0; }
}
@media (max-width: 480px) {
  .finance-summary:not(.meeting-finance-five), .meeting-finance-five { grid-template-columns: minmax(0, 1fr); }
  .approval-meta { grid-template-columns: minmax(0, 1fr); }
  .project-approval-body .approval-meta { grid-template-columns: minmax(0, 1fr); }
  .compact-approval-content .approval-meta { grid-template-columns: minmax(0, 1fr); }
  .import-stat-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.expense-review-hint { margin: 12px 0; font-size: var(--text-caption); color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.expense-meeting-details { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.expense-meeting-details summary { cursor: pointer; font-weight: 700; color: var(--ink); }
#reimbursementCustomerHint { display: block; margin-top: 7px; font-size: var(--text-caption); color: var(--muted); }
#reimbursementCustomerSelect { margin-top: 7px; }
#projectStatementFrame { display: block; width: 100%; height: 560px; border: 1px solid var(--line); border-radius:var(--radius-md); background: var(--card); }
.statement-scope { padding: 12px 16px; background: var(--accent-soft); color: var(--ink); border-radius:var(--radius-md); font-size: var(--text-body); font-weight: 700; line-height: 1.7; }
#downloadStatementAttachmentsBtn svg { flex: none; }
#downloadStatementAttachmentsBtn:disabled { opacity: .55; cursor: wait; }
.statement-attachments-status { margin: 0; color: var(--muted); font-size: var(--text-caption); text-align: end; }
.statement-attachments-status:not(:empty) { margin-top: 8px; }
@media (prefers-reduced-motion: no-preference) {
  #downloadStatementAttachmentsBtn svg { transition: transform 150ms ease; }
  #downloadStatementAttachmentsBtn:not(:disabled):hover svg { transform: translateY(2px); }
}
@media (max-width: 760px) { #projectStatementFrame { height: 460px; } }

#expenseHistoryModal { z-index: 30; }
#expenseWithdrawalModal { z-index: 32; }

/* 待审核会议名称右侧的所属项目，窄屏按现有标题自然换行。 */
.approval-meeting-project { display: inline-block; margin-left: 12px; color: var(--muted); font-size: var(--text-caption); font-weight: 500; vertical-align: baseline; max-width: 100%; }

.cost-payment-title{margin:8px 0 0;font-size:15px;color:var(--text-primary,var(--ink))}
.payment-application-export{display:flex;flex-wrap:wrap;align-items:end;gap:12px;padding:16px;margin-bottom:16px}
.payment-application-export label{display:grid;gap:5px;font-size:var(--text-caption)}
.payment-application-export input{min-height:36px;border:1px solid var(--border,var(--line));border-radius:var(--radius-md);padding:6px 10px;background:var(--card);color:var(--ink);font:inherit}
.payment-application-export small{flex-basis:100%;color:var(--muted)}
.cost-supplier-fields{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.cost-supplier-fields h3,.cost-supplier-fields [data-cost-library],.cost-supplier-fields .expense-supplier-preview{grid-column:1/-1}
.cost-supplier-fields h3{margin:0}
.payment-info-copy{white-space:pre-wrap;overflow-wrap:anywhere}
.executor-directory{padding:18px;margin-bottom:18px}
.executor-name-list{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.executor-name{display:inline-flex;align-items:center;gap:12px;max-width:100%;padding:5px 12px;background:var(--accent-soft,var(--accent-soft));border-radius:var(--radius-md)}
.executor-name-text{min-width:0;overflow-wrap:anywhere}
.executor-remove{flex-shrink:0;border:0;border-radius:var(--radius-sm);padding:5px 8px;background:var(--card);color:var(--red);font-size:var(--text-caption)}
.executor-remove:hover{background:var(--danger-soft)}
.executor-remove:disabled{opacity:.5}
.executor-directory form{display:flex;flex-wrap:wrap;gap:12px;align-items:end}
.executor-directory label{display:grid;gap:6px}
.executor-directory input{padding:8px;border:1px solid var(--border,var(--line));border-radius:var(--radius-md);font:inherit}
.executor-directory [role=alert]{color:var(--red)}
.list-access-dock{position:fixed;z-index:70;bottom:16px;left:calc(50% + 110px);transform:translateX(-50%);display:flex;flex-wrap:wrap;justify-content:center;gap:10px;max-width:calc(100vw - 280px);padding:9px 14px;background:var(--card);border:1px solid var(--line-strong);border-radius:var(--radius-lg);box-shadow:var(--shadow-2);font-size:var(--text-caption);color:var(--ink)}
.list-access-dock>div{display:flex;align-items:center;gap:10px}
.list-access-dock button{border:1px solid var(--line-strong);border-radius:var(--radius-sm);background:var(--paper);color:var(--ink);padding:7px 10px;white-space:nowrap;font:inherit;cursor:pointer}
.list-access-dock button:disabled{opacity:.4;cursor:default}
.list-access-dock input{width:110px;accent-color:var(--accent)}
.workspace{padding-bottom:110px}
@media(max-width:1100px){.list-access-dock{left:50%;bottom:82px;max-width:calc(100vw - 24px);width:max-content;gap:7px;padding:7px 10px}.list-access-dock input{width:75px}.list-access-dock button{padding:7px}.workspace{padding-bottom:190px}}
@media(max-width:600px){.cost-supplier-fields{grid-template-columns:1fr}.payment-application-export label{flex:1;min-width:120px}.payment-application-export>button{width:100%}}

.display-settings-card { width: min(520px, 100%); }
.display-size-field { display: grid; gap: 8px; margin-top: 20px; font-weight: 600; }
.display-size-field select { width: 100%; min-height: var(--control-height); padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--card); color: var(--ink); font-size: var(--text-body); }
.display-font-preview { display: grid; gap: 6px; margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius:var(--radius-md); background: var(--surface-2); overflow-wrap: anywhere; }
.display-font-preview > strong { font-size: var(--text-heading); }
.display-font-preview > span, .display-font-preview > small { color: var(--muted); font-size: var(--text-caption); }
.display-font-preview > b { font-size: var(--text-label); font-variant-numeric: tabular-nums; }
.display-size-status { margin-top: 12px; color: var(--muted); font-size: var(--text-caption); }
@media print { :root { font-size: 16px !important; } }

.attachment-history-row{display:grid;gap:4px;padding:12px 0;border-bottom:1px solid var(--line)}.attachment-history-row small{color:var(--muted)}#attachmentChangeName{overflow-wrap:anywhere}#attachmentChangeForm label{display:grid;gap:12px}

/* 会议总览金额默认遮罩；字号沿用现有字体设置。 */
#ledgerFinanceSummary article { min-height: 72px; }
#ledgerFinanceSummary article > span { font-size: var(--text-caption); font-weight: 400; }
#ledgerFinanceSummary strong { font-size: 1.125rem; font-weight: 400; line-height: 1.5; }
#ledgerFinanceSummary.ledger-finance-masked strong { letter-spacing: .12em; }
.hierarchy-deletion-card { width: min(820px, 100%); }
.hierarchy-deletion-bulk { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.hierarchy-deletion-bulk label { display: grid; gap: 6px; flex: 1; min-width: 0; }
.hierarchy-deletion-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.hierarchy-deletion-row small { display: block; color: var(--muted); font-size: var(--text-caption); overflow-wrap: anywhere; }
.hierarchy-deletion-card select { width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius:var(--radius-md); background: var(--card); color: var(--ink); font: inherit; }
@media(max-width:600px) { .hierarchy-deletion-row { grid-template-columns: minmax(0, 1fr); } .hierarchy-deletion-bulk { display: grid; grid-template-columns: minmax(0, 1fr); } }

/* 打印文档在屏幕外加载，无需用户先打开预览。 */
.reimbursement-preview.reimbursement-print-offscreen { position: fixed; left: -10000px; top: 0; width: 1100px; height: 800px; overflow: hidden; pointer-events: none; }

/* 全站统计卡片统一使用小号常规数字，跟随用户的字号设置缩放。 */
.metric-card > strong, .finance-summary strong, #ledgerFinanceSummary strong,
.user-summary strong, .company-metric-row strong, .employee-metrics strong,
.import-stat-grid strong, .project-finance-stats strong,
.project-finance-stats .project-finance-profit strong, .approval-count strong,
.project-approval-total > strong {
  font-size: var(--text-label);
  font-weight: 400;
  line-height: 1.5;
}
#pendingAmount { font-weight: 400; }
.meeting-note { grid-column: 1 / -1; min-width: 0; }
.meeting-note :is(b, dd) { white-space: pre-wrap; overflow-wrap: anywhere; }
.cancellation-review-hint { padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-softer); color: var(--ink); line-height: 1.6; }

/* Keep the date wrapper transparent to the existing mobile layout. */
.expense-date-range { display: contents; }
.expense-date-range > label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

/* Desktop alignment fixes: retain all fields, labels and table columns. */
@media (min-width: 761px) {
  :root { --control-height: max(42px, 2.625rem); }
  .filter-group :is(input:not([type=checkbox], [type=radio], [type=hidden]), select),
  .company-filter-panel > :is(input:not([type=hidden]), select), .storage-filters :is(input, select),
  .payment-application-export input, #executorDirectoryForm input,
  .ledger-filter-grid :is(input, select), .dashboard-range input,
  .company-directory-head input, .import-customer-input, #majorProjectStatusFilter,
  .form-grid :is(input:not([type=checkbox], [type=radio], [type=file], [type=hidden]), select) {
    box-sizing: border-box;
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--control-radius);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: var(--text-body);
    font-weight: 400;
    line-height: 1.5;
  }
  .filter-group > :is(button, a), .company-filter-panel > button,
  .dashboard-range button, #executorDirectoryForm > button { height: var(--control-height); min-height: var(--control-height); padding-block: 9px; }
  .company-filter-panel { flex-wrap: wrap; align-items: center; }
  .company-filter-panel > .ledger-search { flex: 1 1 16rem; height: var(--control-height); min-width: 0; }
  .company-filter-panel > select { flex: 0 1 auto; max-width: 100%; }
  .company-filter-panel:has(#backstageRecordId) > div { flex-basis: 100%; }
  #backstageRecordId { flex: 1 1 240px; }
  .storage-filters { align-items: end; }
  .form-grid label { align-content: start; }

  .expense-toolbar { align-items: start; }
  .expense-toolbar > .filter-group { width: 100%; align-items: end; }
  .expense-toolbar .filter-group > :is(input, select) { flex: 1 1 160px; }
  .expense-date-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 2 1 320px; gap: 10px; min-width: 0; }
  .expense-date-range > label { display: grid; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); }
  .expense-toolbar .expense-date-range input[type=date] { width: 100%; min-width: 0; }
  .expense-toolbar .filter-group > button { flex: 0 0 auto; }

  #projectDetailView .project-meeting-panel { width: 100%; }
  #projectDetailView .project-meeting-info { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  #projectDetailView .project-meeting-info > .meeting-note { grid-column: 1 / -1; }

  .reimbursement-print-fields { align-items: start; }
  .reimbursement-print-fields > div { display: grid; gap: 12px; min-width: 0; }
  .reimbursement-print-fields label { align-content: start; }
  .reimbursement-print-fields datalist { display: none; }
  .reimbursement-print-fields > div > small { margin-top: -6px; }
  .reimbursement-print-card > :is(.reimbursement-loading, .ledger-form-error):empty { display: none; }

  .user-panel table { width: 100%; min-width: 1100px; table-layout: fixed; white-space: normal; }
  .user-panel :is(th, td) { padding-inline: 12px; white-space: normal; overflow-wrap: anywhere; }
  .user-panel th:nth-child(1) { width: 14%; }
  .user-panel th:nth-child(2) { width: 13%; }
  .user-panel th:nth-child(3) { width: 10%; }
  .user-panel th:nth-child(4) { width: 6%; }
  .user-panel th:nth-child(5) { width: 13%; }
  .user-panel th:nth-child(6) { width: 14%; }
  .user-panel th:nth-child(7) { width: 30%; }
  .user-panel .row-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(36px, auto); align-content: start; gap: 6px; width: 100%; min-height: 78px; }
  .user-panel .row-actions > :is(button, a) { width: 100%; margin: 0; padding-inline: 6px; white-space: normal; }

  #listAccessDock { display: none; }
  .table-scroll-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
  .table-scroll-controls button { min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius:var(--radius-sm); background: var(--card); color: var(--ink); font: inherit; font-size: var(--text-caption); }
  .table-scroll-controls button:disabled { opacity: .4; }
  .table-scroll-controls input { width: clamp(80px, 15vw, 200px); accent-color: var(--accent); }
  .sidebar-foot > .ai-assistant-float { color: var(--ink); }
  .sidebar-foot > .ai-assistant-float.collapsed { position: static; width: 100%; max-width: none; margin-bottom: 14px; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; transform: none; }
  .sidebar-foot .ai-float-launcher { width: 100%; justify-content: center; margin: 0; background: var(--ink-3); cursor: pointer; }
}
@media (min-width: 1280px) {
  #projectDetailView .project-meeting-info { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .table-scroll-controls { display: none; }
}

/* Desktop pages keep their primary title; separate content sections keep theirs. */
@media (min-width: 761px) {
  #pageEyebrow,
  .view > .section-toolbar > div > h2,
  #expenseListPane > .section-toolbar > div > h2,
  #expenseReviewPane > .section-toolbar > div > h2,
  #invoiceRequestsView #invoiceRequestsPanel > .panel-head h2,
  .employee-dashboard #employeeGreeting,
  #notFoundView > .panel > h2 { display: none; }
  .view > .section-toolbar,
  #expenseListPane > .section-toolbar,
  #expenseReviewPane > .section-toolbar { min-height: 0; padding-block: 16px; }
  .view > .section-toolbar > div > p,
  #expenseListPane > .section-toolbar > div > p,
  #expenseReviewPane > .section-toolbar > div > p { margin: 0; }

  /* Same compact, expandable strips as the meeting list. */
  #expenseListPane .table-wrap:has(#expenseTableBody.expense-list-compact) { padding: 0 14px 16px; overflow: hidden; }
  #expenseListPane table:has(> #expenseTableBody.expense-list-compact) { display: block; width: 100%; min-width: 0; white-space: normal; }
  #expenseListPane table:has(> #expenseTableBody.expense-list-compact) > thead { display: none; }
  #expenseTableBody.expense-list-compact { display: grid; gap: 10px; width: 100%; }
  .expense-list-compact > tr { display: block; border: 1px solid var(--line); border-radius:var(--radius-md); background: var(--card); }
  .expense-list-compact > tr > td { display: block; width: 100%; padding: 0; border: 0; }
  .expense-list-compact > tr > td.empty-cell { padding: 24px; }
  .expense-record-card { min-width: 0; }
  .expense-record-summary { display: grid; grid-template-columns: minmax(0, 1fr) 8.5em 7.5em max-content max-content; align-items: start; gap: 8px 12px; min-height: 44px; padding: 10px 14px; list-style: none; cursor: pointer; }
  .expense-record-summary::-webkit-details-marker { display: none; }
  .expense-record-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-body); font-weight: 600; }
  .expense-record-amount { font-size: var(--text-body); font-weight: 400; white-space: nowrap; text-align: right; }
  .expense-record-summary > .status { justify-self: start; white-space: nowrap; padding: 2px 8px; font-size: var(--text-caption); }
  .expense-record-meta { display: grid; grid-column: 1 / -1; grid-template-columns: 12em minmax(0, 1fr) 10em 6em; gap: 8px 14px; min-width: 0; color: var(--muted); font-size: var(--text-caption); line-height: 1.6; }
  .expense-record-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .expense-record-collapse, .expense-record-card[open] .expense-record-expand { display: none; }
  .expense-record-card[open] .expense-record-collapse { display: inline; }
  .expense-record-card[open] .project-finance-toggle svg { transform: rotate(90deg); }
  .expense-record-card[open] > summary { border-bottom: 1px solid var(--line); }
  .expense-record-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius:var(--radius-md); }
  .expense-record-content { padding: 18px 20px; }
  .expense-record-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 24px; margin: 0 0 16px; }
  .expense-record-fields > div { min-width: 0; }
  .expense-record-fields dt { color: var(--muted); font-size: var(--text-caption); margin: 0 0 4px; }
  .expense-record-fields dd { margin: 0; font-size: var(--text-body); font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere; }
  .expense-record-fields .expense-record-wide { grid-column: 1 / -1; }
  .expense-record-fields .expense-record-review { grid-column: span 2; }
  .expense-record-content > .row-actions { justify-content: flex-end; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .expense-record-summary { grid-template-columns: minmax(0, 1fr) auto auto auto auto; column-gap: 8px; }
  .expense-record-meta { grid-template-columns: 10em minmax(0, 1fr) 8em 5em; column-gap: 10px; }
}

/* ── System layer ─────────────────────────────────────────────────────────
   One look for every page. These rules come last so that a page-specific
   rule above cannot drift away from the shared controls again. */

/* Emphasis does not compound: <b> inside a semibold label stays at 700. */
b, strong { font-weight: 700; }

/* Sidebar markers are one line-icon set drawn in the label's colour. */
.nav-item > .nav-icon { display: grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; font-size: 0; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Two button heights everywhere: standard actions and in-row actions. A
   wrapped label still grows the button instead of being clipped. */
.primary-button, .secondary-button, .filter-reset, .list-more, .project-finance-open,
.labor-entry-login, .developer-clear-button, .developer-confirm-button, .approve-button, .reject-button {
  box-sizing: border-box; min-height: var(--control-height); padding-block: 8px;
  border-radius: var(--control-radius); font-weight: 600;
}
.text-button, .row-action, .confirm-entry, .danger-action, .success-action, .member-remove,
.sub-tabs button, .trend-controls button {
  box-sizing: border-box; min-height: var(--control-height-sm); padding-block: 6px;
  border-radius: var(--radius-sm);
}
:is(.primary-button, .secondary-button, .row-action, .danger-action, .success-action):disabled { opacity: .55; }

/* Amounts align digit for digit in every table and summary strip. */
td.amount, .executor-summary td:not(:first-child), .accounting-totals b, .approval-amount,
.expense-record-amount, .project-approval-total > strong, .list-pagination span {
  font-variant-numeric: tabular-nums;
}

/* Inner scroll areas share one quiet scrollbar; the page scrollbar keeps the
   system default so it stays easy to grab. */
.app-shell *, .modal * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sidebar, .sidebar * { scrollbar-color: rgba(255, 255, 255, .24) transparent; }

/* Long lists lay out only the rows near the viewport. */
.expense-list-compact > tr, .ledger-results tbody tr.project-finance-row,
#approvalList > details, #projectApprovalList > details, #accountingMeetingList > details {
  content-visibility: auto; contain-intrinsic-size: auto 72px;
}

/* A full-screen blur repaints the whole page on every frame behind a dialog. */
.modal-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--window-scrim); }

/* Sidebar entries keep their natural rhythm on tall screens instead of
   spreading out to fill the column. */
@media (min-width: 761px) {
  .sidebar .nav { align-content: start; }
  /* A sticky sidebar is its own stacking context, so the assistant window it
     hosts needs the sidebar itself raised above cards in the workspace. */
  .sidebar { z-index: 12; }
}

/* Very wide monitors: content keeps a readable measure instead of stretching. */
@media (min-width: 1920px) {
  .workspace > .topbar, .workspace > .view { max-width: 1680px; margin-inline: auto; }
}

/* Money in tables reads the same on every page: right-aligned under its
   heading, regular weight, digits in fixed columns. Stacked mobile cards put
   the figure back under its label. */
td.amount { font-weight: 400; color: var(--ink); }
.ui-responsive-table :is(td, th).amount { text-align: right; }
@media (max-width: 760px) {
  .ui-responsive-table tbody td.amount { text-align: left; }
}

/* Counters beside a section title share one size and colour. */
.user-count strong, .result-count strong, .approval-count strong {
  font: 600 var(--text-label)/1.5 var(--font-ui); color: var(--link);
}
th.amount { font-weight: 600; color: var(--muted); }

/* Phone layout: floating controls never cover each other, and stacked table
   cards lead with their row title instead of a boxed header cell. */
@media (max-width: 760px) {
  .ai-assistant-float.collapsed { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .ui-responsive-table tbody th {
    display: block; grid-column: 1 / -1; padding: 0; border: 0; background: none;
    font-size: var(--text-label); font-weight: 600; color: var(--ink); text-align: left;
  }
  .payment-application-export > strong { flex-basis: 100%; }
  .payment-application-export label { flex: 1 1 140px; min-width: 0; }
  .payment-application-export input { width: 100%; }
  .payment-application-export > button { width: 100%; }
}

/* ── Layout corrections found in real use ───────────────────────────────── */

/* The page no longer rubber-bands past its ends (which exposed a blank band
   above the header and below the sidebar), and the root shares the page
   colour so nothing white can show through. */
html { background: var(--paper); overscroll-behavior-y: none; }
.sidebar, .sidebar * { scrollbar-color: rgba(255, 255, 255, .16) transparent; }

/* One pagination bar everywhere: centred, compact buttons, clear of the
   panel edge. */
.list-pagination { justify-content: center; gap: 10px; padding: 12px 16px 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.list-pagination .secondary-button { min-height: 32px; padding: 4px 12px; border-radius: var(--radius-sm); font-size: var(--text-caption); }

/* File pickers match the other controls instead of the browser default. */
input[type=file] { max-width: 100%; color: var(--muted); font-size: var(--text-caption); }
input[type=file]::file-selector-button {
  min-height: var(--control-height-sm); margin-right: 10px; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  font: 600 var(--text-caption)/1.5 var(--font-ui); cursor: pointer;
}

/* Income invoices: body text lines up with the panel heading, and the
   picker and its upload button sit on one centred row. */
#projectIncomeInvoicesPanel { padding-bottom: 20px; }
#projectIncomeInvoicesPanel .panel-head { padding-bottom: 12px; }
#projectIncomeInvoicesPanel .panel-head > div { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
#projectIncomeInvoicesPanel > :is(.document-upload-hint, #projectIncomeInvoiceError, #projectIncomeInvoiceList) { margin-inline: 24px; }
#projectIncomeInvoiceUpload { margin-right: 0; }
#projectIncomeInvoiceError:empty { display: none; }
#projectIncomeInvoiceList { margin-block: 12px 0; color: var(--muted); font-size: var(--text-caption); }

/* Daily payment export: the title is centred on the row of controls rather
   than hanging below their labels. */
.payment-application-export { padding: 18px 24px; }
.payment-application-export > strong { display: inline-flex; align-items: center; min-height: var(--control-height); }
@media (max-width: 760px) {
  .payment-application-export { padding: 16px; }
  .payment-application-export > strong { min-height: 0; }
  #projectIncomeInvoicesPanel > :is(.document-upload-hint, #projectIncomeInvoiceError, #projectIncomeInvoiceList) { margin-inline: 18px; }
  #projectIncomeInvoicesPanel .panel-head > div { justify-content: flex-start; width: 100%; }
}

/* Every "nothing here yet" row reads the same, whether or not its markup
   carries the empty-cell class; stacked panels keep one gap between them. */
tbody td[colspan]:only-child:not([class]), td.empty-cell { padding: 28px 18px; text-align: center; color: var(--muted); font-size: var(--text-body); }
#meetingInvoiceRequestsHost > .panel { margin-top: 15px; }

/* On a phone the update prompt sits at the top, clear of the bottom
   navigation, the pagination dock and the assistant button. */
@media (max-width: 760px) {
  .app-update-notice { top: calc(12px + env(safe-area-inset-top)); bottom: auto; left: 16px; right: 16px; }
}

@media screen {
  .workspace { background-image: var(--workspace-light); }
  :is(.topbar h1, .login-card-head h2, .modal-card h2) {
    font-family: var(--font-display);
  }
  .metric-card > strong {
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
  }

  /* Outer surfaces have a wider shadow than the cards inside a list or form. */
  :is(.panel, .metric-card, .welcome-card, .approval-card, .online-meeting-card,
      .finance-summary > article, .user-summary > article, .company-metric-row > article,
      .employee-metrics > article, .import-stat-grid > article) {
    background-image: var(--surface-light);
    box-shadow: var(--shadow-card);
  }
  :is(.expense-document-card, .member-card, .compact-approval-row, .project-approval-card, .statement-invoice-line,
      .accounting-meeting-card, .ledger-results tbody tr.project-finance-row) {
    background-image: var(--surface-light);
    box-shadow: var(--shadow-card-compact);
  }
  :is(.metric-card.dark, .metric-card.is-selected, .finance-summary > .dark-summary, .welcome-card) {
    background-image: var(--surface-light-dark);
    box-shadow: var(--shadow-card-dark);
  }
  :is(.login-card, .modal-card, .confirm-card, .ai-float-window, .company-options, .list-access-dock) {
    background-image: var(--surface-light);
    box-shadow: var(--shadow-window);
  }
  :is(.toast, .app-update-notice) {
    background-image: var(--surface-light-dark);
    box-shadow: var(--shadow-window);
  }
  /* The surrounding dialog already supplies the outside shadow. */
  #invoiceRequestModal .modal-card > .panel { background-image: none; box-shadow: none; }

  :is(.modal.open > .modal-card, .confirm-dialog.open > .confirm-card,
      .ai-assistant-float:not(.collapsed) > .ai-float-window) {
    animation: erp-window-in .22s cubic-bezier(.2, .8, .25, 1);
  }
  @keyframes erp-window-in {
    from { opacity: 0; translate: 0 9px; scale: .98; }
    to { opacity: 1; translate: 0 0; scale: 1; }
  }

  :is(.nav-item, .period, .text-button, .auth-switch, .register-back, .company-option,
      .account-settings-trigger, .ai-resize-handle, summary) {
    --control-rest-shadow: none;
  }
  .metric-selectable { --control-rest-shadow: var(--shadow-card); }
  .metric-selectable.is-selected { --control-rest-shadow: var(--shadow-card-dark); }
  :is(.primary-button, .developer-confirm-button, .ai-float-launcher):not(:disabled) {
    background-image: var(--surface-control-light);
  }
  /* Keep the hit area fixed for dense rows and draggable controls. */
  :is(summary, .company-option, .ai-float-launcher, .ai-resize-handle) {
    --control-lift: none;
    --control-press: none;
  }
  summary { border-radius: var(--radius-sm); }
  summary:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

  :is(button, input:where([type="button"], [type="submit"], [type="reset"]), summary,
      [role="button"], .upload-box:where(:has(input[type="file"]:enabled)),
      a:where(.nav-item, .primary-button, .secondary-button, .row-action,
        .application-category, .project-finance-open, .labor-entry-login, .labor-login-link,
        .statement-invoice-download)):not(:where(:disabled, [aria-disabled="true"])) {
    box-shadow: var(--control-rest-shadow, var(--shadow-control));
    transition: box-shadow .18s ease, translate .19s var(--ease-release),
      background-color .15s ease, border-color .15s ease, color .15s ease;
  }
  input[type="file"]:enabled::file-selector-button {
    box-shadow: var(--shadow-control);
    transition: box-shadow .18s ease, background-color .15s ease, border-color .15s ease;
  }

  @media (hover: hover) and (pointer: fine) {
    :is(button, input:where([type="button"], [type="submit"], [type="reset"]), summary,
        [role="button"], .upload-box:where(:has(input[type="file"]:enabled)),
        a:where(.nav-item, .primary-button, .secondary-button, .row-action,
          .application-category, .project-finance-open, .labor-entry-login, .labor-login-link,
          .statement-invoice-download)):not(:where(:disabled, [aria-disabled="true"])):hover {
      box-shadow: var(--shadow-control-raised);
      translate: var(--control-lift);
    }
    input[type="file"]:enabled::file-selector-button:hover {
      box-shadow: var(--shadow-control-raised);
      background-color: var(--surface-2);
      border-color: var(--accent-300);
    }
  }

  :is(button, input:where([type="button"], [type="submit"], [type="reset"]), summary,
      [role="button"], .upload-box:where(:has(input[type="file"]:enabled)),
      a:where(.nav-item, .primary-button, .secondary-button, .row-action,
        .application-category, .project-finance-open, .labor-entry-login, .labor-login-link,
        .statement-invoice-download)):not(:where(:disabled, [aria-disabled="true"])):active {
    box-shadow: var(--shadow-control-pressed);
    translate: var(--control-press);
    transition-duration: .045s;
    transition-timing-function: ease-out;
  }
  input[type="file"]:enabled::file-selector-button:active {
    box-shadow: var(--shadow-control-pressed);
    transition-duration: .045s;
  }

  @media (max-width: 760px) {
    :is(.ui-responsive-table tbody tr, .expense-list-compact > tr) {
      box-shadow: var(--shadow-card-compact);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    :root { --control-lift: none; --control-press: none; }
    input[type="file"]::file-selector-button { transition: none; }
  }
}

/* 收支草稿箱 */
.finance-workspace{padding-block:clamp(16px,2.5vw,30px)}
.finance-banner{
  position:relative;isolation:isolate;overflow:hidden;
  display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;gap:clamp(18px,4vw,50px);
  padding:clamp(20px,4vw,40px);border-radius:var(--radius-xl);
  background:linear-gradient(120deg,#122440,#163665 72%,#244c83);
  color:#f8fbff;box-shadow:0 16px 42px -28px rgba(25,63,122,.75)
}
.finance-banner::before{
  content:"";position:absolute;z-index:-1;inset:0;pointer-events:none;
  background:radial-gradient(ellipse at 82% 0,rgba(124,183,255,.25),transparent 55%);
}
.finance-banner-copy{display:grid;align-content:center;gap:10px;min-width:0}
.finance-banner-copy p,.finance-banner-copy h2{margin:0}
.finance-kicker{display:flex;align-items:center;gap:9px;font-size:var(--text-caption);font-weight:650;letter-spacing:.12em;color:#d7e9ff}
.finance-kicker span{width:8px;height:8px;border-radius:50%;background:#a3dcff;box-shadow:0 0 0 4px rgba(151,207,255,.16)}
.finance-banner h2{font-family:var(--font-display);font-size:clamp(1.36rem,3.2vw,2.2rem);font-weight:750;line-height:1.28;letter-spacing:-.015em}
.finance-banner-copy>p:last-child{color:#dfeaff;line-height:1.6;font-size:var(--text-body)}
.finance-metric{
  display:grid;align-content:center;gap:4px;min-width:154px;padding:16px 21px;border-radius:var(--radius-lg);
  border:1px solid rgba(238,247,255,.24);background:rgba(233,244,255,.11);color:#edf5ff;
}
.finance-metric strong{font-size:clamp(1.75rem,4vw,3rem);letter-spacing:-.045em;line-height:1.12;font-variant-numeric:tabular-nums}
.finance-metric span,.finance-metric small{font-size:var(--text-caption)}
.finance-list-panel{margin-top:18px;padding:clamp(13px,2.2vw,24px);border:1px solid var(--line)}
.finance-toolbar,.finance-selection,.finance-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.finance-switcher{display:flex;align-items:stretch;flex-wrap:wrap;gap:4px;padding:3px;background:var(--surface-3);border-radius:var(--radius-md)}
.finance-switcher button{
  min-height:44px;padding:6px 13px;border:1px solid transparent;border-radius:var(--radius-sm);
  background:transparent;color:var(--muted);font-size:var(--text-caption);font-weight:700;cursor:pointer;
  transition:background-color .18s,color .18s,box-shadow .18s
}
.finance-switcher button[aria-pressed=true]{background:var(--card);color:var(--ink);box-shadow:var(--shadow-1)}
.finance-toolbar>button,.finance-row button,.finance-selection button,.finance-pagination button{min-height:44px}
.finance-notice{color:var(--link);margin:14px 0 0;font-size:var(--text-caption);overflow-wrap:anywhere}
.finance-notice:empty{display:none}
.finance-list{display:grid;gap:9px;margin-top:15px}
.finance-row{
  display:grid;grid-template-columns:minmax(0,1.6fr) minmax(80px,.5fr) auto minmax(100px,auto);align-items:center;gap:14px;
  padding:14px;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--card);
  transition:border-color .18s,background-color .18s,box-shadow .18s;animation:finance-row-in .24s ease both
}
.finance-row:has(.finance-row-select){grid-template-columns:auto minmax(0,1.6fr) minmax(80px,.5fr) auto minmax(100px,auto)}
.finance-row.is-selected{border-color:var(--focus);background:var(--accent-softer);box-shadow:0 0 0 1px var(--focus)}
.finance-row-select{width:38px;min-height:44px;display:grid;place-items:center}
.finance-row-select input,.finance-selection input,.finance-saved-docs input{width:17px;height:17px;accent-color:var(--link)}
.finance-row-copy,.finance-row-title{min-width:0}
.finance-row-title{display:flex;align-items:center;gap:8px;color:var(--ink)}
.finance-row-title strong,.finance-row-note,.finance-row-meta{overflow-wrap:anywhere}
.finance-row-meta,.finance-row-note,.finance-row-amount span{color:var(--muted);font-size:var(--text-caption);line-height:1.5;margin:4px 0 0}
.finance-kind,.finance-state,.finance-required{
  display:inline-flex;align-items:center;white-space:nowrap;border-radius:999px;padding:4px 8px;font-size:var(--text-caption);font-weight:700;
  color:#234c84;background:#edf4ff
}
.finance-kind[data-kind=expense]{color:#614886;background:#f3effa}
.finance-state[data-tone=ready]{color:#125b48;background:#e2f5ed}
.finance-state[data-tone=attention]{color:#813d13;background:#fdf0dc}
.finance-row-amount{font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.finance-row-amount span{display:block}
.finance-row-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;min-width:0}
.finance-selection{position:sticky;bottom:10px;z-index:1;margin-top:15px;padding:10px 12px;background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius-md);box-shadow:var(--shadow-1)}
.finance-selection label{display:flex;align-items:center;gap:7px;font-size:var(--text-caption);font-weight:700;min-height:44px}
.finance-selection span{color:var(--muted);font-size:var(--text-caption);margin-left:auto}
.finance-pagination{justify-content:center;margin-top:10px;font-size:var(--text-caption);color:var(--muted)}
.finance-empty{display:grid;justify-items:center;align-content:center;min-height:218px;text-align:center;padding:22px;gap:8px;color:var(--ink)}
.finance-empty svg{stroke:var(--link);stroke-width:1.5;stroke-linecap:round}
.finance-empty p{margin:0;color:var(--muted);line-height:1.55}
.finance-saved-docs,.finance-income-intake{margin-top:12px}
.finance-saved-docs ul,.finance-file-list{list-style:none;padding:0;display:grid;gap:7px}
.finance-saved-docs li,.finance-file-list li{display:flex;align-items:center;gap:7px;flex-wrap:wrap;overflow-wrap:anywhere}
.finance-saved-docs li label{margin-left:auto;display:flex;align-items:center;gap:5px}
.finance-file-kind{font-size:var(--text-caption);color:var(--muted);background:var(--surface-3);padding:2px 6px;border-radius:var(--radius-sm)}
@keyframes finance-row-in{from{opacity:.55;transform:translateY(5px)}to{opacity:1;transform:none}}
@media(max-width:760px){
  .finance-banner{grid-template-columns:1fr;gap:13px}
  .finance-metric{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px}
  .finance-metric strong{order:-1}
  .finance-row,.finance-row:has(.finance-row-select){grid-template-columns:auto minmax(0,1fr) auto;gap:8px}
  .finance-row-copy{grid-column:2/-1}.finance-row-amount{grid-column:2}
  .finance-state{grid-column:3;justify-self:end}
  .finance-row-actions{grid-column:2/-1;justify-content:flex-start}
  .finance-row:not(:has(.finance-row-select)) .finance-row-copy{grid-column:1/-1}
  .finance-row:not(:has(.finance-row-select)) .finance-row-amount,.finance-row:not(:has(.finance-row-select)) .finance-row-actions{grid-column:1/3}
  .finance-selection:not(.hidden){display:grid;grid-template-columns:1fr auto;gap:4px 10px;bottom:calc(94px + env(safe-area-inset-bottom, 0px))}
  .finance-selection label{grid-column:1/-1;justify-self:start}
  .finance-selection span{margin-left:0}
}
@media(prefers-reduced-motion:reduce){.finance-row,.finance-switcher button{animation:none;transition:none}}
.statement-print-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 24px;
  padding: 18px 22px;
  margin-bottom: 16px;
}
.statement-print-setting h2 { margin: 0 0 4px; font-size: var(--text-body); }
.statement-print-setting p { margin: 0; line-height: 1.55; }
.statement-print-setting #statementPrintReviewDescription { color: var(--muted); }
.statement-print-setting .ledger-form-error { grid-column: 1 / -1; }
.statement-print-setting .ledger-form-error:empty { display: none; }
.statement-print-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
}
.statement-print-switch:not(:disabled) { cursor: pointer; }
.statement-print-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.statement-print-switch[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.statement-print-switch-track {
  width: 36px;
  height: 20px;
  border-radius: 20px;
  padding: 3px;
  background: var(--muted);
  transition: background-color .18s ease;
}
.statement-print-switch-track::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--card);
  transition: transform .18s ease;
}
.statement-print-switch[aria-checked="true"] .statement-print-switch-track { background: var(--accent-strong); }
.statement-print-switch[aria-checked="true"] .statement-print-switch-track::before { transform: translateX(16px); }
@media (max-width: 540px) {
  .statement-print-setting { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .statement-print-switch { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .statement-print-switch-track, .statement-print-switch-track::before { transition: none; }
}
