/* Final visual system authority 2026-08-29.
 * This file intentionally loads last. It consolidates presentation only and
 * does not alter business visibility, validation, routing, or data behavior.
 */

:root {
  --visual-font-family: var(--erp-ui-font, "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif);
  --visual-font-page-title: 20px;
  --visual-font-section-title: 16px;
  --visual-font-card-title: 14px;
  --visual-font-body: 14px;
  --visual-font-table: 13px;
  --visual-font-helper: 12px;
  --visual-line-body: 1.55;
  --visual-line-compact: 1.45;
  --visual-control-height: 40px;
  --visual-control-height-compact: 34px;
  --visual-touch-height: 44px;
  --visual-table-head-height: 38px;
  --visual-table-row-height: 40px;
  --visual-radius-control: 4px;
  --visual-radius-panel: 6px;
  --visual-radius-dialog: 8px;
  --visual-space-1: 4px;
  --visual-space-2: 8px;
  --visual-space-3: 12px;
  --visual-space-4: 16px;
  --visual-space-5: 24px;
  --visual-space-6: 32px;
  --visual-page-bg: #f6f8fa;
  --visual-surface: #ffffff;
  --visual-surface-subtle: #f7f9fb;
  --visual-surface-hover: #f0f5fb;
  --visual-surface-selected: #eaf2ff;
  --visual-text: #1d2129;
  --visual-text-secondary: #4e5969;
  --visual-text-muted: #6e7681;
  --visual-border: #dfe5ec;
  --visual-border-soft: #edf0f3;
  --visual-border-strong: #c7d0dc;
  --visual-primary: #0f3476;
  --visual-primary-hover: #0b2a60;
  --visual-focus: #2f80ed;
  --visual-positive: #279f91;
  --visual-warning: #d8852f;
  --visual-danger: #d9363e;
  --visual-shadow-panel: 0 1px 3px rgb(15 52 118 / 8%);
  --visual-shadow-dialog: 0 12px 32px rgb(15 23 42 / 20%);
}

/* Finance operations refinement */
.contract-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}

.contract-type-pill.is-material { color: #0b615f; background: #e7f7f6; border-color: #a8dedb; }
.contract-type-pill.is-labor { color: #174b91; background: #edf4ff; border-color: #bfd5f4; }
.contract-type-pill.is-rental { color: #88520a; background: #fff5e8; border-color: #f2cf9d; }
.contract-type-pill.is-other { color: #4f5967; background: #f1f3f6; border-color: #d8dde5; }

.contract-quantity-list-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--visual-text-strong, #1d2129);
}

.cashier-management-compact,
.finance-settings-compact {
  margin-block: 8px !important;
}

.cashier-management-compact > .panel-title,
.finance-settings-compact > .panel-title {
  min-height: 42px !important;
  padding-block: 7px !important;
}

.cashier-management-compact .context-grid,
.cashier-management-compact .cashier-grid,
.finance-settings-compact .form-grid {
  gap: 8px !important;
}

.cashier-management-compact .cashier-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)) !important;
}

.cashier-management-compact .context-card,
.cashier-management-compact .metric-card {
  min-height: 74px !important;
  padding: 10px 12px !important;
}

.cashier-management-compact .data-table :is(th, td),
.finance-settings-compact .data-table :is(th, td) {
  height: 38px !important;
  padding-block: 5px !important;
}

.finance-account-list {
  display: grid;
  gap: 10px;
}

.finance-account-row {
  padding: 12px !important;
}

.finance-account-row .form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.finance-account-row .form-grid.compact > label,
.finance-account-row .form-grid.compact :is(input, select) {
  width: 100%;
  min-width: 0;
}

.cashier-type-settings-panel .cashier-type-grid {
  align-items: start;
  gap: 12px !important;
}

.cashier-type-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 6px !important;
}

.cashier-type-list.is-receipt {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.cashier-empty-workspace {
  min-height: 88px !important;
  padding-block: 12px !important;
}

.cashier-type-row {
  min-height: 34px !important;
  padding: 5px 8px !important;
}

.nav-pending-badge,
.cashier-pending-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding-inline: 5px;
  border-radius: 9px;
  color: #fff;
  background: #e69948;
  font-size: 11px;
  font-weight: 700;
}

.approval-assignment-list {
  display: grid;
  gap: 6px;
}

.approval-assignment-list .approval-assignment-row {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(220px, 1fr) minmax(220px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--visual-border-soft, #e5e9ef);
}

body[data-ui-theme="macos-workspace-v3"] .login-gate > .login-tech-canvas {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  opacity: 1 !important;
}

body[data-ui-theme="macos-workspace-v3"] .login-calm-scene {
  display: none !important;
}

.app-header .user-menu-profile .user-preview-avatar {
  background: #0f3476 !important;
}

.app-header .user-menu-profile .user-preview-avatar > span {
  color: #fff !important;
}

@media (max-width: 980px) {
  .finance-account-row .form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cashier-type-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .approval-assignment-list .approval-assignment-row { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 620px) {
  .finance-account-row .form-grid.compact,
  .cashier-type-list { grid-template-columns: minmax(0, 1fr); }
}

:root[data-color-scheme="dark"],
html[data-color-scheme="dark"] {
  --visual-page-bg: #0f141b;
  --visual-surface: #171e27;
  --visual-surface-subtle: #1b2430;
  --visual-surface-hover: #223043;
  --visual-surface-selected: #18365f;
  --visual-text: #f2f3f5;
  --visual-text-secondary: #c9cdd4;
  --visual-text-muted: #aeb7c4;
  --visual-border: #344154;
  --visual-border-soft: #2a3544;
  --visual-border-strong: #4b5c72;
  --visual-primary: #5b8ff9;
  --visual-primary-hover: #76a3ff;
  --visual-focus: #72c8c4;
  --visual-positive: #72c8c4;
  --visual-warning: #f0a24c;
  --visual-danger: #ff6b70;
  --visual-shadow-panel: 0 1px 3px rgb(0 0 0 / 28%);
  --visual-shadow-dialog: 0 16px 38px rgb(0 0 0 / 45%);
}

html,
body,
button,
input,
select,
textarea {
  font-family: var(--visual-font-family);
  letter-spacing: 0;
}

body {
  color: var(--visual-text);
  background: var(--visual-page-bg);
  font-size: var(--visual-font-body);
  line-height: var(--visual-line-body);
}

.erp-main,
.view-root,
#erp-flow-launch-dialog,
.global-overlay-root {
  color: var(--visual-text);
}

.view-root {
  gap: var(--visual-space-4);
}

.view-root > :is(.view-semantic-title, .workspace-page-head, .workbench-heading) h1 {
  color: var(--visual-text);
  font-size: var(--visual-font-page-title);
  font-weight: 700;
  line-height: 1.4;
}

:is(.panel-title, .workbench-section-head, .dashboard-command, .dashboard-panel-head) :is(h2, strong),
:is(.form-section-label, .flow-section-title),
.flow-record-section-title {
  color: var(--visual-text);
  font-size: var(--visual-font-card-title);
  font-weight: 650;
  line-height: 1.45;
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
  p,
  small,
  time,
  .helper-text,
  .field-hint,
  .empty-state p
) {
  color: var(--visual-text-muted);
  font-size: var(--visual-font-helper);
  line-height: 1.5;
}

/* One calm surface vocabulary for panels and overlays. */
.view-root :is(
  .panel,
  .data-table-shell,
  .business-ledger,
  .context-panel,
  .settings-panel,
  .workbench-task-center,
  .workbench-flow-status-bar,
  .workbench-recent-activity,
  .workbench-project-overview,
  .workbench-portal-panel,
  .dashboard-executive,
  .dashboard-chart-panel,
  .dashboard-detail-drawer
) {
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-panel);
  background: var(--visual-surface);
  box-shadow: var(--visual-shadow-panel);
}

:is(.panel-title, .workbench-section-head, .dashboard-command, .dashboard-panel-head, .workbench-portal-panel > header) {
  min-height: 44px;
  padding: 9px var(--visual-space-4);
  border-bottom: 1px solid var(--visual-border-soft);
  background: var(--visual-surface-subtle);
}

/* Controls: standard dimensions and complete visual states. */
:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
) {
  border: 1px solid var(--visual-border-strong);
  border-radius: var(--visual-radius-control);
  color: var(--visual-text);
  background: var(--visual-surface);
  font-size: var(--visual-font-body);
  line-height: 1.45;
  box-shadow: none;
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select
) {
  height: var(--visual-control-height);
  min-height: var(--visual-control-height);
  padding-inline: 10px;
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) textarea {
  min-height: 76px;
  padding: 8px 10px;
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(input, textarea)::placeholder {
  color: var(--visual-text-muted);
  opacity: 1;
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(input, select, textarea):hover:not(:disabled):not([readonly]) {
  border-color: var(--visual-primary);
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(input, select, textarea):focus-visible,
:is(button, a, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--visual-focus);
  outline-offset: 2px;
}

:is(button, input, select, textarea):disabled {
  opacity: 0.46;
  cursor: not-allowed;
  box-shadow: none;
}

:is(.table-action, .form-actions button, .bottom-actions button, .workbench-primary-action, .workbench-secondary-action) {
  min-height: 36px;
  padding-inline: 14px;
  border-radius: var(--visual-radius-control);
  font-size: var(--visual-font-table);
  font-weight: 600;
  line-height: 1;
}

:is(.table-action.primary, .form-actions #submit-flow:not(:disabled), .bottom-actions .primary, .workbench-primary-action) {
  border-color: var(--visual-primary);
  color: #ffffff;
  background: var(--visual-primary);
  box-shadow: none;
}

:is(.table-action.primary, .form-actions #submit-flow:not(:disabled), .bottom-actions .primary, .workbench-primary-action):hover {
  border-color: var(--visual-primary-hover);
  background: var(--visual-primary-hover);
}

:is(.table-action.danger, .form-actions #clear-flow-form, .danger-button) {
  border: 1px solid color-mix(in srgb, var(--visual-danger) 42%, var(--visual-border));
  color: var(--visual-danger);
  background: transparent;
}

/* The top utility area stays pinned to the right on every desktop width. */
.app-header {
  color: var(--visual-text);
  background: var(--visual-surface);
  border-bottom-color: var(--visual-border);
}

.app-header-workspace,
.app-header .topbar.is-compact,
.app-header .topbar-actions {
  min-width: 0;
}

.app-header .topbar.is-compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.app-header .topbar-actions {
  justify-self: end;
  margin-left: auto;
}

/* Workspace tabs are navigation, not a second content panel. */
.workspace-tabs {
  min-height: 44px;
  border-bottom: 1px solid var(--visual-border);
  background: var(--visual-surface);
}

.workspace-tab {
  min-width: 0;
  height: 44px;
  color: var(--visual-text-secondary);
  background: var(--visual-surface-subtle);
  border-color: var(--visual-border);
}

.workspace-tab.is-active {
  color: var(--visual-primary);
  background: var(--visual-surface);
}

.workspace-tab-activate {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: var(--visual-font-table);
  font-weight: 600;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tab-activate > span {
  min-height: 20px;
  line-height: 20px;
}

.workspace-tab-close,
.workspace-tabs-close-all {
  color: var(--visual-text-muted);
}

body[data-ui-theme="macos-workspace-v3"] .global-search:not(.is-expanded) > #global-search {
  display: none;
}

/* Data tables: compact, readable, horizontally discoverable. */
.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table, .org-editor-table, .schedule-editor-table, .line-item-table, .construction-log-summary-table) {
  color: var(--visual-text);
  font-size: var(--visual-font-table);
  line-height: var(--visual-line-compact);
  font-variant-numeric: tabular-nums;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table, .org-editor-table, .schedule-editor-table, .line-item-table, .construction-log-summary-table) thead th {
  height: var(--visual-table-head-height);
  min-height: var(--visual-table-head-height);
  padding: 8px 10px;
  color: var(--visual-text-secondary);
  background: var(--visual-surface-subtle);
  border-bottom: 1px solid var(--visual-border);
  font-size: var(--visual-font-table);
  font-weight: 600;
  line-height: 20px;
  vertical-align: middle;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table, .org-editor-table, .schedule-editor-table, .line-item-table, .construction-log-summary-table) tbody td {
  height: var(--visual-table-row-height);
  min-height: var(--visual-table-row-height);
  padding: 7px 10px;
  color: var(--visual-text);
  background: var(--visual-surface);
  border-bottom: 1px solid var(--visual-border-soft);
  font-size: var(--visual-font-table);
  line-height: 20px;
  vertical-align: middle;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--visual-surface-subtle) 58%, var(--visual-surface));
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:is(:hover, :focus-within) td {
  background: var(--visual-surface-hover);
}

.data-table-shell,
.workbench-project-table-scroll,
.schedule-table-wrap {
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--visual-border-strong) transparent;
}

.data-table-shell::-webkit-scrollbar,
.workbench-project-table-scroll::-webkit-scrollbar,
.schedule-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.data-table-shell::-webkit-scrollbar-thumb,
.workbench-project-table-scroll::-webkit-scrollbar-thumb,
.schedule-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--visual-border-strong);
  background-clip: padding-box;
}

table[data-ledger-table="true"] :is(th, td) {
  white-space: nowrap;
}

table[data-ledger-table="true"] :is(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  text-align: center;
}

table[data-ledger-table="true"] thead th:first-child {
  z-index: 6;
}

.data-table-scroll-hint {
  min-height: 30px;
  padding: 5px 10px;
  color: var(--visual-text-muted);
  background: var(--visual-surface-subtle);
  font-size: var(--visual-font-helper);
}

.status-pill {
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--visual-border);
  border-radius: 999px;
  color: var(--visual-text-secondary);
  background: var(--visual-surface-subtle);
  font-size: var(--visual-font-helper);
  line-height: 18px;
}

/* Workbench: keep the reference structure but lower saturation and empty height. */
.view-root:has(> .workbench-content-portal) {
  padding: var(--visual-space-4);
}

.workbench-content-portal {
  width: min(100%, 1240px);
  margin-inline: auto;
}

.workbench-portal-grid,
.workbench-portal-main,
.workbench-portal-side,
.workbench-status-board {
  gap: var(--visual-space-3);
}

.workbench-portal-main {
  grid-template-rows: auto auto;
}

.workbench-portal-side {
  grid-template-rows: repeat(2, minmax(160px, auto));
}

.workbench-status-group {
  min-height: 104px;
  padding: 11px 14px 9px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: var(--visual-radius-panel);
  box-shadow: none;
}

.workbench-status-group.blue { background: #4f8fd9; }
.workbench-status-group.coral { background: #df7778; }
.workbench-status-group.violet { background: #6971d2; }
.workbench-status-group.teal { background: #279f91; }

.workbench-status-group h2 {
  font-size: var(--visual-font-card-title);
}

.workbench-status-group button strong {
  overflow: visible;
  font-size: 20px;
  line-height: 26px;
}

.workbench-status-group button span {
  font-size: var(--visual-font-helper);
}

.workbench-common-flow-grid {
  grid-template-columns: repeat(8, minmax(76px, 1fr));
  gap: 8px;
  padding: 16px 12px;
}

.workbench-common-flow-grid button {
  min-height: 80px;
  gap: 6px;
  border-radius: var(--visual-radius-control);
}

.workbench-common-flow-grid button > span {
  width: 38px;
  height: 38px;
  border-radius: var(--visual-radius-panel);
}

.workbench-common-flow-grid strong,
.workbench-content-list button strong,
.workbench-content-list button span,
.workbench-content-list button time {
  font-size: var(--visual-font-helper);
}

.workbench-content-list,
.workbench-content-empty {
  min-height: 120px;
}

/* Dashboard: charts own the space; labels remain readable. */
.dashboard-command-main h2 {
  font-size: var(--visual-font-section-title);
}

.boss-kpi-card :is(span, small),
.dashboard-chart-panel :is(span, small, button),
.dashboard-chart-bar label,
.dashboard-donut-legend,
.dashboard-trend-legend {
  font-size: var(--visual-font-helper);
  line-height: 1.45;
}

.boss-kpi-card strong {
  color: var(--visual-text);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dashboard-chart-suite {
  gap: var(--visual-space-4);
}

.dashboard-chart-panel {
  min-height: 280px;
}

.dashboard-chart-suite svg text {
  fill: var(--visual-text-muted) !important;
  font-size: 12px !important;
}

.workbench-project-overview .workbench-project-table :is(th, td) {
  font-size: var(--visual-font-table) !important;
}

.dashboard-stage-node :is(span, small, b),
.dashboard-stage-lane > header span,
.dashboard-invoice-metric :is(span, b) {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.dashboard-empty-workspace,
.dashboard-chart-empty-inline,
.data-table-empty,
.empty-state,
.workbench-content-empty {
  min-height: 120px;
  padding: var(--visual-space-5);
  color: var(--visual-text-muted);
  background: var(--visual-surface);
}

.dashboard-chart-empty-inline strong {
  color: var(--visual-text);
  font-size: var(--visual-font-body);
  font-weight: 650;
}

.dashboard-chart-empty-inline span {
  color: var(--visual-text-muted);
  font-size: var(--visual-font-helper);
}

/* Forms: sections create hierarchy; individual fields stay visually light. */
.flow-form .form-grid,
#erp-flow-launch-dialog .flow-form .form-grid {
  gap: 10px 14px;
  padding: 14px 16px 18px;
  background: var(--visual-surface);
}

.flow-form .form-grid > label,
#erp-flow-launch-dialog .flow-form .form-grid > label {
  min-width: 0;
  gap: 5px;
}

.flow-form .form-grid label > span,
#erp-flow-launch-dialog .flow-form .form-grid label > span {
  color: var(--visual-text-secondary);
  font-size: var(--visual-font-table);
  font-weight: 600;
  line-height: 20px;
}

.flow-form .form-grid :is(input[readonly], textarea[readonly]),
#erp-flow-launch-dialog .flow-form .form-grid :is(input[readonly], textarea[readonly]),
.readonly-link,
.readonly-value {
  color: var(--visual-text-muted);
  background: var(--visual-surface-subtle);
}

.form-section-label,
.flow-section-title {
  min-height: 36px;
  margin-block: 6px 0;
  padding: 7px 16px;
  border-block: 1px solid var(--visual-border-soft);
  background: var(--visual-surface-subtle);
}

.line-table-head {
  min-height: 38px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--visual-border);
  background: var(--visual-surface-subtle);
}

.line-table-head > span {
  color: var(--visual-text);
  font-size: var(--visual-font-table);
  font-weight: 600;
}

.form-actions,
.bottom-actions {
  min-height: 56px;
  padding: 9px var(--visual-space-4);
  border-top: 1px solid var(--visual-border);
  background: color-mix(in srgb, var(--visual-surface) 96%, transparent);
  box-shadow: none;
}

#erp-flow-launch-dialog {
  padding: 16px;
  background: rgb(15 23 42 / 28%);
}

#erp-flow-launch-dialog > .erp-flow-launch-dialog-shell {
  width: min(1360px, calc(100vw - 32px));
  height: calc(100dvh - 32px);
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-dialog);
  background: var(--visual-surface);
  box-shadow: var(--visual-shadow-dialog);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-head {
  min-height: 52px;
  padding: 0 var(--visual-space-4);
  border-bottom: 1px solid var(--visual-border);
  background: var(--visual-surface-subtle);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-head h2 {
  color: var(--visual-text);
  font-size: var(--visual-font-section-title);
  font-weight: 650;
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--visual-text-secondary);
  background: transparent;
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-close:hover {
  background: var(--visual-surface-hover);
}

/* Preview and approval pages use the same document geometry as forms. */
.flow-record-preview-panel {
  width: min(1120px, 100%);
  max-width: 1120px;
  min-height: 0;
  margin-inline: auto;
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-dialog);
  color: var(--visual-text);
  background: var(--visual-surface);
  box-shadow: var(--visual-shadow-panel);
}

.flow-record-preview-panel > .flow-record-preview-head {
  min-height: 64px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--visual-border);
  background: var(--visual-surface);
}

.flow-record-preview-panel > .flow-record-preview-head h2 {
  color: var(--visual-text);
  font-size: var(--visual-font-section-title);
  line-height: 1.45;
}

.flow-record-preview-main {
  min-height: 0 !important;
  height: auto !important;
  max-height: calc(100dvh - 180px);
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--visual-text);
  background: var(--visual-surface-subtle);
}

.flow-record-preview-main :is(dt, dd, td, th, span, strong, p, small, time) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.flow-record-preview-main :is(dt, .flow-record-field-label, .flow-record-meta-label) {
  color: var(--visual-text-secondary);
  font-size: var(--visual-font-helper);
  font-weight: 500;
}

.flow-record-preview-main :is(dd, .flow-record-field-value, .flow-record-meta-value) {
  color: var(--visual-text);
  font-size: var(--visual-font-table);
  line-height: 1.5;
}

.flow-record-preview-panel .flow-record-preview-bottom-actions,
.flow-record-preview-panel > .bottom-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.flow-record-preview-panel.is-approval-mode {
  width: min(1280px, 100%);
  max-width: 1280px;
}

.flow-record-preview-panel :is(small, em, b) {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.flow-record-preview-panel :is(
  .flow-approval-system-checks li,
  .flow-approval-system-checks li p,
  .flow-approval-timeline li,
  .flow-approval-timeline li span,
  .flow-approval-timeline li strong
) {
  font-size: 12px !important;
  line-height: 1.5 !important;
}

.flow-record-preview-panel .flow-approval-content-section > header span {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.user-menu-dropdown :is(span, small) {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.organization-tree-node span,
.organization-tree-node small,
.organization-tree-branch > span,
.organization-tree-meta,
.organization-tree-count {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

#erp-flow-launch-dialog :is(
  #flow-task-approval-route li,
  #flow-task-approval-route li i,
  #flow-task-approval-route li div,
  #flow-task-approval-route li strong,
  #flow-task-approval-route li span,
  .flow-task-rail-checks li,
  .flow-task-rail-checks li i
) {
  font-size: 12px !important;
  line-height: 1.5 !important;
}

#erp-flow-launch-dialog :is(
  .flow-task-rail-card > header span,
  .flow-task-rail-card > header strong,
  .flow-task-rail-card > header small,
  .flow-document-meta span,
  .flow-form-progress span,
  .flow-form-progress strong,
  .queued-attachment-head span
) {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  gap: var(--visual-space-3);
  padding: var(--visual-space-3);
  border-left: 1px solid var(--visual-border);
  background: var(--visual-surface-subtle);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > :is(section, label, .flow-approval-workbench-head) {
  padding: 10px 12px;
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-panel);
  background: var(--visual-surface);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-actions .primary {
  background: var(--visual-primary);
}

/* Project and ledger comparison rows remain dense enough to scan. */
.project-overview-table tbody tr,
.workbench-project-table tbody tr {
  min-height: 92px;
}

.project-overview-table :is(th, td):first-child,
.workbench-project-table :is(th, td):first-child {
  min-width: 320px;
}

.project-overview-table :is(th, td):not(:first-child) {
  min-width: 180px;
}

.project-summary-compact,
.project-preview-panel .project-summary-compact {
  gap: 0;
}

.project-preview-panel :is(.summary-row, .detail-row) {
  min-height: 34px;
  padding-block: 6px;
}

.project-preview-panel .empty-state,
.project-preview-panel .project-preview-attachments .empty-state {
  min-height: 72px;
}

/* Popovers and notifications share the same elevation. */
:is(.user-menu-dropdown, .global-search-panel, .flow-template-tools-body, .org-module-dropdown-options, .workbench-content-dialog) {
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-dialog);
  color: var(--visual-text);
  background: var(--visual-surface);
  box-shadow: var(--visual-shadow-dialog);
}

.global-search-item:is(:hover, :focus-visible, .is-keyboard-active),
.org-module-dropdown-options > label:is(:hover, :focus-within) {
  background: var(--visual-surface-selected);
}

/* Dark surfaces are purpose-built instead of mechanically inverted. */
:root[data-color-scheme="dark"] :is(.app-header, .workspace-tabs, .workspace-tab, .view-root, .erp-main),
html[data-color-scheme="dark"] :is(.app-header, .workspace-tabs, .workspace-tab, .view-root, .erp-main) {
  color: var(--visual-text);
}

:root[data-color-scheme="dark"] :is(
  .panel-title,
  .workbench-section-head,
  .dashboard-command,
  .dashboard-panel-head,
  .form-section-label,
  .flow-section-title,
  .line-table-head,
  #erp-flow-launch-dialog .erp-flow-launch-dialog-head
),
html[data-color-scheme="dark"] :is(
  .panel-title,
  .workbench-section-head,
  .dashboard-command,
  .dashboard-panel-head,
  .form-section-label,
  .flow-section-title,
  .line-table-head,
  #erp-flow-launch-dialog .erp-flow-launch-dialog-head
) {
  color: var(--visual-text);
  background: var(--visual-surface-subtle);
  border-color: var(--visual-border);
}

:root[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) :is(th, td),
html[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) :is(th, td) {
  color: var(--visual-text);
  border-color: var(--visual-border-soft);
}

:root[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) thead th,
html[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) thead th {
  color: var(--visual-text-secondary);
  background: var(--visual-surface-subtle);
}

:root[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody td,
html[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody td {
  background: var(--visual-surface);
}

:root[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:nth-child(even) td,
html[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:nth-child(even) td {
  background: var(--visual-surface-subtle);
}

:root[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:is(:hover, :focus-within) td,
html[data-color-scheme="dark"] .erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:is(:hover, :focus-within) td {
  background: var(--visual-surface-hover);
}

:root[data-color-scheme="dark"] .workbench-status-group,
html[data-color-scheme="dark"] .workbench-status-group {
  filter: saturate(0.78) brightness(0.84);
}

:root[data-color-scheme="dark"] .workbench-status-group :is(h2, button, strong, span),
html[data-color-scheme="dark"] .workbench-status-group :is(h2, button, strong, span) {
  color: #ffffff;
  opacity: 1;
}

@media (max-width: 1180px) {
  .workbench-content-portal {
    width: min(100%, 1080px);
  }

  .workbench-common-flow-grid {
    grid-template-columns: repeat(4, minmax(76px, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --visual-font-body: 14px;
    --visual-font-table: 14px;
    --visual-font-helper: 14px;
    --visual-control-height: 44px;
    --visual-table-row-height: 44px;
  }

  .erp-main {
    padding: 12px 10px calc(92px + env(safe-area-inset-bottom));
  }

  .view-root {
    gap: var(--visual-space-3);
  }

  .app-header .topbar.is-compact {
    min-height: 52px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .app-header .topbar-actions {
    justify-self: end;
  }

  .workspace-tabs {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    width: 100%;
    height: 44px;
    min-height: 44px;
    overflow: hidden !important;
  }

  .workspace-tabs:empty {
    display: none !important;
  }

  .workspace-tabs:not(.has-active-workspace-tab) {
    display: none !important;
  }

  body[data-ui-theme="macos-workspace-v3"] .global-search-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  body[data-ui-theme="macos-workspace-v3"] :is(.global-search, .user-menu-anchor) {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .workspace-tabs .workspace-tab:not(.is-active) {
    display: none !important;
  }

  .workspace-tab.is-active {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 40px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 44px;
    border-right: 1px solid var(--visual-border);
  }

  .workspace-tab-activate {
    width: 100%;
    min-width: 0;
    padding-inline: 12px 6px;
    font-size: 14px !important;
    line-height: 22px;
    text-align: left;
  }

  .workspace-tab-close {
    width: 40px;
    min-width: 40px;
    height: 44px;
  }

  .workspace-tabs-close-all {
    display: none !important;
  }

  :is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select
  ) {
    height: var(--visual-touch-height);
    min-height: var(--visual-touch-height);
    font-size: 14px !important;
  }

  :is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) textarea {
    min-height: 88px;
    font-size: 14px !important;
  }

  :is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
    p,
    small,
    time,
    label,
    button,
    .helper-text,
    .field-hint,
    .empty-state
  ) {
    font-size: 14px !important;
  }

  .flow-form .form-grid,
  #erp-flow-launch-dialog .flow-form .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .flow-form .form-grid label > span,
  #erp-flow-launch-dialog .flow-form .form-grid label > span {
    font-size: 14px;
  }

  .form-section-label,
  .flow-section-title {
    margin-inline: -12px;
    padding-inline: 12px;
    font-size: 14px;
  }

  #erp-flow-launch-dialog {
    width: 100vw;
    height: 100dvh;
    padding: 0;
  }

  #erp-flow-launch-dialog > .erp-flow-launch-dialog-shell {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  #erp-flow-launch-dialog .erp-flow-launch-dialog-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .flow-record-preview-panel,
  .flow-record-preview-panel.is-approval-mode {
    width: 100%;
    max-width: none;
    border-radius: 0;
  }

  .flow-record-preview-main {
    max-height: none;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    border-left: 0;
    border-top: 1px solid var(--visual-border);
  }

  html body[data-ui-theme="macos-workspace-v3"] .erp-main .flow-record-preview-backdrop.is-workspace .flow-record-preview-panel.is-document-preview.is-approval-mode .flow-record-preview-layout.has-approval-workbench,
  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: max-content max-content !important;
    align-content: start !important;
    height: 100% !important;
    padding-bottom: calc(126px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scroll-padding-bottom: calc(126px + env(safe-area-inset-bottom));
  }

  html body[data-ui-theme="macos-workspace-v3"] .erp-main .flow-record-preview-backdrop.is-workspace .flow-record-preview-panel.is-document-preview.is-approval-mode .flow-record-preview-main,
  .flow-record-preview-panel.is-approval-mode .flow-record-preview-main,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html body[data-ui-theme="macos-workspace-v3"] .erp-main .flow-record-preview-backdrop.is-workspace .flow-record-preview-panel.is-document-preview.is-approval-mode .flow-approval-workbench,
  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html body[data-ui-theme="macos-workspace-v3"] .erp-main .flow-record-preview-backdrop.is-workspace .flow-record-preview-panel.is-document-preview.is-approval-mode .flow-approval-workbench > .flow-approval-actions,
  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    border-top-color: var(--visual-border) !important;
    background: var(--visual-surface) !important;
    box-shadow: 0 -4px 16px rgb(15 23 42 / 14%) !important;
  }

  .form-actions,
  .bottom-actions {
    min-height: 60px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  }

  .workbench-status-board,
  .workbench-portal-grid,
  .workbench-portal-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench-status-group {
    min-height: 100px;
  }

  .workbench-common-flow-grid {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    padding: 12px 6px;
  }

  .workbench-common-flow-grid button {
    min-height: 82px;
  }

  .dashboard-chart-suite {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-chart-panel {
    min-height: 250px;
  }

  .project-overview-table :is(th, td):first-child,
  .workbench-project-table :is(th, td):first-child {
    min-width: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Project document library: compact shared workspace with original-file downloads. */
.project-document-library {
  min-width: 0;
  overflow: hidden;
}

.project-document-library-title > div:first-child {
  min-width: 0;
}

.project-document-library-title > div:first-child > span {
  max-width: min(52vw, 620px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-document-title-actions,
.project-document-row-actions,
.project-document-upload-form > div,
.project-document-version-list article > div:last-child {
  display: flex;
  align-items: center;
  gap: var(--visual-space-2);
}

.project-document-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) minmax(260px, 1fr) max-content max-content;
  align-items: end;
  gap: var(--visual-space-3);
  padding: var(--visual-space-3) var(--visual-space-4);
  border-bottom: 1px solid var(--visual-border-soft);
  background: var(--visual-surface);
}

.project-document-toolbar > label,
.project-document-upload-form > label,
.project-document-inline-form > label {
  display: grid;
  min-width: 0;
  gap: var(--visual-space-1);
  color: var(--visual-text-secondary);
  font-size: var(--visual-font-helper);
}

.project-document-toolbar :is(select, input),
.project-document-upload-form :is(select, input:not([type="file"])),
.project-document-inline-form input {
  width: 100%;
  min-width: 0;
}

.project-document-inline-form,
.project-document-upload-form {
  display: grid;
  align-items: end;
  gap: var(--visual-space-3);
  padding: var(--visual-space-3) var(--visual-space-4);
  border-bottom: 1px solid var(--visual-border);
  background: var(--visual-surface-subtle);
}

.project-document-inline-form {
  grid-template-columns: minmax(220px, 360px) max-content max-content;
}

.project-document-upload-form {
  grid-template-columns: minmax(180px, 0.65fr) minmax(260px, 1.2fr) minmax(280px, 1fr) max-content;
}

.project-document-file-picker input[type="file"] {
  width: 100%;
  min-height: var(--visual-control-height);
  padding: 6px 8px;
  border: 1px solid var(--visual-border-strong);
  border-radius: var(--visual-radius-control);
  color: var(--visual-text-secondary);
  background: var(--visual-surface);
  font-size: var(--visual-font-helper);
}

.project-document-file-picker small {
  line-height: 18px;
}

.project-document-table-wrap {
  width: 100%;
  min-width: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.erp-main .project-document-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.erp-main .project-document-table :is(th, td):nth-child(1) { width: 28%; }
.erp-main .project-document-table :is(th, td):nth-child(2) { width: 12%; }
.erp-main .project-document-table :is(th, td):nth-child(3) { width: 7%; text-align: center; }
.erp-main .project-document-table :is(th, td):nth-child(4) { width: 9%; text-align: right; }
.erp-main .project-document-table :is(th, td):nth-child(5) { width: 10%; }
.erp-main .project-document-table :is(th, td):nth-child(6) { width: 15%; white-space: nowrap; }
.erp-main .project-document-table :is(th, td):nth-child(7) { width: 260px; }

.erp-main .project-document-table tbody td {
  height: 48px;
  padding-block: 5px;
}

.project-document-name {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  padding: 0;
  color: var(--visual-primary);
  background: transparent;
  font: inherit;
  font-weight: 600;
  line-height: 20px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.project-document-name:is(:hover, :focus-visible) {
  color: var(--visual-primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-document-table td:first-child > small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--visual-text-muted);
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-document-row-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.project-document-row-actions .table-action {
  min-height: var(--visual-control-height-compact);
  white-space: nowrap;
}

.project-document-version-button {
  position: relative;
  cursor: pointer;
}

body[data-ui-theme="macos-workspace-v3"] .project-document-preview,
body[data-ui-theme="macos-workspace-v3"] .global-overlay-root .project-document-preview {
  width: min(920px, calc(100vw - 48px)) !important;
  max-width: 920px !important;
  height: fit-content !important;
  max-height: min(760px, calc(100dvh - 48px)) !important;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.project-document-preview-body {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: var(--visual-space-4);
  overflow: auto;
  padding: var(--visual-space-4);
}

.project-document-preview-body > section {
  display: grid;
  gap: var(--visual-space-2);
}

.project-document-preview-body h3 {
  margin: 0;
  color: var(--visual-text);
  font-size: var(--visual-font-card-title);
  line-height: 22px;
}

.project-document-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-control);
  overflow: hidden;
}

.project-document-meta > div {
  min-width: 0;
  padding: 9px 12px;
  border-right: 1px solid var(--visual-border-soft);
}

.project-document-meta > div:last-child {
  grid-column: 1 / -1;
  border-top: 1px solid var(--visual-border-soft);
  border-right: 0;
}

.project-document-meta :is(dt, dd) {
  margin: 0;
}

.project-document-meta dt {
  color: var(--visual-text-muted);
  font-size: var(--visual-font-helper);
}

.project-document-meta dd {
  overflow-wrap: anywhere;
  color: var(--visual-text);
  font-size: var(--visual-font-body);
  font-weight: 600;
}

.project-document-version-list,
.project-document-audit-list {
  display: grid;
  border: 1px solid var(--visual-border);
  border-radius: var(--visual-radius-control);
  overflow: hidden;
}

.project-document-version-list article,
.project-document-audit-list > div {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--visual-space-3);
  padding: 9px 12px;
  border-bottom: 1px solid var(--visual-border-soft);
  background: var(--visual-surface);
}

.project-document-version-list article:last-child,
.project-document-audit-list > div:last-child {
  border-bottom: 0;
}

.project-document-version-list article > div:first-child,
.project-document-audit-list > div {
  min-width: 0;
}

.project-document-version-list :is(strong, span, small),
.project-document-audit-list :is(strong, span, small) {
  display: block;
  overflow-wrap: anywhere;
}

.project-document-version-list span,
.project-document-audit-list span {
  color: var(--visual-text-muted);
  font-size: var(--visual-font-helper);
}

.project-document-audit-list > div {
  display: grid;
  justify-content: stretch;
  gap: 2px;
}

@media (max-width: 1100px) {
  .project-document-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-document-toolbar > .table-action {
    justify-self: start;
  }

  .project-document-upload-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .project-document-library-title {
    align-items: flex-start;
    gap: var(--visual-space-2);
  }

  .project-document-library-title,
  .project-document-title-actions {
    flex-wrap: wrap;
  }

  .project-document-library-title > div:first-child > span {
    max-width: calc(100vw - 64px);
  }

  .project-document-toolbar,
  .project-document-upload-form,
  .project-document-inline-form {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--visual-space-3);
  }

  .project-document-toolbar > .table-action,
  .project-document-inline-form > .table-action,
  .project-document-upload-form > div,
  .project-document-upload-form > div > .table-action {
    width: 100%;
  }

  .project-document-upload-form > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-document-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .erp-main .project-document-table {
    min-width: 920px;
  }

  body[data-ui-theme="macos-workspace-v3"] .project-document-preview,
  body[data-ui-theme="macos-workspace-v3"] .global-overlay-root .project-document-preview {
    width: 100vw !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0;
  }

  .project-document-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-document-meta > div,
  .project-document-meta > div:last-child {
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--visual-border-soft);
  }

  .project-document-meta > div:last-child {
    border-bottom: 0;
  }

  .project-document-version-list article {
    align-items: flex-start;
  }

  .project-document-version-list article > div:last-child {
    flex-direction: column;
  }
}

/* Mobile approval long-title authority 2026-08-30 */
@media (max-width: 760px) {
  body[data-ui-theme="macos-workspace-v3"] .global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head,
  body[data-ui-theme="macos-workspace-v3"].flow-detail-only .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 36px !important;
    grid-template-areas:
      "status close"
      "title title"
      "amount amount" !important;
    align-items: start !important;
    gap: 6px 8px !important;
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px !important;
    overflow: hidden !important;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-title-block,
  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-title-block > div {
    min-width: 0 !important;
    width: 100%;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-title-block > div {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    overflow: hidden;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-title-block > div > strong {
    display: -webkit-box !important;
    width: 100%;
    max-width: 100% !important;
    max-height: calc(2 * 1.35em);
    overflow: hidden !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--visual-text) !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-title-block > div > :is(small, p) {
    display: block;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > .flow-approval-header-amount {
    display: grid !important;
    grid-area: amount !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "document document"
      "amount-value amount-note";
    align-items: baseline;
    gap: 2px 10px;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 6px 0 0 !important;
    border-top: 1px solid var(--visual-border-soft);
    overflow: hidden !important;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount > .flow-record-document-number {
    grid-area: document;
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: nowrap !important;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount > strong {
    grid-area: amount-value;
    min-width: 0;
    font-size: 24px !important;
    line-height: 1.15 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount > .flow-approval-amount-note {
    grid-area: amount-note;
    min-width: 0;
    overflow: hidden !important;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap !important;
  }
}

body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-context-strip > div {
  min-width: 0 !important;
  overflow: hidden;
}

body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-context-strip > div > strong {
  display: -webkit-box !important;
  width: 100%;
  max-width: 100% !important;
  max-height: calc(2 * 1.35em);
  overflow: hidden !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body[data-ui-theme="macos-workspace-v3"] .flow-record-preview-panel.is-approval-mode .flow-approval-context-strip > div > small {
  display: block;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Login cube scene authority 2026-08-30 */
body[data-ui-theme="macos-workspace-v3"] .login-calm-scene {
  display: grid !important;
}
