/* Unified product UI system.
 * This final layer replaces page-by-page visual patches with one shared ERP shell,
 * density scale, component vocabulary, and responsive contract.
 */

:root {
  --ui-primary-950: #0a285f;
  --ui-primary-900: #0f3476;
  --ui-primary-800: #19458b;
  --ui-primary-700: #24579d;
  --ui-primary-100: #e9eff8;
  --ui-primary-050: #f3f6fb;
  --ui-accent-700: #227f7b;
  --ui-accent-600: #369c97;
  --ui-accent-500: #72c8c4;
  --ui-accent-200: #c8e8e5;
  --ui-accent-100: #e9f6f5;
  --ui-income: #176b5c;
  --ui-cost: #d17a2d;
  --ui-warning: #9a4e0b;
  --ui-danger: #d93a36;
  --ui-info: #2d6db2;
  --ui-ink-950: #18202b;
  --ui-ink-800: #313b48;
  --ui-ink-650: #566170;
  --ui-ink-500: #727c88;
  --ui-border-strong: #cbd4df;
  --ui-border: #dce3ea;
  --ui-border-soft: #e9eef3;
  --ui-page: #f3f6f9;
  --ui-surface: #ffffff;
  --ui-surface-subtle: #f8fafc;
  --ui-surface-selected: #edf5f5;
  --ui-overlay: rgba(12, 27, 52, 0.54);
  --ui-content-max: 1600px;
  --ui-sidebar-width: 208px;
  --ui-header-height: 64px;
  --ui-space-page: 20px;
  --ui-radius-sm: 4px;
  --ui-radius: 7px;
  --ui-radius-lg: 10px;
  --ui-shadow-float: 0 8px 24px rgba(15, 52, 118, 0.12);
  --ui-shadow-modal: 0 20px 54px rgba(10, 40, 95, 0.22);
  --ui-focus: 0 0 0 3px rgba(54, 156, 151, 0.22);
  --z-sticky: 220;
  --z-dropdown: 300;
  --z-modal-backdrop: 500;
  --z-modal: 510;
  --z-toast: 600;
  --z-tooltip: 700;
}

/* Unified organization and permission system tree 2026-08-28. */
.organization-access-panel {
  position: relative;
  min-height: min(720px, calc(100dvh - 210px));
  padding: 0;
  overflow: hidden;
}

.organization-access-toolbar {
  min-height: 54px;
  padding: 9px 14px;
}

.organization-access-toolbar > div:last-child,
.organization-tree-editor-head,
.organization-tree-person,
.organization-tree-member-list,
.organization-tree-save {
  display: flex;
  align-items: center;
}

.organization-access-toolbar > div:last-child {
  gap: 8px;
}

.organization-create-menu {
  position: relative;
}

.organization-create-menu > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.organization-create-menu > summary::-webkit-details-marker {
  display: none;
}

.organization-create-menu > summary::after {
  margin-left: 6px;
  content: "⌄";
}

.organization-create-menu > div {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 6px);
  right: 0;
  width: 132px;
  padding: 5px;
  border: 1px solid var(--reference-border);
  border-radius: var(--ui-radius);
  background: var(--reference-surface);
  box-shadow: var(--reference-shadow);
}

.organization-create-menu > div > button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--reference-text);
  text-align: left;
}

.organization-create-menu > div > button:hover,
.organization-create-menu > div > button:focus-visible {
  background: var(--reference-row-hover);
  color: var(--reference-accent);
}

.organization-access-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: calc(min(720px, 100dvh - 210px) - 55px);
}

.organization-system-tree {
  display: grid;
  grid-template-rows: 48px auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--reference-border);
  background: var(--reference-surface);
}

.organization-system-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--reference-border);
}

.organization-system-tree-head strong {
  font-size: 14px;
}

.organization-system-tree-head span {
  color: var(--reference-text-tertiary);
  font-size: 12px;
}

.organization-system-tree > input[type="search"] {
  width: auto;
  height: 36px;
  min-height: 36px;
  margin: 10px 12px;
  padding: 0 11px;
  border: 1px solid var(--reference-border);
  border-radius: var(--ui-radius-sm);
  background: var(--reference-surface);
  color: var(--reference-text);
}

.organization-system-tree-scroll {
  min-height: 0;
  padding: 4px 8px 18px;
  overflow: auto;
}

.organization-tree-root,
.organization-tree-branch,
.organization-tree-node {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--reference-text);
  text-align: left;
}

.organization-tree-root,
.organization-tree-branch {
  padding: 0 8px;
}

.organization-tree-root strong,
.organization-tree-branch strong {
  font-size: 13px;
}

.organization-tree-branch {
  margin-top: 6px;
  font-weight: 700;
}

.organization-tree-root i,
.organization-tree-branch i,
.organization-tree-node i {
  color: var(--reference-text-tertiary);
  font-style: normal;
  text-align: center;
}

.organization-tree-root span,
.organization-tree-branch span,
.organization-tree-node span {
  color: var(--reference-text-tertiary);
  font-size: 11px;
}

.organization-tree-node {
  padding: 0 8px 0 calc(8px + (var(--organization-tree-depth, 1) - 1) * 18px);
  font-size: 13px;
}

.organization-tree-node strong {
  min-width: 0;
  overflow: hidden;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organization-tree-node:hover {
  background: var(--reference-row-hover);
}

.organization-tree-node.is-active {
  background: var(--reference-accent-soft);
  color: var(--reference-accent);
  box-shadow: inset 3px 0 0 var(--reference-accent);
}

.organization-tree-node.is-active i,
.organization-tree-node.is-active span {
  color: inherit;
}

.organization-tree-node[hidden] {
  display: none;
}

.organization-tree-orphan-label {
  padding: 9px 12px 4px;
  color: var(--reference-text-tertiary);
  font-size: 11px;
}

.organization-tree-editor {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--reference-surface-subtle);
}

.organization-tree-editor-head {
  position: sticky;
  z-index: 2;
  top: 0;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--reference-border);
  background: color-mix(in srgb, var(--reference-surface) 96%, transparent);
}

.organization-tree-editor-head > div:not(.organization-tree-person) > strong,
.organization-tree-editor-head > div:not(.organization-tree-person) > small {
  display: block;
}

.organization-tree-editor-head > div:not(.organization-tree-person) > strong {
  font-size: 16px;
}

.organization-tree-editor-head > div:not(.organization-tree-person) > small {
  margin-top: 5px;
  color: var(--reference-text-tertiary);
  font-size: 12px;
}

.organization-tree-person {
  min-width: 0;
  gap: 11px;
}

.organization-tree-person > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--reference-action-solid);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.organization-tree-person strong,
.organization-tree-person small {
  display: block;
}

.organization-tree-person strong {
  font-size: 16px;
}

.organization-tree-person small {
  margin-top: 4px;
  color: var(--reference-text-tertiary);
  font-size: 12px;
}

.organization-tree-editor-body {
  padding: 14px 16px 72px;
}

.organization-tree-settings-section {
  margin-bottom: 12px;
  border: 1px solid var(--reference-border);
  border-radius: var(--ui-radius);
  background: var(--reference-surface);
}

.organization-tree-settings-section > h3 {
  min-height: 42px;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--reference-border);
  color: var(--reference-text);
  font-size: 13px;
}

.organization-tree-field-grid,
.organization-tree-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 14px;
}

.organization-tree-field-grid > label,
.organization-tree-setting-control {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.organization-tree-field-grid > label > span,
.organization-tree-setting-control > span {
  color: var(--reference-text-secondary);
  font-size: 12px;
}

.organization-tree-field-grid :is(input:not([type="checkbox"]), select),
.organization-tree-setting-control .org-module-dropdown > summary,
.organization-tree-permission-grid .org-module-dropdown > summary {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--reference-border);
  border-radius: var(--ui-radius-sm);
  background: var(--reference-surface);
  color: var(--reference-text);
}

.organization-tree-setting-control .org-module-dropdown,
.organization-tree-permission-grid .org-module-dropdown {
  width: 100%;
}

.organization-tree-check {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  align-content: end;
  min-height: 38px;
}

.organization-tree-check > span {
  grid-column: 1 / -1;
}

.organization-tree-check > input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
}

.organization-tree-check > b {
  font-size: 13px;
  font-weight: 500;
}

.organization-tree-member-list {
  flex-wrap: wrap;
  gap: 7px;
  min-height: 52px;
  padding: 10px 14px;
}

.organization-tree-member-list > button,
.organization-tree-member-list > span {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--reference-secondary) 45%, var(--reference-border));
  border-radius: var(--ui-radius-sm);
  background: color-mix(in srgb, var(--reference-secondary) 12%, var(--reference-surface));
  color: var(--reference-secondary);
  font-size: 12px;
}

.organization-role-member-control {
  display: grid;
  gap: 10px;
  padding: 10px 14px;
}

.organization-role-member-picker {
  width: min(100%, 420px);
}

.organization-role-member-control .organization-tree-member-list {
  min-height: 0;
  padding: 0;
}

.organization-tree-save {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 310px;
  z-index: 3;
  justify-content: flex-end;
  min-height: 58px;
  padding: 10px 16px;
  border-top: 1px solid var(--reference-border);
  background: color-mix(in srgb, var(--reference-surface) 96%, transparent);
}

@media (max-width: 900px) {
  .organization-access-panel {
    min-height: 0;
    overflow: visible;
  }

  .organization-access-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .organization-system-tree {
    max-height: 330px;
    border-right: 0;
    border-bottom: 1px solid var(--reference-border);
  }

  .organization-tree-editor {
    overflow: visible;
  }

  .organization-tree-editor-head {
    position: static;
  }

  .organization-tree-save {
    position: sticky;
    left: 0;
  }
}

@media (max-width: 620px) {
  .organization-access-toolbar {
    align-items: center;
  }

  .organization-access-toolbar > div:last-child {
    flex-wrap: nowrap;
  }

  .organization-tree-field-grid,
  .organization-tree-permission-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .organization-tree-editor-body {
    padding: 10px 10px 76px;
  }

  .organization-tree-editor-head {
    min-height: 64px;
    padding: 10px 12px;
  }
}

/* Operator UI primitives: navigation meaning and useful empty states. */
.module-nav button[data-nav-icon]::before {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 0;
  border-radius: 0;
  opacity: 0.72;
  background-color: currentColor;
  -webkit-mask-image: var(--nav-icon);
  mask-image: var(--nav-icon);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  box-shadow: none;
}

.module-nav button[data-nav-icon="workbench"] { --nav-icon: url("./assets/vendor/lucide-icons/layout-dashboard.svg"); }
.module-nav button[data-nav-icon="dashboard"] { --nav-icon: url("./assets/vendor/lucide-icons/chart-no-axes-combined.svg"); }
.module-nav button[data-nav-icon="projects"] { --nav-icon: url("./assets/vendor/lucide-icons/hard-hat.svg"); }
.module-nav button[data-nav-icon="contracts"] { --nav-icon: url("./assets/vendor/lucide-icons/file-signature.svg"); }
.module-nav button[data-nav-icon="receivables"] { --nav-icon: url("./assets/vendor/lucide-icons/hand-coins.svg"); }
.module-nav button[data-nav-icon="payments"] { --nav-icon: url("./assets/vendor/lucide-icons/wallet-cards.svg"); }
.module-nav button[data-nav-icon="invoices"] { --nav-icon: url("./assets/vendor/lucide-icons/receipt-text.svg"); }
.module-nav button[data-nav-icon="finance"] { --nav-icon: url("./assets/vendor/lucide-icons/landmark.svg"); }
.module-nav button[data-nav-icon="parties"] { --nav-icon: url("./assets/vendor/lucide-icons/database.svg"); }
.module-nav button[data-nav-icon="organization"] { --nav-icon: url("./assets/vendor/lucide-icons/users-round.svg"); }

.module-nav button[data-nav-icon].is-active::before,
.module-nav button[data-nav-icon][aria-current="page"]::before {
  border: 0;
  opacity: 1;
  background-color: #a3e3df;
  box-shadow: none;
  transform: none;
}

.workbench-task-center {
  border-top: 2px solid var(--ui-primary-900);
}

.workbench-flow-status-bar {
  border-top: 2px solid var(--ui-accent-600);
}

.workbench-recent-activity {
  border-top: 2px solid var(--ui-border-strong);
}

.workbench-task-center > header,
.workbench-flow-status-bar > .workbench-flow-status-intro,
.workbench-recent-activity > header {
  background: #ffffff;
}

.workbench-next-action-list > button:focus-visible,
.workbench-recent-list > button:focus-visible {
  outline: 2px solid var(--ui-accent-600);
  outline-offset: -2px;
}

.data-table-empty-state {
  min-height: 116px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  color: var(--ui-ink-650);
  background: #fbfcfd;
  text-align: left;
}

.data-table-empty-state > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.data-table-empty-state strong,
.data-table-empty-state p {
  margin: 0;
}

.data-table-empty-state strong {
  color: var(--ui-ink-950);
  font-size: 14px;
  font-weight: 700;
}

.data-table-empty-state p {
  max-width: 68ch;
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.55;
}

.data-table-empty-icon {
  width: 36px;
  height: 36px;
  position: relative;
  display: block;
  border: 1px solid var(--ui-accent-200);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-100);
}

.data-table-empty-icon::before,
.data-table-empty-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--ui-accent-700);
}

.data-table-empty-icon::before {
  top: 12px;
  box-shadow: 0 6px 0 var(--ui-accent-700);
}

.data-table-empty-icon::after {
  width: 4px;
  height: 4px;
  left: 9px;
  right: auto;
  top: 11px;
  border-radius: 50%;
  box-shadow: 0 6px 0 var(--ui-accent-700);
}

.data-table-empty-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--ui-primary-900);
  border-radius: var(--ui-radius-sm);
  color: #ffffff;
  background: var(--ui-primary-900);
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.data-table-empty-action:hover,
.data-table-empty-action:focus-visible {
  border-color: var(--ui-primary-800);
  background: var(--ui-primary-800);
}

.table-empty-cell:has(> .data-table-empty-state) {
  height: auto;
  min-height: 0;
  padding: 0 !important;
  text-align: left !important;
}

.standalone-empty-state {
  border-top: 1px solid var(--ui-border-soft);
}

@media (max-width: 760px) {
  .workbench-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .workbench-heading > .workbench-heading-actions {
    width: auto;
  }

  .workbench-primary-action {
    width: 44px;
    min-width: 44px;
    padding: 10px;
    overflow: hidden;
    color: transparent;
    white-space: nowrap;
  }

  .workbench-primary-action > span {
    color: #ffffff;
    font-size: 22px;
  }

  .data-table-empty-state {
    min-height: 148px;
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 18px 14px;
  }

  .data-table-empty-action {
    grid-column: 1 / -1;
    min-height: 44px;
    width: 100%;
  }
}

/* Global overlay ordering: each child owns its contents and later dialogs paint above earlier ones. */
.global-overlay-root > * {
  z-index: auto !important;
  isolation: isolate;
  pointer-events: auto;
}

/* Workflow overlay portal: secondary dialogs must stay inside the native modal top layer. */
#erp-flow-launch-dialog > .global-overlay-root {
  z-index: calc(var(--z-modal) + 1);
}

html {
  min-width: 320px;
  color-scheme: light;
  background: var(--ui-page);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: clip;
  color: var(--ui-ink-950);
  background: var(--ui-page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.app-tech-canvas {
  display: none;
}

button,
input,
select,
textarea,
summary {
  letter-spacing: 0;
}

button,
summary,
[role="button"],
[data-flow-action],
[data-dashboard-link] {
  touch-action: manipulation;
}

:where(button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ui-accent-600);
  outline-offset: 2px;
}

/* Application shell */
.erp-shell {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--ui-header-height) minmax(0, 1fr);
  justify-content: stretch;
  background: var(--ui-page);
}

.app-header {
  height: var(--ui-header-height);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  padding: 0;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface);
  box-shadow: none;
}

.app-header-brand {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: #ffffff;
  background: var(--ui-primary-900);
}

.app-header-brand .brand {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
}

.app-header-brand .brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: contain;
  filter: none;
}

.app-header-brand .brand > div {
  min-width: 0;
}

.app-header-brand .brand strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 16px;
  font-weight: 720;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-workspace {
  min-width: 0;
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  padding: 0 var(--ui-space-page);
}

.app-header .topbar.is-compact {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(260px, 680px) auto;
  grid-template-areas: "search actions";
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.global-search {
  min-width: 0;
  grid-area: search;
}

.app-header .global-search input {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0 40px 0 36px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-950);
  background-color: var(--ui-surface-subtle);
  box-shadow: none;
  font-size: 13px;
}

.app-header .global-search input::placeholder {
  color: var(--ui-ink-650);
  opacity: 1;
}

.app-header .global-search input:hover {
  border-color: var(--ui-border-strong);
  background: #ffffff;
}

.app-header .global-search input:focus {
  border-color: var(--ui-accent-600);
  outline: 0;
  background: #ffffff;
  box-shadow: var(--ui-focus);
}

.topbar-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.cloud-sync-status {
  width: 28px;
  height: 28px;
  min-height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  overflow: hidden;
}

.cloud-sync-status::before {
  width: 8px;
  height: 8px;
  margin: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--ui-ink-500);
  box-shadow: 0 0 0 2px var(--ui-border);
}

.cloud-sync-status[data-state="saved"]::before {
  background: var(--ui-income);
  box-shadow: 0 0 0 2px #dcefe8;
}

.cloud-sync-status[data-state="saving"]::before {
  background: var(--ui-warning);
  box-shadow: 0 0 0 2px #f7ead8;
}

.cloud-sync-status[data-state="error"] {
  background: transparent;
}

.cloud-sync-status[data-state="error"]::before {
  background: var(--ui-danger);
  box-shadow: 0 0 0 2px #f8dedd;
}

.user-menu-anchor,
.user-name-button.user-avatar-button {
  width: 40px;
  height: 40px;
}

.app-header .user-name-button.user-avatar-button {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

.app-header .user-name-button.user-avatar-button:hover,
.app-header .user-name-button.user-avatar-button[aria-expanded="true"] {
  border-color: var(--ui-accent-200);
  background: var(--ui-accent-100);
}

.user-toolbar-avatar {
  width: 34px;
  height: 34px;
  border: 1px solid #c9d6e5;
  border-radius: 50%;
  background: var(--ui-primary-900);
  overflow: hidden;
}

.user-toolbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-toolbar-avatar > span {
  color: #ffffff;
}

.user-menu-chevron {
  display: none;
}

.user-menu-dropdown {
  top: calc(100% + 9px);
  right: 0;
  width: 260px;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: #ffffff;
  box-shadow: var(--ui-shadow-float);
}

.erp-sidebar,
.erp-shell > .erp-sidebar {
  width: var(--ui-sidebar-width);
  height: calc(100dvh - var(--ui-header-height));
  position: sticky;
  top: var(--ui-header-height);
  z-index: 180;
  grid-column: 1;
  grid-row: 2;
  padding: 12px 10px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  background: var(--ui-primary-900);
  box-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.module-nav.ui-system-v2 {
  width: 100%;
  display: grid;
  align-content: start;
  gap: 6px;
  margin: 0;
  overflow: visible;
}

.module-nav-group {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 0 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.module-nav-group:last-of-type {
  border-bottom: 0;
}

.module-nav-title {
  display: block;
  padding: 7px 10px 3px;
  color: rgba(228, 238, 252, 0.62);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.module-nav button,
.module-nav-branch > button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: rgba(241, 246, 254, 0.82);
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 580;
  line-height: 1.35;
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease;
}

.module-nav button::after {
  display: none;
}

.module-nav button::before {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  opacity: 0.72;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.module-nav button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.module-nav button.is-active,
.module-nav button[aria-current="page"] {
  color: #ffffff;
  border: 0;
  background: rgba(114, 200, 196, 0.18);
  box-shadow: inset 3px 0 0 var(--ui-accent-500);
}

.module-nav button.is-active::before,
.module-nav button[aria-current="page"]::before {
  border-color: #9be0dc;
  background: var(--ui-accent-500);
  box-shadow: none;
  opacity: 1;
  transform: none;
}

.module-nav-label {
  min-width: 0;
  flex: 1;
}

.module-nav-chevron {
  margin-left: auto;
  opacity: 0.72;
}

.module-subnav {
  position: static;
  display: grid;
  gap: 1px;
  margin: 2px 0 4px 22px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid rgba(151, 208, 204, 0.36);
  background: transparent;
}

.module-subnav[hidden] {
  display: none;
}

.module-subnav button {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: var(--ui-radius-sm);
  color: rgba(235, 242, 252, 0.76);
  font-size: 12px;
  font-weight: 520;
}

.module-subnav button::before {
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  border: 0;
  border-radius: 50%;
  background: currentColor;
}

.module-subnav button.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.module-subnav button.is-active::before {
  width: 4px;
  height: 4px;
  border: 0;
  background: var(--ui-accent-500);
}

.erp-main {
  width: 100%;
  min-width: 0;
  max-width: none;
  grid-column: 2;
  grid-row: 2;
  display: block;
  margin: 0;
  padding: var(--ui-space-page);
  background: var(--ui-page);
}

.erp-main::before,
.erp-main::after {
  display: none;
}

.workspace-tabs,
.view-root {
  width: 100%;
  max-width: var(--ui-content-max);
  margin-inline: auto;
}

.workspace-tabs {
  min-height: 0;
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

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

.workspace-tab {
  min-height: 32px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: #ffffff;
  box-shadow: none;
}

.workspace-tab.is-active {
  border-color: var(--ui-primary-900);
  color: #ffffff;
  background: var(--ui-primary-900);
}

.view-root {
  display: grid;
  align-content: start;
  gap: 14px;
}

.view-semantic-title {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workspace-page-head,
.workbench-heading {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--ui-border);
}

.workspace-page-head > div,
.workbench-heading > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.workspace-page-head > div > span,
.workbench-heading > div > span {
  color: var(--ui-ink-650);
  font-size: 11px;
}

.workspace-page-head h1,
.workbench-heading h1 {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 22px;
  font-weight: 720;
  line-height: 1.3;
  letter-spacing: 0;
  text-wrap: balance;
}

.workspace-page-head p,
.workbench-heading p {
  max-width: 72ch;
  margin: 0;
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Shared surfaces and controls */
.panel,
.flow-form,
.dashboard-visual-panel,
.dashboard-chart-panel,
.dashboard-detail-drawer,
.workbench-flow-status-bar,
.workbench-flow-detail-panel,
.workbench-project-overview,
.data-export-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-950);
  background: var(--ui-surface);
  background-image: none;
  box-shadow: none;
}

.panel-title,
.form-head,
.dashboard-panel-head,
.workbench-section-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-950);
  background: var(--ui-surface);
  background-image: none;
}

.panel-title strong,
.form-head strong,
.dashboard-panel-head h2,
.workbench-section-head h2 {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

.panel-title span,
.form-head span,
.dashboard-panel-head span,
.workbench-section-head span {
  color: var(--ui-ink-650);
  font-size: 12px;
}

.table-action,
.form-actions button,
.line-table-head button,
.inline-settings button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-800);
  background: #ffffff;
  background-image: none;
  box-shadow: none;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.table-action:hover,
.form-actions button:hover,
.line-table-head button:hover,
.inline-settings button:hover {
  border-color: #9badc0;
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
  transform: none;
}

.table-action.primary,
.form-actions button:last-child,
.inline-settings button {
  border-color: var(--ui-primary-900);
  color: #ffffff;
  background: var(--ui-primary-900);
}

.table-action.primary:hover,
.form-actions button:last-child:hover,
.inline-settings button:hover {
  border-color: var(--ui-primary-800);
  color: #ffffff;
  background: var(--ui-primary-800);
}

.table-action.danger,
.form-actions #clear-flow-form {
  border-color: #efc4c2;
  color: #b62f2b;
  background: #fffafa;
}

.table-action:disabled,
.form-actions button:disabled {
  border-color: var(--ui-border);
  color: #929aa4;
  background: #f0f3f6;
  cursor: not-allowed;
  opacity: 1;
}

.tabs,
.finance-subnav,
.contract-subtabs,
.project-subtabs,
.party-subtabs,
.organization-subtabs {
  width: 100%;
  max-width: 100%;
  position: static;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: none;
  backdrop-filter: none;
}

.tab-button,
.finance-subnav button,
.contract-subtabs button,
.project-subtabs button,
.party-subtabs button,
.organization-subtabs button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: transparent;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.tab-button.is-active,
.finance-subnav button.is-active,
.contract-subtabs button.is-active,
.project-subtabs button.is-active,
.party-subtabs button.is-active,
.organization-subtabs button.is-active {
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  box-shadow: none;
}

/* Tables */
.data-table-shell,
.table-scroll,
.responsive-table,
.workbench-project-table-scroll,
.data-export-table-scroll {
  width: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.data-table,
.workbench-project-table,
.payroll-table,
.org-directory-table,
.line-item-table,
.data-export-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ui-ink-950);
  background: #ffffff;
  font-size: 12px;
}

/* Business line-item tables use field-specific widths instead of equal columns. */
#contract-line-items,
#expense-line-items,
#settlement-line-items {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.business-line-table {
  width: 100%;
  table-layout: fixed;
}

.business-line-table th {
  padding-inline: 8px;
}

.business-line-table td {
  padding: 6px 7px;
}

.business-line-table input,
.business-line-table select,
.business-line-table textarea {
  min-width: 0;
  padding-inline: 7px;
}

#flow-form .business-line-table .line-header-input {
  min-width: 0;
  min-height: 32px;
  padding: 4px 5px;
  font-size: 12px;
}

.business-line-table .line-serial,
.business-line-cell--unit {
  text-align: center;
}

.business-line-cell--quantity,
.business-line-cell--unitPrice,
.business-line-cell--totalPrice,
.business-line-cell--equipmentQuantity,
.business-line-cell--dailyRent,
.business-line-cell--shiftDays,
.business-line-cell--contractQuantity,
.business-line-cell--acceptedQuantity,
.business-line-cell--availableQuantity,
.business-line-cell--settlementQuantity,
.business-line-cell--settlementAmount,
.business-line-cell--differenceQuantity {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.business-line-cell--quantity input,
.business-line-cell--unitPrice input,
.business-line-cell--equipmentQuantity input,
.business-line-cell--dailyRent input,
.business-line-cell--shiftDays input,
.business-line-cell--settlementQuantity input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.business-line-cell--name,
.business-line-cell--specification,
.business-line-cell--workContent,
.business-line-cell--remark,
.business-line-cell--equipmentName,
.business-line-cell--equipmentModel {
  white-space: normal;
  overflow-wrap: anywhere;
}

.contract-line-table.is-material {
  min-width: 920px;
}

.contract-line-table.is-material .business-line-col--serialNo { width: 76px; }
.contract-line-table.is-material .business-line-col--name { width: 188px; }
.contract-line-table.is-material .business-line-col--specification { width: 180px; }
.contract-line-table.is-material .business-line-col--unit { width: 100px; }
.contract-line-table.is-material .business-line-col--quantity { width: 110px; }
.contract-line-table.is-material .business-line-col--unitPrice { width: 122px; }
.contract-line-table.is-material .business-line-col--totalPrice { width: 138px; }
.contract-line-table.is-labor {
  min-width: 1100px;
}

.contract-line-table.is-labor .business-line-col--serialNo { width: 76px; }
.contract-line-table.is-labor .business-line-col--name { width: 150px; }
.contract-line-table.is-labor .business-line-col--workContent { width: 250px; }
.contract-line-table.is-labor .business-line-col--unit { width: 96px; }
.contract-line-table.is-labor .business-line-col--quantity { width: 100px; }
.contract-line-table.is-labor .business-line-col--unitPrice { width: 112px; }
.contract-line-table.is-labor .business-line-col--totalPrice { width: 130px; }
.contract-line-table.is-labor .business-line-col--remark { width: 180px; }
.contract-line-table.is-equipment {
  min-width: 1040px;
}

.contract-line-table.is-equipment .business-line-col--serialNo { width: 80px; }
.contract-line-table.is-equipment .business-line-col--equipmentName { width: 184px; }
.contract-line-table.is-equipment .business-line-col--equipmentModel { width: 172px; }
.contract-line-table.is-equipment .business-line-col--equipmentQuantity { width: 98px; }
.contract-line-table.is-equipment .business-line-col--dailyRent { width: 128px; }
.contract-line-table.is-equipment .business-line-col--shiftDays { width: 138px; }
.contract-line-table.is-equipment .business-line-col--totalPrice { width: 140px; }
.supplier-settlement-line-table {
  min-width: 1140px;
}

.supplier-settlement-line-table.has-material-availability {
  min-width: 1360px;
}

.supplier-settlement-line-table .business-line-col--serialNo { width: 52px; }
.supplier-settlement-line-table .business-line-col--name { width: 180px; }
.supplier-settlement-line-table .business-line-col--specification { width: 210px; }
.supplier-settlement-line-table .business-line-col--unit { width: 86px; }
.supplier-settlement-line-table .business-line-col--contractQuantity { width: 110px; }
.supplier-settlement-line-table .business-line-col--acceptedQuantity { width: 106px; }
.supplier-settlement-line-table .business-line-col--availableQuantity { width: 114px; }
.supplier-settlement-line-table .business-line-col--settlementQuantity { width: 116px; }
.supplier-settlement-line-table .business-line-col--unitPrice { width: 126px; }
.supplier-settlement-line-table .business-line-col--settlementAmount { width: 148px; }
.supplier-settlement-line-table .business-line-col--differenceQuantity { width: 112px; }

.data-table th,
.workbench-project-table th,
.payroll-table th,
.org-directory-table th,
.line-item-table th,
.data-export-table th,
.erp-main table thead th {
  height: 40px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-ink-650);
  background: #f4f7fa;
  background-image: none;
  font-size: 11px;
  font-weight: 680;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table th:last-child,
.flow-summary-preview-panel .data-table th:last-child {
  background: #f4f7fa;
  background-image: none;
}

.data-table td,
.workbench-project-table td,
.payroll-table td,
.org-directory-table td,
.line-item-table td,
.data-export-table td {
  min-height: 46px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-800);
  line-height: 1.45;
  vertical-align: middle;
}

.data-table tbody tr:hover td,
.workbench-project-table tbody tr:hover td,
.payroll-table tbody tr:hover td,
.org-directory-table tbody tr:hover td,
.data-export-table tbody tr:hover td {
  background: #f7fafc;
}

.data-table td.is-money,
.data-table td .amount,
.workbench-project-table td:nth-child(n + 2) {
  font-variant-numeric: tabular-nums;
}

.table-empty-row,
.table-empty-cell,
.workbench-table-empty,
.data-export-empty,
.empty-state {
  min-height: 150px;
  color: var(--ui-ink-650);
  background: #ffffff;
}

.status-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-ink-650);
  background: var(--ui-surface-subtle);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Forms */
.form-grid,
.flow-form .form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  padding: 14px 16px 18px;
  background: #ffffff;
}

.form-grid label,
.flow-form .form-grid label,
.form-grid > .field-control {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.form-grid label:hover,
.flow-form .form-grid label:hover,
.form-grid label:focus-within,
.flow-form .form-grid label:focus-within {
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.form-grid label > span,
.flow-form .form-grid label > span,
.schedule-editor-toolbar label,
.material-movement-form label > span {
  min-height: 17px;
  color: var(--ui-ink-800);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid select,
.flow-form .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.flow-form .form-grid select,
.material-movement-form input:not([type="radio"]):not([type="file"]),
.material-movement-form select,
.org-directory-table input,
.org-directory-table select {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.35;
}

.form-grid textarea,
.flow-form .form-grid textarea,
.material-movement-form textarea {
  width: 100%;
  min-height: 76px;
  padding: 8px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

.form-grid input::placeholder,
.form-grid textarea::placeholder,
.flow-form .form-grid input::placeholder,
.flow-form .form-grid textarea::placeholder {
  color: var(--ui-ink-650);
  opacity: 1;
}

.form-grid :is(input, select, textarea):hover,
.flow-form .form-grid :is(input, select, textarea):hover {
  border-color: #a7b5c4;
}

.form-grid :is(input, select, textarea):focus,
.flow-form .form-grid :is(input, select, textarea):focus {
  border-color: var(--ui-accent-600);
  outline: 0;
  box-shadow: var(--ui-focus);
}

.form-grid input[readonly],
.flow-form .form-grid input[readonly] {
  color: var(--ui-ink-650);
  background: #f3f6f8;
}

.form-grid label.field-invalid,
.flow-form .form-grid label.field-invalid {
  padding: 7px;
  border: 1px solid #efb7b4;
  border-radius: var(--ui-radius-sm);
  background: #fff7f7;
}

.field-wide,
.form-grid > .form-section-label,
.form-grid > .flow-related-field,
.form-grid > .contract-lines,
.form-grid > .attachment-upload-control {
  grid-column: 1 / -1;
}

.form-section-label {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px -16px 0;
  padding: 7px 16px;
  border: 0;
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  color: var(--ui-primary-900);
  background: #f5f8fb;
  font-size: 13px;
  font-weight: 700;
}

.contract-lines,
.attachment-upload-control,
.flow-related-field {
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.line-table-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--ui-border);
  background: #f5f8fb;
}

.line-table-head > span {
  color: var(--ui-primary-900);
  font-size: 13px;
  font-weight: 700;
}

.form-actions {
  min-height: 58px;
  position: sticky;
  bottom: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -4px 12px rgba(15, 52, 118, 0.06);
}

/* Workbench */
.workbench-heading {
  min-height: 58px;
  padding: 0 2px 10px;
}

.workbench-heading > .workbench-heading-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workbench-secondary-action,
.workbench-primary-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.2;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.workbench-secondary-action {
  color: var(--ui-primary-900);
  background: #ffffff;
}

.workbench-secondary-action:hover,
.workbench-secondary-action:focus-visible {
  border-color: var(--ui-primary-900);
  background: var(--ui-primary-050);
}

.workbench-secondary-action strong {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  font-size: 11px;
  text-align: center;
}

.workbench-primary-action {
  border-color: var(--ui-primary-900);
  color: #ffffff;
  background: var(--ui-primary-900);
}

.workbench-primary-action:hover,
.workbench-primary-action:focus-visible {
  border-color: #0a285e;
  background: #0a285e;
}

.workbench-primary-action span {
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

.workbench-secondary-action:disabled,
.workbench-primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.workbench-next-action-section {
  min-width: 0;
  margin: 0;
  padding: 0 2px 10px;
  border-block: 1px solid var(--ui-border);
  background: transparent;
}

.workbench-next-action-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workbench-next-action-head > div {
  min-width: 0;
}

.workbench-next-action-head h2,
.workbench-next-action-head p {
  margin: 0;
}

.workbench-next-action-head h2 {
  color: var(--ui-ink-950);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.35;
}

.workbench-next-action-head p,
.workbench-next-action-head > span {
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.45;
}

.workbench-next-action-head > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.workbench-next-action-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}

.workbench-next-action-list > button {
  min-width: 0;
  min-height: 60px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-950);
  background: transparent;
  text-align: left;
}

.workbench-next-action-list > button:hover,
.workbench-next-action-list > button:focus-visible {
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
}

.workbench-next-action-mark,
.workbench-next-action-check {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-accent-700);
  background: var(--ui-accent-100);
  font-size: 12px;
  font-weight: 750;
  font-style: normal;
}

.workbench-next-action-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.workbench-next-action-copy small,
.workbench-next-action-copy strong,
.workbench-next-action-copy em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-next-action-copy small,
.workbench-next-action-copy em {
  color: var(--ui-ink-650);
  font-size: 10px;
  font-style: normal;
}

.workbench-next-action-copy strong {
  font-size: 12px;
  font-weight: 680;
}

.workbench-next-action-arrow {
  color: var(--ui-ink-500);
  font-size: 18px;
  line-height: 1;
}

.workbench-next-action-empty {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ui-ink-650);
}

.workbench-next-action-empty > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.workbench-next-action-empty strong,
.workbench-next-action-empty small {
  overflow-wrap: anywhere;
}

.workbench-next-action-empty strong {
  color: var(--ui-ink-950);
  font-size: 12px;
}

.workbench-next-action-empty small {
  font-size: 11px;
}

.workbench-flow-status-bar {
  min-height: 72px;
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  margin: 0;
  overflow: visible;
  border: 0;
  border-block: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
}

.workbench-flow-status-intro {
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 10px 14px 10px 2px;
  border: 0;
  border-right: 1px solid var(--ui-border);
}

.workbench-flow-status-intro > div {
  min-width: 0;
}

.workbench-flow-status-intro strong {
  color: var(--ui-ink-950);
  font-size: 15px;
}

.workbench-flow-status-intro small {
  display: block;
  margin-top: 2px;
  color: var(--ui-ink-650);
  font-size: 11px;
}

.workbench-flow-status-groups {
  min-width: 0;
  display: grid;
  grid-template-columns: 0.8fr 1.12fr 1.08fr;
  padding: 7px 0;
}

.workbench-flow-status-group {
  min-width: 0;
  gap: 2px;
  padding: 0 10px;
  border-right: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-group > span {
  color: var(--ui-ink-650);
  font-size: 10px;
  font-weight: 650;
}

.workbench-flow-status-group > div {
  gap: 3px;
}

.workbench-flow-status-button {
  min-height: 36px;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: transparent;
}

.workbench-flow-status-button.is-active {
  border-color: var(--ui-accent-200);
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
}

.workbench-flow-status-button strong {
  color: var(--ui-ink-950);
  font-size: 14px;
}

.workbench-flow-detail-panel {
  margin: 0;
  overflow: visible;
  border: 0;
  border-top: 2px solid var(--ui-ink-950);
  border-radius: 0;
  background: transparent;
}

.workbench-project-overview {
  margin: 0;
  border-top: 1px solid var(--ui-border);
}

.workbench-section-head {
  min-height: 52px;
  padding: 8px 2px;
  background: transparent;
}

.workbench-section-head h2 {
  font-size: 15px;
}

.workbench-section-head > button {
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.workbench-section-head > button:hover,
.workbench-section-head > button:focus-visible {
  background: var(--ui-primary-050);
}

.workbench-flow-record {
  min-height: 64px;
  grid-template-columns: 32px minmax(200px, 1fr) minmax(130px, 0.45fr) auto auto;
  gap: 10px;
  padding: 8px 2px;
}

.workbench-flow-record-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
}

.workbench-flow-list {
  padding: 0 2px 2px;
  border-top: 1px solid var(--ui-border-soft);
}

.workbench-flow-empty {
  min-height: 112px;
  padding: 18px;
}

/* Dashboard */
.dashboard-page-head {
  align-items: center;
}

.dashboard-page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-project-picker.compact {
  width: 220px;
  height: 36px;
  position: relative;
  display: block;
  border: 0;
  background: transparent;
}

.dashboard-project-picker.compact select {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  appearance: none;
  position: static;
  z-index: auto;
  opacity: 1;
  font-size: 12px;
}

.dashboard-filter-trigger {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ui-primary-900);
  border-bottom: 2px solid var(--ui-primary-900);
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.dashboard-executive {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-950);
  background: #ffffff;
  background-image: none;
  box-shadow: none;
}

.dashboard-executive::before,
.dashboard-executive::after {
  display: none;
}

.dashboard-command {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-950);
  background: #ffffff;
}

.dashboard-command-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dashboard-command-main .dashboard-eyebrow {
  color: var(--ui-primary-900);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-command-main h1,
.dashboard-command-main h2 {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.dashboard-command-main small {
  color: var(--ui-ink-650);
  font-size: 11px;
}

.dashboard-command .dashboard-project-picker {
  display: none;
}

.boss-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0;
}

.boss-kpi-card {
  min-width: 0;
  min-height: 92px;
  padding: 14px 16px;
  border: 0;
  border-right: 1px solid var(--ui-border-soft);
  border-radius: 0;
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  text-align: left;
}

.boss-kpi-card:last-child {
  border-right: 0;
}

.boss-kpi-card:hover,
.boss-kpi-card:focus-visible {
  background: var(--ui-surface-subtle);
  transform: none;
}

.boss-kpi-card span,
.boss-kpi-card small {
  color: var(--ui-ink-650);
  font-size: 11px;
}

.boss-kpi-card strong {
  display: block;
  margin: 5px 0 2px;
  color: var(--ui-ink-950);
  font-size: 22px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.boss-kpi-card.receive strong,
.boss-kpi-card.cash strong {
  color: var(--ui-accent-700);
}

.boss-kpi-card.pay strong {
  color: var(--ui-cost);
}

.dashboard-trend-legend button {
  min-height: 32px;
  color: var(--ui-ink-650);
  font-size: 12px;
}

.dashboard-stage-node small,
.dashboard-cost-connector,
.dashboard-cost-result span,
.dashboard-cost-result small,
.dashboard-exposure-item span,
.dashboard-exposure-item small,
.dashboard-invoice-row small {
  color: var(--ui-ink-650);
  font-size: 12px;
}

.dashboard-chart-suite {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 14px;
}

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

.dashboard-comparison-chart {
  grid-column: 1;
}

.dashboard-donut-chart {
  grid-column: 2;
}

.dashboard-trend-chart {
  min-height: 330px;
  grid-column: 1 / -1;
}

.dashboard-panel-head {
  min-height: 52px;
  padding: 10px 14px;
}

.dashboard-chart-empty-inline {
  min-height: 220px;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 20px;
  color: var(--ui-ink-650);
  text-align: center;
}

.dashboard-chart-empty-inline strong {
  color: var(--ui-ink-950);
}

.dashboard-detail-drawer {
  border-top: 1px solid var(--ui-border);
}

.dashboard-detail-drawer > summary {
  min-height: 52px;
  padding: 10px 14px;
  color: var(--ui-ink-950);
  background: #ffffff;
}

.dashboard-detail-drawer > summary:hover {
  background: var(--ui-surface-subtle);
}

.workbench-metric-band {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.workbench-metric-band button {
  min-height: 92px;
  padding: 13px 16px;
}

.workbench-metric-band strong {
  font-size: 21px;
}

/* Flow dialog and form */
.erp-flow-launch-dialog {
  width: min(1440px, calc(100vw - 32px));
  height: min(920px, calc(100dvh - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--ui-radius-lg);
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: var(--ui-shadow-modal);
}

.erp-flow-launch-dialog::backdrop {
  background: var(--ui-overlay);
  backdrop-filter: none;
}

.erp-flow-launch-dialog.is-picker {
  width: min(500px, calc(100vw - 32px));
  height: fit-content;
}

.erp-flow-launch-dialog-shell {
  width: 100%;
  max-width: min(1440px, 100%);
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.erp-flow-launch-dialog-head {
  min-height: 66px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--ui-border);
  background: #ffffff;
}

.erp-flow-launch-dialog-head > div:first-child {
  gap: 1px;
}

.erp-flow-launch-dialog-head > div:first-child > span {
  color: var(--ui-ink-650);
  font-size: 10px;
}

.erp-flow-launch-dialog-head h2 {
  color: var(--ui-ink-950);
  font-size: 19px;
}

.erp-flow-launch-dialog-head p {
  color: var(--ui-ink-650);
  font-size: 11px;
}

.erp-flow-launch-dialog-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: #ffffff;
}

.erp-flow-launch-dialog-close:hover {
  border-color: #efc4c2;
  color: var(--ui-danger);
  background: #fff7f7;
}

.erp-flow-launch-dialog-body {
  min-height: 0;
  flex: 1;
  padding: 12px;
  overflow: auto;
  background: var(--ui-page);
}

.erp-flow-launch-dialog-body.is-form {
  padding: 0;
  background: #ffffff;
}

.erp-flow-launch-dialog-form > .flow-form {
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.flow-form > .form-head {
  min-height: 60px;
  padding: 9px 16px;
  background: #ffffff;
}

.flow-form-state {
  align-self: center;
}

.flow-template-tools {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-surface-subtle);
}

.flow-template-tools > label {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-template-tools > label > span {
  flex: 0 0 auto;
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 650;
}

.flow-template-tools select {
  width: 220px;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  font-size: 12px;
}

.flow-template-tools .table-action {
  min-height: 32px;
  padding-block: 5px;
}

.flow-form-progress {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(120px, 240px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--ui-border);
  background: #ffffff;
}

.flow-form-progress > div {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.flow-form-progress > i {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #e6ebf0;
}

.flow-form-progress > i b {
  background: var(--ui-accent-600);
}

#flow-section-nav {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  overflow-x: auto;
}

#flow-section-nav button {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: #ffffff;
  font-size: 10px;
  white-space: nowrap;
}

#flow-section-nav button:hover,
#flow-section-nav button.is-active {
  border-color: var(--ui-accent-200);
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
}

.workbench-flow-picker-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.workbench-flow-picker-select {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.workbench-flow-picker-form select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 38px;
  border-color: var(--ui-border-strong);
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  appearance: none;
}

/* Data export and settings workspaces */
.data-export-layout {
  min-height: 580px;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  border-top: 1px solid var(--ui-border);
}

.data-export-config {
  padding: 14px;
  border-right: 1px solid var(--ui-border);
  background: #f7f9fb;
}

.data-export-preview-head,
.data-export-download-bar {
  background: #ffffff;
}

.data-export-field-list,
.data-export-statuses {
  border-color: var(--ui-border);
  background: #ffffff;
}

.data-export-empty {
  min-height: 260px;
}

.organization-layout,
.finance-layout,
.material-management-layout,
.payroll-layout {
  gap: 14px;
}

.org-module-dropdown,
.org-project-checks,
.approval-template-list,
.approval-tree-builder {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: none;
}

.dingtalk-directory-picker {
  width: min(980px, calc(100vw - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  border: 0;
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-modal);
}

.dingtalk-directory-picker .organization-picker-body {
  min-height: 500px;
  grid-template-columns: 260px minmax(0, 1fr);
}

.dingtalk-import-department-tree {
  padding: 8px;
}

.dingtalk-import-department-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  padding-inline-start: calc(var(--department-depth, 0) * 12px);
}

.dingtalk-import-department-row > label {
  width: 32px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.dingtalk-import-department-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ui-accent-700);
}

.dingtalk-import-department-row > button,
.dingtalk-import-all-filter {
  min-width: 0;
  margin: 0;
}

.dingtalk-import-all-filter {
  margin-bottom: 4px;
}

.dingtalk-directory-picker .organization-picker-content {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

.dingtalk-import-selection-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.dingtalk-import-selection-tools > span {
  min-width: 0;
  overflow: hidden;
  color: var(--ui-ink-650);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dingtalk-import-selection-tools > div {
  display: flex;
  gap: 6px;
}

.dingtalk-import-selection-tools button {
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
  font-size: 11px;
  font-weight: 650;
}

.dingtalk-import-selection-tools button:hover,
.dingtalk-import-selection-tools button:focus-visible {
  background: var(--ui-primary-100);
}

.dingtalk-import-employee {
  grid-template-columns: 18px 36px minmax(0, 1fr) auto;
}

.dingtalk-import-employee > em {
  align-self: center;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--ui-accent-700);
  background: var(--ui-accent-100);
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
  white-space: nowrap;
}

.dashboard-preview-backdrop,
.system-notice-backdrop {
  background: var(--ui-overlay);
}

.dashboard-preview-panel,
.system-notice-panel {
  border: 0;
  border-radius: var(--ui-radius-lg);
  background: #ffffff;
  box-shadow: var(--ui-shadow-modal);
}

.dashboard-lane-head span,
.data-export-section-title span,
.data-export-field-wide small,
.data-export-preview-head span,
.org-role-name-field > span,
.org-module-checks legend,
.org-role-members-empty,
.approval-template-list-head small,
.approval-template-list > button small,
.approval-tree-note {
  color: var(--ui-ink-650);
}

.data-export-field-wide small,
.approval-template-list-head small,
.approval-template-list > button small {
  font-size: 11px;
}

.approval-tree-step {
  color: #ffffff;
  background: var(--ui-accent-700);
}

/* Retire legacy decorative surfaces without changing business layout. */
.context-card,
.metric-card,
.template-card,
.history-box,
.schedule-editor-toolbar,
.schedule-table-wrap,
.org-table-wrap,
.finance-detail-grid > div {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-950);
  background: #ffffff;
  background-image: none;
  backdrop-filter: none;
  box-shadow: none;
}

.metric-card::before,
.context-card::before,
.template-card::before,
.history-box::before {
  display: none;
}

.context-card.warning {
  border-color: #efc48d;
  background: #fff9f0;
}

.context-card.danger {
  border-color: #efc4c2;
  background: #fff7f7;
}

.context-card.linked:hover {
  border-color: var(--ui-accent-600);
  background: #ffffff;
  background-image: none;
  box-shadow: none;
  transform: none;
}

.template-card .template-meta {
  gap: 0;
  padding: 10px 0;
  border-top: 1px solid var(--ui-border-soft);
  border-bottom: 1px solid var(--ui-border-soft);
}

.template-card .template-meta .context-card {
  min-height: 0;
  padding: 0 10px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.template-card .template-meta .context-card + .context-card {
  padding-right: 0;
  padding-left: 12px;
  border-left: 1px solid var(--ui-border-soft);
}

.template-card .template-meta .context-card strong {
  margin: 3px 0 2px;
  font-size: 14px;
}

.dashboard-operating-loop .dashboard-panel-head {
  background: var(--ui-surface-subtle);
  background-image: none;
}

.workbench-flow-status-intro small,
.workbench-flow-status-group > span {
  font-size: 11px;
}

.workbench-flow-status-button small {
  font-size: 11px;
}

.dashboard-stage-node span b,
.approval-tree-node-fields label > span {
  font-size: 11px;
}

.data-export-field-actions button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 11px;
}

.approval-template-layout {
  min-height: 300px;
}

.approval-tree-nodes {
  min-height: 120px;
  gap: 12px;
  padding: 14px;
}

.approval-tree-node {
  gap: 10px;
  padding: 10px;
  border-color: var(--ui-border);
  box-shadow: none;
}

.approval-tree-connector {
  bottom: -13px;
  height: 12px;
  background: var(--ui-accent-500);
}

/* Login surface stays visually related without inheriting the dense app shell. */
.login-gate {
  background: var(--ui-primary-950);
}

.login-gate-card {
  width: min(420px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 64px rgba(3, 20, 48, 0.28);
}

@media (min-width: 1800px) {
  :root {
    --ui-space-page: 24px;
  }

  .erp-main {
    padding-inline: 28px;
  }

  .view-root,
  .workspace-tabs {
    max-width: var(--ui-content-max);
  }
}

@media (max-width: 1180px) {
  :root {
    --ui-sidebar-width: 196px;
    --ui-space-page: 16px;
  }

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

  .workbench-flow-status-bar {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .dashboard-chart-suite {
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  }

  .boss-kpi-card {
    padding-inline: 12px;
  }

  .flow-template-tools {
    flex-wrap: wrap;
  }

  .flow-form-progress {
    grid-template-columns: auto minmax(100px, 180px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .workbench-flow-status-bar {
    grid-template-columns: 1fr;
  }

  .workbench-flow-status-intro {
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .boss-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .boss-kpi-card:nth-child(3) {
    border-right: 0;
  }

  .boss-kpi-card:nth-child(n + 4) {
    border-top: 1px solid var(--ui-border-soft);
  }

  .dashboard-chart-suite {
    grid-template-columns: 1fr;
  }

  .dashboard-comparison-chart,
  .dashboard-donut-chart,
  .dashboard-trend-chart {
    grid-column: 1;
  }

  .data-export-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  :root {
    --ui-header-height: 56px;
    --ui-space-page: 12px;
  }

  body {
    font-size: 14px;
  }

  #view-root button {
    min-width: 44px;
    min-height: 44px;
  }

  .erp-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--ui-header-height) minmax(0, 1fr);
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
  }

  .app-header {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .app-header-brand {
    grid-column: 1;
    grid-row: 1;
    padding: 0 6px;
  }

  .app-header-brand .brand {
    justify-content: center;
  }

  .app-header-brand .brand img {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .app-header-brand .brand > div {
    display: none;
  }

  .app-header-workspace {
    width: auto;
    grid-column: 2;
    grid-row: 1;
    padding: 0 10px;
  }

  .app-header .topbar.is-compact {
    width: 100%;
    min-height: 44px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "search actions";
    gap: 6px;
  }

  .app-header .global-search input {
    height: 42px;
    min-height: 42px;
    padding-inline: 30px 8px;
    font-size: 12px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .cloud-sync-status {
    width: 24px;
  }

  .user-menu-anchor,
  .user-name-button.user-avatar-button {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 42px;
  }

  .app-header .user-name-button.user-avatar-button {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
  }

  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .erp-sidebar,
  .erp-shell > .erp-sidebar {
    width: 100%;
    height: calc(58px + env(safe-area-inset-bottom));
    position: fixed;
    inset: auto 0 0;
    z-index: 240;
    display: flex;
    padding: 4px 6px max(4px, env(safe-area-inset-bottom));
    overflow: visible;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: var(--ui-primary-900);
  }

  .module-nav.ui-system-v2 {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    gap: 3px;
  }

  .module-nav-group {
    display: contents;
    padding: 0;
    border: 0;
  }

  .module-nav-title,
  .module-nav-branch:not(:has(> button[data-mobile-primary])),
  .module-nav-group > button:not([data-mobile-primary]) {
    display: none;
  }

  .module-nav button[data-mobile-primary],
  .mobile-more-toggle {
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: var(--ui-radius-sm);
    font-size: 10px;
    text-align: center;
  }

  .module-nav button[data-mobile-primary]::before {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .module-nav-label {
    flex: 0 0 auto;
  }

  .module-nav-chevron,
  .module-subnav {
    display: none;
  }

  .erp-main {
    grid-column: 1;
    grid-row: 2;
    padding: var(--ui-space-page);
  }

  .workspace-tabs {
    gap: 5px;
    margin-bottom: 8px;
    overflow-x: auto;
  }

  .workspace-tab {
    flex: 0 0 auto;
  }

  .view-root {
    gap: 10px;
  }

  .workspace-page-head,
  .workbench-heading {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 0 0 10px;
  }

  .workspace-page-head h1,
  .workbench-heading h1 {
    font-size: 19px;
  }

  .workbench-heading > .workbench-heading-actions {
    width: 100%;
    flex-direction: row;
  }

  .dashboard-page-head-actions {
    width: 100%;
  }

  .workbench-secondary-action,
  .workbench-primary-action,
  .dashboard-project-picker.compact {
    min-height: 44px;
  }

  .workbench-secondary-action,
  .workbench-primary-action {
    flex: 1 1 0;
  }

  .dashboard-project-picker.compact select {
    height: 44px;
  }

  .workbench-flow-status-groups {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .workbench-next-action-list {
    grid-template-columns: 1fr;
  }

  .app-header .global-search input,
  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
    height: 44px;
    min-height: 44px;
  }

  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
  }

  .workbench-flow-status-button,
  .tabs button,
  .finance-subnav button,
  .contract-subtabs button,
  .project-subtabs button,
  .party-subtabs button,
  .organization-subtabs button,
  .workspace-tab-activate,
  .workspace-tab-close,
  .dashboard-trend-legend button {
    min-height: 44px;
  }

  .workbench-flow-status-group {
    padding: 5px 0;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .workbench-flow-status-group:last-child {
    border-bottom: 0;
  }

  .workbench-flow-record {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    min-height: 68px;
  }

  .workbench-flow-process,
  .workbench-flow-record > .table-action {
    display: none;
  }

  .boss-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .boss-kpi-card,
  .boss-kpi-card:nth-child(3) {
    min-height: 88px;
    border-right: 1px solid var(--ui-border-soft);
    border-top: 1px solid var(--ui-border-soft);
  }

  .boss-kpi-card:nth-child(-n + 2) {
    border-top: 0;
  }

  .boss-kpi-card:nth-child(2n) {
    border-right: 0;
  }

  .dashboard-command-main {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .dashboard-chart-panel,
  .dashboard-trend-chart {
    min-height: 270px;
  }

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

  .form-section-label {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .form-grid select,
  .flow-form .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .flow-form .form-grid select,
  .table-action,
  .form-actions button,
  .line-table-head button {
    min-height: 44px;
  }

  .form-grid textarea,
  .flow-form .form-grid textarea {
    min-height: 96px;
    font-size: 14px;
  }

  #contract-line-items,
  #expense-line-items,
  #settlement-line-items {
    overflow: visible;
  }

  .business-line-table {
    min-width: 0;
    table-layout: auto;
  }

  .business-line-table.contract-line-table,
  .business-line-table.supplier-settlement-line-table {
    min-width: 0;
  }

  .mobile-editable-table .business-line-table colgroup {
    display: none;
  }

  .mobile-editable-table .business-line-table .line-serial {
    width: auto;
  }

  #flow-form .business-line-table .line-header-input {
    height: 44px;
    min-height: 44px;
  }

  .erp-flow-launch-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .erp-flow-launch-dialog.is-picker {
    width: calc(100vw - 24px);
    height: fit-content;
    max-height: calc(100dvh - 24px);
    margin: auto;
    border-radius: var(--ui-radius-lg);
  }

  .erp-flow-launch-dialog-head {
    min-height: 62px;
    padding: max(9px, env(safe-area-inset-top)) 12px 9px;
  }

  .erp-flow-launch-dialog-head p {
    display: none;
  }

  .erp-flow-launch-dialog-close {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .flow-form > .form-head {
    min-height: 56px;
    padding: 8px 12px;
  }

  .flow-template-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 12px;
  }

  .flow-template-tools > label {
    min-width: 0;
    grid-column: 1 / -1;
  }

  .flow-template-tools select {
    width: 100%;
    height: 44px;
  }

  .flow-template-tools .table-action {
    min-width: 0;
    min-height: 44px;
  }

  .flow-form-progress {
    grid-template-columns: 1fr auto;
    padding: 8px 12px;
  }

  .flow-form-progress > i {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  #flow-section-nav {
    grid-row: 3;
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  #flow-section-nav button {
    min-height: 44px;
  }

  .form-actions {
    min-height: 64px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  }

  .data-export-layout {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .data-export-config {
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .data-export-field-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-card .template-meta .context-card {
    padding-right: 0;
  }

  .template-card .template-meta .context-card + .context-card {
    margin-top: 8px;
    padding-top: 8px;
    padding-left: 0;
    border-top: 1px solid var(--ui-border-soft);
    border-left: 0;
  }

  .panel-title,
  .dashboard-panel-head,
  .workbench-section-head {
    padding-inline: 10px;
  }

  .dingtalk-directory-picker {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .dingtalk-directory-picker .organization-picker-body {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .dingtalk-import-department-tree {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px 8px;
    overflow-x: auto;
  }

  .dingtalk-import-department-row {
    flex: 0 0 auto;
    grid-template-columns: 32px auto;
    padding-inline-start: 0;
  }

  .dingtalk-import-department-row > label,
  .dingtalk-import-department-row > button,
  .dingtalk-import-all-filter {
    min-height: 44px;
  }

  .dingtalk-import-selection-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .dingtalk-import-selection-tools button {
    min-height: 40px;
  }

  .dingtalk-import-employee {
    grid-template-columns: 18px 36px minmax(0, 1fr) auto;
  }
}

/* Business ledgers: show the decision fields first and keep supporting fields inside each group. */
.business-ledger {
  min-width: 0;
  border-top: 1px solid var(--ui-border-soft);
}

.business-ledger .data-table-shell {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}

.business-ledger .data-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border: 0;
  border-radius: 0;
}

.project-ledger .data-table th:nth-child(1),
.project-ledger .data-table td:nth-child(1) { width: 21%; }
.project-ledger .data-table th:nth-child(2),
.project-ledger .data-table td:nth-child(2) { width: 16%; }
.project-ledger .data-table th:nth-child(3),
.project-ledger .data-table td:nth-child(3) { width: 16%; }
.project-ledger .data-table th:nth-child(4),
.project-ledger .data-table td:nth-child(4) { width: 16%; }
.project-ledger .data-table th:nth-child(5),
.project-ledger .data-table td:nth-child(5) { width: 16%; }
.project-ledger .data-table th:nth-child(6),
.project-ledger .data-table td:nth-child(6) { width: 15%; }

.contract-ledger-table .data-table th:nth-child(1),
.contract-ledger-table .data-table td:nth-child(1) { width: 20%; }
.contract-ledger-table .data-table th:nth-child(2),
.contract-ledger-table .data-table td:nth-child(2) { width: 16%; }
.contract-ledger-table .data-table th:nth-child(3),
.contract-ledger-table .data-table td:nth-child(3) { width: 14%; }
.contract-ledger-table .data-table th:nth-child(4),
.contract-ledger-table .data-table td:nth-child(4) { width: 16%; }
.contract-ledger-table .data-table th:nth-child(5),
.contract-ledger-table .data-table td:nth-child(5) { width: 16%; }
.contract-ledger-table .data-table th:nth-child(6),
.contract-ledger-table .data-table td:nth-child(6) { width: 11%; }
.contract-ledger-table .data-table th:nth-child(7),
.contract-ledger-table .data-table td:nth-child(7) { width: 7%; min-width: 76px; }

.business-ledger .data-table tbody td {
  min-width: 0;
  max-width: none;
  padding: 10px 11px;
  vertical-align: top;
  white-space: normal;
}

.business-ledger .data-table tbody td.is-ledger-cell {
  min-width: 0;
  max-width: none;
  text-align: left;
  white-space: normal;
}

.business-ledger .data-table tbody td.is-text {
  min-width: 0;
  max-width: none;
}

.ledger-record-cell,
.ledger-party-cell,
.ledger-status-cell {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 3px;
}

.ledger-record-context,
.ledger-record-cell small,
.ledger-party-cell small,
.ledger-party-cell > span,
.ledger-status-cell > small {
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ledger-record-link {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: var(--ui-primary-900);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
}

.ledger-record-link:hover {
  color: var(--ui-accent-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ledger-record-number {
  color: var(--ui-ink-800);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.ledger-party-cell strong {
  color: var(--ui-ink-950);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ledger-metric-stack {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 2px;
}

.ledger-metric-link,
.ledger-static-metric {
  min-width: 0;
  min-height: 27px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-650);
  background: transparent;
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
}

.ledger-metric-stack > :last-child {
  border-bottom: 0;
}

.ledger-metric-link {
  width: 100%;
  cursor: pointer;
}

.ledger-metric-link:hover,
.ledger-metric-link:focus-visible {
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
}

.ledger-metric-link span,
.ledger-static-metric span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ledger-metric-link strong,
.ledger-static-metric strong {
  color: var(--ui-ink-950);
  font-size: 12px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-metric-link.positive strong,
.ledger-static-metric.positive strong { color: var(--ui-income); }
.ledger-metric-link.warning strong,
.ledger-static-metric.warning strong { color: var(--ui-warning); }
.ledger-metric-link.negative strong,
.ledger-static-metric.negative strong { color: var(--ui-danger); }

.ledger-status-cell > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.ledger-status-cell > strong {
  color: var(--ui-ink-800);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ledger-alert-stack {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.ledger-alert-link {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  border: 0;
  color: var(--ui-ink-800);
  background: transparent;
  text-align: left;
}

.ledger-alert-link strong {
  min-width: 28px;
  color: var(--ui-primary-900);
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ledger-alert-link span,
.ledger-secondary-stat {
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.4;
}

.ledger-alert-link.has-warning strong { color: var(--ui-warning); }
.ledger-alert-link:hover,
.ledger-alert-link:focus-visible { background: var(--ui-primary-050); }

.ledger-secondary-stat {
  display: flex;
  gap: 4px;
  align-items: baseline;
}

.ledger-secondary-stat strong {
  color: var(--ui-ink-800);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .business-ledger .data-table-shell {
    overflow: visible;
  }

  .business-ledger .data-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .business-ledger .data-table tbody td {
    width: auto;
    min-width: 0 !important;
    max-width: none !important;
    align-items: flex-start;
  }

  .business-ledger .data-table tbody td > .ledger-record-cell,
  .business-ledger .data-table tbody td > .ledger-party-cell,
  .business-ledger .data-table tbody td > .ledger-metric-stack,
  .business-ledger .data-table tbody td > .ledger-status-cell,
  .business-ledger .data-table tbody td > .ledger-alert-stack {
    flex: 1 1 auto;
    width: auto;
    max-width: 100%;
  }

  .ledger-metric-link,
  .ledger-static-metric {
    min-height: 32px;
  }

  .ledger-record-link {
    font-size: 14px;
  }
}

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

/* Operational template presentation system.
 * Repeated forms, ledgers, settings templates and empty states share one
 * hierarchy so business pages read as one product rather than page patches.
 */
.panel-title {
  min-height: 52px;
  padding: 10px 16px;
}

.panel-title > div:first-child {
  min-width: 0;
  padding-inline-start: 11px;
  border-inline-start: 3px solid var(--ui-accent-500);
}

.panel-title > div:first-child::before {
  display: none;
}

.panel-title > div:first-child > span {
  max-width: 88ch;
  line-height: 1.45;
}

.flow-section-title {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid var(--ui-border-soft);
  border-bottom: 1px solid var(--ui-border-soft);
  border-radius: 0;
  color: var(--ui-primary-900);
  background: var(--ui-surface-subtle);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.panel > .context-grid.compact-context {
  gap: 0;
  margin: 0;
  padding: 12px 14px;
}

.panel > .context-grid.compact-context > .context-card {
  min-height: 76px;
  padding: 9px 12px;
  border-radius: 0;
  border-left-width: 0;
}

.panel > .context-grid.compact-context > .context-card:first-child {
  border-left-width: 1px;
  border-radius: var(--ui-radius-sm) 0 0 var(--ui-radius-sm);
}

.panel > .context-grid.compact-context > .context-card:last-child {
  border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
}

.empty-state {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 0;
  border-radius: 0;
  color: var(--ui-ink-650);
  background: #fbfcfd;
  box-shadow: none;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.panel > .empty-state {
  border-top: 1px solid var(--ui-border-soft);
}

.empty-state > strong,
.empty-state > span {
  max-width: 64ch;
}

.table-empty-cell,
.workbench-table-empty {
  height: 96px;
  min-height: 96px;
  padding: 18px !important;
  color: var(--ui-ink-650) !important;
  background: #fbfcfd !important;
  text-align: center !important;
}

.data-table tbody tr:nth-child(even) td,
.workbench-project-table tbody tr:nth-child(even) td,
.org-directory-table tbody tr:nth-child(even) td,
.data-export-table tbody tr:nth-child(even) td {
  background: #fbfcfd;
}

.data-table tbody tr:hover td,
.workbench-project-table tbody tr:hover td,
.org-directory-table tbody tr:hover td,
.data-export-table tbody tr:hover td {
  background: var(--ui-primary-050);
}

.data-table td.is-money > .table-action.amount-link,
.data-table td:first-child > .table-action[data-project-preview] {
  min-height: 28px;
  padding: 3px 6px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: transparent;
  box-shadow: none;
  font-weight: 700;
}

.data-table td.is-money > .table-action.amount-link:hover,
.data-table td.is-money > .table-action.amount-link:focus-visible,
.data-table td:first-child > .table-action[data-project-preview]:hover,
.data-table td:first-child > .table-action[data-project-preview]:focus-visible {
  color: var(--ui-primary-950);
  background: var(--ui-accent-100);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.contract-ledger-group-switch {
  gap: 16px;
  margin: 0;
  padding: 0 14px;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  border-radius: 0;
  background: #ffffff;
}

.contract-ledger-group-switch button {
  min-height: 40px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--ui-ink-650);
  background: transparent;
}

.contract-ledger-group-switch button:hover,
.contract-ledger-group-switch button.is-active {
  border-color: var(--ui-accent-600);
  color: var(--ui-primary-900);
  background: transparent;
}

.flow-form > .form-head {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px 16px;
}

.flow-form > .form-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.flow-form-state {
  display: grid;
  justify-items: end;
  gap: 1px;
}

.flow-template-tools {
  min-height: 0;
  display: block;
  padding: 0;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-surface-subtle);
}

.flow-template-tools > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 16px;
  color: var(--ui-ink-800);
  cursor: pointer;
  list-style: none;
}

.flow-template-tools > summary::-webkit-details-marker {
  display: none;
}

.flow-template-tools > summary:hover {
  background: #f3f6f8;
}

.flow-template-tools > summary > span {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.flow-template-tools > summary strong {
  color: var(--ui-ink-950);
  font-size: 12px;
  font-weight: 700;
}

.flow-template-tools > summary small {
  color: var(--ui-ink-650);
  font-size: 11px;
}

.flow-template-tools > summary b {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: var(--ui-primary-900);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-template-tools > summary b::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.flow-template-tools[open] > summary b::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.flow-template-tools-body {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, auto);
  align-items: end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--ui-border-soft);
  background: #ffffff;
}

.flow-template-tools-body > label {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.flow-template-tools-body > label > span {
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 650;
}

.flow-template-tools-body select {
  width: 100%;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  font-size: 12px;
}

.flow-template-tools-body .table-action {
  min-height: 34px;
}

.flow-form-progress {
  position: sticky;
  top: 0;
  z-index: 16;
  min-height: 46px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 10px rgba(15, 52, 118, 0.06);
}

#flow-section-nav button {
  min-height: 32px;
  font-size: 11px;
}

.form-section-label[data-flow-section] {
  scroll-margin-top: 58px;
}

.flow-document-number {
  grid-column: span 2;
}

.template-grid {
  gap: 12px;
  padding: 14px;
}

.template-card {
  gap: 9px;
  padding: 14px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.template-title-button {
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--ui-primary-900);
  background: transparent;
  font-size: 16px;
  font-weight: 720;
  line-height: 1.4;
  text-align: left;
}

.template-title-button:hover:not(:disabled),
.template-title-button:focus-visible:not(:disabled) {
  color: var(--ui-primary-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.template-title-button:disabled {
  color: var(--ui-ink-800);
}

.template-field-legend {
  gap: 14px;
}

.template-field-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ui-ink-650);
  background: transparent;
  font-size: 11px;
}

.template-field-legend span::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 1px solid var(--ui-accent-600);
  border-radius: 2px;
  background: var(--ui-accent-100);
}

.template-field-legend span:last-child::before {
  border-color: var(--ui-border-strong);
  background: #eef1f4;
}

.template-step-strip {
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-subtle);
}

.template-step-strip span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  border-right: 1px solid var(--ui-border-soft);
  border-radius: 0;
  color: var(--ui-ink-650);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}

.template-step-strip span:last-child {
  border-right: 0;
}

.org-role-summary {
  background: #ffffff;
}

.org-module-dropdown > summary,
.approval-assignment-dropdown > summary {
  background: var(--ui-surface-subtle);
}

.approval-template-layout {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  min-height: 260px;
}

.approval-template-list {
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
}

.approval-tree-builder {
  border: 0;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
}

.payroll-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 220px));
  align-items: end;
  justify-content: start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-surface-subtle);
}

.payroll-filters label {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 650;
}

.payroll-filters :is(input, select) {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  font-size: 12px;
}

.payroll-summary-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: #ffffff;
}

.payroll-summary-metrics > .context-card {
  min-height: 82px;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--ui-border-soft);
  border-radius: 0;
  background: #ffffff;
}

.payroll-summary-metrics > .context-card:last-child {
  border-right: 0;
}

.progress-command {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  background: #ffffff;
}

.progress-command > .context-card {
  min-height: 82px;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--ui-border-soft);
  border-radius: 0;
  background: #ffffff;
}

.progress-command > .context-card:last-child {
  border-right: 0;
}

.schedule-editor {
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}

.schedule-editor > * {
  min-width: 0;
}

.schedule-editor-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(3, auto);
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-subtle);
}

.schedule-editor-toolbar label {
  min-width: 0;
}

.schedule-editor-toolbar :is(select, input) {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
}

.schedule-editor-toolbar .table-action {
  min-height: 36px;
}

.schedule-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
}

.schedule-editor-table {
  min-width: 1320px;
  table-layout: auto;
}

.schedule-editor-table th:nth-child(2),
.schedule-editor-table td:nth-child(2) {
  min-width: 138px;
}

.schedule-editor-table th:nth-child(3),
.schedule-editor-table td:nth-child(3) {
  min-width: 190px;
}

.schedule-editor-table th:nth-child(n + 4):nth-child(-n + 7),
.schedule-editor-table td:nth-child(n + 4):nth-child(-n + 7) {
  min-width: 132px;
}

.schedule-editor-table th:nth-child(10),
.schedule-editor-table td:nth-child(10) {
  min-width: 132px;
}

.schedule-editor-table th:nth-child(11),
.schedule-editor-table td:nth-child(11) {
  min-width: 190px;
}

.schedule-gantt {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
}

.schedule-gantt-head {
  background: var(--ui-surface-subtle);
}

@media (max-width: 1180px) {
  .flow-template-tools-body {
    grid-template-columns: minmax(220px, 1fr) repeat(2, auto);
  }

  .flow-document-number {
    grid-column: span 1;
  }

  .payroll-summary-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .payroll-summary-metrics > .context-card:nth-child(3n) {
    border-right: 0;
  }

  .payroll-summary-metrics > .context-card:nth-child(n + 4) {
    border-top: 1px solid var(--ui-border-soft);
  }

  .panel > .context-grid.compact-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--ui-border-soft);
  }

  .panel > .context-grid.compact-context > .context-card,
  .panel > .context-grid.compact-context > .context-card:first-child,
  .panel > .context-grid.compact-context > .context-card:last-child {
    border: 0;
    border-radius: 0;
  }
}

@media (max-width: 760px) {
  .panel-title {
    min-height: 48px;
    padding: 9px 10px;
  }

  .panel-title > div:first-child {
    padding-inline-start: 9px;
  }

  .panel-title > div:first-child > span {
    display: block;
    margin-top: 2px;
  }

  .project-subtabs,
  .contract-subtabs,
  .finance-subnav,
  .party-subtabs,
  .organization-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    padding: 3px;
    overflow: visible;
  }

  .organization-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-subtabs button,
  .contract-subtabs button,
  .finance-subnav button,
  .party-subtabs button,
  .organization-subtabs button {
    width: 100%;
    min-width: 0;
    padding: 6px 4px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }

  .flow-form > .form-head {
    min-height: 48px;
    padding: 7px 12px;
  }

  .flow-form > .form-head > div:first-child > span,
  .flow-form-state small {
    display: none;
  }

  .flow-template-tools > summary {
    min-height: 44px;
    padding: 7px 12px;
  }

  .flow-template-tools > summary small {
    display: none;
  }

  .flow-template-tools-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px 12px 10px;
  }

  .flow-template-tools-body > label {
    grid-column: 1 / -1;
  }

  .flow-template-tools-body select,
  .flow-template-tools-body .table-action {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .flow-form-progress {
    min-height: 0;
    padding: 7px 12px;
  }

  .flow-document-number {
    grid-column: 1 / -1;
  }

  .payroll-filters {
    grid-template-columns: minmax(0, 1fr);
    padding: 9px 10px;
  }

  .payroll-filters :is(input, select) {
    min-height: 44px;
    font-size: 14px;
  }

  .payroll-summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payroll-summary-metrics > .context-card,
  .payroll-summary-metrics > .context-card:nth-child(3n) {
    border-right: 1px solid var(--ui-border-soft);
  }

  .payroll-summary-metrics > .context-card:nth-child(2n) {
    border-right: 0;
  }

  .payroll-summary-metrics > .context-card:nth-child(n + 3) {
    border-top: 1px solid var(--ui-border-soft);
  }

  .payroll-summary-metrics > .context-card:last-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .progress-command {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-command > .context-card {
    border-right: 1px solid var(--ui-border-soft);
  }

  .progress-command > .context-card:nth-child(2n) {
    border-right: 0;
  }

  .progress-command > .context-card:nth-child(n + 3) {
    border-top: 1px solid var(--ui-border-soft);
  }

  .schedule-editor {
    padding: 10px;
  }

  .schedule-editor-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 9px;
  }

  .schedule-editor-toolbar label {
    grid-column: 1 / -1;
  }

  .schedule-editor-toolbar .table-action {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 5px;
    white-space: normal;
  }

  .panel > .context-grid.compact-context {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 10px;
  }

  .template-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .template-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-card .template-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-step-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .template-actions .table-action {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .approval-template-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .approval-template-list {
    max-height: 220px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .approval-tree-builder {
    border-left: 0;
  }

  .data-table td.is-money > .table-action.amount-link,
  .data-table td:first-child > .table-action[data-project-preview] {
    min-height: 44px;
  }

  .empty-state,
  .table-empty-cell,
  .workbench-table-empty {
    min-height: 80px;
  }
}

/* Task-focused workflow surfaces: keep entry and approval decisions compact. */
.erp-flow-launch-dialog:not(.is-picker) {
  width: min(1240px, calc(100vw - 32px));
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-shell {
  max-width: 1240px;
}

.erp-flow-launch-dialog-head {
  min-height: 54px;
  padding-block: 8px;
}

.erp-flow-launch-dialog-head h2 {
  font-size: 18px;
}

.flow-template-tools > summary {
  min-height: 40px;
}

.flow-template-summary-side {
  min-width: 0;
  display: flex;
  align-items: center !important;
  justify-content: flex-end;
  gap: 12px !important;
}

.flow-template-summary-side .flow-form-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.flow-template-summary-side .flow-form-state > span {
  padding: 2px 6px;
  border: 1px solid var(--ui-border);
  border-radius: 3px;
  color: var(--ui-primary-900);
  background: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

.flow-template-summary-side .flow-form-state small {
  font-size: 10px;
}

.flow-form-progress.is-single-section {
  grid-template-columns: auto minmax(120px, 240px);
}

.flow-form-progress.is-single-section #flow-section-nav {
  display: none;
}

.flow-document-number {
  grid-column: span 1;
}

.flow-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border-soft);
  border-radius: 0;
  color: var(--ui-ink-800);
  background: #ffffff;
  box-shadow: none;
}

.flow-preview > span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  border-right: 1px solid var(--ui-border-soft);
}

.flow-preview > span:first-child {
  padding-left: 0;
}

.flow-preview > span:last-child {
  border-right: 0;
}

.flow-preview b {
  color: var(--ui-ink-650);
  font-size: 10px;
  font-weight: 650;
}

.flow-preview strong {
  overflow: hidden;
  color: var(--ui-ink-950);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1101px) {
  .flow-form .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.flow-record-preview-panel.is-approval-mode {
  width: min(1240px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 68px;
  padding: 10px 16px;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  grid-template-columns: minmax(0, 1fr) 370px;
}

.flow-approval-focus {
  gap: 12px;
  margin: 14px 16px 12px;
  padding: 15px 16px;
  box-shadow: none;
}

.flow-approval-focus-head {
  align-items: center;
  padding-bottom: 10px;
}

.flow-approval-focus-head strong {
  font-size: 15px;
}

.flow-approval-risk-banner {
  border-left: 1px solid #f1d39c;
}

.flow-approval-risk-banner.is-high {
  border-left-color: #efb7b4;
}

.flow-approval-risk-banner.is-clear {
  grid-template-columns: minmax(0, 1fr);
  border-left-color: #b9ddda;
}

.flow-record-preview-panel.is-approval-mode .dashboard-preview-table {
  padding: 0 16px 20px;
}

.flow-approval-attachment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  border: 1px solid var(--ui-border);
  border-radius: 0 0 5px 5px;
  background: var(--ui-border-soft);
  list-style: none;
}

.flow-approval-attachment-list li {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  background: #ffffff;
}

.flow-approval-attachment-list :is(a, button) {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-business-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--ui-border);
  border-radius: 0 0 5px 5px;
  background: #ffffff;
}

.flow-approval-business-details > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(96px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  padding: 9px 11px;
  border-right: 1px solid var(--ui-border-soft);
  border-bottom: 1px solid var(--ui-border-soft);
}

.flow-approval-business-details > div:nth-child(2n),
.flow-approval-business-details > div.is-wide {
  border-right: 0;
}

.flow-approval-business-details > div.is-wide {
  grid-column: 1 / -1;
}

.flow-approval-business-details dt,
.flow-approval-business-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}

.flow-approval-business-details dt {
  color: var(--ui-ink-650);
}

.flow-approval-business-details dd {
  color: var(--ui-ink-950);
  font-weight: 650;
}

.flow-approval-workbench {
  height: calc(100dvh - 100px);
  max-height: calc(100dvh - 100px);
  gap: 14px;
  padding: 16px;
}

.flow-approval-comment-field textarea {
  min-height: 104px;
}

.flow-approval-actions {
  bottom: 0;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 7px;
  margin: 0 -16px -16px;
  padding: 12px 16px 16px;
}

.flow-approval-actions .primary {
  grid-column: auto;
  min-height: 40px;
}

.flow-approval-actions .table-action:first-child {
  grid-column: auto;
}

@media (max-width: 1040px) {
  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: max-content max-content max-content;
    align-content: start;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
    display: contents;
  }

  .flow-approval-focus {
    order: 1;
  }

  .flow-approval-workbench {
    order: 2;
    height: auto;
    max-height: none;
  }

  .flow-record-preview-panel.is-approval-mode .dashboard-preview-table {
    order: 3;
  }

  .flow-approval-actions {
    margin: 0;
    padding: 12px 0 0;
  }
}

@media (max-width: 760px) {
  .erp-flow-launch-dialog:not(.is-picker) {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .flow-template-summary-side .flow-form-state small,
  .flow-template-tools > summary > span:first-child small {
    display: none;
  }

  .flow-template-summary-side {
    gap: 7px !important;
  }

  .flow-form-progress.is-single-section {
    grid-template-columns: auto minmax(90px, 1fr);
  }

  .flow-preview {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 10px;
  }

  .flow-preview > span,
  .flow-preview > span:first-child {
    padding: 7px 0;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .flow-preview > span:last-child {
    border-bottom: 0;
  }

  .flow-approval-attachment-list,
  .flow-approval-business-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-approval-business-details > div,
  .flow-approval-business-details > div:nth-child(2n) {
    grid-template-columns: minmax(84px, 0.38fr) minmax(0, 1fr);
    border-right: 0;
  }

  .flow-approval-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-approval-actions .primary {
    grid-column: 1 / -1;
    order: -1;
  }
}

/* 2026-08-12 workflow task surface v2 */
@media (min-width: 761px) {
  #erp-flow-launch-dialog:not(.is-picker)[open] {
    position: fixed;
    inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
    z-index: calc(var(--z-sticky) - 1);
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--ui-page);
    box-shadow: none;
  }

  #erp-flow-launch-dialog:not(.is-picker)::backdrop {
    background: transparent;
    backdrop-filter: none;
  }
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-shell {
  width: 100%;
  height: 100%;
  max-width: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--ui-page);
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head {
  min-height: 54px;
  padding: 8px max(18px, var(--ui-space-page));
  border-bottom: 1px solid var(--ui-border);
  background: #ffffff;
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head h2 {
  color: var(--ui-ink-950);
  font-size: 16px;
  font-weight: 730;
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
  min-height: 0;
  padding: 0 max(18px, var(--ui-space-page)) 28px;
  overflow-y: auto;
  background: var(--ui-page);
  scrollbar-gutter: stable;
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form,
#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form > .flow-form {
  width: 100%;
  max-width: 1420px;
  min-height: 100%;
  margin-inline: auto;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(292px, 320px);
  grid-template-areas:
    "document document"
    "templates rail"
    "progress rail"
    "fields rail"
    "actions rail";
  column-gap: 16px;
  row-gap: 0;
  align-items: start;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-document-head {
  grid-area: document;
  min-height: 116px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  grid-template-areas:
    "category number"
    "title number"
    "description number";
  justify-items: start;
  align-content: center;
  align-items: center;
  gap: 2px 24px;
  padding: 20px 2px 16px;
  border: 0;
  text-align: left;
  background: transparent;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-category {
  grid-area: category;
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 650;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-head h3 {
  grid-area: title;
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 23px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: left;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-head p {
  max-width: 72ch;
  grid-area: description;
  margin: 2px 0 0;
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.55;
  text-wrap: pretty;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-number {
  width: 100%;
  min-height: 54px;
  grid-area: number;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-650);
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-number > span {
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--ui-ink-650);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-number > input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: var(--ui-surface-subtle);
  box-shadow: none;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-template-tools {
  grid-area: templates;
  margin: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-template-tools > summary {
  min-height: 44px;
  padding: 7px 14px;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-template-tools > summary > span:first-child {
  gap: 8px;
  display: flex;
  align-items: center;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-template-tools > summary > span:first-child small {
  color: var(--ui-ink-650);
  font-size: 10px;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-template-tools-body {
  grid-template-columns: minmax(220px, 1fr) repeat(4, auto);
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--ui-border-soft);
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress {
  min-height: 44px;
  grid-area: progress;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 6px 12px;
  position: static;
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
  border-left: 1px solid var(--ui-border);
  background: #ffffff;
  box-shadow: none;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress > div,
#erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress > i {
  display: none;
}

#erp-flow-launch-dialog .flow-form-streamlined #flow-section-nav {
  min-width: 0;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

#erp-flow-launch-dialog .flow-form-streamlined #flow-section-nav button {
  min-height: 30px;
  flex: 0 0 auto;
  gap: 5px;
  padding: 4px 8px;
  border: 0;
  border-radius: 5px;
  color: var(--ui-ink-650);
  background: transparent;
  font-size: 10px;
}

#erp-flow-launch-dialog .flow-form-streamlined #flow-section-nav button:hover,
#erp-flow-launch-dialog .flow-form-streamlined #flow-section-nav button:focus-visible,
#erp-flow-launch-dialog .flow-form-streamlined #flow-section-nav button.is-active {
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  outline: 0;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
  min-width: 0;
  grid-area: fields;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 16px 14px;
  padding: 14px 16px 24px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-left: 1px solid var(--ui-border);
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-field {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(40px, auto);
  align-items: start;
  gap: 6px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label > span,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-field > span {
  min-width: 0;
  min-height: 18px;
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  color: var(--ui-ink-800);
  background: transparent;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.45;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label > :is(input, select, textarea, button, .percent-input-control),
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-field > .flow-related-trigger {
  width: 100%;
  min-width: 0;
  grid-column: 1;
  grid-row: 2;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
#erp-flow-launch-dialog .flow-form-streamlined .readonly-link,
#erp-flow-launch-dialog .flow-form-streamlined .percent-input-control,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-trigger {
  min-height: 40px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  font-size: 12px;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid textarea {
  min-height: 86px;
  padding: 9px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  font-size: 12px;
  line-height: 1.55;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(input, select, textarea, button):focus-visible {
  border-color: var(--ui-accent-600);
  outline: 0;
  box-shadow: var(--ui-focus);
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid label[data-flow-field="amount"] input {
  border-color: #9fb7d6;
  color: var(--ui-primary-900);
  background: #fbfdff;
  font-size: 15px;
  font-weight: 760;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid input[readonly],
#erp-flow-launch-dialog .flow-form-streamlined .readonly-link {
  color: var(--ui-primary-900);
  background: var(--ui-surface-subtle);
  font-weight: 700;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-related-chips {
  grid-column: 1;
  grid-row: 3;
  padding: 6px 0 0;
  border: 0;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-section-label,
#erp-flow-launch-dialog .flow-form-streamlined .form-grid > :is(.field-wide, .contract-lines, .attachment-upload-control) {
  grid-column: 1 / -1;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid {
  counter-reset: workflow-section;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-section-label {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 0;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  color: var(--ui-ink-950);
  background: transparent;
  font-size: 14px;
  font-weight: 740;
  scroll-margin-top: 70px;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-section-label::before {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  counter-increment: workflow-section;
  content: counter(workflow-section, decimal-leading-zero);
  border-radius: 50%;
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  font-size: 10px;
  font-weight: 800;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-section-incomplete-count {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid #ead4aa;
  border-radius: 999px;
  color: #80500e;
  background: #fff8eb;
  font-size: 10px;
  font-weight: 700;
}

#erp-flow-launch-dialog .flow-form-streamlined .contract-lines,
#erp-flow-launch-dialog .flow-form-streamlined .attachment-upload-control {
  margin-top: 2px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
  min-width: 0;
  max-height: calc(100dvh - var(--ui-header-height) - 84px);
  grid-area: rail;
  position: sticky;
  top: 16px;
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: var(--ui-shadow-panel);
}

#erp-flow-launch-dialog .flow-task-rail-card {
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-task-rail-card:first-child {
  border-radius: var(--ui-radius) var(--ui-radius) 0 0;
}

#erp-flow-launch-dialog .flow-task-rail-card > header {
  min-height: 52px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-border-soft);
}

#erp-flow-launch-dialog .flow-task-rail-checks li,
#erp-flow-launch-dialog #flow-task-approval-route li {
  padding: 7px 0;
  font-size: 11px;
}

#erp-flow-launch-dialog .flow-task-rail-note {
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  color: #315f5d;
  background: var(--ui-accent-100);
  font-size: 10px;
  line-height: 1.55;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-preview {
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-preview > span,
#erp-flow-launch-dialog .flow-task-rail > .flow-preview > span:first-child {
  padding: 9px 11px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

#erp-flow-launch-dialog .flow-task-rail > .flow-context {
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--ui-border);
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions {
  min-height: 62px;
  grid-area: actions;
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border: 1px solid var(--ui-border);
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -2px 6px rgba(15, 52, 118, 0.05);
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions #clear-flow-form {
  margin-right: auto;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions #submit-flow {
  min-width: 104px;
}

.global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
  position: fixed;
  inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
  z-index: calc(var(--z-sticky) - 1);
  display: block;
  padding: 0;
  background: var(--ui-page);
  backdrop-filter: none;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: var(--ui-page);
  box-shadow: none;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 78px;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 270px) auto;
  gap: 16px;
  padding: 10px max(20px, var(--ui-space-page));
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-ink-950);
  background: #ffffff;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-title-block strong {
  color: var(--ui-ink-950);
  font-size: 20px;
  font-weight: 760;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount strong {
  color: var(--ui-primary-900);
  font-size: 24px;
  font-weight: 780;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  width: min(1480px, 100%);
  height: calc(100dvh - var(--ui-header-height) - 78px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 370px);
  gap: 0;
  margin-inline: auto;
  overflow: hidden;
  background: var(--ui-page);
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  background: var(--ui-page);
  scrollbar-gutter: stable;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-document {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: var(--ui-shadow-panel);
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  min-width: 0;
  min-height: 0;
  max-height: none;
  position: static;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  padding: 18px;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
  background: #eef2f6;
  box-shadow: none;
  scrollbar-gutter: stable;
}

.global-overlay-root .flow-approval-system-checks,
.global-overlay-root .flow-approval-decision-panel {
  border-radius: var(--ui-radius);
  box-shadow: none;
}

.global-overlay-root .flow-approval-review-brief > div {
  grid-template-columns: 78px minmax(0, 1fr);
  padding: 8px 10px;
}

.global-overlay-root .flow-approval-comment-field textarea {
  min-height: 122px;
  font-size: 12px;
  line-height: 1.55;
}

.global-overlay-root .flow-approval-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 8px;
  margin: 0 -14px -14px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--ui-border);
  background: #ffffff;
}

.global-overlay-root .flow-approval-actions .primary {
  min-height: 44px;
  grid-column: auto;
  grid-row: auto;
  order: initial;
}

@media (max-width: 1240px) and (min-width: 761px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
    overflow: visible;
  }

  #erp-flow-launch-dialog .flow-task-rail-note,
  #erp-flow-launch-dialog .flow-task-rail > .flow-preview,
  #erp-flow-launch-dialog .flow-task-rail > .flow-context {
    grid-column: 1 / -1;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
    overflow: visible;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    grid-template-columns: minmax(280px, 0.8fr) minmax(340px, 1.2fr);
    overflow: visible;
    border-top: 1px solid var(--ui-border);
    border-left: 0;
  }

  .global-overlay-root .flow-approval-actions {
    position: static;
  }
}

@media (max-width: 760px) {
  #erp-flow-launch-dialog:not(.is-picker)[open] {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head {
    min-height: 54px;
    padding: 7px 10px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
    padding: 0;
    scrollbar-gutter: auto;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-document-head {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "category"
      "title"
      "description"
      "number";
    gap: 3px;
    padding: 14px 12px 12px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .flow-document-head h3 {
    font-size: 20px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .flow-document-head p {
    font-size: 11px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .flow-document-number {
    min-height: 46px;
    margin-top: 8px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-template-tools {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

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

  #erp-flow-launch-dialog .flow-form-streamlined .flow-template-tools-body > label {
    grid-column: 1 / -1;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress {
    border-right: 0;
    border-left: 0;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    padding: 12px 12px 18px;
    border-right: 0;
    border-left: 0;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .form-grid > label,
  #erp-flow-launch-dialog .flow-form-streamlined .flow-related-field {
    grid-template-columns: minmax(0, 1fr);
  }

  #erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
  #erp-flow-launch-dialog .flow-form-streamlined .readonly-link,
  #erp-flow-launch-dialog .flow-form-streamlined .percent-input-control,
  #erp-flow-launch-dialog .flow-form-streamlined .flow-related-trigger {
    min-height: 44px;
    font-size: 14px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .form-grid textarea {
    min-height: 94px;
    font-size: 14px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    margin: 12px;
    overflow: visible;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-actions {
    min-height: 64px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
    display: grid;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-actions button {
    min-width: 0;
    min-height: 44px;
    margin: 0;
  }

  .global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
    inset: 0;
    z-index: var(--z-modal-backdrop);
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode {
    height: 100dvh;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
    min-height: 104px;
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    width: 100%;
    height: calc(100dvh - 104px);
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
    padding: 10px;
    overflow: visible;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 10px 12px;
    overflow: visible;
    border-top: 1px solid var(--ui-border);
    border-left: 0;
    background: var(--ui-page);
  }

  .global-overlay-root .flow-approval-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 -12px -12px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .global-overlay-root .flow-approval-actions .primary {
    grid-column: 1 / -1;
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #erp-flow-launch-dialog .flow-task-rail-progress-track > i {
    transition: none;
  }
}

/* Operator semantic controls audit 2026-08-14-43 */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

#erp-flow-launch-dialog .flow-form button.readonly-link:disabled {
  color: var(--ui-ink-650);
  border-color: var(--ui-border);
  background: var(--ui-surface-soft);
  text-decoration: none;
  box-shadow: none;
}

.table-missing-value {
  color: var(--ui-ink-650);
  font-weight: 500;
  white-space: nowrap;
}

/* 2026-08-12 workflow cascade lock: keep the task layout above legacy patches. */
@media (min-width: 761px) {
  .erp-flow-launch-dialog:not(.is-picker)[open] {
    position: fixed;
    inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
    z-index: var(--z-modal);
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--ui-page);
    box-shadow: none;
  }

  .erp-flow-launch-dialog:not(.is-picker)::backdrop {
    background: transparent;
    backdrop-filter: none;
  }
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
  padding: 14px max(18px, var(--ui-space-page)) 24px;
  background: var(--ui-page);
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
  width: min(1460px, 100%);
  margin-inline: auto;
}

.erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  grid-template-areas:
    "document document"
    "templates templates"
    "progress progress"
    "fields rail"
    "actions actions";
  align-items: start;
  overflow: visible;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-document-head {
  grid-area: document;
  min-height: 78px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  grid-template-rows: auto auto;
  gap: 2px 24px;
  padding: 13px 18px;
  text-align: left;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-document-head .flow-document-category {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-document-head h3 {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  font-size: 20px;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-document-head .flow-document-number {
  width: 100%;
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-template-tools {
  grid-area: templates;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-form-progress {
  grid-area: progress;
}

.flow-form.is-document-layout.flow-form-streamlined > .form-grid {
  grid-area: fields;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 14px 12px;
  padding: 16px 18px 24px;
  border-right: 1px solid var(--ui-border);
}

.flow-form.is-document-layout.flow-form-streamlined .form-grid > label,
.flow-form.is-document-layout.flow-form-streamlined .flow-related-field {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(40px, auto);
  align-items: start;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.flow-form.is-document-layout.flow-form-streamlined .form-grid > label > span,
.flow-form.is-document-layout.flow-form-streamlined .flow-related-field > span {
  min-height: 18px;
  grid-column: 1;
  grid-row: 1;
  padding: 0;
  border: 0;
  color: var(--ui-ink-800);
  background: transparent;
}

.flow-form.is-document-layout.flow-form-streamlined .form-grid > label > :is(input, select, textarea, button, .percent-input-control),
.flow-form.is-document-layout.flow-form-streamlined .flow-related-field > .flow-related-trigger {
  width: 100%;
  min-width: 0;
  grid-column: 1;
  grid-row: 2;
  border-radius: var(--ui-radius-sm);
}

.flow-form.is-document-layout.flow-form-streamlined .form-section-label,
.flow-form.is-document-layout.flow-form-streamlined .form-grid > :is(.field-wide, .contract-lines, .attachment-upload-control) {
  grid-column: 1 / -1;
}

.flow-form.is-document-layout.flow-form-streamlined > .flow-task-rail {
  grid-area: rail;
  max-height: calc(100dvh - 210px);
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  background: #f6f8fb;
}

.flow-form.is-document-layout.flow-form-streamlined > .form-actions {
  grid-area: actions;
  margin: 0;
}

.flow-task-rail > .flow-preview {
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
}

.flow-task-rail > .flow-preview > span,
.flow-task-rail > .flow-preview > span:first-child {
  padding: 9px 11px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.flow-task-rail > .flow-preview > span:last-child {
  border-bottom: 0;
}

.global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
  inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
  display: block;
  padding: 0;
  background: var(--ui-page);
  backdrop-filter: none;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: var(--ui-page);
  box-shadow: none;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  width: min(1480px, 100%);
  height: calc(100dvh - var(--ui-header-height) - 74px);
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  background: var(--ui-page);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  max-height: none;
  padding: 18px;
  border-left: 1px solid var(--ui-border);
  background: #eef2f6;
}

.flow-approval-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.flow-approval-actions .primary {
  grid-column: 1 / -1;
  grid-row: 1;
}

@media (max-width: 1180px) and (min-width: 761px) {
  .erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  .flow-form.is-document-layout.flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
  }

  .flow-form.is-document-layout.flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--ui-border);
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
    border: 0;
    border-radius: 0;
  }

  .flow-form.is-document-layout.flow-form-streamlined > .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px 12px 18px;
    border-right: 0;
  }

  .flow-form.is-document-layout.flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    padding: 12px;
    overflow: visible;
  }

  .global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
    inset: 0;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    width: 100%;
    height: calc(100dvh - 104px);
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Workflow task surfaces: preserve the application shell and optimize repeated work. */
@media (min-width: 761px) {
  .erp-flow-launch-dialog:not(.is-picker)[open] {
    position: fixed;
    inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
    z-index: calc(var(--z-sticky) - 1);
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--ui-page);
    box-shadow: none;
  }

  .erp-flow-launch-dialog:not(.is-picker)::backdrop {
    background: transparent;
    backdrop-filter: none;
  }

  .erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-shell {
    max-width: none;
  }
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head {
  min-height: 56px;
  padding: 8px max(18px, var(--ui-space-page));
  border-bottom-color: var(--ui-border);
  background: #ffffff;
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head h2 {
  font-size: 17px;
  font-weight: 720;
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
  padding: 14px max(18px, var(--ui-space-page)) 24px;
  background: var(--ui-page);
}

.erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
  width: min(1460px, 100%);
  min-height: 0;
  margin-inline: auto;
}

.erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  grid-template-areas:
    "document document"
    "templates templates"
    "progress progress"
    "fields rail"
    "actions actions";
  align-items: start;
  overflow: visible;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.flow-form-streamlined > .flow-document-head {
  grid-area: document;
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 24px;
  padding: 13px 18px;
  text-align: left;
}

.flow-form-streamlined > .flow-document-head .flow-document-category {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  color: var(--ui-ink-650);
  font-size: 10px;
}

.flow-form-streamlined > .flow-document-head h3 {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.flow-form-streamlined > .flow-document-head .flow-document-number {
  width: 100%;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
}

.flow-form-streamlined > .flow-template-tools {
  grid-area: templates;
}

.flow-form-streamlined > .flow-form-progress {
  grid-area: progress;
}

.flow-form-streamlined > .form-grid {
  grid-area: fields;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 14px 12px;
  padding: 16px 18px 24px;
  border-right: 1px solid var(--ui-border);
  background: #ffffff;
}

.flow-form-streamlined .form-section-label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 0;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-ink-950);
  background: transparent;
  font-size: 14px;
  font-weight: 720;
}

.flow-form-streamlined .form-grid {
  counter-reset: flow-section;
}

.flow-form-streamlined .form-section-label::before {
  counter-increment: flow-section;
  content: counter(flow-section, decimal-leading-zero);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  border-radius: 50%;
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  font-size: 10px;
  font-weight: 800;
}

.flow-form-streamlined .form-grid > label,
.flow-form-streamlined .flow-related-field {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(40px, auto);
  gap: 6px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.flow-form-streamlined .form-grid > label > span,
.flow-form-streamlined .flow-related-field > span {
  min-height: 18px;
  display: flex;
  align-items: center;
  grid-column: 1;
  grid-row: 1;
  padding: 0;
  border: 0;
  color: var(--ui-ink-800);
  background: transparent;
  font-size: 11px;
  font-weight: 680;
}

.flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.flow-form-streamlined .readonly-link,
.flow-form-streamlined .percent-input-control,
.flow-form-streamlined .flow-related-trigger {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  grid-column: 1;
  grid-row: 2;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
}

.flow-form-streamlined .form-grid textarea {
  width: 100%;
  min-height: 84px;
  grid-column: 1;
  grid-row: 2;
  padding: 9px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #ffffff;
}

.flow-form-streamlined .form-grid input[readonly],
.flow-form-streamlined .readonly-link {
  color: var(--ui-primary-900);
  background: var(--ui-surface-subtle);
  font-weight: 700;
}

.flow-form-streamlined .form-grid :is(input, select, textarea, button):focus-visible {
  border-color: var(--ui-accent-600);
  outline: 0;
  box-shadow: var(--ui-focus);
}

.flow-form-streamlined .form-grid > :is(.field-wide, .contract-lines, .attachment-upload-control),
.flow-form-streamlined .form-grid > .form-section-label {
  grid-column: 1 / -1;
}

.flow-form-streamlined .flow-related-chips {
  grid-column: 1;
  grid-row: 3;
  padding: 6px 0 0;
  border: 0;
}

.flow-form-streamlined .contract-lines,
.flow-form-streamlined .attachment-upload-control {
  margin-top: 0;
  border-radius: var(--ui-radius-sm);
}

.flow-form-streamlined > .flow-task-rail {
  grid-area: rail;
  min-width: 0;
  max-height: calc(100dvh - 210px);
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  background: #f6f8fb;
}

.flow-task-rail-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.flow-task-rail-card > header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-border-soft);
}

.flow-task-rail-card > header > div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.flow-task-rail-card > header span,
.flow-task-rail-card > header small {
  color: var(--ui-ink-650);
  font-size: 10px;
}

.flow-task-rail-card > header strong {
  overflow: hidden;
  color: var(--ui-ink-950);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-task-rail-progress-card > header > b {
  color: var(--ui-primary-900);
  font-size: 18px;
}

.flow-task-rail-progress-track {
  height: 4px;
  margin: 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf0;
}

.flow-task-rail-progress-track > i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--ui-accent-600);
  transition: none;
}

.flow-task-rail-checks,
#flow-task-approval-route {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 8px 12px 11px;
  list-style: none;
}

.flow-task-rail-checks li,
#flow-task-approval-route li {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  color: var(--ui-ink-650);
  font-size: 10px;
  line-height: 1.45;
}

.flow-task-rail-checks li > i,
#flow-task-approval-route li > i {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-border-strong);
  border-radius: 50%;
  color: var(--ui-ink-650);
  background: #ffffff;
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
}

.flow-task-rail-checks li.is-ready > i {
  border-color: var(--ui-accent-600);
  color: #ffffff;
  background: var(--ui-accent-600);
}

#flow-task-approval-route li > div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

#flow-task-approval-route li strong,
#flow-task-approval-route li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#flow-task-approval-route li strong {
  color: var(--ui-ink-950);
  font-size: 11px;
}

#flow-task-approval-route li.is-empty > i {
  border-color: #e6c27d;
  color: #8a590d;
  background: #fff7e8;
}

.flow-task-rail-note {
  padding: 10px 11px;
  border: 1px solid var(--ui-accent-200);
  border-radius: var(--ui-radius);
  color: #315f5d;
  background: var(--ui-accent-100);
  font-size: 10px;
  line-height: 1.55;
}

.flow-task-rail > .flow-preview {
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
}

.flow-task-rail > .flow-preview:empty {
  display: none;
}

.flow-task-rail > .flow-preview > span,
.flow-task-rail > .flow-preview > span:first-child {
  padding: 9px 11px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.flow-task-rail > .flow-preview > span:last-child {
  border-bottom: 0;
}

.flow-task-rail > .flow-context {
  min-width: 0;
  display: grid;
  gap: 8px;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-context .context-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-context .context-card {
  min-width: 0;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-context .context-card :is(span, strong, small) {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.flow-task-rail > .flow-context[hidden] {
  display: none;
}

.flow-form-streamlined > .form-actions {
  grid-area: actions;
  margin: 0;
}

/* Approval is a primary workspace, not a dimmed secondary dialog. */
.global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
  inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
  display: block;
  padding: 0;
  background: var(--ui-page);
  backdrop-filter: none;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: var(--ui-page);
  box-shadow: none;
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 74px;
  padding: 10px max(20px, var(--ui-space-page));
  border-bottom: 1px solid var(--ui-border);
  background: #ffffff;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  width: min(1480px, 100%);
  height: calc(100dvh - var(--ui-header-height) - 74px);
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  background: var(--ui-page);
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  padding: 18px;
  background: var(--ui-page);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-document {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  max-height: none;
  padding: 18px;
  border-left: 1px solid var(--ui-border);
  background: #eef2f6;
}

.flow-approval-review-brief {
  display: grid;
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-subtle);
}

.flow-approval-review-brief > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ui-border-soft);
}

.flow-approval-review-brief > div:last-child {
  border-bottom: 0;
}

.flow-approval-review-brief dt,
.flow-approval-review-brief dd {
  min-width: 0;
  margin: 0;
  font-size: 10px;
}

.flow-approval-review-brief dt {
  color: var(--ui-ink-650);
}

.flow-approval-review-brief dd {
  overflow: hidden;
  color: var(--ui-ink-950);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-review-brief dd.is-money {
  color: var(--ui-primary-900);
  font-size: 13px;
}

.flow-approval-decision-panel {
  gap: 12px;
  border-color: var(--ui-border);
}

.flow-approval-comment-field textarea {
  min-height: 126px;
  font-size: 12px;
  line-height: 1.55;
}

.flow-approval-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.flow-approval-actions .primary {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 44px;
}

.flow-approval-actions .danger,
.flow-approval-actions .table-action:not(.primary):not(.danger) {
  grid-row: 2;
}

@media (max-width: 1180px) and (min-width: 761px) {
  .erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
  }

  .flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--ui-border);
    overflow: visible;
  }

  .flow-task-rail-note,
  .flow-task-rail > .flow-preview,
  .flow-task-rail > .flow-context {
    grid-column: 1 / -1;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 330px);
  }
}

@media (max-width: 760px) {
  .erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
    padding: 0;
  }

  .erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
    border: 0;
    border-radius: 0;
  }

  .flow-form-streamlined > .flow-document-head {
    min-height: 84px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 2px;
    padding: 11px 12px;
  }

  .flow-form-streamlined > .flow-document-head .flow-document-category,
  .flow-form-streamlined > .flow-document-head h3,
  .flow-form-streamlined > .flow-document-head .flow-document-number {
    width: 100%;
    grid-column: 1;
    justify-self: stretch;
  }

  .flow-form-streamlined > .flow-document-head .flow-document-category {
    grid-row: 1;
  }

  .flow-form-streamlined > .flow-document-head h3 {
    grid-row: 2;
    font-size: 18px;
  }

  .flow-form-streamlined > .flow-document-head .flow-document-number {
    grid-row: 3;
  }

  .flow-form-streamlined > .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px 12px 18px;
    border-right: 0;
  }

  .flow-form-streamlined .form-section-label {
    margin-top: 2px;
  }

  .flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    padding: 12px;
    border-top: 1px solid var(--ui-border);
    overflow: visible;
  }

  .global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
    inset: 0;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    width: 100%;
    height: calc(100dvh - 104px);
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
    padding: 10px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    padding: 0 10px 12px;
    border-left: 0;
    background: var(--ui-page);
  }

  .flow-approval-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-task-rail-progress-track > i {
    transition: none;
  }
}

/* Specificity reset for the legacy document-table form rules. */
.flow-form.is-document-layout.flow-form-streamlined > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
  padding: 16px 18px 24px;
}

.flow-form.is-document-layout.flow-form-streamlined .form-grid > label,
.flow-form.is-document-layout.flow-form-streamlined .flow-related-field {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(40px, auto);
  align-items: start;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.flow-form.is-document-layout.flow-form-streamlined .form-grid > label > span,
.flow-form.is-document-layout.flow-form-streamlined .flow-related-field > span {
  min-height: 18px;
  grid-column: 1;
  grid-row: 1;
  padding: 0;
  border: 0;
  color: var(--ui-ink-800);
  background: transparent;
}

.flow-form.is-document-layout.flow-form-streamlined .form-grid > label > :is(input, select, textarea, button, .percent-input-control),
.flow-form.is-document-layout.flow-form-streamlined .flow-related-field > .flow-related-trigger {
  width: 100%;
  min-width: 0;
  grid-column: 1;
  grid-row: 2;
}

.flow-form.is-document-layout.flow-form-streamlined .flow-related-chips {
  grid-column: 1;
  grid-row: 3;
}

.flow-form.is-document-layout.flow-form-streamlined .form-section-label,
.flow-form.is-document-layout.flow-form-streamlined .form-grid > :is(.field-wide, .contract-lines, .attachment-upload-control) {
  grid-column: 1 / -1;
}

@media (max-width: 1180px) and (min-width: 761px) {
  .flow-form.is-document-layout.flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .flow-form.is-document-layout.flow-form-streamlined > .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px 12px 18px;
  }
}

/* System interaction redesign: task-first hierarchy and predictable density. */
:root {
  --ui-content-max: 1440px;
  --ui-sidebar-width: 208px;
  --ui-space-page: 20px;
  --ui-radius: 8px;
  --ui-radius-lg: 10px;
  --ui-shadow-panel: 0 1px 2px rgba(15, 52, 118, 0.05);
  --ui-shadow-modal: 0 18px 48px rgba(10, 40, 95, 0.24);
}

.skip-to-content {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: var(--z-toast);
  padding: 8px 12px;
  border-radius: var(--ui-radius-sm);
  color: #ffffff;
  background: var(--ui-primary-950);
  box-shadow: var(--ui-shadow-panel);
  font-size: 13px;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-to-content:focus-visible {
  outline: 2px solid var(--ui-accent-500);
  outline-offset: 2px;
  transform: translateY(0);
}

.app-header {
  box-shadow: 0 1px 0 rgba(15, 52, 118, 0.03);
}

.app-header .topbar.is-compact {
  grid-template-columns: minmax(220px, 560px) auto;
  gap: 20px;
}

.app-header-workspace {
  padding-inline: 20px 24px;
}

.erp-sidebar,
.erp-shell > .erp-sidebar {
  padding: 16px 12px 24px;
}

.module-nav.ui-system-v2 {
  gap: 8px;
}

.module-nav-group {
  gap: 4px;
  padding-bottom: 9px;
}

.module-nav-title {
  padding: 8px 10px 4px;
  color: rgba(235, 243, 255, 0.68);
  font-size: 11px;
  letter-spacing: 0;
}

.module-nav button,
.module-nav-branch > button {
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
}

.module-nav button:hover,
.module-nav button:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.module-nav button.is-active,
.module-nav button[aria-current="page"] {
  background: rgba(114, 200, 196, 0.2);
  box-shadow: none;
}

.module-nav button.is-active::before,
.module-nav button[aria-current="page"]::before {
  width: 10px;
  height: 10px;
  flex-basis: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--ui-accent-500);
}

.module-subnav {
  margin-left: 20px;
  padding-left: 10px;
  border-inline-start: 1px solid rgba(151, 208, 204, 0.36);
}

.module-subnav button {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.module-subnav button.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.erp-main {
  max-width: none;
  padding: 20px 24px 36px;
}

.workspace-tabs,
.view-root {
  max-width: var(--ui-content-max);
}

.view-root {
  gap: 18px;
}

.workspace-page-head,
.workbench-heading {
  min-height: 68px;
  padding: 4px 0 16px;
  border-bottom-color: var(--ui-border);
}

.workspace-page-head h1,
.workbench-heading h1 {
  font-size: 23px;
  line-height: 1.28;
}

.workspace-page-head p,
.workbench-heading p {
  color: var(--ui-ink-650);
  font-size: 12px;
}

.panel,
.flow-form,
.dashboard-visual-panel,
.dashboard-chart-panel,
.dashboard-detail-drawer,
.workbench-flow-status-bar,
.workbench-flow-detail-panel,
.workbench-project-overview,
.data-export-panel {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow-panel);
}

.panel-title,
.form-head,
.dashboard-panel-head,
.workbench-section-head {
  min-height: 56px;
  padding: 11px 16px;
  border-bottom-color: var(--ui-border-soft);
}

.panel-title > div:first-child {
  padding-inline-start: 0;
  border-inline-start: 0;
}

.panel-title strong,
.form-head strong,
.dashboard-panel-head h2,
.workbench-section-head h2 {
  font-size: 15px;
  font-weight: 750;
}

.panel-title span,
.form-head span,
.dashboard-panel-head span,
.workbench-section-head span {
  color: var(--ui-ink-650);
  line-height: 1.45;
}

.tabs,
.finance-subnav,
.contract-subtabs,
.project-subtabs,
.party-subtabs,
.organization-subtabs {
  min-height: 44px;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-subtle);
}

.tab-button,
.finance-subnav button,
.contract-subtabs button,
.project-subtabs button,
.party-subtabs button,
.organization-subtabs button {
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 6px;
  color: var(--ui-ink-650);
  font-size: 12px;
}

.tab-button.is-active,
.finance-subnav button.is-active,
.contract-subtabs button.is-active,
.project-subtabs button.is-active,
.party-subtabs button.is-active,
.organization-subtabs button.is-active {
  color: var(--ui-primary-900);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 52, 118, 0.09);
}

.table-action,
.form-actions button,
.line-table-head button,
.inline-settings button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.table-action.primary,
.form-actions button:last-child,
.inline-settings button {
  color: #ffffff;
  background: var(--ui-primary-900);
}

.table-action:focus-visible,
.form-actions button:focus-visible,
.line-table-head button:focus-visible,
.inline-settings button:focus-visible {
  box-shadow: var(--ui-focus);
}

.data-table-shell,
.table-scroll,
.responsive-table,
.workbench-project-table-scroll,
.data-export-table-scroll {
  max-width: 100%;
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}

.data-table-shell {
  max-height: min(66dvh, 760px);
}

.erp-main table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 11px;
  border-bottom-color: var(--ui-border-strong);
  color: var(--ui-ink-800);
  background: #f1f5f8;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.erp-main table tbody td {
  padding: 10px 11px;
  color: var(--ui-ink-950);
  line-height: 1.45;
}

.erp-main table tbody tr:hover td {
  background: var(--ui-primary-050);
}

.table-empty-cell,
.workbench-table-empty,
.empty-state {
  min-height: 124px;
  color: var(--ui-ink-650) !important;
  background: #fbfcfd !important;
}

/* Workbench: surface the next action first, then the status index. */
.view-root:has(.workbench-heading) {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  align-items: start;
}

.view-root:has(.workbench-heading) > .workbench-heading,
.view-root:has(.workbench-heading) > .workbench-flow-detail-panel {
  grid-column: 1 / -1;
}

.workbench-heading {
  grid-column: 1 / -1;
}

.workbench-heading > .workbench-heading-actions {
  align-self: center;
}

.workbench-next-action-section,
.workbench-flow-status-bar {
  height: 100%;
  margin: 0;
}

.workbench-next-action-section {
  grid-column: 1;
}

.workbench-flow-status-bar {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
}

.workbench-flow-status-intro {
  min-height: 76px;
  padding: 13px 16px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-groups {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.workbench-flow-status-group {
  min-width: 0;
  padding: 12px 13px;
  border-bottom: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-group:nth-child(odd) {
  border-right: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-button {
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #ffffff;
}

.workbench-flow-status-button.is-active {
  border-color: var(--ui-accent-200);
  background: var(--ui-accent-100);
}

.workbench-next-action-head {
  padding: 13px 16px 10px;
}

.workbench-next-action-list {
  min-height: 104px;
  padding: 0 10px 10px;
}

.workbench-next-action-list > button {
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 6px;
}

.workbench-flow-detail-panel {
  grid-column: 1 / -1;
}

/* Dashboard: reduce chrome and keep the selected project in the page header. */
.dashboard-page-head {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: end;
  gap: 20px;
}

.dashboard-page-head-actions {
  justify-content: end;
}

.dashboard-project-picker.compact,
.dashboard-project-picker.compact select {
  width: 100%;
  height: 38px;
}

.dashboard-executive {
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow-panel);
}

.dashboard-command {
  min-height: 54px;
  padding: 10px 16px;
}

.boss-kpi-card {
  min-height: 100px;
  padding: 15px 16px;
}

.boss-kpi-card strong {
  font-size: 23px;
}

.dashboard-chart-suite {
  gap: 16px;
}

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

/* Forms: labels are labels, controls carry the surface. */
.erp-flow-launch-dialog:not(.is-picker) {
  width: min(1200px, calc(100vw - 48px));
  height: min(860px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
}

.erp-flow-launch-dialog-head {
  min-height: 70px;
  padding: 13px 18px;
}

.erp-flow-launch-dialog-head h2 {
  font-size: 19px;
}

.erp-flow-launch-dialog-body.is-form {
  background: var(--ui-page);
}

.erp-flow-launch-dialog-form > .flow-form {
  background: #ffffff;
}

.flow-template-tools {
  background: var(--ui-surface-subtle);
}

.flow-template-tools > summary {
  min-height: 44px;
  padding-inline: 18px;
}

.flow-form-progress {
  min-height: 52px;
  grid-template-columns: auto minmax(130px, 220px) minmax(0, 1fr);
  padding-inline: 18px;
}

#flow-section-nav {
  justify-content: flex-end;
}

#flow-section-nav button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 11px;
}

.flow-form .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 16px 18px 22px;
}

.flow-form .form-grid label > span {
  min-height: 17px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ui-ink-800);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.flow-form .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.flow-form .form-grid select {
  height: 38px;
  min-height: 38px;
  padding-inline: 10px;
  border-radius: 6px;
  border-color: var(--ui-border-strong);
}

.flow-form .form-grid textarea {
  min-height: 92px;
  border-radius: 6px;
}

.flow-form .form-grid input:focus,
.flow-form .form-grid select:focus,
.flow-form .form-grid textarea:focus {
  border-color: var(--ui-accent-600);
  box-shadow: var(--ui-focus);
}

.flow-form .form-section-label {
  min-height: 40px;
  margin: 8px -18px 0;
  padding: 8px 18px;
  border: 1px solid var(--ui-border-soft);
  border-inline: 0;
  border-radius: 0;
  color: var(--ui-primary-900);
  background: #f2f6f9;
  font-size: 13px;
}

.flow-document-number {
  grid-column: span 1;
}

.contract-lines,
.attachment-upload-control,
.flow-related-field {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
}

.form-actions {
  min-height: 66px;
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -4px 12px rgba(15, 52, 118, 0.06);
}

.form-actions #submit-flow {
  min-width: 92px;
}

/* Approval preview: the decision and the action remain visible together. */
.flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  grid-template-columns: minmax(0, 1fr) minmax(310px, 340px);
  gap: 0;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  min-width: 0;
  background: #ffffff;
}

.flow-approval-focus {
  margin: 14px 16px 12px;
  padding: 15px 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #f8fafc;
  box-shadow: none;
}

.flow-approval-risk-banner {
  border: 1px solid #efd4a4;
  border-radius: 6px;
}

.flow-approval-workbench {
  height: auto;
  max-height: none;
  align-self: stretch;
  padding: 16px;
  border-inline-start: 1px solid var(--ui-border);
  background: #f7fafb;
}

.flow-approval-workbench-head strong {
  font-size: 15px;
}

.flow-approval-actions {
  position: sticky;
  bottom: 0;
  margin-inline: -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ui-border);
  background: rgba(247, 250, 251, 0.98);
}

.flow-approval-actions .primary {
  min-height: 42px;
}

/* Compact, predictable editing surfaces for ledgers and settings. */
.finance-layout,
.organization-layout,
.material-management-layout,
.payroll-layout {
  gap: 16px;
}

.data-export-layout {
  border-radius: var(--ui-radius);
  overflow: hidden;
}

.org-module-dropdown,
.org-project-checks,
.approval-template-list,
.approval-tree-builder,
.schedule-editor-toolbar,
.schedule-table-wrap {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
}

@media (min-width: 1600px) {
  .erp-main {
    padding-inline: 36px;
  }
}

@media (max-width: 1180px) and (min-width: 761px) {
  :root {
    --ui-sidebar-width: 196px;
    --ui-space-page: 18px;
  }

  .erp-main {
    padding: 20px 18px 32px;
  }

  .view-root:has(.workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
  }

  .view-root:has(.workbench-heading) > *,
  .workbench-next-action-section,
  .workbench-flow-status-bar,
  .workbench-flow-detail-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 760px) {
  :root {
    --ui-sidebar-width: 52px;
    --ui-space-page: 12px;
  }

  .app-header-workspace {
    padding-inline: 10px 12px;
  }

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

  .app-header .global-search input {
    height: 38px;
    min-height: 38px;
    padding-inline: 34px 8px;
    font-size: 12px;
  }

  .topbar-actions {
    gap: 4px;
  }

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

  .view-root:has(.workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .view-root:has(.workbench-heading) > *,
  .workbench-next-action-section,
  .workbench-flow-status-bar,
  .workbench-flow-detail-panel {
    grid-column: 1 / -1;
  }

  .workspace-page-head,
  .workbench-heading {
    min-height: 0;
    padding-bottom: 12px;
  }

  .workspace-page-head h1,
  .workbench-heading h1 {
    font-size: 20px;
  }

  .dashboard-page-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .dashboard-page-head-actions {
    justify-content: stretch;
  }

  .dashboard-project-picker.compact {
    width: 100%;
  }

  .workbench-flow-status-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-flow-status-group:nth-child(odd) {
    border-inline-end: 1px solid var(--ui-border-soft);
  }

  .erp-flow-launch-dialog:not(.is-picker) {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .erp-flow-launch-dialog-head {
    min-height: 64px;
    padding: 10px 12px;
  }

  .erp-flow-launch-dialog-body.is-form {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .flow-form .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px 12px 18px;
  }

  .flow-document-number,
  .flow-form .form-grid > .form-section-label,
  .flow-form .form-grid > .flow-related-field,
  .flow-form .form-grid > .contract-lines,
  .flow-form .form-grid > .attachment-upload-control {
    grid-column: 1 / -1;
  }

  .flow-form .form-section-label {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .flow-form-progress {
    grid-template-columns: auto minmax(90px, 1fr);
    gap: 8px;
    padding-inline: 12px;
  }

  #flow-section-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    width: 100%;
    padding-top: 2px;
  }

  .flow-template-tools > summary {
    padding-inline: 12px;
  }

  .flow-template-tools-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-inline: 12px;
  }

  .flow-template-tools-body > label {
    grid-column: 1 / -1;
  }

  .form-actions {
    justify-content: stretch;
    padding-inline: 12px;
  }

  .form-actions button {
    flex: 1 1 0;
    min-height: 44px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-approval-workbench {
    border-inline-start: 0;
    border-top: 1px solid var(--ui-border);
  }

  .flow-approval-actions {
    margin-inline: 0;
    padding-inline: 0;
  }

  .data-table-shell {
    max-height: none;
  }

  .erp-main table {
    min-width: 680px;
  }

  .data-table-shell .data-table,
  .workbench-project-table {
    min-width: 680px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-to-content,
  .module-nav button,
  .table-action,
  .flow-form input,
  .flow-form select,
  .flow-form textarea {
    transition-duration: 0.01ms !important;
  }
}

/* Pages without a bespoke header still need an obvious location cue. */
.view-root > .view-semantic-title {
  width: auto;
  height: auto;
  position: static;
  overflow: visible;
  clip-path: none;
  margin: 0;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-ink-950);
  font-size: 22px;
  font-weight: 720;
  line-height: 1.3;
  text-wrap: balance;
}

@media (max-width: 760px) {
  .view-root > .view-semantic-title {
    padding-bottom: 10px;
    font-size: 20px;
  }
}

/* Mobile interaction guardrails: status groups and the overflow menu keep their own space. */
@media (max-width: 760px) {
  .workbench-flow-status-groups {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    overflow: visible;
  }

  .workbench-flow-status-group,
  .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: 66px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px;
    border-inline-end: 0;
  }

  .workbench-flow-status-group > div {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 4px;
  }

  .workbench-flow-status-button {
    width: 100%;
    min-width: 0;
    padding-inline: 6px;
  }

  .module-nav.is-mobile-open {
    width: calc(100vw - 24px);
    max-height: min(60dvh, 480px);
    position: fixed;
    inset: auto 12px calc(66px + env(safe-area-inset-bottom));
    z-index: var(--z-dropdown);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(48px, auto);
    gap: 4px;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-lg);
    background: var(--ui-surface);
    box-shadow: 0 -4px 8px rgba(15, 52, 118, 0.14);
  }

  .module-nav.is-mobile-open .module-nav-group,
  .module-nav.is-mobile-open .module-nav-branch {
    display: contents;
  }

  .module-nav.is-mobile-open .module-nav-title,
  .module-nav.is-mobile-open .module-subnav {
    display: none;
  }

  .module-nav.is-mobile-open button[data-view] {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--ui-border-soft);
    border-radius: 6px;
    color: var(--ui-ink-800);
    background: var(--ui-surface-subtle);
    box-shadow: none;
    font-size: 12px;
    text-align: left;
  }

  .module-nav.is-mobile-open button[data-view][hidden] {
    display: none !important;
  }

  .module-nav.is-mobile-open button[data-view] .module-nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .module-nav.is-mobile-open button[data-view].is-active,
  .module-nav.is-mobile-open button[data-view]:focus-visible {
    color: var(--ui-primary-900);
    border-color: var(--ui-accent-500);
    background: var(--ui-accent-100);
    box-shadow: none;
  }

  .module-nav.is-mobile-open #mobile-more-toggle {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    margin: 4px 0 0;
    flex-direction: row;
    gap: 8px;
    border: 1px solid var(--ui-border-strong);
    border-radius: 6px;
    color: var(--ui-primary-900);
    background: var(--ui-surface-subtle);
    box-shadow: none;
  }
}

/* Final interaction reflow: keep each task surface proportionate and usable. */
.workspace-page-head-actions,
.workbench-heading-actions,
.dashboard-page-head-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-page-head-actions > *,
.workbench-heading-actions > *,
.dashboard-page-head-actions > * {
  max-width: 100%;
}

.workbench-next-action-section,
.workbench-flow-status-bar {
  align-self: start;
  height: auto;
  min-height: 0;
}

.workbench-next-action-empty {
  min-height: 92px;
  padding-block: 14px;
}

.workbench-flow-status-intro {
  min-height: 64px;
}

.workbench-flow-status-groups {
  align-content: start;
}

.erp-flow-launch-dialog-body.is-form {
  scroll-padding-block: 58px 104px;
  overscroll-behavior: contain;
}

.erp-flow-launch-dialog-form > .flow-form {
  min-height: 100%;
  padding-bottom: 92px;
}

.form-actions {
  isolation: isolate;
  scroll-margin-bottom: 96px;
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-layout {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-main,
.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  min-height: 0;
}

@media (max-width: 1040px) {
  .flow-record-preview-panel.is-approval-mode > .flow-record-preview-layout {
    overflow: auto;
  }
}

@media (max-width: 760px) {
  .workspace-page-head-actions,
  .workbench-heading-actions,
  .dashboard-page-head-actions {
    width: 100%;
    align-items: stretch;
  }

  .workspace-page-head-actions > *,
  .workbench-heading-actions > *,
  .dashboard-page-head-actions > * {
    min-width: 0;
    flex: 1 1 0;
  }

  .erp-flow-launch-dialog-body.is-form {
    scroll-padding-block: 56px calc(112px + env(safe-area-inset-bottom));
  }

  .erp-flow-launch-dialog-form > .flow-form {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .flow-record-preview-panel.is-approval-mode > .flow-record-preview-layout {
    overscroll-behavior: contain;
  }
}

/* UI audit pass 1: a stable shell and a deliberate workbench rhythm.
 * Keep the workbench's task list and status index in the same visual row,
 * but do not let the taller status grid stretch the task surface. */
:root {
  --ui-content-max: 1480px;
  --ui-space-page: clamp(16px, 2.2vw, 32px);
  --ui-radius: 8px;
  --ui-radius-lg: 10px;
}

.app-header {
  box-shadow: 0 1px 0 rgba(15, 52, 118, 0.04);
}

.app-header-workspace {
  padding-inline: var(--ui-space-page);
}

.app-header .topbar.is-compact {
  grid-template-columns: minmax(240px, 620px) auto;
  gap: clamp(12px, 2vw, 24px);
}

.erp-main {
  padding: clamp(16px, 2.2vw, 28px) var(--ui-space-page) 40px;
}

.erp-sidebar {
  padding-inline: 10px;
}

.module-nav-title {
  padding-top: 9px;
  color: rgba(228, 238, 252, 0.7);
  font-size: 10px;
  letter-spacing: 0;
}

.module-nav-group {
  gap: 4px;
  padding-bottom: 8px;
}

.module-nav button,
.module-nav-branch > button {
  min-height: 40px;
  padding-inline: 9px;
  border-radius: 6px;
}

.module-nav button::before {
  width: 13px;
  height: 13px;
  flex-basis: 13px;
  border-radius: 3px;
  opacity: 0.64;
}

.module-nav button.is-active,
.module-nav button[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--ui-accent-500), 0 1px 0 rgba(255, 255, 255, 0.04);
}

.module-subnav {
  margin-left: 21px;
  padding-left: 9px;
  border-left-color: rgba(151, 208, 204, 0.3);
}

.module-subnav button {
  min-height: 34px;
  padding-inline: 8px;
}

.view-root:has(> .workbench-heading) {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
  grid-template-areas:
    "heading heading"
    "next status"
    "queue queue";
  gap: 14px 18px;
  align-items: start;
}

.view-root:has(> .workbench-heading) > .workbench-heading {
  grid-area: heading;
}

.view-root:has(> .workbench-heading) > .workbench-next-action-section {
  grid-area: next;
}

.view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
  grid-area: status;
}

.view-root:has(> .workbench-heading) > .workbench-flow-detail-panel {
  grid-area: queue;
}

.workbench-heading {
  min-height: 74px;
  padding-bottom: 12px;
}

.workbench-heading h1 {
  font-size: clamp(20px, 1.6vw, 24px);
}

.workbench-heading-actions {
  flex-wrap: nowrap;
}

.workbench-secondary-action,
.workbench-primary-action {
  min-height: 38px;
  white-space: nowrap;
}

.workbench-next-action-section,
.workbench-flow-status-bar,
.workbench-flow-detail-panel {
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}

.workbench-next-action-section {
  padding: 0 14px 10px;
}

.workbench-next-action-head {
  min-height: 54px;
}

.workbench-next-action-list {
  column-gap: 18px;
}

.workbench-next-action-list > button {
  padding-inline: 4px;
}

.workbench-next-action-empty {
  min-height: 108px;
  padding: 14px 4px;
}

.workbench-flow-status-bar {
  grid-template-columns: 1fr;
  min-height: 0;
}

.workbench-flow-status-intro {
  min-height: 62px;
  padding: 10px 14px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto;
  padding: 7px 0;
}

.workbench-flow-status-group {
  padding: 0 10px;
  border-right: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-group:last-child {
  border-right: 0;
}

.workbench-flow-status-group > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: auto;
}

.workbench-flow-status-button {
  min-width: 0;
  min-height: 40px;
  flex-direction: row;
  gap: 4px;
  padding-inline: 4px;
}

.workbench-flow-status-button small {
  max-width: 100%;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-flow-status-button strong {
  line-height: 1.1;
}

.workbench-flow-detail-panel {
  border-top: 1px solid var(--ui-border);
}

.workbench-flow-detail-panel .workbench-section-head {
  padding-inline: 14px;
}

.workbench-flow-list {
  padding: 0 14px 2px;
}

.workbench-flow-record {
  padding-inline: 0;
}

.workbench-flow-empty {
  min-height: 128px;
  padding-inline: 4px;
}

.workspace-page-head:not(.workbench-heading) {
  min-height: 66px;
}

.panel-title,
.form-head,
.dashboard-panel-head,
.workbench-section-head {
  padding-inline: 16px;
}

.data-table th,
.workbench-project-table th,
.payroll-table th,
.org-directory-table th,
.line-item-table th,
.data-export-table th,
.erp-main table thead th {
  height: 38px;
  padding-block: 7px;
}

@media (max-width: 1180px) and (min-width: 761px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "next"
      "status"
      "queue";
  }

  .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .erp-main {
    padding: 12px 12px calc(82px + env(safe-area-inset-bottom));
  }

  .app-header-workspace {
    padding-inline: 10px;
  }

  .app-header .topbar.is-compact {
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "next"
      "status"
      "queue";
  }

  .workbench-heading {
    min-height: 0;
    padding-bottom: 12px;
  }

  .workbench-heading-actions {
    flex-wrap: wrap;
  }

  .workbench-secondary-action,
  .workbench-primary-action {
    flex: 1 1 0;
  }

  .workbench-next-action-section,
  .workbench-flow-detail-panel {
    padding-inline: 10px;
  }

  .workbench-flow-status-intro {
    padding-inline: 12px;
  }

  .workbench-flow-status-groups {
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 0;
  }

  .workbench-flow-status-group,
  .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: 66px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .workbench-flow-status-group:last-child {
    border-bottom: 0;
  }

  .workbench-flow-status-group > div {
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  }

  .workbench-flow-status-button {
    flex-direction: row;
    gap: 4px;
  }

  .workbench-flow-detail-panel .workbench-section-head {
    padding-inline: 4px;
  }

  .workbench-flow-list {
    padding-inline: 4px;
  }
}

/* UI audit pass 3: mobile menu layering, focus visibility, and motion safety. */
.global-overlay-root {
  z-index: var(--z-modal-backdrop);
}

.global-overlay-root > .dashboard-preview-backdrop,
.global-overlay-root > .system-notice-backdrop {
  z-index: var(--z-modal-backdrop);
}

.global-overlay-root .dashboard-preview-panel,
.global-overlay-root .system-notice-panel {
  z-index: var(--z-modal);
}

.module-nav button:focus-visible,
.module-nav .mobile-more-toggle:focus-visible,
.workspace-tab button:focus-visible,
.workbench-flow-status-button:focus-visible {
  outline: 2px solid #9be0dc;
  outline-offset: -2px;
}

@media (max-width: 760px) {
  .module-nav.is-mobile-open {
    inset: auto 12px calc(12px + env(safe-area-inset-bottom));
    max-height: min(70dvh, 560px);
  }

  .module-nav.is-mobile-open #mobile-more-toggle {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .module-nav.is-mobile-open #mobile-more-toggle::before {
    display: none;
  }

  .module-nav.is-mobile-open #mobile-more-toggle span {
    line-height: 1;
  }

  .module-nav.is-mobile-open button[data-view] {
    min-height: 48px;
  }

  .module-nav.is-mobile-open button[data-view]::before {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* UI audit pass 2: reduce task-surface noise and protect the decision path. */
.erp-flow-launch-dialog:not(.is-picker) {
  width: min(1080px, calc(100vw - 40px));
  height: min(820px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  border-radius: var(--ui-radius-lg);
}

.erp-flow-launch-dialog-head {
  min-height: 64px;
  padding: 11px 16px;
}

.erp-flow-launch-dialog-head h2 {
  font-size: 18px;
}

.erp-flow-launch-dialog-body.is-form {
  background: var(--ui-page);
}

.erp-flow-launch-dialog-form > .flow-form {
  max-width: 1080px;
  margin-inline: auto;
  background: var(--ui-surface);
}

.flow-template-tools {
  border-bottom-color: var(--ui-border);
}

.flow-template-tools > summary {
  min-height: 44px;
  padding-inline: 16px;
}

.flow-form-progress {
  min-height: 48px;
  grid-template-columns: auto minmax(120px, 190px) minmax(0, 1fr);
  gap: 12px;
  padding: 5px 16px;
  background: #ffffff;
}

.flow-form-progress > div {
  gap: 4px;
}

.flow-form-progress > div strong,
.flow-form-progress > div span {
  font-size: 11px;
}

.flow-form-progress > i {
  height: 5px;
}

.flow-form-progress #flow-section-nav {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.flow-form-progress #flow-section-nav button {
  min-height: 30px;
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-ink-650);
  background: #ffffff;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.flow-form-progress #flow-section-nav button:hover,
.flow-form-progress #flow-section-nav button:focus-visible,
.flow-form-progress #flow-section-nav button.is-active {
  border-color: var(--ui-accent-500);
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
}

.flow-form .form-grid {
  gap: 11px 13px;
  padding: 14px 16px 20px;
}

.flow-form .form-grid label > span {
  min-height: 16px;
  font-size: 11px;
}

.flow-form .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.flow-form .form-grid select {
  height: 36px;
  min-height: 36px;
  padding-inline: 9px;
  font-size: 13px;
}

.flow-form .form-grid textarea {
  min-height: 82px;
}

.flow-form .form-section-label {
  min-height: 38px;
  margin-inline: -16px;
  padding-inline: 16px;
}

.flow-preview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-inline: 16px;
}

.flow-preview > span:last-child {
  border-right: 0;
}

.form-actions {
  min-height: 58px;
  padding: 9px 16px calc(9px + env(safe-area-inset-bottom));
}

.form-actions button {
  min-height: 38px;
}

.flow-record-preview-panel.is-approval-mode {
  width: min(1160px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 380px);
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 70px;
  padding-inline: 18px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-focus {
  margin: 14px 16px 12px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  padding: 16px 18px;
  background: #f8fafc;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-actions {
  margin-inline: -18px;
  padding-inline: 18px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-actions .primary {
  min-height: 44px;
}

.contract-lines .line-table-head,
.attachment-upload-control > header {
  min-height: 40px;
  padding-block: 6px;
}

.business-line-table th,
.business-line-table td {
  padding-block: 6px;
}

@media (max-width: 760px) {
  .erp-flow-launch-dialog:not(.is-picker) {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .erp-flow-launch-dialog-head {
    min-height: 64px;
    padding-inline: 12px;
  }

  .erp-flow-launch-dialog-form > .flow-form {
    max-width: none;
  }

  .flow-template-tools > summary {
    padding-inline: 12px;
  }

  .flow-form-progress {
    grid-template-columns: auto minmax(90px, 1fr);
    gap: 8px;
    padding-inline: 12px;
  }

  .flow-form-progress #flow-section-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .flow-form .form-grid {
    gap: 10px;
    padding: 12px 12px 18px;
  }

  .flow-form .form-section-label {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .erp-flow-launch-dialog-body.is-form .form-actions {
    position: relative;
    bottom: auto;
    z-index: auto;
    margin-top: 0;
    box-shadow: none;
  }

  .flow-preview {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 12px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    padding: 13px 12px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-actions {
    margin-inline: -12px;
    padding-inline: 12px;
  }
}

/* Final mobile override: generic ledgers use record cards instead of a clipped wide table. */
@media (max-width: 760px) {
  .business-ledger .data-table-shell {
    overflow: visible;
  }

  .business-ledger .data-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .business-ledger .data-table tbody td {
    width: auto;
    min-width: 0 !important;
    max-width: none !important;
    align-items: flex-start;
  }

  .business-ledger .data-table tbody td:nth-child(n) {
    width: auto !important;
  }
}

/* Reference document-style flow layout */
.flow-form.is-document-layout {
  --flow-document-label-width: 124px;
  min-width: 0;
  color: var(--ui-ink-950);
  background: #ffffff;
}

.flow-form.is-document-layout > .flow-document-head {
  min-height: 92px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  padding: 13px 24px 12px;
  border-bottom: 1px solid var(--ui-border);
  text-align: center;
  background: #ffffff;
}

.flow-document-category {
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 650;
}

.flow-document-head h3 {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 22px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: 0;
  text-wrap: balance;
}

.flow-document-head .flow-document-number {
  width: min(360px, 100%);
  min-height: 30px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 1px 0 0;
  color: var(--ui-ink-650);
  font-size: 11px;
}

.flow-document-head .flow-document-number > span {
  font-weight: 650;
  white-space: nowrap;
}

.flow-document-head .flow-document-number > input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid var(--ui-border-strong);
  border-radius: 0;
  color: var(--ui-primary-900);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 720;
  text-align: center;
}

.flow-form.is-document-layout > .flow-template-tools {
  background: #f8fafb;
}

.flow-form.is-document-layout > .flow-template-tools > summary,
.flow-form.is-document-layout > .flow-template-tools > .flow-template-tools-body {
  padding-inline: 22px;
}

.flow-form.is-document-layout > .flow-form-progress {
  min-height: 46px;
  padding-inline: 22px;
  box-shadow: 0 3px 8px rgba(15, 52, 118, 0.05);
}

.flow-form.is-document-layout .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
  padding: 0 22px 24px;
  background: #ffffff;
}

.flow-form.is-document-layout .form-section-label {
  min-height: 38px;
  grid-column: 1 / -1;
  margin: 16px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--ui-border);
  border-radius: 3px 3px 0 0;
  color: var(--ui-ink-950);
  background: #f1f3f5;
  font-size: 13px;
  font-weight: 740;
  scroll-margin-top: 56px;
}

.flow-form.is-document-layout .form-grid > label {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: var(--flow-document-label-width) minmax(0, 1fr);
  align-content: stretch;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-top: 0;
  border-radius: 0;
  overflow: hidden;
  background: #ffffff;
  box-shadow: none;
}

.flow-form.is-document-layout .form-grid > label:hover {
  border-color: var(--ui-border);
  background: #ffffff;
}

.flow-form.is-document-layout .form-grid > label:focus-within {
  z-index: 1;
  border-color: var(--ui-accent-600);
  box-shadow: 0 0 0 1px var(--ui-accent-600);
}

.flow-form.is-document-layout .form-grid > label > span {
  min-width: 0;
  min-height: 45px;
  display: flex;
  align-items: center;
  padding: 8px 11px;
  border-right: 1px solid var(--ui-border);
  color: var(--ui-ink-800);
  background: #f6f8fa;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.flow-form.is-document-layout .form-grid > label:has(textarea) > span {
  align-items: flex-start;
  padding-top: 11px;
}

.flow-form.is-document-layout .form-grid > label.field-wide,
.flow-form.is-document-layout .form-grid > :is(.field-wide, .contract-lines, .attachment-upload-control) {
  grid-column: 1 / -1;
}

.flow-form.is-document-layout .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.flow-form.is-document-layout .form-grid select {
  height: 45px;
  min-height: 45px;
  padding: 0 11px;
  border: 0;
  border-radius: 0;
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  font-size: 13px;
}

.flow-form.is-document-layout .form-grid textarea {
  min-height: 88px;
  padding: 10px 11px;
  border: 0;
  border-radius: 0;
  color: var(--ui-ink-950);
  background: #ffffff;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.55;
}

.flow-form.is-document-layout .form-grid :is(input, select, textarea):hover {
  border: 0;
  background: #fbfdfe;
}

.flow-form.is-document-layout .form-grid :is(input, select, textarea):focus {
  border: 0;
  outline: 2px solid var(--ui-accent-600);
  outline-offset: -2px;
  box-shadow: none;
}

.flow-form.is-document-layout .form-grid input[readonly],
.flow-form.is-document-layout .form-grid select:disabled,
.flow-form.is-document-layout .form-grid textarea[readonly] {
  color: var(--ui-ink-650);
  background: #f8fafb;
}

.flow-form.is-document-layout .form-grid > label.field-invalid {
  padding: 0;
  border-color: #e8a5a1;
  background: #fff8f8;
}

.flow-form.is-document-layout .form-grid > label.field-invalid > span {
  border-right-color: #efc4c1;
  background: #fff1f1;
}

.flow-form.is-document-layout .readonly-link {
  width: 100%;
  min-height: 45px;
  justify-content: flex-start;
  padding: 0 11px;
  border: 0;
  border-radius: 0;
  color: var(--ui-primary-900);
  background: #f8fafb;
  font-size: 13px;
  text-align: left;
}

.flow-form.is-document-layout .readonly-link:hover,
.flow-form.is-document-layout .readonly-link:focus-visible {
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
  box-shadow: inset 0 0 0 2px var(--ui-accent-600);
}

.flow-form.is-document-layout .percent-input-control {
  min-height: 45px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.flow-form.is-document-layout .percent-input-control > span {
  min-height: 45px;
  border-left-color: var(--ui-border);
  border-right: 0;
}

.flow-form.is-document-layout .flow-related-field {
  min-height: 46px;
  grid-column: auto;
  display: grid;
  grid-template-columns: var(--flow-document-label-width) minmax(0, 1fr);
  align-content: stretch;
  gap: 0;
  margin-top: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 0;
  background: #ffffff;
}

.flow-form.is-document-layout .flow-related-field > span {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  padding: 8px 11px;
  border-right: 1px solid var(--ui-border);
  color: var(--ui-ink-800);
  background: #f6f8fa;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.45;
}

.flow-form.is-document-layout .flow-related-trigger {
  min-height: 45px;
  grid-column: 2;
  grid-row: 1;
  padding: 0 11px;
  border: 0;
  border-radius: 0;
  color: var(--ui-primary-900);
  background: #ffffff;
}

.flow-form.is-document-layout .flow-related-trigger:hover,
.flow-form.is-document-layout .flow-related-trigger:focus-visible {
  border: 0;
  background: var(--ui-accent-100);
  box-shadow: inset 0 0 0 2px var(--ui-accent-600);
}

.flow-form.is-document-layout .flow-related-chips {
  grid-column: 2;
  grid-row: 2;
  padding: 7px 10px;
  border-top: 1px solid var(--ui-border-soft);
}

.flow-form.is-document-layout .contract-lines,
.flow-form.is-document-layout .attachment-upload-control {
  margin-top: 12px;
  border-color: var(--ui-border);
  border-radius: 4px;
  box-shadow: none;
}

.flow-form.is-document-layout .line-table-head,
.flow-form.is-document-layout .queued-attachment-toolbar {
  background: #f6f8fa;
}

.flow-form.is-document-layout > .flow-preview {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0 22px 16px;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: #ffffff;
}

.flow-form.is-document-layout > .flow-preview > span {
  padding: 9px 11px;
}

.flow-form.is-document-layout > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  min-height: 60px;
  gap: 8px;
  padding: 10px 22px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -4px 10px rgba(15, 52, 118, 0.06);
}

.flow-form.is-document-layout > .form-actions #clear-flow-form {
  order: 1;
  margin-right: auto;
}

.flow-form.is-document-layout > .form-actions #save-draft {
  order: 2;
}

.flow-form.is-document-layout > .form-actions #submit-flow {
  order: 3;
  min-width: 96px;
}

@media (max-width: 760px) {
  .flow-form.is-document-layout {
    --flow-document-label-width: 108px;
  }

  .flow-form.is-document-layout > .flow-document-head {
    min-height: 88px;
    padding: 11px 12px 10px;
  }

  .flow-document-head h3 {
    font-size: 19px;
  }

  .flow-document-head .flow-document-number {
    width: min(320px, 100%);
  }

  .flow-form.is-document-layout > .flow-template-tools > summary,
  .flow-form.is-document-layout > .flow-template-tools > .flow-template-tools-body,
  .flow-form.is-document-layout > .flow-form-progress {
    padding-inline: 12px;
  }

  .flow-form.is-document-layout .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 12px 18px;
  }

  .flow-form.is-document-layout .form-section-label {
    margin-top: 12px;
    padding-inline: 10px;
  }

  .flow-form.is-document-layout .form-grid > label,
  .flow-form.is-document-layout .flow-related-field {
    grid-template-columns: var(--flow-document-label-width) minmax(0, 1fr);
  }

  .flow-form.is-document-layout > .flow-preview {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 12px 12px;
  }

  .flow-form.is-document-layout > .flow-preview > span {
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .flow-form.is-document-layout > .flow-preview > span:last-child {
    border-bottom: 0;
  }

  .erp-flow-launch-dialog-body.is-form .flow-form.is-document-layout > .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding-inline: 12px;
    box-shadow: 0 -4px 10px rgba(15, 52, 118, 0.06);
  }
}

@media (max-width: 420px) {
  .flow-form.is-document-layout {
    --flow-document-label-width: 100px;
  }

  .flow-form.is-document-layout .form-grid > label > span,
  .flow-form.is-document-layout .flow-related-field > span {
    padding-inline: 9px;
    font-size: 11px;
  }

  .flow-form.is-document-layout .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .flow-form.is-document-layout .form-grid select,
  .flow-form.is-document-layout .form-grid textarea,
  .flow-form.is-document-layout .readonly-link,
  .flow-form.is-document-layout .flow-related-trigger {
    padding-inline: 9px;
    font-size: 12px;
  }
}

/* Reference approval workspace: one business document and one decision rail. */
.global-overlay-root > .queued-attachment-dialog-backdrop {
  z-index: calc(var(--z-modal) + 10);
  pointer-events: auto;
}

.flow-record-preview-panel.is-approval-mode {
  width: min(1240px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr);
  border-color: #cfd8e3;
  border-radius: 8px;
  background: #f3f6fa;
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 270px) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #dbe3eb;
  color: #1d2129;
  background: #ffffff;
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > .flow-approval-title-block {
  min-width: 0;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 12px;
}

.flow-approval-status-chip {
  width: max-content;
  flex: 0 0 auto;
  align-self: center;
  padding: 5px 8px;
  border: 1px solid #efcb8c;
  border-radius: 5px;
  color: #80500e !important;
  background: #fff7e9;
  font-size: 11px !important;
  font-weight: 750;
}

.flow-approval-title-block > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-title-block small {
  overflow: hidden;
  color: #6e7681;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-title-block strong {
  overflow: hidden;
  color: #14213d;
  font-size: 19px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-title-block p {
  margin: 0;
  overflow: hidden;
  color: #6e7681;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-header-amount {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 1px;
  padding-left: 16px;
  border-left: 1px solid #e1e7ed;
  text-align: right;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-header-amount span,
.flow-record-preview-panel.is-approval-mode .flow-approval-header-amount small {
  color: #6e7681;
  font-size: 10px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-header-amount strong {
  color: #0f3476;
  font-size: 23px;
  line-height: 1.25;
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > button {
  width: 38px;
  min-width: 38px;
  min-height: 36px;
  padding: 0;
  border-color: #cfd8e3;
  color: #344054;
  background: #ffffff;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
  gap: 0;
  overflow: auto;
  background: #f3f6fa;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  min-width: 0;
  padding: 16px;
  background: #f3f6fa;
}

.flow-approval-document {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d9e2eb;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 52, 118, 0.06);
}

.flow-approval-context-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid #dce4ec;
  background: #f8fafc;
}

.flow-approval-context-strip > div {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 11px 13px;
  border-right: 1px solid #dce4ec;
}

.flow-approval-context-strip > div:last-child {
  border-right: 0;
}

.flow-approval-context-strip span,
.flow-approval-context-strip small {
  overflow: hidden;
  color: #6e7681;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-context-strip strong {
  overflow: hidden;
  color: #1d2129;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-content-section,
.flow-record-preview-panel.is-approval-mode .flow-approval-focus {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid #e0e6ec;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.flow-approval-content-section:last-child {
  border-bottom: 0;
}

.flow-approval-content-section > header,
.flow-approval-focus-head {
  min-height: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}

.flow-approval-content-section > header strong,
.flow-approval-focus-head strong {
  color: #1d2129;
  font-size: 14px;
  font-weight: 750;
}

.flow-approval-content-section > header span,
.flow-approval-focus-head span,
.flow-approval-focus-head em {
  color: #6e7681;
  font-size: 10px;
  font-style: normal;
}

.flow-approval-focus-head > div {
  display: grid;
  gap: 2px;
}

.flow-approval-business-overview {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  border: 1px solid #dce4ec;
  border-radius: 5px;
  overflow: hidden;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-primary {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px;
  border: 0;
  border-right: 1px solid #dce4ec;
  background: #ffffff;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-primary > span {
  color: #6e7681;
  font-size: 10px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-primary strong,
.flow-record-preview-panel.is-approval-mode .flow-approval-primary.is-object strong {
  margin: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  color: #1d2129;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.65;
}

.flow-approval-financial-comparison {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.flow-approval-financial-comparison > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(84px, 0.8fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-right: 1px solid #edf0f3;
  border-bottom: 1px solid #edf0f3;
}

.flow-approval-financial-comparison > div:nth-child(2n) {
  border-right: 0;
}

.flow-approval-financial-comparison > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.flow-approval-financial-comparison dt,
.flow-approval-financial-comparison dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.flow-approval-financial-comparison dt {
  color: #6e7681;
}

.flow-approval-financial-comparison dd {
  color: #14213d;
  font-weight: 750;
  text-align: right;
}

.flow-approval-basis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 10px;
  padding: 0;
  border: 1px solid #e1e7ed;
  border-radius: 5px;
}

.flow-approval-basis > div {
  min-width: 0;
  padding: 9px 11px;
}

.flow-approval-basis > div + div {
  padding-left: 11px;
  border-left: 1px solid #e1e7ed;
}

.flow-approval-basis span {
  color: #6e7681;
  font-size: 10px;
}

.flow-approval-basis p {
  margin: 3px 0 0;
  color: #344054;
  font-size: 11px;
  line-height: 1.5;
}

.flow-approval-business-details {
  border: 1px solid #dce4ec;
  border-radius: 5px;
  overflow: hidden;
}

.flow-approval-business-details > div {
  min-height: 42px;
  padding: 9px 11px;
}

.flow-approval-account-section > dl {
  margin: 0;
  border: 1px solid #dce4ec;
  border-radius: 5px;
  overflow: hidden;
}

.flow-approval-account-section > dl > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e6ebf0;
}

.flow-approval-account-section > dl > div:last-child {
  border-bottom: 0;
}

.flow-approval-account-section dt,
.flow-approval-account-section dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.flow-approval-account-section dt {
  color: #6e7681;
}

.flow-approval-account-section dd {
  color: #1d2129;
  font-weight: 700;
}

.flow-approval-account-section dd.is-account-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.flow-approval-attachment-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.flow-approval-attachment-list li {
  min-height: 50px;
  padding: 9px 11px;
  border: 1px solid #dce4ec;
  border-radius: 5px;
  background: #ffffff;
}

.flow-approval-timeline-list {
  min-width: 100%;
  display: flex;
  gap: 0;
  margin: 0;
  padding: 8px 0 2px;
  overflow-x: auto;
  list-style: none;
}

.flow-approval-timeline-list li {
  position: relative;
  min-width: 150px;
  flex: 1 0 150px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  padding-right: 12px;
}

.flow-approval-timeline-list li::before {
  position: absolute;
  top: 7px;
  left: 8px;
  right: -1px;
  height: 1px;
  background: #d4dde7;
  content: "";
}

.flow-approval-timeline-list li:last-child::before {
  display: none;
}

.flow-approval-timeline-list li > i {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5df;
  border-radius: 50%;
  background: #ffffff;
}

.flow-approval-timeline-list li.is-done > i {
  border-color: #0f3476;
  background: #0f3476;
}

.flow-approval-timeline-list li.is-current > i {
  border: 5px solid #0f3476;
}

.flow-approval-timeline-list li.is-rejected > i {
  border-color: #e53935;
  background: #e53935;
}

.flow-approval-timeline-list li > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.flow-approval-timeline-list strong,
.flow-approval-timeline-list span,
.flow-approval-timeline-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-timeline-list strong {
  color: #1d2129;
  font-size: 10px;
}

.flow-approval-timeline-list span,
.flow-approval-timeline-list small {
  color: #6e7681;
  font-size: 9px;
}

.flow-approval-workbench {
  position: sticky;
  top: 0;
  align-self: start;
  height: auto;
  max-height: calc(100dvh - 120px);
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 0;
  border-left: 1px solid #d7e0e9;
  border-radius: 0;
  background: #f3f6fa;
  box-shadow: none;
  overflow-y: auto;
}

.flow-approval-system-checks {
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid #b8dcd8;
  border-left: 1px solid #b8dcd8;
  border-radius: 7px;
  background: #ffffff;
}

.flow-approval-system-checks.is-high {
  border-color: #efb7b4;
  background: #ffffff;
}

.flow-approval-system-checks.is-medium {
  border-color: #efd4a4;
  background: #ffffff;
}

.flow-approval-system-checks > header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  background: #eaf7f5;
}

.flow-approval-system-checks.is-high > header {
  background: #fff0ef;
}

.flow-approval-system-checks.is-medium > header {
  background: #fff7e9;
}

.flow-approval-system-checks > header > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffffff;
  background: #278f88;
  font-size: 13px;
  font-weight: 800;
}

.flow-approval-system-checks.is-high > header > span {
  background: #e53935;
}

.flow-approval-system-checks.is-medium > header > span {
  background: #d18424;
}

.flow-approval-system-checks > header > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.flow-approval-system-checks > header strong {
  color: #185f5a;
  font-size: 12px;
}

.flow-approval-system-checks.is-high > header strong {
  color: #a42c29;
}

.flow-approval-system-checks.is-medium > header strong {
  color: #80500e;
}

.flow-approval-system-checks > header small {
  color: #55706e;
  font-size: 9px;
}

.flow-approval-system-checks > ul {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 7px 12px;
  list-style: none;
}

.flow-approval-system-checks > ul > li {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 0;
  color: #344054;
}

.flow-approval-system-checks > ul > li > span {
  color: #278f88;
  font-size: 11px;
  font-weight: 800;
}

.flow-approval-system-checks > ul > li.is-warning > span {
  color: #c77716;
}

.flow-approval-system-checks > ul > li.is-high > span {
  color: #e53935;
}

.flow-approval-system-checks > ul > li.is-neutral > span {
  color: #6e7681;
}

.flow-approval-system-checks > ul > li p {
  margin: 0;
  color: inherit;
  font-size: 10px;
  line-height: 1.5;
}

.flow-approval-decision-panel {
  min-width: 0;
  display: grid;
  gap: 13px;
  padding: 14px;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  background: #ffffff;
}

.flow-approval-workbench-head {
  padding: 0 0 10px;
  border-bottom: 1px solid #e1e7ed;
}

.flow-approval-comment-field textarea {
  min-height: 108px;
  resize: vertical;
}

.flow-approval-opinion-upload {
  min-height: 38px;
  width: 100%;
  border: 1px dashed #aebdcb;
  border-radius: 5px;
  color: #41566c;
  background: #f8fafc;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.flow-approval-opinion-upload:hover,
.flow-approval-opinion-upload:focus-visible {
  border-color: #72c8c4;
  color: #0f3476;
  background: #eff8f7;
  outline: 0;
}

.flow-approval-utility-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 7px;
}

.approval-reassignment-reason-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 22px 65px rgba(15, 52, 118, 0.18);
}

.approval-reassignment-reason-dialog > header,
.approval-reassignment-reason-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.approval-reassignment-reason-dialog > header {
  border-bottom: 1px solid #e5e9ef;
}

.approval-reassignment-reason-dialog > header div {
  display: grid;
  gap: 3px;
}

.approval-reassignment-reason-dialog > header span,
.approval-reassignment-reason-dialog label > span {
  color: #6e7681;
  font-size: 11px;
}

.approval-reassignment-reason-dialog > header button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #6e7681;
  font-size: 22px;
  cursor: pointer;
}

.approval-reassignment-reason-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.approval-reassignment-reason-body dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.approval-reassignment-reason-body dl > div {
  padding: 10px 12px;
  border: 1px solid #e5e9ef;
  border-radius: 5px;
  background: #f6f8fa;
}

.approval-reassignment-reason-body dt {
  color: #6e7681;
  font-size: 10px;
}

.approval-reassignment-reason-body dd {
  margin: 4px 0 0;
  color: #1d2129;
  font-weight: 700;
}

.approval-reassignment-reason-body label {
  display: grid;
  gap: 7px;
}

.approval-reassignment-reason-body textarea {
  min-height: 112px;
  resize: vertical;
  border: 1px solid #cdd6df;
  border-radius: 5px;
  padding: 10px 12px;
  color: #1d2129;
  font: inherit;
}

.approval-reassignment-reason-body textarea.is-invalid {
  border-color: #e53935;
}

.approval-reassignment-reason-body small {
  color: #6e7681;
  font-size: 10px;
}

.approval-reassignment-reason-dialog > footer {
  justify-content: flex-end;
  border-top: 1px solid #e5e9ef;
  background: #f6f8fa;
}

@media (max-width: 560px) {
  .approval-reassignment-reason-body dl {
    grid-template-columns: minmax(0, 1fr);
  }
}

.flow-approval-utility-actions .table-action {
  min-height: 36px;
}

.flow-approval-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 7px;
  margin: 0 -14px -14px;
  padding: 12px 14px 14px;
  border-top: 1px solid #e1e7ed;
  background: #ffffff;
}

.flow-approval-actions .primary {
  grid-column: auto;
  min-height: 42px;
}

.flow-approval-audit-note {
  margin: 0;
  color: #6e7681;
  font-size: 9px;
  line-height: 1.5;
}

@media (max-width: 1040px) {
  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: max-content max-content;
    align-content: start;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
    display: contents;
  }

  .flow-approval-document {
    order: 1;
    margin: 14px;
  }

  .flow-approval-workbench {
    position: static;
    order: 2;
    max-height: none;
    min-height: 0;
    grid-template-columns: minmax(280px, 0.8fr) minmax(340px, 1.2fr);
    align-items: start;
    padding: 0 14px 14px;
    border-left: 0;
    overflow: visible;
  }

  .flow-approval-actions {
    position: static;
  }
}

@media (max-width: 760px) {
  .flow-record-preview-panel.is-approval-mode {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 104px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
  }

  .flow-approval-title-block {
    align-items: flex-start;
    gap: 8px;
  }

  .flow-approval-status-chip {
    margin-top: 1px;
    padding: 4px 6px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-title-block strong {
    max-width: calc(100vw - 142px);
    font-size: 14px;
  }

  .flow-approval-title-block p {
    max-width: calc(100vw - 142px);
  }

  .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > .flow-approval-header-amount {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0 0;
    border-top: 1px solid #e1e7ed;
    border-left: 0;
    text-align: left;
  }

  .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > button {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount > span {
    display: none;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount strong {
    font-size: 18px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .flow-approval-document {
    margin: 10px;
  }

  .flow-approval-context-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-approval-context-strip > div:nth-child(2) {
    border-right: 0;
  }

  .flow-approval-context-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid #dce4ec;
  }

  .flow-approval-content-section,
  .flow-record-preview-panel.is-approval-mode .flow-approval-focus {
    padding: 12px;
  }

  .flow-approval-business-overview,
  .flow-approval-basis {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-approval-financial-comparison {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-approval-financial-comparison > div,
  .flow-approval-financial-comparison > div:nth-child(2n),
  .flow-approval-financial-comparison > div:nth-last-child(-n + 2) {
    grid-template-columns: minmax(104px, 0.8fr) minmax(0, 1fr);
    border-right: 0;
    border-bottom: 1px solid #edf0f3;
  }

  .flow-approval-financial-comparison > div:last-child {
    border-bottom: 0;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-primary {
    border-right: 0;
    border-bottom: 1px solid #dce4ec;
  }

  .flow-approval-basis > div + div {
    padding-left: 11px;
    border-top: 1px solid #e1e7ed;
    border-left: 0;
  }

  .flow-approval-business-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-approval-account-section > dl > div {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .flow-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 10px 12px;
  }

  .flow-approval-decision-panel {
    padding: 12px;
  }

  .flow-approval-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 -12px -12px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .flow-approval-actions .primary {
    grid-column: 1 / -1;
    order: -1;
  }
}

/* 2026-08-12 workflow task surface v2 */
#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form > .flow-form {
  width: 100%;
  max-width: 1420px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
  grid-template-columns: minmax(0, 1fr) minmax(292px, 320px);
  grid-template-areas:
    "document document"
    "templates rail"
    "progress rail"
    "fields rail"
    "actions rail";
  column-gap: 16px;
  border: 0;
  background: transparent;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-document-head {
  grid-area: document;
  text-align: left;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-template-tools {
  grid-area: templates;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress {
  grid-area: progress;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
  grid-area: fields;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-field {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(40px, auto);
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
  grid-area: rail;
  position: sticky;
  top: 16px;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions {
  grid-area: actions;
  position: sticky;
  bottom: 0;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-preview {
  display: none;
}

.global-overlay-root > .flow-record-preview-backdrop.is-approval-mode:not(.is-standalone) {
  width: auto;
  height: auto;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  width: min(1480px, 100%);
  grid-template-columns: minmax(0, 1fr) minmax(330px, 370px);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  align-self: stretch;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-decision-panel {
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 0.85fr) minmax(0, 1.75fr);
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: 0 -1px 4px rgba(15, 52, 118, 0.05);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions > .table-action {
  grid-row: auto;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary {
  min-height: 44px;
  grid-column: auto;
  grid-row: auto;
  order: initial;
}

body.flow-detail-only {
  min-width: 0;
  overflow: hidden;
  background: var(--ui-page);
}

body.flow-detail-only .view-root {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}

body.flow-detail-only .flow-record-preview-backdrop.is-standalone.is-approval-mode {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  position: fixed !important;
  inset: 0 !important;
  display: block;
  padding: 0 !important;
  background: var(--ui-page);
}

body.flow-detail-only .flow-record-preview-panel.is-approval-mode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  box-sizing: border-box;
}

body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  width: min(1480px, 100%);
  height: calc(100dvh - 78px);
  margin-inline: auto;
  overflow: hidden;
}

@media (max-width: 1240px) and (min-width: 761px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
    position: static;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    grid-template-columns: minmax(280px, 0.8fr) minmax(340px, 1.2fr);
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-decision-panel {
    overflow: visible;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "templates"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
    position: static;
  }

  .global-overlay-root > .flow-record-preview-backdrop.is-approval-mode {
    inset: 0;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-decision-panel {
    overflow: visible;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-modal);
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 0.85fr) minmax(0, 1.75fr);
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
    box-shadow: 0 -2px 6px rgba(15, 52, 118, 0.08);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary {
    grid-column: auto;
    order: initial;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    padding-bottom: calc(65px + env(safe-area-inset-bottom));
    box-sizing: border-box;
  }
}

/* 2026-08-12 workflow task hierarchy v3 */
#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head {
  min-height: 52px;
  padding: 7px max(18px, var(--ui-space-page));
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
  padding: 12px max(18px, var(--ui-space-page)) 24px;
  scroll-padding-block: 64px 88px;
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
  width: min(1400px, 100%);
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 304px);
  grid-template-areas:
    "document document"
    "progress rail"
    "fields rail"
    "actions rail";
  gap: 0 14px;
  align-items: start;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .flow-document-head {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  grid-template-areas: none;
  grid-template-rows: auto;
  gap: 16px;
  align-items: center;
  justify-items: stretch;
  padding: 14px 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-document-heading {
  min-width: 0;
  display: grid;
  gap: 3px;
}

#erp-flow-launch-dialog .flow-document-heading > :is(.flow-document-meta, h3, p) {
  width: auto;
  grid-column: auto;
  grid-row: auto;
  justify-self: stretch;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-document-head .flow-document-heading > h3,
#erp-flow-launch-dialog .flow-form-streamlined .flow-document-head .flow-document-heading > p {
  width: auto;
  grid-area: auto;
  grid-column: auto;
  grid-row: auto;
  justify-self: stretch;
}

#erp-flow-launch-dialog .flow-document-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#erp-flow-launch-dialog .flow-document-category {
  color: var(--ui-primary-900);
  font-size: 11px;
  font-weight: 720;
}

#erp-flow-launch-dialog .flow-form-state {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ui-ink-650);
  font-size: 11px;
}

#erp-flow-launch-dialog .flow-form-state > span {
  padding: 2px 6px;
  border: 1px solid #ead3a4;
  border-radius: 4px;
  color: #80500e;
  background: #fff8ea;
  font-weight: 700;
}

#erp-flow-launch-dialog .flow-form-state small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#erp-flow-launch-dialog .flow-document-heading h3 {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 20px;
  font-weight: 740;
  line-height: 1.3;
  letter-spacing: 0;
}

#erp-flow-launch-dialog .flow-document-heading p {
  max-width: 72ch;
  margin: 0;
  overflow: hidden;
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#erp-flow-launch-dialog .flow-document-identity {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

#erp-flow-launch-dialog .flow-document-identity > .flow-document-number {
  width: auto;
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: stretch;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#erp-flow-launch-dialog .flow-document-identity > .flow-template-tools {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

#erp-flow-launch-dialog .flow-document-number {
  min-width: 0;
  display: grid;
  gap: 5px;
}

#erp-flow-launch-dialog .flow-document-number > span {
  color: var(--ui-ink-650);
  font-size: 12px;
  font-weight: 650;
}

#erp-flow-launch-dialog .flow-document-number > input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: var(--ui-surface-subtle);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

#erp-flow-launch-dialog .flow-template-tools {
  position: relative;
}

#erp-flow-launch-dialog .flow-template-tools > summary {
  min-width: 88px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

#erp-flow-launch-dialog .flow-template-tools > summary:hover,
#erp-flow-launch-dialog .flow-template-tools > summary:focus-visible {
  border-color: var(--ui-accent-600);
  background: var(--ui-accent-100);
  outline: 0;
  box-shadow: var(--ui-focus);
}

#erp-flow-launch-dialog .flow-template-tools-body {
  width: min(460px, calc(100vw - 40px));
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: var(--z-dropdown);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: 0 4px 8px rgba(15, 52, 118, 0.12);
}

#erp-flow-launch-dialog .flow-template-tools-body > label {
  min-width: 0;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
}

#erp-flow-launch-dialog .flow-template-tools-body > label > span {
  color: var(--ui-ink-650);
  font-size: 10px;
}

#erp-flow-launch-dialog .flow-template-tools-body select,
#erp-flow-launch-dialog .flow-template-tools-body .table-action {
  min-width: 0;
  min-height: 36px;
  font-size: 11px;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress {
  min-width: 0;
  min-height: 48px;
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: stretch;
  margin-top: 12px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-bottom: 0;
  border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  background: rgba(255, 255, 255, 0.98);
}

#erp-flow-launch-dialog .flow-form-progress > :is(div, i) {
  display: none;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav::-webkit-scrollbar {
  display: none;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button {
  min-width: max-content;
  min-height: 47px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  color: var(--ui-ink-650);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button::after {
  height: 2px;
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  border-radius: 2px;
  background: transparent;
  content: "";
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button:hover,
#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button:focus-visible,
#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button.is-active,
#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button[aria-current="step"] {
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  outline: 0;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button.is-active::after,
#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button[aria-current="step"]::after {
  background: var(--ui-primary-700);
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav small {
  color: #9a6418;
  font-size: 9px;
  font-weight: 700;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 16px 88px;
  border: 1px solid var(--ui-border);
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-section-label {
  min-height: 38px;
  margin: 6px 0 0;
  padding: 8px 0 7px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-ink-950);
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 740;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-section-label::before {
  display: none;
}

#erp-flow-launch-dialog .flow-form-streamlined .flow-section-incomplete-count {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid #ead3a4;
  border-radius: 4px;
  color: #80500e;
  background: #fff8ea;
  font-size: 9px;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-field {
  gap: 5px;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label > span,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-field > span {
  min-height: 18px;
  color: var(--ui-ink-800);
  font-size: 12px;
  font-weight: 680;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
#erp-flow-launch-dialog .flow-form-streamlined .readonly-link,
#erp-flow-launch-dialog .flow-form-streamlined .percent-input-control,
#erp-flow-launch-dialog .flow-form-streamlined .flow-related-trigger {
  min-height: 40px;
  padding: 8px 10px;
  border-color: var(--ui-border-strong);
  font-size: 13px;
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid textarea {
  min-height: 76px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.55;
}

#erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
  max-height: calc(100dvh - 136px);
  top: 12px;
  gap: 0;
  margin-top: 12px;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-task-rail-card {
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
}

#erp-flow-launch-dialog .flow-task-rail-card:last-of-type {
  border-bottom: 0;
}

#erp-flow-launch-dialog .flow-task-rail-card > header {
  min-height: 54px;
  padding: 10px 12px;
}

#erp-flow-launch-dialog .flow-task-rail-card > header span,
#erp-flow-launch-dialog .flow-task-rail-card > header small {
  font-size: 10px;
}

#erp-flow-launch-dialog .flow-task-rail-card > header strong {
  font-size: 12px;
}

#erp-flow-launch-dialog .flow-task-rail-progress-card > header > b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

#erp-flow-launch-dialog .flow-task-rail-checks,
#erp-flow-launch-dialog #flow-task-approval-route {
  padding: 8px 12px 12px;
}

#erp-flow-launch-dialog .flow-task-rail-checks li,
#erp-flow-launch-dialog #flow-task-approval-route li {
  padding: 8px 0;
  font-size: 12px;
}

#erp-flow-launch-dialog .flow-task-rail-note,
#erp-flow-launch-dialog .flow-task-rail > .flow-preview {
  display: none;
}

#erp-flow-launch-dialog .flow-task-rail > .flow-context {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ui-border);
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions {
  min-height: 60px;
  position: sticky;
  bottom: 0;
  z-index: 14;
  gap: 8px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--ui-border);
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -2px 6px rgba(15, 52, 118, 0.06);
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions button {
  min-height: 40px;
  min-width: 92px;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions #clear-flow-form {
  margin-right: auto;
}

#erp-flow-launch-dialog .flow-form-streamlined > .form-actions #submit-flow {
  min-width: 112px;
}

/* Approval: read the decision context first, then act in a dedicated rail. */
.global-overlay-root > .flow-record-preview-backdrop.is-approval-mode:not(.is-standalone) {
  inset: var(--ui-header-height) 0 0 var(--ui-sidebar-width);
  overflow: hidden;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode {
  grid-template-rows: 76px minmax(0, 1fr);
  overflow: hidden;
  background: var(--ui-page);
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 260px) auto;
  gap: 14px;
  padding: 10px max(18px, var(--ui-space-page));
}

.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 {
  width: min(1460px, 100%);
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr) minmax(340px, 368px);
  align-items: stretch;
  overflow: hidden;
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  align-self: stretch;
  padding: 18px 20px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-document {
  max-width: 1080px;
  margin-inline: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip > div {
  min-height: 80px;
  padding: 12px 14px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip span,
.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip small {
  font-size: 11px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip strong {
  font-size: 13px;
  line-height: 1.45;
}

.flow-approval-main-checks {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ui-border);
  background: #ffffff;
}

.flow-approval-main-checks .flow-approval-system-checks {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.flow-approval-main-checks .flow-approval-system-checks > header {
  min-height: 38px;
  padding: 7px 9px;
  border-radius: var(--ui-radius-sm);
}

.flow-approval-main-checks .flow-approval-system-checks > ul {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 16px;
  padding: 7px 2px 0;
}

.flow-approval-main-checks .flow-approval-system-checks > ul > li {
  padding: 7px 2px;
  font-size: 12px;
  line-height: 1.55;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-focus,
.flow-record-preview-panel.is-approval-mode .flow-approval-content-section {
  padding: 18px 16px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-content-section > header strong,
.flow-record-preview-panel.is-approval-mode .flow-approval-focus-head strong {
  font-size: 15px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-content-section > header span,
.flow-record-preview-panel.is-approval-mode .flow-approval-focus-head span,
.flow-record-preview-panel.is-approval-mode .flow-approval-focus-head em {
  font-size: 11px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-primary > span,
.flow-record-preview-panel.is-approval-mode .flow-approval-basis span {
  font-size: 11px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-primary strong,
.flow-record-preview-panel.is-approval-mode .flow-approval-primary.is-object strong {
  font-size: 13px;
  line-height: 1.7;
}

.flow-record-preview-panel.is-approval-mode :is(
  .flow-approval-financial-comparison dt,
  .flow-approval-financial-comparison dd,
  .flow-approval-basis p,
  .flow-approval-business-details dt,
  .flow-approval-business-details dd,
  .flow-approval-account-section dt,
  .flow-approval-account-section dd
) {
  font-size: 12px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  min-height: 0;
  height: 100%;
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  padding: 18px;
  overflow-y: auto;
  border-left: 1px solid var(--ui-border);
  background: #f4f7f9;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  grid-template-columns: minmax(0, 1fr);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-decision-panel {
  min-height: 0;
  align-content: start;
  gap: 12px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench-head {
  min-height: 54px;
  padding: 0 0 12px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench-head strong {
  font-size: 16px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-review-brief {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: #ffffff;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-review-brief > div {
  min-height: 42px;
  grid-template-columns: 78px minmax(0, 1fr);
  padding: 9px 11px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-review-brief dt,
.flow-record-preview-panel.is-approval-mode .flow-approval-review-brief dd {
  font-size: 12px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-review-brief dd.is-money {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-comment-field textarea {
  min-height: 116px;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.6;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px -18px -18px;
  padding: 12px 18px 18px;
  border: 0;
  border-top: 1px solid var(--ui-border);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -2px 6px rgba(15, 52, 118, 0.06);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary {
  min-height: 44px;
  grid-column: 1 / -1;
  grid-row: 1;
  order: initial;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-actions .table-action:not(.primary) {
  min-height: 40px;
  grid-row: 2;
}

@media (max-width: 1180px) and (min-width: 761px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
    overflow: visible;
  }

  #erp-flow-launch-dialog .flow-task-rail-card:first-child {
    border-right: 1px solid var(--ui-border);
    border-bottom: 0;
  }

  #erp-flow-launch-dialog .flow-task-rail > .flow-context {
    grid-column: 1 / -1;
  }

  .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 {
    grid-template-columns: minmax(0, 1fr) minmax(310px, 340px);
  }
}

@media (max-width: 1180px) {
  .global-overlay-root > .flow-record-preview-backdrop.is-approval-mode:not(.is-standalone) {
    inset: var(--ui-header-height) 0 0;
  }
}

@media (max-width: 920px) {
  .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;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: max-content;
    align-content: start;
    overflow-y: auto;
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-main,
  .flow-record-preview-panel.is-approval-mode .flow-approval-document {
    display: contents;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-context-strip {
    order: 1;
    margin: 14px 14px 0;
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-main-checks {
    order: 2;
    margin: 14px 14px 0;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-focus {
    order: 3;
    margin: 14px 14px 0;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    height: auto;
    order: 4;
    margin: 14px;
    padding: 16px;
    overflow: visible;
    border: 1px solid var(--ui-border);
    border-top: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-content-section {
    order: 5;
    margin: 0 14px;
    border: 1px solid var(--ui-border);
    border-top: 0;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-content-section:last-child {
    margin-bottom: 14px;
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  }
}

@media (max-width: 920px) and (min-width: 761px) {
  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
    position: static;
    margin: 16px -16px -16px;
    padding: 12px 16px 16px;
  }
}

/* Final audit pass: keep the desktop workbench status rail compact and financial values intact. */
@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-bar {
    min-height: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro small {
    margin: 0;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    min-width: 68px;
    min-height: 34px;
    padding: 6px 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 6px 8px 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 2px 6px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-right: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    min-height: 30px;
    padding: 4px 6px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button small {
    font-size: 11px;
  }
}

.flow-approval-financial-comparison dd,
.flow-approval-review-brief dd.is-money {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

/* EOF audit marker: rules below intentionally remain the last cascade layer. */
.workbench-flow-status-intro > div {
  min-width: 0;
}

@media (min-width: 921px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    min-width: 0;
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > strong {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > small {
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: auto;
    min-width: 68px;
    flex: 0 0 auto;
  }
}

.dashboard-stage-node > :is(span, strong, small) {
  min-width: 0;
}

.dashboard-stage-node > strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stage-node > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-ledger-table .data-table :is(th, td):last-child {
  min-width: 92px;
  white-space: nowrap;
}

.org-project-checks label {
  align-items: start;
}

.org-project-checks label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Final interaction audit: preserve readable workbench status and dense data controls. */
@media (min-width: 921px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    min-width: 0;
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > strong {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > small {
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: auto;
    min-width: 68px;
    flex: 0 0 auto;
  }
}

.dashboard-stage-node > :is(span, strong, small) {
  min-width: 0;
}

.dashboard-stage-node > strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stage-node > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-ledger-table .data-table :is(th, td):last-child {
  min-width: 92px;
  white-space: nowrap;
}

.org-project-checks label {
  align-items: start;
}

.org-project-checks label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Final content-fit audit: keep dense labels readable at every supported viewport. */
.dashboard-stage-node > :is(span, strong, small) {
  min-width: 0;
}

.dashboard-stage-node > strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stage-node > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-ledger-table .data-table :is(th, td):last-child {
  min-width: 92px;
  white-space: nowrap;
}

.org-project-checks label {
  align-items: start;
}

.org-project-checks label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Final interaction audit: the last layer owns dense content and workbench layout. */
@media (min-width: 921px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    min-width: 0;
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > strong {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > small {
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: auto;
    min-width: 68px;
    flex: 0 0 auto;
  }
}

.dashboard-stage-node > :is(span, strong, small) {
  min-width: 0;
}

.dashboard-stage-node > strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stage-node > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-ledger-table .data-table :is(th, td):last-child {
  min-width: 92px;
  white-space: nowrap;
}

.org-project-checks label {
  align-items: start;
}

.org-project-checks label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}

.flow-approval-financial-comparison dd,
.flow-approval-review-brief dd.is-money {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

/* Keep the workbench status rail readable when the desktop shell narrows its side column. */
@media (min-width: 921px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > strong {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > small {
    min-width: 0;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 760px) {
  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head {
    min-height: 50px;
    padding: 6px 10px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
    padding: 0 0 calc(72px + env(safe-area-inset-bottom));
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .flow-document-head {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 11px 12px 12px;
    border: 0;
    border-bottom: 1px solid var(--ui-border);
    border-radius: 0;
  }

  #erp-flow-launch-dialog .flow-document-heading h3 {
    font-size: 18px;
  }

  #erp-flow-launch-dialog .flow-document-heading p {
    font-size: 11px;
    white-space: normal;
  }

  #erp-flow-launch-dialog .flow-document-identity {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #erp-flow-launch-dialog .flow-template-tools-body {
    width: min(352px, calc(100vw - 24px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #erp-flow-launch-dialog .flow-template-tools-body > label {
    grid-column: 1 / -1;
  }

  #erp-flow-launch-dialog .flow-template-tools-body .table-action {
    min-height: 40px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-form-progress {
    min-height: 46px;
    margin-top: 0;
    border: 0;
    border-bottom: 1px solid var(--ui-border);
    border-radius: 0;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav button {
    min-height: 45px;
    padding-inline: 11px;
    font-size: 12px;
  }

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

  #erp-flow-launch-dialog .flow-form-streamlined .form-section-label {
    min-height: 42px;
    margin-top: 4px;
    font-size: 15px;
    scroll-margin-top: 54px;
  }

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

  #erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
  #erp-flow-launch-dialog .flow-form-streamlined .readonly-link,
  #erp-flow-launch-dialog .flow-form-streamlined .percent-input-control,
  #erp-flow-launch-dialog .flow-form-streamlined .flow-related-trigger,
  #erp-flow-launch-dialog .flow-form-streamlined .form-grid textarea {
    min-height: 44px;
    font-size: 16px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .form-grid textarea {
    min-height: 88px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .flow-task-rail {
    max-height: none;
    position: static;
    display: block;
    margin: 0 12px 12px;
    overflow: visible;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions {
    min-height: 64px;
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-modal);
    margin: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-actions button {
    min-width: 0;
    min-height: 44px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined > .form-actions #submit-flow {
    min-width: 100px;
  }

  .global-overlay-root > .flow-record-preview-backdrop.is-approval-mode:not(.is-standalone) {
    inset: 0;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode {
    grid-template-rows: 128px minmax(0, 1fr);
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
    height: 128px;
    min-height: 128px;
    grid-template-rows: minmax(0, 1fr) 34px;
    row-gap: 4px;
    padding: 8px 10px;
    overflow: hidden;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount {
    min-height: 34px;
    padding-top: 4px;
    overflow: hidden;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-header-amount strong {
    flex: 0 0 auto;
    overflow: visible;
    font-size: 20px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-title-block strong {
    max-width: calc(100vw - 138px);
    display: -webkit-box;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .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;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: max-content;
    align-content: start;
    overflow-y: auto;
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .flow-record-preview-panel.is-approval-mode .flow-record-preview-main,
  .flow-record-preview-panel.is-approval-mode .flow-approval-document {
    display: contents;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-context-strip {
    order: 1;
    margin: 10px 10px 0;
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-context-strip > div {
    min-height: 68px;
    padding: 9px 10px;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-main-checks {
    order: 2;
    margin: 10px 10px 0;
    padding: 10px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-approval-main-checks .flow-approval-system-checks > ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-focus {
    order: 3;
    margin: 10px 10px 0;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    height: auto;
    order: 4;
    margin: 10px;
    padding: 12px;
    overflow: visible;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: #f2f5f8;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-content-section {
    order: 5;
    margin: 0 10px;
    padding: 12px;
    border: 1px solid var(--ui-border);
    border-top: 0;
    background: #ffffff;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-content-section:last-child {
    margin-bottom: 10px;
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
    position: fixed;
    inset: auto 0 0;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 0.92fr) minmax(0, 1.6fr);
    margin: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ui-border);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-actions .primary {
    grid-column: 3;
    grid-row: 1;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-actions .table-action:not(.primary) {
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav button,
  #erp-flow-launch-dialog .flow-template-tools > summary {
    transition: none;
  }
}

/* Reference parity: compact operational surfaces */
.view-root:has(> .workbench-heading) {
  width: 100%;
  max-width: var(--ui-content-max);
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 0.82fr);
  grid-template-areas:
    "heading heading"
    "status status"
    "next queue";
  gap: 12px 16px;
  align-items: start;
}

.view-root:has(> .workbench-heading) > .workbench-heading {
  grid-area: heading;
}

.view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
  grid-area: status;
}

.view-root:has(> .workbench-heading) > .workbench-next-action-section {
  grid-area: next;
}

.view-root:has(> .workbench-heading) > .workbench-flow-detail-panel {
  grid-area: queue;
}

.workbench-heading {
  min-height: 58px;
  padding: 0 0 10px;
}

.workbench-heading h1 {
  font-size: 21px;
}

.workbench-heading p {
  font-size: 11px;
}

.workbench-heading-actions {
  gap: 8px;
}

.workbench-secondary-action,
.workbench-primary-action {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
}

.workbench-next-action-section,
.workbench-flow-status-bar,
.workbench-flow-detail-panel {
  align-self: start;
  height: auto;
}

.workbench-next-action-section,
.workbench-flow-status-bar,
.workbench-flow-detail-panel {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: var(--ui-shadow-panel);
}

.workbench-flow-status-bar {
  min-height: 0;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  border-block: 1px solid var(--ui-border);
  overflow: hidden;
}

.workbench-flow-status-intro {
  min-height: 76px;
  padding: 13px 16px;
  border-right: 1px solid var(--ui-border-soft);
  border-bottom: 0;
}

.workbench-flow-status-intro strong {
  font-size: 15px;
}

.workbench-flow-status-groups {
  grid-template-columns: 0.8fr 1.12fr 1.08fr;
  padding: 10px 0;
}

.workbench-flow-status-group {
  padding: 0 11px;
}

.workbench-flow-status-group > span {
  font-size: 10px;
}

.workbench-flow-status-button {
  min-height: 42px;
  padding: 7px 8px;
  background: #ffffff;
}

.workbench-flow-status-button small {
  font-size: 11px;
}

.workbench-flow-status-button strong {
  font-size: 15px;
}

.workbench-next-action-section {
  padding: 0 12px 8px;
}

.workbench-next-action-head {
  min-height: 50px;
  padding: 9px 4px 7px;
}

.workbench-next-action-list {
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
}

.workbench-next-action-list > button {
  min-height: 58px;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  gap: 8px;
  padding: 8px 4px;
}

.workbench-next-action-mark,
.workbench-next-action-check {
  width: 30px;
  height: 30px;
}

.workbench-flow-detail-panel {
  overflow: hidden;
}

.workbench-flow-detail-panel .workbench-section-head {
  min-height: 50px;
  padding: 9px 12px;
}

.workbench-flow-list {
  padding: 0 12px 2px;
}

.workbench-flow-record {
  min-height: 60px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 0;
}

.workbench-flow-record-mark {
  width: 30px;
  height: 30px;
}

.workbench-flow-process,
.workbench-flow-record > .table-action {
  display: none;
}

.workbench-flow-record-copy strong,
.workbench-flow-record-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
  width: min(1280px, 100%);
  max-width: min(1280px, 100%);
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
  grid-template-columns: minmax(0, 1fr) minmax(270px, 304px);
  grid-template-areas:
    "document document"
    "progress rail"
    "fields rail"
    "actions rail";
  column-gap: 16px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 11px 14px 82px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid > label > span,
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-field > span {
  font-size: 11px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .readonly-link,
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .percent-input-control,
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-trigger {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 12px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid textarea {
  min-height: 68px;
  padding: 8px 9px;
  font-size: 12px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
  position: sticky;
  max-height: calc(100dvh - 126px);
  top: 10px;
  margin-top: 10px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-task-rail-card > header {
  min-height: 50px;
  padding: 9px 11px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-task-rail-checks,
#erp-flow-launch-dialog:not(.is-picker) #flow-task-approval-route {
  padding: 7px 11px 10px;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-task-rail-checks li,
#erp-flow-launch-dialog:not(.is-picker) #flow-task-approval-route li {
  padding: 7px 0;
  font-size: 11px;
}

.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 {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 320px);
}

.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 {
  padding: 14px 16px 24px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-document,
.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-document {
  max-width: 1040px;
  margin-inline: auto;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  position: sticky;
  top: 12px;
  align-self: start;
  height: auto;
  max-height: calc(100dvh - var(--ui-header-height) - 96px);
  padding: 14px;
  overflow-y: auto;
}

.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 {
  margin: 14px -14px -14px;
  padding: 10px 14px 14px;
}

@media (max-width: 1180px) and (min-width: 981px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 304px);
    grid-template-areas:
      "document document"
      "progress rail"
      "fields rail"
      "actions rail";
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
    position: sticky;
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }
}

@media (max-width: 980px) and (min-width: 761px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "status"
      "next"
      "queue";
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
    position: static;
    max-height: none;
    margin-top: 10px;
  }

  .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 {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 304px);
  }
}

@media (max-width: 920px) and (min-width: 761px) {
  .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 {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    position: static;
    top: auto;
    width: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .workbench-secondary-action,
  .workbench-primary-action {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .workbench-flow-status-button {
    min-height: 44px;
    padding: 9px 10px;
  }

  .workbench-flow-status-button small,
  .workbench-flow-status-group > span {
    font-size: 14px;
  }

  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "status"
      "next"
      "queue";
  }

  .workbench-flow-status-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench-flow-status-intro {
    min-height: 48px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .workbench-flow-status-groups {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(238px, 76vw);
    gap: 0;
    padding: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
  }

  .workbench-flow-status-group,
  .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 8px;
    padding: 4px 8px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
    scroll-snap-align: start;
  }

  .workbench-flow-status-group:last-child {
    border-right: 0;
  }

  .workbench-flow-status-group > div {
    grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "document"
      "progress"
      "fields"
      "rail"
      "actions";
  }

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

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .readonly-link,
  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .percent-input-control,
  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-trigger {
    min-height: 44px;
    padding: 9px 11px;
    font-size: 16px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid > label > span,
  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-field > span {
    font-size: 14px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid textarea {
    min-height: 88px;
    padding: 10px 11px;
    font-size: 16px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
    position: static;
    max-height: none;
    margin: 0 12px 12px;
  }

  .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 {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    position: static;
    top: auto;
    max-height: none;
  }

  .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 {
    margin: 0;
    width: 100%;
    max-width: 100vw;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    box-sizing: border-box;
  }
}

/* Stable form geometry: breakpoint-based sizes prevent continuous viewport stretching. */
:root {
  --ui-form-control-height: 38px;
  --ui-form-control-font-size: 14px;
  --ui-form-label-size: 12px;
  --ui-form-field-width: 240px;
  --ui-form-grid-gap: 12px;
  --ui-form-double-field-width: 492px;
  --ui-form-triple-field-width: 744px;
  --ui-form-quad-field-width: 996px;
  --ui-form-textarea-height: 88px;
}

.schedule-editor-table {
  width: 1600px;
  min-width: 1600px;
  max-width: 1600px;
  table-layout: fixed;
}

.schedule-editor-table :is(th, td) {
  box-sizing: border-box;
  overflow: hidden;
  vertical-align: middle;
}

.schedule-editor-table :is(th, td):nth-child(1) { width: 64px; }
.schedule-editor-table :is(th, td):nth-child(2) { width: 138px; }
.schedule-editor-table :is(th, td):nth-child(3) { width: 240px; }

.schedule-editor-table :is(th, td):nth-child(4),
.schedule-editor-table :is(th, td):nth-child(5),
.schedule-editor-table :is(th, td):nth-child(6),
.schedule-editor-table :is(th, td):nth-child(7) {
  width: 122px;
}

.schedule-editor-table :is(th, td):nth-child(8) { width: 96px; }
.schedule-editor-table :is(th, td):nth-child(9) { width: 112px; }
.schedule-editor-table :is(th, td):nth-child(10) { width: 132px; }
.schedule-editor-table :is(th, td):nth-child(11) { width: 220px; }
.schedule-editor-table :is(th, td):nth-child(12) { width: 110px; }

.schedule-editor-table :is(input, select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 10px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.schedule-editor-table textarea {
  height: 72px;
  min-height: 72px;
  padding: 8px 10px;
  line-height: 1.45;
  resize: vertical;
}

.schedule-editor-table .table-action {
  min-width: 78px;
  min-height: var(--ui-form-control-height);
  padding-inline: 10px;
  font-size: var(--ui-form-control-font-size);
}

.login-gate-card {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 24px;
}

.admin-login-form {
  width: 368px;
  max-width: 100%;
  gap: 12px;
}

.admin-login-form label {
  gap: 4px;
  font-size: var(--ui-form-label-size);
}

.admin-login-form input {
  width: 100%;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.admin-login-form .login-account-submit {
  min-height: var(--ui-form-control-height);
  font-size: var(--ui-form-control-font-size);
}

.erp-flow-launch-dialog.is-picker {
  width: 384px;
  max-width: calc(100vw - 32px);
}

.workbench-flow-picker-form > label,
.workbench-flow-picker-select,
.workbench-flow-picker-form select {
  width: 320px;
  max-width: 100%;
}

.workbench-flow-picker-form > label {
  gap: 4px;
}

.workbench-flow-picker-form > label > span {
  font-size: var(--ui-form-label-size);
}

.workbench-flow-picker-form select {
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 36px 0 12px;
  font-size: var(--ui-form-control-font-size);
}

.form-grid,
.flow-form .form-grid {
  grid-template-columns: repeat(3, var(--ui-form-field-width));
  justify-content: start;
  align-items: start;
  gap: var(--ui-form-grid-gap);
}

.form-grid.compact {
  grid-template-columns: repeat(2, var(--ui-form-field-width));
  justify-content: start;
  align-items: start;
  gap: var(--ui-form-grid-gap);
}

.form-grid.compact.change-order-form-grid {
  grid-template-columns: repeat(3, var(--ui-form-field-width));
}

.construction-log-form .form-grid.compact {
  grid-template-columns: repeat(3, var(--ui-form-field-width));
}

.finance-account-row .form-grid.compact {
  grid-template-columns: repeat(3, var(--ui-form-field-width));
}

.enterprise-profile-form .form-grid {
  grid-template-columns: repeat(3, var(--ui-form-field-width));
}

.cashier-form .form-grid.compact {
  grid-template-columns: repeat(2, var(--ui-form-field-width));
  justify-content: start;
  align-items: start;
  gap: var(--ui-form-grid-gap);
}

.cashier-reversal-panel .form-grid.compact {
  grid-template-columns: repeat(2, var(--ui-form-field-width));
  justify-content: start;
  align-items: start;
  gap: var(--ui-form-grid-gap);
}

.material-movement-form {
  grid-template-columns: repeat(2, var(--ui-form-field-width));
  justify-content: start;
  align-items: start;
  gap: var(--ui-form-grid-gap);
}

.form-grid > label,
.flow-form .form-grid > label,
.form-grid > .field-control,
.material-movement-form > label,
.material-movement-form > fieldset {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.form-grid > :is(.field-wide, .form-section-label, .flow-related-field, .contract-lines, .attachment-upload-control),
.flow-form .form-grid > :is(.field-wide, .form-section-label, .flow-related-field, .contract-lines, .attachment-upload-control),
.material-movement-form > :is(.field-wide, .material-contract-reference, .material-movement-actions, .queued-attachment-control) {
  width: auto;
  max-width: none;
}

#change-order-form {
  width: 100%;
  max-width: 1320px;
}

.enterprise-profile-form {
  width: 100%;
  max-width: 1320px;
}

.enterprise-profile-form .form-grid {
  width: 800px;
  max-width: 100%;
  padding-inline: 0;
}

.finance-account-row .form-grid.compact {
  width: 800px;
  max-width: 100%;
  padding-inline: 0;
}

.change-order-form-grid > label.field-wide {
  grid-column: span 2;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.enterprise-profile-form .form-grid > label.field-wide {
  grid-column: span 2;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.finance-account-row .form-grid > label.field-wide {
  grid-column: span 2;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.change-order-form-grid > .change-order-attachment-control {
  grid-column: 1 / -1;
  width: var(--ui-form-triple-field-width);
  max-width: var(--ui-form-triple-field-width);
}

.cashier-grid {
  grid-template-columns: minmax(0, 1fr) 540px;
}

.cashier-form .form-grid.compact {
  width: var(--ui-form-double-field-width);
  max-width: 100%;
  padding-inline: 0;
}

.cashier-form .form-grid > :is(.field-wide, .cashier-voucher-control),
.cashier-reversal-panel .form-grid > .field-wide {
  grid-column: 1 / -1;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.material-management-layout {
  grid-template-columns: 540px minmax(0, 1fr);
}

.material-movement-form {
  width: 540px;
  max-width: 100%;
}

.material-movement-form > :is(.field-wide, .material-contract-reference, .material-movement-actions, .queued-attachment-control) {
  grid-column: 1 / -1;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.schedule-editor-toolbar {
  grid-template-columns: 320px repeat(3, max-content);
  justify-content: start;
}

.schedule-editor-toolbar label,
.schedule-editor-toolbar :is(select, input) {
  width: 320px;
  max-width: 320px;
}

.inline-select select {
  flex: 0 0 320px;
  width: 320px;
  min-width: 0;
  max-width: 320px;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.data-export-filter-grid {
  grid-template-columns: var(--ui-form-field-width);
  justify-content: start;
  gap: var(--ui-form-grid-gap);
}

.data-export-filter-grid > label {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
  gap: 4px;
  font-size: var(--ui-form-label-size);
}

.data-export-filter-grid > .data-export-field-wide {
  grid-column: auto;
}

.data-export-filter-grid :is(input, select),
.data-export-download-bar input {
  width: 100%;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.data-export-download-bar > label {
  width: 320px;
  max-width: 320px;
  font-size: var(--ui-form-label-size);
}

.construction-log-header-controls > label {
  grid-template-columns: auto var(--ui-form-field-width);
  justify-content: end;
  gap: 8px;
}

.construction-log-header-controls select {
  width: var(--ui-form-field-width);
  min-width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 36px 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.payroll-filters {
  grid-template-columns: repeat(3, 220px);
  justify-content: start;
  gap: var(--ui-form-grid-gap);
}

.payroll-filters label {
  width: 220px;
  max-width: 220px;
  gap: 4px;
  font-size: var(--ui-form-label-size);
}

.payroll-filters :is(input, select) {
  width: 220px;
  max-width: 220px;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.finance-period-control {
  grid-template-columns: var(--ui-form-field-width) minmax(280px, 1fr) auto;
}

.finance-period-control > label {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
  gap: 4px;
  font-size: var(--ui-form-label-size);
}

.finance-period-control input {
  width: var(--ui-form-field-width);
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.payroll-sheet-meta {
  width: 800px;
  max-width: 100%;
  grid-template-columns: repeat(3, var(--ui-form-field-width));
  justify-content: start;
  gap: var(--ui-form-grid-gap);
}

.payroll-sheet-meta > label {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.payroll-sheet-meta > .payroll-note-field {
  grid-column: span 2;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.supplier-contract-identity {
  grid-template-columns: repeat(4, var(--ui-form-field-width));
  justify-content: start;
  gap: var(--ui-form-grid-gap);
}

.supplier-contract-identity > label {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.supplier-contract-extras {
  grid-template-columns: repeat(2, var(--ui-form-double-field-width));
  justify-content: start;
  gap: var(--ui-form-grid-gap);
}

.supplier-contract-extras > :is(label, .supplier-template-attachment-control) {
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.supplier-contract-identity :is(input, select),
.supplier-link-scope-form select,
.supplier-contract-extras textarea {
  width: 100%;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

.supplier-contract-extras textarea {
  height: auto;
  min-height: var(--ui-form-textarea-height);
  padding: 8px 12px;
  line-height: 1.55;
}

.supplier-contract-identity span,
.supplier-contract-extras span,
.supplier-link-scope-form label {
  font-size: var(--ui-form-label-size);
  line-height: 1.4;
}

.supplier-link-scope-panel {
  width: 560px;
  max-width: calc(100vw - 32px);
}

.approval-tree-head > label {
  width: 360px;
  max-width: 100%;
  min-width: 0;
}

.approval-tree-head > label input,
.approval-tree-node-fields :is(input, select),
.org-department-row :is(input, select),
.org-department-actions input,
.org-role-actions input,
.cashier-type-grid .inline-settings input,
.org-role-name-field input {
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
}

.approval-tree-node-fields {
  grid-template-columns: repeat(2, var(--ui-form-field-width));
  justify-content: start;
}

.approval-tree-node-fields > label {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.approval-assignment-row {
  grid-template-columns: 140px var(--ui-form-field-width);
  justify-content: start;
}

.approval-assignment-dropdown {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.org-department-row {
  grid-template-columns: repeat(2, var(--ui-form-field-width)) 72px max-content;
  justify-content: start;
}

.org-department-row :is(input, select) {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.org-department-actions,
.org-role-actions,
.cashier-type-grid .inline-settings {
  grid-template-columns: 320px repeat(2, max-content);
  justify-content: start;
}

.cashier-type-grid .inline-settings {
  grid-template-columns: 320px max-content;
}

.org-department-actions input,
.org-role-actions input,
.cashier-type-grid .inline-settings input {
  width: 320px;
  max-width: 320px;
}

.org-role-summary {
  grid-template-columns: var(--ui-form-field-width) minmax(var(--ui-form-field-width), 1fr) max-content max-content;
}

.org-role-name-field,
.org-role-name-field input {
  width: var(--ui-form-field-width);
  max-width: var(--ui-form-field-width);
}

.org-editor-table :is(input:not([type="checkbox"]):not([type="radio"]), select) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 10px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

@media (min-width: 761px) {
  .org-employee-permission-table {
    width: 1380px;
    min-width: 1380px;
    max-width: 1380px;
    table-layout: fixed;
  }

  .org-employee-permission-table :is(th, td):nth-child(1) { width: 170px; }
  .org-employee-permission-table :is(th, td):nth-child(2) { width: 140px; }
  .org-employee-permission-table :is(th, td):nth-child(3) { width: 140px; }
  .org-employee-permission-table :is(th, td):nth-child(4) { width: 190px; }
  .org-employee-permission-table :is(th, td):nth-child(5) { width: 220px; }
  .org-employee-permission-table :is(th, td):nth-child(6) { width: 210px; }
  .org-employee-permission-table :is(th, td):nth-child(7) { width: 90px; }
  .org-employee-permission-table :is(th, td):nth-child(8) { width: 100px; }
  .org-employee-permission-table :is(th, td):nth-child(9) { width: 120px; }

  .org-directory-table {
    width: 980px;
    min-width: 980px;
    max-width: 980px;
    table-layout: fixed;
  }

  .org-directory-table :is(th, td):nth-child(1) { width: 170px; }
  .org-directory-table :is(th, td):nth-child(2) { width: 150px; }
  .org-directory-table :is(th, td):nth-child(3) { width: 150px; }
  .org-directory-table :is(th, td):nth-child(4) { width: 300px; }
  .org-directory-table :is(th, td):nth-child(5) { width: 100px; }
  .org-directory-table :is(th, td):nth-child(6) { width: 110px; }
}

.form-grid label > span,
.flow-form .form-grid label > span,
.material-movement-form label > span,
.material-direction-segmented legend,
.payroll-sheet-meta label > span,
.schedule-editor-toolbar label > span {
  font-size: var(--ui-form-label-size);
  line-height: 1.4;
}

.form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.flow-form .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.material-movement-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.payroll-sheet-meta :is(input, select),
.schedule-editor-toolbar :is(input, select) {
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .readonly-link,
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .percent-input-control,
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-trigger {
  height: var(--ui-form-control-height);
  min-height: var(--ui-form-control-height);
  padding: 0 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.35;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .percent-input-control > input {
  height: calc(var(--ui-form-control-height) - 2px);
  min-height: calc(var(--ui-form-control-height) - 2px);
  font-size: var(--ui-form-control-font-size);
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid > label > span,
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-field > span {
  font-size: var(--ui-form-label-size);
}

.form-grid textarea,
.flow-form .form-grid textarea,
.material-movement-form textarea {
  min-height: var(--ui-form-textarea-height);
  padding: 8px 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.55;
}

#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid textarea {
  min-height: var(--ui-form-textarea-height);
  padding: 8px 12px;
  font-size: var(--ui-form-control-font-size);
  line-height: 1.55;
}

.flow-form .form-grid textarea[rows="2"],
.change-order-form-grid textarea[rows="2"],
.cashier-form .form-grid textarea[rows="2"] {
  min-height: 72px;
}

.construction-log-form .form-grid textarea,
.flow-form .form-grid textarea[rows="3"] {
  min-height: 96px;
}

.flow-form .form-grid textarea[rows="4"] {
  min-height: 120px;
}

.payroll-table :is(input, select) {
  min-height: 32px;
  font-size: 12px;
}

.payroll-table textarea {
  min-height: 48px;
  font-size: 12px;
}

@media (min-width: 1400px) {
  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
    width: 1120px;
    max-width: 1120px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: 800px 304px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(3, var(--ui-form-field-width));
    justify-content: start;
  }
}

@media (min-width: 1061px) and (max-width: 1399px) {
  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
    width: 816px;
    max-width: 816px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: 520px 280px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, var(--ui-form-field-width));
    justify-content: start;
  }
}

@media (min-width: 761px) and (max-width: 1060px) {
  .form-grid,
  .form-grid.compact,
  .form-grid.compact.change-order-form-grid,
  .construction-log-form .form-grid.compact,
  .cashier-form .form-grid.compact,
  .cashier-reversal-panel .form-grid.compact,
  .enterprise-profile-form .form-grid,
  .finance-account-row .form-grid.compact,
  .material-movement-form,
  .payroll-sheet-meta {
    grid-template-columns: repeat(2, var(--ui-form-field-width));
  }

  .change-order-form-grid > .change-order-attachment-control {
    width: var(--ui-form-double-field-width);
    max-width: var(--ui-form-double-field-width);
  }

  .schedule-editor-toolbar {
    grid-template-columns: repeat(3, max-content);
  }

  .schedule-editor-toolbar label {
    grid-column: 1 / -1;
  }

  .inline-select select {
    flex-basis: var(--ui-form-field-width);
    width: var(--ui-form-field-width);
    max-width: var(--ui-form-field-width);
  }

  .finance-period-control {
    grid-template-columns: var(--ui-form-field-width) minmax(0, 1fr);
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
    width: 520px;
    max-width: 520px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    grid-template-columns: 520px;
    grid-template-areas:
      "document"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(2, var(--ui-form-field-width));
    justify-content: start;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
    position: static;
    width: 520px;
    max-height: none;
    margin: 12px 0 0;
  }
}

@media (max-width: 1180px) and (min-width: 761px) {
  .cashier-grid,
  .material-management-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .supplier-contract-identity {
    grid-template-columns: repeat(2, var(--ui-form-field-width));
  }

  .supplier-contract-extras {
    grid-template-columns: var(--ui-form-double-field-width);
  }
}

@media (max-width: 760px) {
  :root {
    --ui-form-control-height: 44px;
    --ui-form-control-font-size: 16px;
    --ui-form-label-size: 14px;
    --ui-form-field-width: 100%;
    --ui-form-textarea-height: 96px;
  }

  .login-gate-card {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    padding: 20px;
  }

  .admin-login-form,
  .workbench-flow-picker-form > label,
  .workbench-flow-picker-select,
  .workbench-flow-picker-form select {
    width: 100%;
    max-width: none;
  }

  .admin-login-form input,
  .admin-login-form .login-account-submit,
  .workbench-flow-picker-form select {
    height: var(--ui-form-control-height);
    min-height: var(--ui-form-control-height);
    font-size: var(--ui-form-control-font-size);
  }

  .erp-flow-launch-dialog.is-picker {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .schedule-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .schedule-editor-table {
    display: table;
    width: 1600px;
    min-width: 1600px;
    max-width: 1600px;
    table-layout: fixed;
  }

  .erp-main .schedule-editor-table {
    min-width: 1600px;
  }

  .schedule-editor-table thead {
    display: table-header-group;
  }

  .schedule-editor-table tbody {
    display: table-row-group;
  }

  .schedule-editor-table tbody tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .schedule-editor-table tbody td {
    display: table-cell;
    min-height: 0;
    padding: 9px 8px;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .schedule-editor-table tbody td::before {
    display: none;
  }

  .schedule-editor-table :is(input, select, textarea) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: var(--ui-form-control-height);
    min-height: var(--ui-form-control-height);
    font-size: var(--ui-form-control-font-size);
  }

  .schedule-editor-table textarea {
    height: 72px;
    min-height: 72px;
  }

  .form-grid,
  .flow-form .form-grid,
  .change-order-form-grid,
  .construction-log-form .form-grid,
  .cashier-form .form-grid,
  .enterprise-profile-form .form-grid,
  .finance-account-row .form-grid,
  .material-movement-form,
  .payroll-sheet-meta,
  .supplier-contract-identity,
  .supplier-contract-extras,
  .approval-tree-node-fields,
  .approval-assignment-row,
  .org-department-row,
  .org-department-actions,
  .org-role-actions,
  .cashier-type-grid .inline-settings,
  .org-role-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid > label,
  .flow-form .form-grid > label,
  .form-grid > .field-control,
  .material-movement-form > label,
  .material-movement-form > fieldset,
  .payroll-sheet-meta > label,
  .payroll-sheet-meta > .payroll-note-field,
  .supplier-contract-identity > label,
  .supplier-contract-extras > :is(label, .supplier-template-attachment-control),
  .approval-tree-head > label,
  .approval-tree-node-fields > label,
  .approval-assignment-dropdown,
  .org-department-row :is(input, select),
  .org-department-actions input,
  .org-role-actions input,
  .cashier-type-grid .inline-settings input,
  .org-role-name-field,
  .org-role-name-field input {
    width: 100%;
    max-width: none;
  }

  .change-order-form-grid > label.field-wide,
  .enterprise-profile-form .form-grid > label.field-wide,
  .finance-account-row .form-grid > label.field-wide,
  .change-order-form-grid > .change-order-attachment-control,
  .cashier-form .form-grid > :is(.field-wide, .cashier-voucher-control),
  .cashier-reversal-panel .form-grid > .field-wide,
  .material-movement-form > :is(.field-wide, .material-contract-reference, .material-movement-actions, .queued-attachment-control),
  .payroll-sheet-meta > .payroll-note-field {
    grid-column: 1;
    width: 100%;
    max-width: none;
  }

  .schedule-editor-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .schedule-editor-toolbar label {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }

  .schedule-editor-toolbar :is(select, input) {
    width: 100%;
    max-width: none;
  }

  .inline-select {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .construction-log-header-controls {
    width: 100%;
    min-width: 0;
  }

  .construction-log-header-controls > label {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 4px;
  }

  .construction-log-header-controls select {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: var(--ui-form-control-height);
    min-height: var(--ui-form-control-height);
    font-size: var(--ui-form-control-font-size);
  }

  .payroll-filters,
  .finance-period-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .payroll-filters label,
  .payroll-filters :is(input, select),
  .finance-period-control > label,
  .finance-period-control input {
    width: 100%;
    max-width: none;
  }

  .payroll-filters :is(input, select),
  .finance-period-control input {
    height: var(--ui-form-control-height);
    min-height: var(--ui-form-control-height);
    font-size: var(--ui-form-control-font-size);
  }

  .inline-select select,
  .data-export-filter-grid > label,
  .data-export-download-bar > label {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
  }

  .data-export-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-export-filter-grid :is(input, select),
  .data-export-download-bar input {
    height: var(--ui-form-control-height);
    min-height: var(--ui-form-control-height);
    font-size: var(--ui-form-control-font-size);
  }

  .data-export-download-bar {
    align-items: stretch;
  }

  .supplier-contract-identity :is(input, select),
  .supplier-link-scope-form select,
  .approval-tree-head > label input,
  .approval-tree-node-fields :is(input, select),
  .org-department-row :is(input, select),
  .org-department-actions input,
  .org-role-actions input,
  .cashier-type-grid .inline-settings input,
  .org-role-name-field input {
    height: var(--ui-form-control-height);
    min-height: var(--ui-form-control-height);
    font-size: var(--ui-form-control-font-size);
  }

  .supplier-contract-extras textarea {
    min-height: var(--ui-form-textarea-height);
    font-size: var(--ui-form-control-font-size);
  }

.payroll-table :is(input, select, textarea) {
    font-size: 16px;
  }
}

/* Workbench operational command center final layer */
.view-root:has(> .workbench-heading) {
  width: 100%;
  max-width: min(var(--ui-content-max), 1440px);
  grid-template-columns: minmax(0, 1fr) minmax(304px, 336px);
  grid-template-areas:
    "heading heading"
    "tasks status";
  gap: 16px;
  align-items: start;
}

.view-root:has(> .workbench-heading) > .workbench-heading {
  grid-area: heading;
}

.view-root:has(> .workbench-heading) > .workbench-next-action-section {
  grid-area: tasks;
}

.view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
  grid-area: status;
}

.view-root:has(> .workbench-heading) > .workbench-next-action-section:last-child {
  grid-column: 1 / -1;
}

.workbench-heading {
  min-height: 64px;
  gap: 16px;
  padding: 4px 0 12px;
  border-bottom-color: var(--ui-border);
}

.workbench-heading-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workbench-heading-copy > span {
  color: var(--ui-ink-650);
  font-size: 12px;
  font-weight: 600;
}

.workbench-heading h1 {
  font-size: 20px;
  font-weight: 720;
  line-height: 1.3;
}

.workbench-heading-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workbench-heading-summary > span {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--ui-accent-600);
}

.workbench-heading-summary > span.has-attention {
  background: var(--ui-warning);
}

.workbench-heading-summary p {
  margin: 0;
  color: var(--ui-ink-650);
  font-size: 13px;
  line-height: 1.5;
}

.workbench-heading > .workbench-heading-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.workbench-primary-action {
  min-height: 40px;
  gap: 8px;
  padding: 8px 16px;
  border-color: var(--ui-primary-900);
  border-radius: var(--ui-radius-sm);
  color: #ffffff;
  background: var(--ui-primary-900);
  font-size: 13px;
  font-weight: 680;
  box-shadow: 0 1px 2px rgba(15, 52, 118, 0.12);
}

.workbench-primary-action:hover,
.workbench-primary-action:focus-visible {
  border-color: var(--ui-primary-800);
  background: var(--ui-primary-800);
}

.workbench-primary-action > span {
  font-size: 18px;
  line-height: 1;
}

.workbench-next-action-section,
.workbench-flow-status-bar {
  align-self: start;
  height: auto;
}

.workbench-task-center {
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 52, 118, 0.05);
}

.workbench-next-action-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-surface-subtle);
}

.workbench-next-action-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workbench-next-action-head h2 {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 18px;
  font-weight: 720;
  line-height: 1.35;
}

.workbench-next-action-head p {
  max-width: 64ch;
  margin: 0;
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.5;
}

.workbench-task-head-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workbench-task-head-actions > span {
  min-width: 40px;
  color: var(--ui-ink-650);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.workbench-task-head-actions > button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: #ffffff;
  font-size: 12px;
  font-weight: 650;
}

.workbench-task-head-actions > button:hover,
.workbench-task-head-actions > button:focus-visible {
  border-color: var(--ui-accent-600);
  background: var(--ui-accent-100);
}

.workbench-next-action-list {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 0 16px 4px;
}

.workbench-next-action-list > button {
  min-width: 0;
  min-height: 60px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) minmax(128px, 176px) 16px;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  border-radius: 0;
  color: var(--ui-ink-950);
  background: transparent;
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease;
}

.workbench-next-action-list > button:last-child {
  border-bottom: 0;
}

.workbench-next-action-list > button:hover,
.workbench-next-action-list > button:focus-visible {
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
}

.workbench-next-action-list > button:active {
  background: var(--ui-primary-100);
}

.workbench-next-action-mark,
.workbench-next-action-check {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: var(--ui-primary-100);
  font-size: 12px;
  font-weight: 760;
  font-style: normal;
}

.workbench-next-action-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workbench-next-action-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workbench-next-action-meta small {
  min-width: 0;
  padding: 2px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-ink-650);
  background: var(--ui-surface-subtle);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.5;
}

.workbench-next-action-meta time {
  min-width: 0;
  overflow: hidden;
  color: var(--ui-ink-650);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-next-action-copy strong,
.workbench-next-action-copy em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-next-action-copy strong {
  color: var(--ui-ink-950);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.4;
}

.workbench-next-action-copy em {
  color: var(--ui-ink-650);
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
}

.workbench-next-action-owner {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.workbench-next-action-owner small {
  max-width: 100%;
  overflow: hidden;
  color: var(--ui-ink-650);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-next-action-owner strong {
  color: var(--ui-primary-900);
  font-size: 12px;
  font-weight: 680;
}

.workbench-next-action-arrow {
  color: var(--ui-ink-500);
  font-size: 20px;
  line-height: 1;
  text-align: center;
}

.workbench-next-action-empty {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 4px;
  color: var(--ui-ink-650);
}

.workbench-next-action-empty > span:last-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workbench-next-action-empty strong {
  color: var(--ui-ink-950);
  font-size: 13px;
}

.workbench-next-action-empty small {
  font-size: 12px;
}

.workbench-flow-status-bar {
  min-width: 0;
  display: grid;
  align-content: start;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  box-shadow: none;
}

.workbench-flow-status-intro {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-surface-subtle);
}

.workbench-flow-status-intro > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workbench-flow-status-intro strong {
  color: var(--ui-ink-950);
  font-size: 16px;
  font-weight: 720;
}

.workbench-flow-status-intro small {
  margin: 0;
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.45;
}

.workbench-flow-status-overview {
  min-width: 80px;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: #ffffff;
}

.workbench-flow-status-overview span {
  font-size: 11px;
  font-weight: 650;
}

.workbench-flow-status-overview strong {
  color: var(--ui-ink-950);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.workbench-flow-status-overview:hover,
.workbench-flow-status-overview:focus-visible,
.workbench-flow-status-overview.is-active {
  border-color: var(--ui-accent-500);
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
}

.workbench-flow-status-groups {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 4px 16px 8px;
}

.workbench-flow-status-group,
.workbench-flow-status-group:nth-child(odd) {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-group:last-child {
  border-bottom: 0;
}

.workbench-flow-status-group > span {
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 680;
  line-height: 1.4;
}

.workbench-flow-status-group > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.workbench-flow-status-button {
  min-width: 0;
  min-height: 36px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-650);
  background: transparent;
  text-align: left;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.workbench-flow-status-button:hover,
.workbench-flow-status-button:focus-visible {
  border-color: var(--ui-border);
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
}

.workbench-flow-status-button.is-active {
  border-color: var(--ui-accent-200);
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
  box-shadow: inset 2px 0 0 var(--ui-accent-500);
}

.workbench-flow-status-button small {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-flow-status-button strong {
  flex: 0 0 auto;
  color: var(--ui-ink-950);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1180px) and (min-width: 761px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "tasks"
      "status";
  }

  .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .workbench-flow-status-group,
  .workbench-flow-status-group:nth-child(odd) {
    align-content: start;
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "tasks"
      "status";
    gap: 12px;
  }

  .workbench-heading {
    min-height: 0;
    align-items: stretch;
    gap: 8px;
    padding: 4px 0 12px;
  }

  .workbench-heading h1 {
    font-size: 20px;
  }

  .workbench-heading-summary p {
    font-size: 12px;
  }

  .workbench-heading > .workbench-heading-actions {
    width: 100%;
    flex-direction: row;
  }

  .workbench-primary-action {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .workbench-next-action-head {
    min-height: 0;
    align-items: flex-start;
    padding: 12px;
  }

  .workbench-next-action-head p {
    max-width: 44ch;
  }

  .workbench-task-head-actions {
    align-self: center;
  }

  .workbench-next-action-list {
    padding: 0 12px 4px;
  }

  .workbench-next-action-list > button {
    min-height: 72px;
    grid-template-columns: 32px minmax(0, 1fr) 16px;
    gap: 8px;
    padding: 8px 4px;
  }

  .workbench-next-action-owner {
    display: none;
  }

  .workbench-next-action-copy strong,
  .workbench-next-action-copy em {
    white-space: normal;
  }

  .workbench-next-action-copy em {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .workbench-flow-status-intro {
    min-height: 64px;
    padding: 12px;
  }

  .workbench-flow-status-groups {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 0;
    padding: 4px 12px 8px;
    overflow: visible;
    overscroll-behavior: auto;
    scroll-snap-type: none;
  }

  .workbench-flow-status-group,
  .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .workbench-flow-status-group:last-child {
    border-bottom: 0;
  }

  .workbench-flow-status-group > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .workbench-flow-status-button {
    min-height: 44px;
    padding: 8px 12px;
  }

  .workbench-flow-status-button small {
    font-size: 14px;
  }
}

/* Operator layout authority 2026-08-13-26 */
.material-inventory-view-switch {
  display: flex;
  flex-wrap: nowrap;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
}

.material-inventory-view-switch button {
  flex: 0 0 auto;
  min-width: 68px;
}

.org-module-dropdown-options.is-floating-open {
  max-width: calc(100vw - 24px);
  overflow-x: hidden;
  overflow-y: auto;
}

.org-module-dropdown-options.is-floating-open > label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (min-width: 761px) {
  .org-employee-permission-table {
    width: 1200px;
    min-width: 1200px;
    max-width: 1200px;
  }

  .org-employee-permission-table :is(th, td):nth-child(4) { width: 184px; }
  .org-employee-permission-table :is(th, td):nth-child(5) { width: 196px; }
  .org-employee-permission-table :is(th, td):nth-child(6) { width: 168px; }
}

@media (max-width: 760px) {
  .module-subnav button {
    min-height: 44px;
  }

  .material-inventory-heading {
    align-items: flex-start;
  }

  .material-inventory-view-switch {
    width: 100%;
  }

  .material-inventory-view-switch button {
    flex: 1 1 50%;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workbench-primary-action,
  .workbench-next-action-list > button,
  .workbench-flow-status-button {
    transition: none;
  }
}

/* Final audit pass: keep the compact desktop status rail readable at narrow widths. */
@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr) minmax(304px, 336px);
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-bar {
    display: block;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    min-height: 0;
    display: grid;
    gap: 10px;
    padding: 14px 16px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: 100%;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 6px 12px 10px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 10px 0;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
}

/* Final interaction audit: preserve complete charts and approval actions on small screens. */
@media (max-width: 760px) {
  .dashboard-comparison-scroll {
    overflow: visible;
    overscroll-behavior-inline: auto;
  }

  .dashboard-comparison-scroll .dashboard-comparison-bars {
    min-width: 0;
    height: auto;
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 148px;
    gap: 10px 6px;
    padding: 12px 2px 4px;
    background: none;
  }

  .dashboard-comparison-scroll .dashboard-chart-bar {
    width: 100%;
    height: 148px;
    grid-template-rows: 20px minmax(0, 1fr) 30px;
  }

  .dashboard-comparison-scroll .dashboard-chart-bar > i {
    width: min(32px, 58%);
  }

  .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 {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-modal);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 8px;
    margin: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 -2px 8px rgba(15, 52, 118, 0.1);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary {
    grid-column: 1 / -1;
    grid-row: 1;
    order: initial;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary),
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary) {
    grid-row: 2;
    min-width: 0;
  }
}

/* Narrow task surfaces keep identity visible and defer explanatory copy. */
@media (max-width: 1060px) and (min-width: 761px) {
  #erp-flow-launch-dialog .flow-document-heading p {
    display: none;
  }

  #erp-flow-launch-dialog .flow-document-meta {
    margin-bottom: 4px;
  }
}

@media (max-width: 760px) {
  #erp-flow-launch-dialog .flow-document-heading p {
    display: none;
  }

  #erp-flow-launch-dialog .flow-document-head {
    row-gap: 8px;
  }
}

/* Operator audit 2026-08-13-12: final detail layer for real working widths. */
.workbench-task-center {
  border-top: 2px solid var(--ui-primary-900);
}

.workbench-flow-status-bar {
  border-top: 2px solid var(--ui-accent-600);
}

.workbench-recent-activity {
  border-top: 2px solid var(--ui-border-strong);
}

.construction-log-form .form-grid.compact {
  grid-template-columns: repeat(2, var(--ui-form-field-width));
  justify-content: start;
}

.construction-log-form .form-grid > .construction-log-field,
.construction-log-form .form-grid > .construction-log-upload-field {
  grid-column: 1 / -1;
  width: var(--ui-form-double-field-width);
  max-width: var(--ui-form-double-field-width);
}

.construction-log-form .construction-log-field textarea {
  width: 100%;
}

.cashier-type-grid {
  gap: 16px;
}

.cashier-type-grid > div {
  min-width: 0;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
  overflow: hidden;
}

.cashier-type-grid .flow-section-title {
  min-height: 48px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-950);
  background: var(--ui-surface-subtle);
  font-size: 14px;
}

.cashier-type-list {
  display: grid;
  border: 1px solid var(--ui-border);
  border-width: 0 0 1px;
}

.cashier-type-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 16px;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-900);
  background: #ffffff;
  font-size: 13px;
}

.cashier-type-row:last-child {
  border-bottom: 0;
}

.cashier-type-row:hover {
  background: var(--ui-surface-subtle);
}

.cashier-type-remove {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-danger);
  background: transparent;
  cursor: pointer;
}

.cashier-type-remove:is(:hover, :focus-visible) {
  border-color: #f2b8b5;
  background: #fff2f1;
}

.cashier-type-remove > span {
  font-size: 18px;
  line-height: 1;
}

.cashier-type-empty {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 16px;
  border-bottom: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-650);
  background: #fbfcfd;
}

.cashier-type-empty strong {
  color: var(--ui-ink-950);
  font-size: 13px;
}

.cashier-type-empty span {
  font-size: 12px;
}

.cashier-type-grid .inline-settings {
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  margin: 0;
  padding: 12px;
  background: #ffffff;
}

.cashier-type-grid .inline-settings input {
  width: 100%;
  max-width: none;
}

.finance-account-empty-state {
  min-height: 132px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  color: var(--ui-ink-650);
  background: #fbfcfd;
}

.finance-account-empty-state > span {
  width: 36px;
  height: 36px;
  display: block;
  border: 1px solid var(--ui-accent-200);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-100);
}

.finance-account-empty-state > span::before {
  content: "+";
  display: block;
  color: var(--ui-accent-700);
  font-size: 24px;
  line-height: 34px;
  text-align: center;
}

.finance-account-empty-state strong,
.finance-account-empty-state p {
  margin: 0;
}

.finance-account-empty-state strong {
  color: var(--ui-ink-950);
  font-size: 14px;
}

.finance-account-empty-state p {
  max-width: 68ch;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.55;
}

.reconciliation-table-shell {
  position: relative;
  isolation: isolate;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.data-table-scroll-hint {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 12px;
  border-top: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-650);
  background: var(--ui-surface-subtle);
  font-size: 11px;
}

.data-table-scroll-hint span::after {
  content: "  →";
  color: var(--ui-primary-900);
  font-weight: 750;
}

.reconciliation-table {
  table-layout: fixed;
}

.reconciliation-table-downstream {
  width: 1340px;
  min-width: 1340px;
}

.reconciliation-table-upstream {
  width: 1120px;
  min-width: 1120px;
}

.reconciliation-table :is(th, td) {
  white-space: nowrap;
}

.reconciliation-table :is(th, td):nth-child(-n + 3) {
  white-space: normal;
}

@media (max-width: 760px) {
  .erp-main .data-table-shell:has(.table-empty-row) > .data-table {
    display: table;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .construction-log-form .form-grid.compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .construction-log-form .form-grid > .construction-log-field,
  .construction-log-form .form-grid > .construction-log-upload-field {
    grid-column: 1;
    width: 100%;
    max-width: none;
  }

  .cashier-type-grid {
    gap: 12px;
  }

  .cashier-type-row {
    min-height: 48px;
  }

  .cashier-type-remove {
    width: 44px;
    height: 44px;
  }

  .finance-account-empty-state {
    min-height: 160px;
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 18px 14px;
  }

  .finance-account-empty-state > button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
  }

  .data-table-scroll-hint {
    display: none;
  }

  .reconciliation-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }
}

/* Mobile empty tables must not inherit the 680px data-table browsing width. */
@media (max-width: 760px) {
  .erp-main .data-table-shell:has(.table-empty-row) {
    overflow: hidden;
  }

  .erp-main .data-table-shell:has(.table-empty-row) > .data-table {
    display: table;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .erp-main .data-table-shell:has(.table-empty-row) .table-empty-row {
    display: table-row;
    width: auto;
  }

  .erp-main .data-table-shell:has(.table-empty-row) .table-empty-cell {
    display: table-cell;
    width: auto;
    min-width: 0;
  }

  .erp-main .data-table-shell:has(.table-empty-row) .data-table-empty-state {
    width: auto;
    max-width: 100%;
  }
}

/* Deep operator UI audit 2026-08-13: authoritative interaction hierarchy. */
.module-nav button[data-nav-icon]::before {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 0;
  border-radius: 0;
  opacity: 0.74;
  background-color: currentColor;
  -webkit-mask-image: var(--nav-icon);
  mask-image: var(--nav-icon);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  box-shadow: none;
  transform: none;
}

.module-nav button[data-nav-icon].is-active::before,
.module-nav button[data-nav-icon][aria-current="page"]::before {
  border: 0;
  opacity: 1;
  background-color: #a3e3df;
  box-shadow: none;
  transform: none;
}

.workbench-task-center {
  border-top: 2px solid var(--ui-primary-900);
}

.workbench-flow-status-bar {
  border-top: 2px solid var(--ui-accent-600);
}

.workbench-recent-activity {
  border-top: 2px solid var(--ui-border-strong);
}

.workbench-task-center > header,
.workbench-flow-status-bar > .workbench-flow-status-intro,
.workbench-recent-activity > header {
  background: #ffffff;
}

.data-table-empty-state {
  min-height: 116px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  color: var(--ui-ink-650);
  background: #fbfcfd;
  text-align: left;
}

.data-table-empty-action {
  min-height: 36px;
  border-color: var(--ui-primary-900);
  color: #ffffff;
  background: var(--ui-primary-900);
}

@media (max-width: 760px) {
  .data-table-shell:has(.table-empty-row) {
    overflow: hidden;
  }

  .data-table-shell:has(.table-empty-row) .data-table {
    width: 100%;
    min-width: 0;
  }

  .data-table-shell:has(.table-empty-row) .table-empty-row,
  .data-table-shell:has(.table-empty-row) .table-empty-cell {
    width: 100%;
    min-width: 0;
    display: block;
  }

  .workbench-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .workbench-heading > .workbench-heading-actions {
    width: auto;
  }

  .workbench-primary-action {
    width: 44px;
    min-width: 44px;
    padding: 10px;
    overflow: hidden;
    color: transparent;
    white-space: nowrap;
  }

  .workbench-primary-action > span {
    color: #ffffff;
    font-size: 22px;
  }

  .data-table-empty-state {
    min-height: 148px;
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 18px 14px;
  }
}

@media (max-width: 920px) and (min-width: 761px) {
  .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 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

/* Final audit override: the desktop status rail is a compact three-column control, not a vertical dashboard. */
@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-bar {
    min-height: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    min-width: 0;
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > strong {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro small {
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: auto;
    min-width: 68px;
    min-height: 34px;
    flex: 0 0 auto;
    padding: 6px 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 6px 8px 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 2px 6px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-right: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    min-height: 30px;
    padding: 4px 6px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button small {
    font-size: 11px;
  }
}

.flow-approval-financial-comparison dd {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

.flow-approval-review-brief dd.is-money {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

/* Final content-fit audit: keep dense labels readable at every supported viewport. */
.dashboard-stage-node > :is(span, strong, small) {
  min-width: 0;
}

.dashboard-stage-node > strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stage-node > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-ledger-table .data-table :is(th, td):last-child {
  min-width: 92px;
  white-space: nowrap;
}

.org-project-checks label {
  align-items: start;
}

.org-project-checks label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Final audit remediation 2026-08-13-release: authoritative last layer. */
.view-root:has(> .workbench-heading) {
  grid-template-areas:
    "heading heading"
    "tasks status"
    "activity activity";
}

.view-root:has(> .workbench-heading) > .workbench-heading {
  height: 66px;
  min-height: 66px;
  padding: 6px 0 7px;
  box-sizing: border-box;
}

.view-root:has(> .workbench-heading) .workbench-heading-copy {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "date title"
    "date summary";
  align-items: center;
  column-gap: 12px;
  row-gap: 1px;
}

.view-root:has(> .workbench-heading) .workbench-heading-copy > span {
  grid-area: date;
}

.view-root:has(> .workbench-heading) .workbench-heading-copy > h1 {
  grid-area: title;
}

.view-root:has(> .workbench-heading) .workbench-heading-summary {
  grid-area: summary;
}

.view-root:has(> .workbench-heading) .workbench-next-action-head {
  height: 56px;
  min-height: 56px;
  padding: 8px 14px;
  box-sizing: border-box;
}

.view-root:has(> .workbench-heading) .workbench-next-action-list {
  padding-inline: 14px;
}

.view-root:has(> .workbench-heading) .workbench-next-action-list > button {
  height: 56px;
  min-height: 56px;
  grid-template-columns: 32px minmax(0, 1fr) minmax(112px, 156px) 16px;
  gap: 10px;
  padding: 6px 4px;
  box-sizing: border-box;
}

.view-root:has(> .workbench-heading) .workbench-next-action-copy {
  gap: 2px;
}

.view-root:has(> .workbench-heading) .workbench-next-action-copy :is(strong, em) {
  white-space: nowrap;
}

.view-root:has(> .workbench-heading) .workbench-next-action-owner {
  gap: 1px;
}

.workbench-recent-activity {
  min-width: 0;
  grid-area: activity;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #ffffff;
}

.workbench-recent-activity > header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-surface-subtle);
}

.workbench-recent-activity > header > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.workbench-recent-activity h2,
.workbench-recent-activity p {
  margin: 0;
}

.workbench-recent-activity h2 {
  color: var(--ui-ink-950);
  font-size: 15px;
  font-weight: 720;
}

.workbench-recent-activity p {
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.45;
}

.workbench-recent-activity > header > button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-primary-900);
  background: #ffffff;
  font-size: 12px;
  font-weight: 650;
}

.workbench-recent-list {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 0 16px 4px;
}

.workbench-recent-list > button {
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 166px 16px;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid var(--ui-border-soft);
  border-radius: 0;
  color: var(--ui-ink-950);
  background: transparent;
  text-align: left;
}

.workbench-recent-list > button:last-child {
  border-bottom: 0;
}

.workbench-recent-list > button:is(:hover, :focus-visible) {
  color: var(--ui-primary-900);
  background: var(--ui-primary-050);
}

.workbench-recent-action {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid var(--ui-accent-200);
  border-radius: 999px;
  color: var(--ui-primary-900);
  background: var(--ui-accent-100);
  font-size: 11px;
  font-weight: 680;
}

.workbench-recent-list > button > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.workbench-recent-list > button :is(strong, small, time) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-recent-list > button strong {
  font-size: 13px;
  font-weight: 680;
}

.workbench-recent-list > button small,
.workbench-recent-list > button time {
  color: var(--ui-ink-650);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.workbench-recent-list > button time {
  text-align: right;
}

.workbench-recent-list > button i {
  color: var(--ui-ink-500);
  font-size: 18px;
  font-style: normal;
  text-align: center;
}

.workbench-recent-empty {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 4px;
}

.workbench-recent-empty strong {
  color: var(--ui-ink-950);
  font-size: 13px;
}

.workbench-recent-empty span {
  color: var(--ui-ink-650);
  font-size: 12px;
}

.cashier-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--ui-border-soft);
}

.cashier-summary-grid > .context-card {
  min-height: 104px;
  padding: 14px 16px;
  border: 0;
  border-right: 1px solid var(--ui-border-soft);
  border-radius: 0;
}

.cashier-summary-grid > .context-card:last-child {
  border-right: 0;
}

.cashier-empty-workspace {
  min-height: 148px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  gap: 12px;
  padding: 22px 24px;
  border-top: 1px solid var(--ui-border-soft);
  color: var(--ui-ink-650);
  background: #fbfcfd;
}

.cashier-empty-workspace > span {
  width: 36px;
  height: 36px;
  display: block;
  border: 1px solid var(--ui-accent-200);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-100);
}

.cashier-empty-workspace > span::before {
  content: "";
  width: 12px;
  height: 7px;
  display: block;
  margin: 11px auto 0;
  border-bottom: 2px solid var(--ui-accent-700);
  border-left: 2px solid var(--ui-accent-700);
  transform: rotate(-45deg);
}

.cashier-empty-workspace strong,
.cashier-empty-workspace p {
  margin: 0;
}

.cashier-empty-workspace strong {
  color: var(--ui-ink-950);
  font-size: 14px;
}

.cashier-empty-workspace p {
  max-width: 68ch;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.55;
}

.contract-ledger-table .data-table {
  width: 100%;
  min-width: 980px;
}

.contract-ledger-table .data-table th:nth-child(1),
.contract-ledger-table .data-table td:nth-child(1) { width: 21%; }
.contract-ledger-table .data-table th:nth-child(2),
.contract-ledger-table .data-table td:nth-child(2) { width: 17%; }
.contract-ledger-table .data-table th:nth-child(3),
.contract-ledger-table .data-table td:nth-child(3) { width: 15%; }
.contract-ledger-table .data-table th:nth-child(4),
.contract-ledger-table .data-table td:nth-child(4) { width: 19%; }
.contract-ledger-table .data-table th:nth-child(5),
.contract-ledger-table .data-table td:nth-child(5) { width: 17%; }
.contract-ledger-table .data-table th:nth-child(6),
.contract-ledger-table .data-table td:nth-child(6) { width: 11%; }

.contract-ledger-table .ledger-static-metric span {
  white-space: nowrap;
}

.org-employee-permission-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.org-employee-permission-table {
  overflow: visible;
}

@media (min-width: 761px) {
  .org-employee-permission-table {
    width: 1120px;
    min-width: 1120px;
    max-width: 1120px;
  }

  .org-employee-permission-table :is(th, td):nth-child(1) { width: 136px; }
  .org-employee-permission-table :is(th, td):nth-child(2) { width: 112px; }
  .org-employee-permission-table :is(th, td):nth-child(3) { width: 112px; }
  .org-employee-permission-table :is(th, td):nth-child(4) { width: 158px; }
  .org-employee-permission-table :is(th, td):nth-child(5) { width: 168px; }
  .org-employee-permission-table :is(th, td):nth-child(6) { width: 156px; }
  .org-employee-permission-table :is(th, td):nth-child(7) { width: 80px; }
  .org-employee-permission-table :is(th, td):nth-child(8) { width: 104px; }
  .org-employee-permission-table :is(th, td):nth-child(9) { width: 94px; }
}

.org-employee-permission-table .org-module-dropdown {
  width: 100%;
  min-width: 0;
}

.org-employee-permission-table .org-module-dropdown > summary {
  grid-template-columns: minmax(0, 1fr) 14px;
  gap: 4px;
  padding-inline: 8px;
}

.org-employee-permission-table .org-module-dropdown > summary > span {
  display: none;
}

.org-employee-permission-table .org-module-dropdown > summary > b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-employee-permission-table .org-inline-check {
  min-height: 38px;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.org-project-dropdown .org-module-dropdown-options,
.org-module-dropdown-options.is-project-options {
  grid-template-columns: minmax(0, 1fr);
}

.org-employee-permission-table :is(th, td):nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #ffffff;
  box-shadow: 1px 0 0 var(--ui-border-soft);
}

.org-employee-permission-table :is(th, td):nth-child(8) {
  position: static;
  right: auto;
  z-index: auto;
  background: #ffffff;
  box-shadow: none;
}

.org-employee-permission-table :is(th, td):nth-child(9) {
  position: static;
  right: auto;
  z-index: auto;
  background: #ffffff;
  box-shadow: none;
}

.org-employee-permission-table thead :is(th:nth-child(8), th:nth-child(9)) {
  z-index: auto;
  background: var(--ui-surface-soft);
}

.org-employee-permission-table thead th:nth-child(1) {
  z-index: 6;
  background: var(--ui-surface-soft);
}

.org-employee-permission-table tbody tr:hover :is(td:nth-child(1)) {
  background: #f7fafc;
}

.view-root:has(> .workbench-heading) .workbench-flow-status-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.view-root:has(> .workbench-heading) .workbench-flow-status-intro {
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
  min-width: 0;
  width: auto;
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.view-root:has(> .workbench-heading) .workbench-flow-status-intro > div > strong {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

.view-root:has(> .workbench-heading) .workbench-flow-status-intro small {
  min-width: 0;
  flex: 1 1 auto;
  width: auto;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-root:has(> .workbench-heading) .workbench-flow-status-overview {
  width: auto;
  min-width: 68px;
  min-height: 34px;
  flex: 0 0 auto;
}

.dashboard-chart-panel.is-zero-data {
  min-height: 220px;
}

.dashboard-chart-panel.is-zero-data .dashboard-chart-empty-inline {
  min-height: 148px;
}

@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 6px 8px 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 2px 6px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-right: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    min-height: 30px;
    padding: 4px 6px;
  }
}

@media (max-width: 760px) {
  .view-root:has(> .workbench-heading) > .workbench-heading {
    height: auto;
    min-height: 66px;
  }

  .view-root:has(> .workbench-heading) .workbench-heading-copy {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "date"
      "title"
      "summary";
    row-gap: 3px;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-head {
    height: auto;
    min-height: 56px;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-list > button {
    grid-template-columns: 32px minmax(0, 1fr) 16px;
  }

  .erp-main .org-employee-permission-table {
    min-width: 0 !important;
    width: 100%;
  }

  .org-employee-permission-table {
    display: block;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .org-employee-permission-table thead {
    display: none;
  }

  .org-employee-permission-table tbody,
  .org-employee-permission-table tbody tr {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .org-employee-permission-table tbody tr {
    padding: 4px 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .org-employee-permission-table tbody td,
  .org-employee-permission-table tbody td:nth-child(n) {
    position: static;
    right: auto;
    z-index: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 8px 10px;
    box-shadow: none;
    background: #ffffff;
  }

  .workbench-recent-activity > header {
    padding: 10px 12px;
  }

  .workbench-recent-activity > header p {
    display: none;
  }

  .workbench-recent-activity > header > button {
    min-height: 44px;
  }

  .workbench-recent-list {
    padding: 0 12px 4px;
  }

  .workbench-recent-list > button {
    min-height: 68px;
    grid-template-columns: 58px minmax(0, 1fr) 16px;
    gap: 8px;
  }

  .workbench-recent-list > button time {
    grid-column: 2;
    text-align: left;
  }

  .workbench-recent-list > button i {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .cashier-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--ui-border-soft);
  }

  .cashier-summary-grid > .context-card {
    min-height: 88px;
    border: 0;
  }

  .cashier-summary-grid > .context-card:last-child {
    grid-column: 1 / -1;
  }

  .cashier-empty-workspace {
    min-height: 132px;
    padding: 18px 14px;
  }

  .contract-ledger-table .data-table {
    width: 100%;
    min-width: 0;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .org-employee-permission-table tbody td::before {
    flex: 0 0 68px;
    color: var(--ui-ink-650);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.4;
  }

  .org-employee-permission-table tbody td:nth-child(1)::before { content: "姓名"; }
  .org-employee-permission-table tbody td:nth-child(2)::before { content: "部门"; }
  .org-employee-permission-table tbody td:nth-child(3)::before { content: "角色"; }
  .org-employee-permission-table tbody td:nth-child(4)::before { content: "分配项目"; }
  .org-employee-permission-table tbody td:nth-child(5)::before { content: "开放模块"; }
  .org-employee-permission-table tbody td:nth-child(6)::before { content: "操作权限"; }
  .org-employee-permission-table tbody td:nth-child(7)::before { content: "审批人"; }
  .org-employee-permission-table tbody td:nth-child(8)::before { content: "状态"; }
  .org-employee-permission-table tbody td:nth-child(9)::before { content: "操作"; }

  .org-employee-permission-table tbody td > :is(input, select, details),
  .org-employee-permission-table tbody td > .org-project-checks {
    min-width: 0;
    width: auto;
    max-width: none;
    flex: 1 1 auto;
  }

  .org-employee-permission-table tbody td > .org-inline-check,
  .org-employee-permission-table tbody td > .table-action {
    margin-left: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 0;
    padding: 4px 6px 8px;
    overflow: visible;
    overscroll-behavior: auto;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 8px 5px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-right: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > span {
    font-size: 11px;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    min-height: 44px;
    padding: 7px 6px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button small {
    font-size: 12px;
  }

  .dashboard-chart-panel.is-zero-data {
    min-height: 190px;
  }

  .dashboard-chart-panel.is-zero-data .dashboard-chart-empty-inline {
    min-height: 118px;
    padding-inline: 12px;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-modal);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 8px;
    margin: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    max-width: 100vw;
    box-sizing: border-box;
    border: 0;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 -2px 8px rgba(15, 52, 118, 0.1);
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .primary {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary) {
    grid-row: 2;
    min-width: 0;
  }
}

/* Workbench responsive correction: preserve the operator task order below desktop width. */
@media (max-width: 1180px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "tasks"
      "status"
      "activity";
  }

  .view-root:has(> .workbench-heading) > :is(
    .workbench-heading,
    .workbench-task-center,
    .workbench-flow-status-bar,
    .workbench-recent-activity
  ) {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .view-root:has(> .workbench-heading) .workbench-primary-action {
    width: auto;
    min-width: 96px;
    min-height: 44px;
    padding: 9px 12px;
    overflow: visible;
    color: #ffffff;
    font-size: 13px;
  }

  .view-root:has(> .workbench-heading) .workbench-primary-action > span {
    color: #ffffff;
    font-size: 19px;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-list > button {
    height: auto;
    min-height: 72px;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-copy :is(strong, em) {
    white-space: normal;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-copy em {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 360px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    gap: 3px;
    padding-inline: 4px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button small {
    font-size: 11px;
  }
}

@media (min-width: 1061px) {
  .data-export-layout {
    grid-template-columns: 340px minmax(0, 1fr);
    height: clamp(560px, calc(100dvh - 300px), 720px);
    min-height: 0;
  }

  .data-export-config {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto auto auto auto minmax(120px, 1fr);
    align-content: start;
    overflow: hidden;
  }

  .data-export-config > .data-export-statuses {
    min-height: 0;
    margin-top: 8px;
    padding: 6px 8px;
  }

  .data-export-config > .data-export-statuses legend {
    padding-inline: 4px;
  }

  .data-export-config > .data-export-statuses > div {
    gap: 4px;
  }

  .data-export-config > .data-export-statuses label {
    min-height: 32px;
    padding: 4px 6px;
  }

  .data-export-config > .data-export-reset {
    margin-top: 6px;
  }

  .data-export-config > .data-export-fields-title {
    min-height: 34px;
    margin-top: 8px;
    margin-bottom: 6px;
  }

  .data-export-config > .data-export-field-actions {
    margin-top: -30px;
    margin-bottom: 4px;
  }

  .data-export-field-list {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .data-export-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .data-export-filter-grid > label {
    width: 100%;
    max-width: none;
  }

  .data-export-filter-grid > .data-export-field-wide {
    grid-column: 1 / -1;
  }

  .data-export-preview {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .data-export-preview > [data-export-preview-table] {
    min-height: 0;
    overflow: hidden;
  }

  .data-export-preview > [data-export-preview-table] > .data-export-table-scroll {
    height: 100%;
    max-height: none;
    overflow: auto;
  }

  .data-export-download-bar {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--ui-border);
  }
}

@media (min-width: 761px) and (max-width: 1060px) {
  .data-export-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .data-export-config {
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .data-export-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-export-filter-grid > label {
    width: 100%;
    max-width: none;
  }

  .data-export-filter-grid > .data-export-field-wide {
    grid-column: 1 / -1;
  }

  .data-export-field-list {
    max-height: 220px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-y: auto;
  }

  .data-export-preview > [data-export-preview-table] {
    max-height: 460px;
    overflow: hidden;
  }

  .data-export-preview > [data-export-preview-table] > .data-export-table-scroll {
    max-height: 460px;
    overflow: auto;
  }
}

@media (max-width: 760px) {
  .app-header .global-search input {
    height: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  .erp-flow-launch-dialog.is-picker :is(.table-action, button),
  #erp-flow-launch-dialog .flow-template-tools :is(summary, button, select) {
    min-height: 44px;
  }
}

.login-audit-inline-error,
.system-management-inline-error {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(229, 57, 53, 0.28);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #fff7f7;
}

.system-management-inline-error > span,
.login-audit-inline-error > span {
  min-width: 0;
  line-height: 1.5;
}

.system-management-inline-error > strong {
  flex: 0 0 auto;
  color: var(--ui-danger);
}

.system-management-inline-error > .table-action,
.login-audit-inline-error > .table-action {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .login-audit-inline-error,
  .system-management-inline-error {
    align-items: stretch;
    flex-direction: column;
  }

  .login-audit-inline-error > .table-action,
  .system-management-inline-error > .table-action {
    min-height: 44px;
  }
}

/* Approval evidence-first remediation 2026-08-13 */
.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip strong {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.flow-record-preview-panel:not(.is-decision-mode) .dashboard-preview-table {
  max-height: none;
  overflow-y: visible;
}

.flow-preview-action-bar {
  flex-wrap: wrap;
}

.flow-attachment-file-list > .attachment-file-unavailable {
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(217, 58, 54, 0.28);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-ink-950);
  background: #fff7f7;
}

.attachment-file-unavailable > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-file-unavailable > em {
  color: var(--ui-danger);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.related-flow-reference-list {
  min-width: 0;
  display: grid;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  overflow: hidden;
}

.related-flow-reference-item {
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--ui-border-soft);
  background: #ffffff;
}

.related-flow-reference-item:last-child {
  border-bottom: 0;
}

.related-flow-reference-item > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.related-flow-reference-item :is(span, strong) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-flow-reference-item span {
  color: var(--ui-ink-650);
  font-size: 11px;
}

.related-flow-reference-item strong {
  color: var(--ui-ink-950);
  font-size: 13px;
  font-weight: 680;
}

.related-flow-reference-item small {
  min-height: 20px;
}

@media (min-width: 921px) {
  .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 368px);
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    min-width: 340px;
  }
}

@media (max-width: 920px) {
  .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: max-content;
    align-content: start;
  }

  .flow-record-preview-panel.is-decision-mode .flow-record-preview-main,
  .flow-record-preview-panel.is-decision-mode .flow-approval-document {
    display: contents;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-context-strip { order: 1; }
  .flow-record-preview-panel.is-decision-mode .flow-approval-main-checks { order: 2; }
  .flow-record-preview-panel.is-decision-mode .flow-approval-focus { order: 3; }

  .flow-record-preview-panel.is-decision-mode .flow-approval-content-section {
    order: 4;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    position: static;
    top: auto;
    order: 5;
    width: auto;
    min-width: 0;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench {
    padding-bottom: 0;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: static;
    inset: auto;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 0.92fr) minmax(0, 1.6fr);
    margin: 12px -12px -12px;
    padding: 10px 12px 12px;
    max-width: none;
    border-top: 1px solid var(--ui-border);
    box-shadow: none;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .primary,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .primary {
    grid-column: 3;
    grid-row: 1;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary),
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary) {
    grid-row: 1;
  }

  .related-flow-reference-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .related-flow-reference-item > .table-action {
    min-width: 56px;
    min-height: 44px;
  }
}

/* Workbench information architecture 2026-08-13: task-first, full-width status matrix. */
.view-root:has(> .workbench-heading) {
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
  grid-template-areas:
    "heading heading"
    "status status"
    "tasks activity";
  gap: 16px;
}

.view-root:has(> .workbench-heading) > .workbench-heading {
  height: auto;
  min-height: 66px;
  padding-block: 7px 10px;
}

.view-root:has(> .workbench-heading) .workbench-heading-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: none;
  gap: 3px;
}

.workbench-heading-title-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.view-root:has(> .workbench-heading) .workbench-heading-title-row > h1,
.view-root:has(> .workbench-heading) .workbench-heading-title-row > span {
  grid-area: auto;
}

.workbench-heading-title-row > span {
  flex: 0 0 auto;
  color: var(--ui-ink-650);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.view-root:has(> .workbench-heading) .workbench-heading-summary {
  grid-area: auto;
}

.view-root:has(> .workbench-heading) > .workbench-task-center {
  grid-area: tasks;
}

.view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
  grid-area: status;
}

.view-root:has(> .workbench-heading) > .workbench-recent-activity {
  grid-area: activity;
}

@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-bar {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: stretch;
    min-height: 124px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    align-items: start;
    gap: 12px;
    padding: 16px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    display: grid;
    align-items: start;
    gap: 3px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    padding: 10px 12px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 6px;
    padding: 4px 14px;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-right: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    min-height: 54px;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 2px;
    padding: 7px 9px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button small {
    font-size: 11px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button strong {
    font-size: 17px;
  }

  .view-root:has(> .workbench-heading) .workbench-recent-list > button {
    grid-template-columns: 56px minmax(0, 1fr) 16px;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    min-height: 62px;
  }

  .view-root:has(> .workbench-heading) .workbench-recent-list > button > time {
    grid-column: 2;
    text-align: left;
  }

  .view-root:has(> .workbench-heading) .workbench-recent-list > button > i {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 1180px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "tasks"
      "status"
      "activity";
  }
}

@media (max-width: 760px) {
  .workbench-heading-title-row {
    display: grid;
    gap: 2px;
  }

  .workbench-heading-title-row > span {
    grid-row: 1;
  }

  .workbench-heading-title-row > h1 {
    grid-row: 2;
  }
}

/* Operator detail remediation 2026-08-13: touch, flat detail surfaces, and compact tools. */
.party-import-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-950);
  background: #ffffff;
}

.party-import-toolbar > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.party-import-toolbar strong {
  font-size: 13px;
  font-weight: 700;
}

.party-import-toolbar span {
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.45;
}

.finance-linked-detail {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.finance-linked-detail > .flow-section-title {
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--ui-border-soft);
}

.organization-picker-backdrop,
.dingtalk-directory-picker-backdrop {
  z-index: var(--z-modal-backdrop);
}

.organization-picker-head > button,
.organization-picker-tree button,
.organization-picker-search input {
  min-height: 38px;
}

.ledger-static-metric.positive strong {
  color: #176b5c;
}

.ledger-static-metric.warning strong,
.ledger-alert-link.has-warning strong {
  color: #9a4e0b;
}

.table-column-menu > summary {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
}

.table-column-menu > div > label,
.org-module-dropdown-options > label {
  min-height: 38px;
  align-items: center;
}

.table-column-menu input[type="checkbox"],
.org-module-dropdown-options input[type="checkbox"],
.org-inline-check input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
}

.template-title-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding-block: 6px;
}

.org-role-member > button {
  min-width: 32px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.login-audit-agent {
  min-width: 118px;
  max-width: 100%;
}

.login-audit-agent > summary {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  color: var(--ui-primary-800);
  font-weight: 650;
  cursor: pointer;
}

.login-audit-agent > p {
  max-width: 56ch;
  margin: 4px 0 0;
  color: var(--ui-ink-800);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: normal;
}

.construction-calendar-week span {
  color: #64717f;
}

.construction-calendar-grid button.is-outside-month {
  color: #667383;
}

@media (pointer: coarse) {
  .app-header .global-search input,
  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button,
  .workbench-flow-status-button,
  .workbench-flow-status-overview,
  .workbench-primary-action,
  .workbench-flow-picker-form :is(select, button),
  .flow-personal-template-bar :is(select, button),
  .organization-picker-head > button,
  .organization-picker-tree button,
  .organization-picker-search input,
  .organization-picker-actions :is(button, input, select),
  .dingtalk-directory-picker :is(button, input, select),
  .flow-related-chips button,
  .related-flow-picker-toolbar input,
  .related-flow-picker .dashboard-preview-actions button,
  .queued-attachment-card figcaption > button,
  .queued-attachment-dialog :is(button, input),
  .attachment-image-preview-head > button,
  .construction-calendar-controls button,
  .cashier-type-remove {
    min-height: 44px;
  }

  .app-header .global-search input {
    height: 44px;
    font-size: 14px;
  }

  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
  }

  .workbench-flow-status-button {
    padding-block: 7px;
  }

  .cashier-type-remove {
    width: 44px;
    min-width: 44px;
  }

  .org-role-member > button {
    min-width: 44px;
    min-height: 44px;
  }

  .flow-related-chips button,
  .queued-attachment-card figcaption > button,
  .attachment-image-preview-head > button,
  .construction-calendar-controls button:not(.construction-calendar-today) {
    width: 44px;
    min-width: 44px;
  }
}

@media (max-width: 920px) {
  .app-header .global-search input,
  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button,
  .workbench-flow-status-button,
  .workbench-flow-status-overview,
  .workbench-primary-action,
  .workbench-flow-picker-form :is(select, button),
  .flow-personal-template-bar :is(select, button),
  .organization-picker-head > button,
  .organization-picker-tree button,
  .organization-picker-search input,
  .organization-picker-actions :is(button, input, select),
  .dingtalk-directory-picker :is(button, input, select),
  .cashier-type-remove {
    min-height: 44px;
  }

  .app-header .global-search input {
    height: 44px;
    font-size: 14px;
  }

  .app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
  }

  .workbench-flow-status-button {
    padding-block: 7px;
  }

  .cashier-type-remove {
    width: 44px;
    min-width: 44px;
  }
}

@media (max-width: 760px) {
  .party-import-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .party-import-toolbar > .table-action {
    min-height: 44px;
  }

  #flow-form .flow-personal-template-bar :is(select, button),
  #flow-form input[name="documentNo"] {
    min-height: 44px;
    font-size: 14px;
  }
}

/* Tablet workflow authority: full-screen task space with fixed field geometry. */
@media (min-width: 761px) and (max-width: 920px) {
  #erp-flow-launch-dialog:not(.is-picker)[open] {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--ui-page);
    box-shadow: none;
  }

  #erp-flow-launch-dialog:not(.is-picker)::backdrop {
    background: var(--ui-overlay);
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-shell {
    width: 100%;
    max-width: none;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-head {
    min-height: 58px;
    padding: 7px 16px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
    padding: 12px 16px 24px;
    overflow-x: hidden;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
    width: 744px;
    max-width: calc(100vw - 32px);
    margin-inline: auto;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined {
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 744px);
    grid-template-areas:
      "document"
      "progress"
      "fields"
      "rail"
      "actions";
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, var(--ui-form-field-width));
    justify-content: start;
    gap: var(--ui-form-grid-gap);
    padding: 12px 14px 82px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid > :is(label:not(.field-wide), fieldset:not(.field-wide)) {
    grid-column: auto !important;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-grid > :is(.field-wide, .form-section-label, .flow-related-field, .contract-lines, .attachment-upload-control) {
    width: min(716px, calc(100vw - 60px));
    max-width: none;
    min-width: 0;
    grid-column: 1 / -1;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-grid > .contract-lines {
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
    position: static;
    width: 100%;
    max-width: 100%;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px 0 0;
    overflow: visible;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-task-rail > :is(.flow-context, .flow-task-rail-note) {
    grid-column: 1 / -1;
  }

  #erp-flow-launch-dialog :is(
    .erp-flow-launch-dialog-close,
    .flow-personal-template-bar select,
    .flow-personal-template-bar button,
    .flow-template-tools > summary,
    .flow-template-tools-body select,
    .flow-template-tools-body button,
    .flow-form-progress button,
    .flow-related-trigger,
    .readonly-link,
    .form-actions button,
    .line-table-head button,
    .business-line-table button
  ) {
    min-height: 44px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions {
    min-height: 64px;
  }

  #erp-flow-launch-dialog .flow-template-tools-body .table-action,
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions button {
    min-height: 44px;
  }
}

@media (min-width: 800px) and (max-width: 920px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .form-grid {
    grid-template-columns: repeat(3, var(--ui-form-field-width));
    padding: 12px 0 82px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-grid > :is(.field-wide, .form-section-label, .flow-related-field, .contract-lines, .attachment-upload-control) {
    width: 744px;
  }
}

/* Approval decision priority: keep the decision task ahead of supporting detail on narrow screens. */
.flow-approval-workbench > .flow-approval-actions .table-action {
  min-height: 44px;
}

@media (max-width: 920px) {
  .flow-record-preview-panel.is-decision-mode .flow-approval-context-strip {
    order: 1;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-main-checks {
    order: 2;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    position: static;
    top: auto;
    order: 3;
    width: auto;
    min-width: 0;
    max-height: none;
    overflow: visible;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-focus {
    order: 4;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-content-section {
    order: 5;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: static;
    inset: auto;
    box-shadow: none;
  }
}

@media (min-width: 761px) and (max-width: 920px) {
  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    margin: 14px;
    padding: 16px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-decision-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "head head"
      "brief progress"
      "comment comment"
      "upload utility"
      "note note";
    align-items: start;
    gap: 12px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench-head {
    grid-area: head;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-review-brief {
    grid-area: brief;
    align-self: stretch;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-progress {
    grid-area: progress;
    align-self: stretch;
    margin: 0;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-comment-field {
    grid-area: comment;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-comment-field textarea {
    min-height: 96px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-opinion-upload {
    grid-area: upload;
    min-height: 44px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-utility-actions {
    grid-area: utility;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-utility-actions .table-action {
    min-height: 44px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-audit-note {
    grid-area: note;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
    margin: 14px -16px -16px;
    padding: 12px 16px 16px;
    position: static;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .primary,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .primary {
    grid-column: 1;
    grid-row: 1;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary),
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions .table-action:not(.primary) {
    grid-row: 1;
  }
}

@media (max-width: 760px) {
  .flow-record-preview-panel.is-decision-mode .flow-approval-decision-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: static;
  }

  .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench {
    padding-bottom: 0;
  }
}

/* Workbench task-first authority 2026-08-13 */
.view-root:has(> .workbench-heading) {
  width: 100%;
  max-width: min(var(--ui-content-max), 1440px);
  grid-template-columns: minmax(0, 1fr) minmax(304px, 328px);
  grid-template-areas:
    "heading heading"
    "tasks status"
    "activity activity";
  align-items: start;
  gap: 14px;
}

.view-root:has(> .workbench-heading) > .workbench-heading {
  grid-area: heading;
  height: auto;
  min-height: 68px;
  padding: 6px 0 10px;
}

.view-root:has(> .workbench-heading) > .workbench-task-center {
  grid-area: tasks;
  align-self: stretch;
  height: 100%;
}

.view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
  grid-area: status;
}

.view-root:has(> .workbench-heading) > .workbench-recent-activity {
  grid-area: activity;
}

.view-root:has(> .workbench-heading) .workbench-next-action-head,
.view-root:has(> .workbench-heading) .workbench-flow-status-intro,
.view-root:has(> .workbench-heading) .workbench-recent-activity > header {
  background: var(--ui-surface-subtle);
}

.view-root:has(> .workbench-heading) .workbench-next-action-list {
  min-height: 132px;
  align-content: start;
}

.view-root:has(> .workbench-heading) .workbench-next-action-empty {
  min-height: 132px;
}

@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) .workbench-flow-status-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    min-height: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro > div {
    min-width: 0;
    display: grid;
    gap: 1px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-overview {
    width: auto;
    min-width: 72px;
    min-height: 36px;
    padding: 6px 9px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-groups {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 4px 10px 7px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:nth-child(odd) {
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    border-right: 0;
    border-bottom: 1px solid var(--ui-border-soft);
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child {
    border-bottom: 0;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > div,
  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group:last-child > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button {
    min-height: 34px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    padding: 5px 6px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button small {
    font-size: 11px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-button strong {
    font-size: 14px;
  }

  .view-root:has(> .workbench-heading) .workbench-recent-list > button {
    grid-template-columns: 64px minmax(0, 1fr) minmax(150px, 190px) 16px;
    grid-template-rows: auto;
    min-height: 54px;
    gap: 10px;
  }

  .view-root:has(> .workbench-heading) .workbench-recent-list > button > time {
    grid-column: 3;
    text-align: right;
  }

  .view-root:has(> .workbench-heading) .workbench-recent-list > button > i {
    grid-column: 4;
    grid-row: 1;
  }
}

@media (max-width: 1180px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "tasks"
      "status"
      "activity";
  }

  .view-root:has(> .workbench-heading) > .workbench-task-center {
    height: auto;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-list,
  .view-root:has(> .workbench-heading) .workbench-next-action-empty {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .view-root:has(> .workbench-heading) {
    gap: 10px;
  }

  .view-root:has(> .workbench-heading) > .workbench-heading {
    min-height: 72px;
    padding: 4px 0 8px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-intro {
    min-height: 54px;
  }

  .view-root:has(> .workbench-heading) .workbench-flow-status-group > span {
    text-align: center;
  }
}

/* Mobile approval operability authority 2026-08-13-27 */
@media (max-width: 760px) {
  .global-overlay-root .flow-record-preview-panel.is-approval-mode,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-areas:
      "status close"
      "title title"
      "amount amount";
    gap: 6px 8px;
    align-items: center;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    overflow: visible;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-title-block,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-title-block {
    display: contents;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-status-chip,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-status-chip {
    grid-area: status;
    justify-self: start;
    margin: 0;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-title-block > div,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-title-block > div {
    min-width: 0;
    grid-area: title;
    gap: 2px;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-title-block small,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-title-block p,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-title-block small,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-title-block p {
    max-width: none;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-title-block strong,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-title-block strong {
    max-width: none;
    font-size: 18px;
    line-height: 1.35;
    text-wrap: balance;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > .flow-approval-header-amount,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > .flow-approval-header-amount {
    min-width: 0;
    grid-area: amount;
    margin: 0;
  }

  .global-overlay-root .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > button,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head > button {
    grid-area: close;
    align-self: start;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    padding-bottom: 0;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: 12px -12px 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ui-border);
    background: #ffffff;
  }
}

/* Mobile expense record layout authority 2026-08-13-27 */
@media (max-width: 760px) {
  #expense-line-items .line-item-table tbody td,
  #expense-line-items .line-item-table tbody td.expense-item-wide,
  #expense-line-items .line-item-table tbody td.expense-money-col {
    width: 100%;
    min-width: 0;
    max-width: none;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    box-sizing: border-box;
  }

  #expense-line-items .line-item-table tbody td.expense-item-wide {
    width: 100%;
  }

  #expense-line-items .line-item-table tbody td.expense-item-wide :is(input, textarea),
  #expense-line-items .line-item-table tbody td :is(input, select, textarea) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-column: 2;
    grid-row: 1;
    box-sizing: border-box;
  }

#expense-line-items .line-item-table tbody td.expense-item-wide textarea {
    min-height: 96px;
  }
}

/* Project mobile operability authority 2026-08-13-28 */
@media (max-width: 760px) {
  .material-management-layout {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row;
  }

  .material-management-layout > :is(.material-movement-entry, .material-inventory-section) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-column: 1;
  }

  .change-order-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 0;
  }

  .change-order-metrics > .context-card {
    min-height: 92px;
    padding: 12px 14px;
    border: 0;
    border-right: 1px solid var(--ui-border-soft);
    border-bottom: 1px solid var(--ui-border-soft);
    border-radius: 0;
    background: #ffffff;
  }

  .change-order-metrics > .context-card:nth-child(2n) {
    border-right: 0;
  }

  .change-order-metrics > .context-card:nth-child(n + 3) {
    border-bottom: 0;
  }

  .schedule-table-wrap {
    overflow: visible;
  }

  .schedule-editor-table,
  .erp-main .schedule-editor-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    table-layout: auto;
  }

  .schedule-editor-table thead {
    display: none;
  }

  .schedule-editor-table tbody {
    display: grid;
    gap: 10px;
  }

  .schedule-editor-table tbody tr {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: #ffffff;
    box-shadow: var(--ui-shadow-xs);
  }

  .schedule-editor-table tbody td,
  .schedule-editor-table tbody td:nth-child(n) {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
  }

  .schedule-editor-table tbody td::before {
    content: attr(data-mobile-label);
    display: block;
    color: var(--ui-ink-650);
    font-size: 12px;
    font-weight: 650;
  }

  .schedule-editor-table tbody td:nth-child(2),
  .schedule-editor-table tbody td:nth-child(3),
  .schedule-editor-table tbody td:nth-child(11),
  .schedule-editor-table tbody td:nth-child(12) {
    grid-column: 1 / -1;
  }

  .schedule-editor-table tbody td > :is(input, select, textarea, button) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-column: 2;
    grid-row: 1;
  }

  .schedule-editor-table tbody td.line-serial {
    grid-column: 1 / -1;
    grid-template-columns: max-content max-content;
    justify-content: start;
    color: var(--ui-primary-900);
    font-weight: 750;
  }

  .schedule-editor-table tbody td.line-serial::before {
    color: var(--ui-ink-650);
  }
}

/* Admin mobile record layout authority 2026-08-13-29 */
@media (max-width: 760px) {
  .data-table-shell:has(> .mobile-record-table),
  .org-table-wrap:has(.org-directory-table.mobile-record-table) {
    overflow: visible;
  }

  .mobile-record-table,
  .erp-main .mobile-record-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    border-collapse: separate;
    background: transparent;
  }

  .mobile-record-table thead {
    display: none;
  }

  .mobile-record-table tbody {
    width: 100%;
    display: grid;
    gap: 10px;
  }

  .mobile-record-table tbody tr {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: #ffffff;
    box-shadow: var(--ui-shadow-xs);
  }

  .mobile-record-table tbody td,
  .mobile-record-table tbody td:nth-child(n) {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(84px, 30%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--ui-border-soft);
    background: transparent;
    overflow-wrap: anywhere;
  }

  .mobile-record-table tbody td:last-child {
    border-bottom: 0;
  }

  .mobile-record-table tbody td::before {
    content: attr(data-label);
    color: var(--ui-ink-650);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.4;
  }

  .org-directory-table.mobile-record-table tbody td::before {
    content: attr(data-mobile-label);
  }

  .mobile-record-table tbody td > :is(button, summary, input, select, details),
  .mobile-record-table tbody td > details > summary,
  .mobile-record-table tbody td .org-module-dropdown > summary {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    max-width: 100%;
  }

  .mobile-record-table tbody td > .table-action {
    justify-content: center;
  }

  .login-audit-table tbody td:first-child,
  .system-audit-table tbody td:first-child,
  .system-backup-table tbody td:first-child,
  .system-notification-table tbody td:first-child {
    padding-top: 11px;
    color: var(--ui-primary-900);
    font-weight: 720;
  }

  .login-audit-agent {
    width: 100%;
    min-width: 0;
    max-width: none;
    overflow: visible;
    white-space: normal;
  }

  .login-audit-agent > summary {
    width: 100%;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--ui-border-strong);
    border-radius: var(--ui-radius-sm);
    background: var(--ui-surface-subtle);
  }

  .login-audit-agent > p {
    max-width: none;
    margin: 8px 0 2px;
    padding: 9px 10px;
    border-radius: var(--ui-radius-sm);
    background: var(--ui-surface-subtle);
    font-size: 12px;
  }

  .org-directory-table.mobile-record-table tbody tr {
    padding-top: 4px;
  }

  .org-directory-table.mobile-record-table tbody td {
    grid-template-columns: minmax(76px, 27%) minmax(0, 1fr);
  }

  .org-directory-table.mobile-record-table .org-project-dropdown,
  .org-directory-table.mobile-record-table .org-module-dropdown-options {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .system-management-overview > .panel-title,
  .system-backup-panel > .panel-title {
    align-items: stretch;
  }

  .system-management-overview > .panel-title > .table-action,
  .system-backup-panel > .panel-title > .table-action {
    width: 100%;
    min-height: 44px;
  }
}

/* Approval settings density authority 2026-08-13-29 */
.approval-assignment-groups > .approval-assignment-group {
  min-width: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  overflow: hidden;
  background: #ffffff;
}

.approval-assignment-group > summary {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--ui-primary-900);
  background: var(--ui-surface-subtle);
  cursor: pointer;
  list-style: none;
}

.approval-assignment-group > summary::-webkit-details-marker {
  display: none;
}

.approval-assignment-group > summary strong {
  font-size: 13px;
  font-weight: 720;
}

.approval-assignment-group > summary span {
  font-size: 11px;
  font-weight: 650;
}

.approval-assignment-group > summary span.is-complete {
  color: #176b5c;
}

.approval-assignment-group > summary span.is-incomplete {
  color: #9a4e0b;
}

.approval-assignment-group > summary i {
  color: var(--ui-accent-700);
  font-size: 16px;
  font-style: normal;
  text-align: center;
  transition: transform 180ms ease-out;
}

.approval-assignment-group[open] > summary {
  border-bottom: 1px solid var(--ui-border-soft);
}

.approval-assignment-group[open] > summary i {
  transform: rotate(180deg);
}

.approval-assignment-group > div {
  display: grid;
}

@media (max-width: 760px) {
  .approval-assignment-section > p {
    line-height: 1.55;
  }

  .approval-assignment-groups {
    gap: 8px;
  }

  .approval-assignment-group > summary {
    min-height: 48px;
  }

  .approval-assignment-group:not([open]) {
    box-shadow: none;
  }

  .approval-assignment-section + .bottom-actions {
    width: 100%;
    padding: 12px 0 0;
  }

  #save-approval-template-settings {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .approval-assignment-group > summary i {
    transition: none;
  }
}

/* Common picker touch authority 2026-08-13-29 */
@media (max-width: 920px), (pointer: coarse) {
  .organization-picker-head > button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    min-height: 44px;
    display: inline-grid;
    place-items: center;
    padding: 0;
  }
}

/* Operator-wide UI detail audit 2026-08-13-30 */
.module-nav .module-subnav button {
  min-height: 34px;
  padding: 6px 8px;
}

.material-inventory-view-switch button {
  min-height: 36px;
}

.approval-tree-node-actions button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
}

.material-movement-panel > .panel-title > div:first-child > span {
  display: block;
  max-width: 72ch;
  overflow: visible;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
}

.cashier-type-list {
  max-height: min(520px, calc(100dvh - 360px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.cashier-type-grid {
  align-items: start;
}

.data-export-field-list {
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  scrollbar-gutter: stable;
}

.workbench-project-empty > .data-table-empty-state {
  border-top: 0;
}

@media (min-width: 761px) and (max-width: 1180px) {
  .material-movement-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .material-movement-panel > .panel-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .material-movement-panel > .panel-title > div:first-child {
    flex: 1 1 300px;
  }

  .material-movement-panel > .panel-title > .material-project-select {
    flex: 0 1 280px;
  }
}

@media (max-width: 920px), (pointer: coarse) {
  :is(.material-inventory-view-switch button, .approval-tree-node-actions button) {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
  }
}

@media (max-width: 760px) {
  .cashier-type-list {
    max-height: min(440px, 56dvh);
  }

  .data-export-field-list {
    padding: 6px;
  }

  .erp-main .data-table-shell:has(.table-empty-row) .data-table > thead {
    display: none;
  }

  .erp-main .data-table-shell:has(.table-empty-row) :is(tbody, .table-empty-row, .table-empty-cell) {
    display: block !important;
    width: 100%;
    min-width: 0;
  }

  .erp-main .data-table-shell:has(.table-empty-row) .table-empty-cell {
    padding: 0 !important;
  }

  .erp-main .data-table-shell:has(.table-empty-row) .data-table-empty-state {
    width: 100%;
    min-height: 136px;
  }

  .workbench-project-empty .data-table-empty-state {
    min-height: 136px;
  }
}

/* Operator flow clarity audit 2026-08-14-31 */
@media (max-width: 760px) {
  #erp-flow-launch-dialog .flow-form-progress {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    overflow-x: auto;
    scroll-padding-inline: 8px;
    scrollbar-gutter: auto;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav button {
    flex: 0 0 auto;
  }
}

/* Operator layout audit 2026-08-14-32 */
.dashboard-chart-suite-empty {
  min-width: 0;
  min-height: 120px;
  display: grid;
  align-items: center;
  padding: 16px 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-ink-650);
  background: #ffffff;
}

.dashboard-chart-suite-empty > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.dashboard-chart-suite-empty strong {
  color: var(--ui-ink-950);
  font-size: 14px;
  font-weight: 700;
}

.dashboard-chart-suite-empty span {
  max-width: 72ch;
  font-size: 12px;
  line-height: 1.55;
}

.org-employee-mobile-toggle {
  display: none;
}

@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) {
    grid-template-areas:
      "heading heading"
      "tasks status"
      "activity status";
    align-items: start;
    column-gap: 16px;
    row-gap: 12px;
  }

  .view-root:has(> .workbench-heading) > .workbench-heading {
    padding: 8px 0 12px;
  }

  .view-root:has(> .workbench-heading) > .workbench-task-center {
    height: auto;
    align-self: start;
  }

  .view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
    align-self: start;
  }

  .view-root:has(> .workbench-heading) .workbench-next-action-list,
  .view-root:has(> .workbench-heading) .workbench-next-action-empty {
    min-height: 72px;
  }
}

@media (min-width: 761px) {
  .org-employee-mobile-toggle {
    display: none;
  }
}

@media (max-width: 760px) {
  .dashboard-chart-suite-empty {
    min-height: 112px;
    padding: 16px;
  }

  .workbench-flow-status-bar.is-empty .workbench-flow-status-intro {
    min-height: 52px;
  }

  .workbench-flow-status-bar.is-empty .workbench-flow-status-groups {
    padding-block: 0 8px;
  }

  .workbench-flow-status-bar.is-empty .workbench-flow-status-group,
  .workbench-flow-status-bar.is-empty .workbench-flow-status-group:nth-child(odd) {
    padding-block: 8px;
  }

  .workbench-flow-status-bar.is-empty .workbench-flow-status-button {
    min-height: 44px;
  }

  .org-employee-permission-table tbody tr {
    padding: 0;
  }

  .org-employee-permission-table tbody tr:not(.is-expanded) td:not(:first-child) {
    display: none;
  }

  .org-employee-permission-table tbody td:first-child,
  .org-employee-permission-table tbody td:first-child:nth-child(n) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-height: 56px;
    padding: 6px 8px;
  }

  .org-employee-permission-table tbody td:first-child::before {
    display: none;
  }

  .org-employee-permission-table tbody tr:not(.is-expanded) td:first-child > input {
    display: none;
  }

  .org-employee-mobile-toggle {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--ui-radius-sm);
    color: var(--ui-ink-950);
    background: transparent;
    text-align: left;
  }

  .org-employee-mobile-toggle > span {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .org-employee-mobile-toggle :is(strong, small) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .org-employee-mobile-toggle strong {
    font-size: 14px;
    font-weight: 700;
  }

  .org-employee-mobile-toggle small {
    color: var(--ui-ink-650);
    font-size: 12px;
  }

  .org-employee-mobile-toggle i {
    color: var(--ui-primary-800);
    font-size: 16px;
    font-style: normal;
    text-align: center;
    transition: transform 180ms ease-out;
  }

  .org-employee-permission-table tbody tr.is-expanded .org-employee-mobile-toggle {
    background: var(--ui-primary-050);
  }

  .org-employee-permission-table tbody tr.is-expanded .org-employee-mobile-toggle i {
    transform: rotate(180deg);
  }

  .org-employee-permission-table tbody tr.is-expanded td:not(:first-child) {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .org-employee-mobile-toggle i {
    transition: none;
  }
}

/* Approval account and recovery clarity 2026-08-14-33 */
.flow-approval-account-brief {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: #ffffff;
}

.flow-approval-account-brief.is-pass {
  border-color: #a8d7ce;
  background: #f4fbf9;
}

.flow-approval-account-brief.is-warning {
  border-color: #e7c48e;
  background: #fffaf1;
}

.flow-approval-account-brief.is-danger {
  border-color: #e9aaa6;
  background: #fff7f6;
}

.flow-approval-account-brief > header {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.flow-approval-account-brief > header strong {
  color: var(--ui-ink-950);
  font-size: 13px;
  font-weight: 730;
}

.flow-approval-account-brief > header span,
.flow-approval-account-brief > p {
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.45;
}

.flow-approval-account-brief > dl {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--ui-border-soft);
  border-radius: 5px;
  background: var(--ui-border-soft);
}

.flow-approval-account-brief > dl > div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  background: #ffffff;
}

.flow-approval-account-brief :is(dt, dd) {
  min-width: 0;
  margin: 0;
}

.flow-approval-account-brief dt {
  color: var(--ui-ink-650);
  font-size: 10px;
}

.flow-approval-account-brief dd {
  overflow: hidden;
  color: var(--ui-ink-950);
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-approval-account-brief dd.is-account-number {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.flow-approval-account-brief.is-pass dd.is-audit-state {
  color: #176b5c;
}

.flow-approval-account-brief.is-warning dd.is-audit-state {
  color: #8a500b;
}

.flow-approval-account-brief.is-danger dd.is-audit-state {
  color: #b42318;
}

.flow-approval-account-brief > p {
  margin: 0;
}

#erp-flow-launch-dialog .flow-recovery-banner {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  padding: 8px 9px 8px 10px;
  border: 1px solid #e7c48e;
  border-radius: var(--ui-radius-sm);
  background: #fffaf1;
}

#erp-flow-launch-dialog .flow-recovery-banner[hidden] {
  display: none;
}

#erp-flow-launch-dialog .flow-recovery-banner > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

#erp-flow-launch-dialog .flow-recovery-banner strong {
  color: #7a4508;
  font-size: 12px;
  font-weight: 730;
}

#erp-flow-launch-dialog .flow-recovery-banner span {
  color: #6d4c22;
  font-size: 11px;
  line-height: 1.45;
}

#erp-flow-launch-dialog .flow-recovery-banner .table-action {
  min-height: 34px;
  flex: 0 0 auto;
  border-color: #d7ad70;
  color: #76440a;
  background: #ffffff;
}

#erp-flow-launch-dialog .flow-document-category.is-recovered {
  color: #8a500b;
}

@media (max-width: 760px) {
  .flow-approval-account-brief > dl {
    grid-template-columns: minmax(0, 1fr);
  }

  #erp-flow-launch-dialog .flow-recovery-banner {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  #erp-flow-launch-dialog .flow-recovery-banner .table-action {
    width: 100%;
    min-height: 44px;
  }
}

/* Operator-wide usability authority 2026-08-14-35 */
.view-root:not(:has(> .workbench-heading)) > .workspace-page-head {
  min-height: 68px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 13px;
  border-bottom: 1px solid var(--ui-border);
}

.view-root:not(:has(> .workbench-heading)) > .workspace-page-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.view-root:not(:has(> .workbench-heading)) > .workspace-page-head > div:first-child > span {
  color: var(--ui-ink-650);
  font-size: 11px;
  font-weight: 650;
}

.workspace-page-head h1,
.view-semantic-title {
  margin: 0;
  color: var(--ui-ink-950);
  font-size: 21px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0;
  text-wrap: balance;
}

.view-root > .view-semantic-title {
  min-height: 68px;
  display: flex;
  align-items: flex-end;
  margin: 0;
  padding: 8px 2px 13px;
  border-bottom: 1px solid var(--ui-border);
}

.workspace-page-head p {
  max-width: 72ch;
  margin: 0;
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.5;
}

.panel,
.workbench-task-center,
.workbench-flow-status-bar,
.workbench-recent-activity,
.dashboard-chart-panel,
.dashboard-cockpit {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow-xs);
}

.panel > .panel-title,
.panel > header.panel-title {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui-border-soft);
  background: #ffffff;
}

.panel > .panel-title > div:first-child,
.panel > header.panel-title > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.panel > .panel-title strong,
.panel > header.panel-title strong {
  color: var(--ui-ink-950);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.35;
}

.panel > .panel-title span,
.panel > header.panel-title span {
  max-width: 72ch;
  color: var(--ui-ink-650);
  font-size: 11px;
  line-height: 1.45;
}

.erp-main :is(.data-table, .workbench-project-table) thead th {
  min-height: 38px;
  padding-block: 9px;
  color: #42526a;
  background: #f1f5f8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
  vertical-align: middle;
}

.erp-main :is(.data-table, .workbench-project-table) tbody td {
  min-height: 46px;
  color: var(--ui-ink-900);
  font-size: 12px;
  line-height: 1.5;
  vertical-align: middle;
}

.erp-main :is(.data-table, .workbench-project-table) tbody tr:nth-child(even) td {
  background: #fbfcfd;
}

.erp-main :is(.data-table, .workbench-project-table) tbody tr:hover td {
  background: #f4f8fc;
}

.erp-main :is(.data-table, .workbench-project-table) :is(td, th):has(.money),
.erp-main :is(.data-table, .workbench-project-table) td.is-money,
.erp-main :is(.data-table, .workbench-project-table) .money,
.flow-approval-review-brief dd.is-money {
  font-variant-numeric: tabular-nums;
}

.filter-bar,
.table-toolbar,
.material-project-select,
.party-import-toolbar {
  gap: 8px;
}

.erp-main :is(input, select, textarea),
.global-overlay-root :is(input, select, textarea),
#erp-flow-launch-dialog :is(input, select, textarea) {
  color: var(--ui-ink-950);
  font-size: 13px;
  letter-spacing: 0;
}

.erp-main :is(input, select, textarea)::placeholder,
.global-overlay-root :is(input, select, textarea)::placeholder,
#erp-flow-launch-dialog :is(input, select, textarea)::placeholder {
  color: #687386;
  opacity: 1;
}

.table-action,
.erp-main button,
.global-overlay-root button,
#erp-flow-launch-dialog button {
  letter-spacing: 0;
}

.table-action:not(.primary):not(.danger) {
  color: #28405f;
  background: #ffffff;
}

.data-table-empty-state,
.workbench-recent-empty,
.workbench-next-action-empty,
.finance-account-empty-state {
  color: var(--ui-ink-650);
}

.data-table-empty-state strong,
.workbench-recent-empty strong,
.workbench-next-action-empty strong,
.finance-account-empty-state strong {
  color: var(--ui-ink-950);
}

.workbench-heading {
  min-height: 66px;
  padding-inline: 2px;
}

.workbench-heading h1 {
  font-size: 20px;
}

.workbench-heading-summary p,
.workbench-next-action-head p,
.workbench-recent-activity > header p,
.workbench-flow-status-intro small {
  color: var(--ui-ink-650);
}

.workbench-next-action-section,
.workbench-flow-status-bar,
.workbench-recent-activity {
  overflow: hidden;
  background: #ffffff;
}

.workbench-flow-status-intro {
  min-height: 58px;
  padding: 9px 12px;
}

.workbench-flow-status-groups {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
}

.workbench-flow-status-group {
  min-width: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border-soft);
}

.workbench-flow-status-group:last-child {
  border-bottom: 0;
}

.workbench-flow-status-group > span {
  font-size: 10px;
  font-weight: 680;
}

.workbench-flow-status-group > div {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.workbench-flow-status-button {
  min-height: 38px;
}

.workbench-next-action-head,
.workbench-recent-activity > header,
.workbench-flow-status-intro {
  background: #fbfcfd;
}

.workbench-next-action-list > button,
.workbench-recent-list > button {
  border-radius: 0;
  box-shadow: none;
}

.workbench-next-action-list > button:hover,
.workbench-recent-list > button:hover {
  background: #f4f8fc;
}

.workbench-flow-status-button {
  border-radius: 5px;
}

.flow-approval-review-brief {
  order: 1;
}

.flow-approval-account-brief {
  order: 2;
}

.flow-approval-progress {
  order: 3;
}

.flow-approval-comment-field {
  order: 4;
}

.flow-approval-opinion-upload {
  order: 5;
}

.flow-approval-utility-actions {
  order: 6;
}

.flow-approval-audit-note {
  order: 7;
}

.organization-picker-employee small {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (min-width: 1181px) {
  .view-root:has(> .workbench-heading) {
    grid-template-columns: minmax(0, 1fr) minmax(304px, 328px);
    grid-template-areas:
      "heading heading"
      "tasks status"
      "activity status";
    align-items: start;
    column-gap: 16px;
    row-gap: 12px;
  }

  .view-root:has(> .workbench-heading) > .workbench-task-center {
    height: auto;
    min-height: 0;
  }

  .view-root:has(> .workbench-heading) > .workbench-recent-activity {
    align-self: start;
  }

  .view-root:has(> .workbench-heading) > .workbench-flow-status-bar {
    align-self: stretch;
  }
}

@media (min-width: 1700px) {
  .erp-main .view-root {
    width: min(100%, 1440px);
    max-width: 1440px;
    margin-inline: auto;
  }

  .workspace-tabs {
    width: min(100%, 1440px);
    max-width: 1440px;
    margin-inline: auto;
  }
}

@media (max-width: 920px) {
  .view-root:not(:has(> .workbench-heading)) > .workspace-page-head,
  .view-root > .view-semantic-title {
    min-height: 60px;
    padding-block: 8px 10px;
  }

  .panel > .panel-title,
  .panel > header.panel-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .workspace-page-head h1,
  .view-semantic-title {
    font-size: 18px;
    line-height: 1.35;
  }

  .view-root:not(:has(> .workbench-heading)) > .workspace-page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .view-root:not(:has(> .workbench-heading)) > .workspace-page-head > :is(button, label, div:last-child) {
    max-width: 100%;
  }

  .panel > .panel-title,
  .panel > header.panel-title {
    min-height: 52px;
    padding: 9px 11px;
  }

  .erp-main :is(.data-table, .workbench-project-table) tbody td {
    font-size: 13px;
  }

  .erp-main :is(input, select, textarea),
  .global-overlay-root :is(input, select, textarea),
  #erp-flow-launch-dialog :is(input, select, textarea) {
    font-size: 14px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ui-ink-650: #4c5666;
    --ui-border: #b9c3cf;
    --ui-border-soft: #cbd3dc;
  }

  .table-action,
  .erp-main :is(input, select, textarea),
  .global-overlay-root :is(input, select, textarea),
  #erp-flow-launch-dialog :is(input, select, textarea) {
    border-color: #8d9aad;
  }
}

/* Design engineers audit 2026-08-15: reduce empty-dashboard noise and clarify linked fields. */
@media (min-width: 1700px) {
  .erp-main .view-root {
    margin-inline: 0 auto;
  }

  .erp-main .workspace-tabs {
    margin-inline: 0 auto;
  }
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid input[readonly][placeholder]::placeholder {
  color: var(--ui-ink-650);
  opacity: 1;
}

.dashboard-empty-workspace {
  min-height: 196px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-panel);
}

.dashboard-empty-workspace-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.dashboard-empty-workspace-mark {
  width: 42px;
  height: 42px;
  position: relative;
  border: 1px solid var(--ui-accent-200);
  border-radius: 6px;
  background: var(--ui-accent-100);
}

.dashboard-empty-workspace-mark::before,
.dashboard-empty-workspace-mark::after {
  width: 18px;
  height: 2px;
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 2px;
  background: var(--ui-accent-700);
  content: "";
}

.dashboard-empty-workspace-mark::before {
  transform: translate(-50%, -50%);
}

.dashboard-empty-workspace-mark::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.dashboard-empty-workspace-copy > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.dashboard-empty-workspace-copy strong {
  color: var(--ui-ink-950);
  font-size: 15px;
  font-weight: 750;
}

.dashboard-empty-workspace-copy span {
  color: var(--ui-ink-650);
  font-size: 12px;
  line-height: 1.5;
}

.dashboard-empty-workspace > .table-action {
  min-width: 112px;
}

@media (max-width: 760px) {
  .dashboard-empty-workspace {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 18px 14px;
  }

  .dashboard-empty-workspace > .table-action {
    width: 100%;
    min-height: 44px;
  }
}

/* Stable high-frequency controls */
.dashboard-project-picker.compact {
  box-sizing: border-box;
  max-width: 100%;
}

.dashboard-project-picker.compact select {
  box-sizing: border-box;
  max-width: 100%;
}

.dashboard-project-picker.compact {
  overflow: hidden;
}

.dashboard-project-picker.compact select {
  display: block;
  margin: 0;
}

.dashboard-stage-node,
.dashboard-stage-node > :is(span, strong, small) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.cashier-grid {
  min-width: 0;
}

.cashier-grid > * {
  min-width: 0;
  max-width: 100%;
}

.cashier-grid > * > .data-table-shell {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

.construction-log-summary-panel > .data-table-shell {
  overscroll-behavior: contain;
}

.construction-log-summary-month input,
.construction-calendar-controls button,
.construction-calendar-grid button {
  box-sizing: border-box;
}

.org-module-dropdown-options.is-floating-open {
  max-width: calc(100vw - 24px);
  max-height: min(420px, calc(100dvh - 24px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-width: 921px) {
  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench {
    min-height: 0;
    height: 100%;
    max-height: 100%;
    position: static;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-decision-panel,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-decision-panel {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: static;
    inset: auto;
    z-index: auto;
    flex: 0 0 auto;
  }
}

@media (pointer: coarse) {
  .data-table td.is-money > .table-action.amount-link,
  .data-table td:first-child > .table-action[data-project-preview],
  .data-table td > .table-action,
  .table-column-menu > summary,
  .table-column-menu > div > label,
  .org-module-dropdown > summary,
  .org-module-dropdown-options > label,
  .construction-log-summary-month input,
  .construction-calendar-grid button,
  .data-table-pagination .table-action,
  .server-data-pagination .table-action {
    min-height: 44px;
  }
}

@media (max-width: 760px) {
  .dashboard-project-picker.compact,
  .dashboard-project-picker.compact select {
    width: 100%;
    height: 44px;
    min-height: 44px;
  }

  .cashier-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .cashier-grid > * {
    width: 100%;
    grid-column: 1;
  }

  .cashier-form .form-grid.compact,
  .cashier-form .form-grid > :is(.field-wide, .cashier-voucher-control) {
    width: 100%;
    max-width: 100%;
  }

  .construction-log-summary-panel > .data-table-shell {
    max-height: 460px;
    overflow: auto;
    border-top: 1px solid var(--ui-border-soft);
  }

  .construction-log-summary-panel .data-table {
    width: 100%;
    min-width: 560px;
    display: table;
  }

  .construction-log-summary-panel .data-table thead {
    display: table-header-group;
  }

  .construction-log-summary-panel .data-table tbody {
    display: table-row-group;
  }

  .construction-log-summary-panel .data-table tbody tr {
    display: table-row;
  }

  .construction-log-summary-panel .data-table tbody td,
  .construction-log-summary-panel .data-table tbody td:nth-child(n) {
    width: auto;
    min-height: 44px;
    display: table-cell;
    padding: 8px 10px;
    border-bottom: 1px solid var(--ui-border-soft);
    white-space: nowrap;
  }

  .construction-log-summary-panel .data-table tbody td::before {
    display: none;
  }

  .construction-log-summary-panel .data-table :is(th, td):nth-child(1) { min-width: 104px; }
  .construction-log-summary-panel .data-table :is(th, td):nth-child(2) { min-width: 64px; }
  .construction-log-summary-panel .data-table :is(th, td):nth-child(3) { min-width: 88px; }
  .construction-log-summary-panel .data-table :is(th, td):nth-child(4) { min-width: 104px; }
  .construction-log-summary-panel .data-table :is(th, td):nth-child(5) { min-width: 88px; }

  .construction-log-summary-month input {
    height: 44px;
    min-height: 44px;
  }

  .construction-calendar-grid button {
    min-height: 44px;
  }

  .panel > .panel-title span,
  .panel > header.panel-title span {
    display: block;
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Operator detail remediation 2026-08-14-36 */
.dashboard-filter-trigger::before {
  content: none;
  display: none;
}

.dashboard-filter-trigger {
  box-sizing: border-box;
  flex: 0 0 auto;
}

.ledger-record-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 4px 2px;
  border-radius: 4px;
}

.ledger-metric-link {
  min-height: 32px;
  padding: 5px 4px;
  border-radius: 4px;
}

.ledger-record-link:focus-visible,
.ledger-metric-link:focus-visible {
  outline: 2px solid var(--ui-accent-600);
  outline-offset: 1px;
}

#erp-flow-launch-dialog .flow-task-rail-card > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

#erp-flow-launch-dialog .flow-task-rail-card > header > div {
  min-width: 0;
}

#erp-flow-launch-dialog .flow-task-rail-card > header strong {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

#erp-flow-launch-dialog .flow-task-rail-route-card > header > small {
  max-width: 116px;
  text-align: right;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.reconciliation-table :is(th, td):nth-child(-n + 3) {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (pointer: coarse) {
  .ledger-record-link,
  .ledger-metric-link {
    min-height: 44px;
  }
}

/* Operator mobile data legibility 2026-08-14-38 */
@media (max-width: 760px) {
  .erp-main .data-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .erp-main .data-table tbody,
  .erp-main .data-table tbody tr {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .erp-main .data-table tbody td,
  .erp-main .data-table tbody td:nth-child(n) {
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-wrap: anywhere;
  }

  .erp-main .data-table tbody td > :is(button, a, span, div, details, input, select) {
    min-width: 0;
    max-width: 100%;
  }

  .reconciliation-panel > .data-table-scroll-hint {
    min-height: 34px;
    display: flex;
    justify-content: flex-start;
    padding-inline: 11px;
    border-top: 0;
    border-bottom: 1px solid var(--ui-border-soft);
    background: #f7f9fb;
  }

  .erp-main .reconciliation-table-shell {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: auto;
  }

  .erp-main .reconciliation-table {
    display: table;
    max-width: none;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .erp-main .reconciliation-table-downstream {
    width: 1180px;
    min-width: 1180px;
  }

  .erp-main .reconciliation-table-upstream {
    width: 980px;
    min-width: 980px;
  }

  .erp-main .reconciliation-table thead {
    display: table-header-group;
  }

  .erp-main .reconciliation-table tbody {
    display: table-row-group;
    width: auto;
  }

  .erp-main .reconciliation-table tbody tr {
    display: table-row;
    width: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .erp-main .reconciliation-table tbody td,
  .erp-main .reconciliation-table tbody td:nth-child(n) {
    width: auto;
    min-width: 0 !important;
    max-width: none !important;
    display: table-cell;
    padding: 8px 9px;
    border-bottom: 1px solid var(--ui-border-soft);
    white-space: nowrap;
    vertical-align: middle;
  }

  .erp-main .reconciliation-table :is(th, td):nth-child(-n + 3) {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .erp-main .reconciliation-table tbody td::before {
    display: none;
  }

  .erp-main .reconciliation-table-downstream :is(th, td):nth-child(1) { width: 122px; }
  .erp-main .reconciliation-table-downstream :is(th, td):nth-child(2) { width: 148px; }
  .erp-main .reconciliation-table-downstream :is(th, td):nth-child(3) { width: 176px; }
  .erp-main .reconciliation-table-upstream :is(th, td):nth-child(1) { width: 146px; }
  .erp-main .reconciliation-table-upstream :is(th, td):nth-child(2) { width: 154px; }

  .construction-log-summary-panel .data-table {
    width: 100%;
    min-width: 560px;
    max-width: none;
    display: table;
  }
}
/* Operator responsive detail audit 2026-08-14-39 */
.dashboard-project-scroll-hint {
  display: none;
}

@media (min-width: 761px) and (max-width: 920px) {
  .payroll-filters {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    box-sizing: border-box;
  }

  .payroll-filters label,
  .payroll-filters :is(input, select) {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .org-table-wrap:has(.org-directory-table.mobile-record-table),
  .org-employee-permission-wrap {
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .org-directory-table.mobile-record-table,
  .erp-main .org-directory-table.mobile-record-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    border-collapse: separate;
    background: transparent;
  }

  .org-directory-table.mobile-record-table thead {
    display: none;
  }

  .org-directory-table.mobile-record-table tbody {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
  }

  .org-directory-table.mobile-record-table tbody tr {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 0 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: #ffffff;
  }

  .org-directory-table.mobile-record-table tbody td,
  .org-directory-table.mobile-record-table tbody td:nth-child(n) {
    position: static;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid var(--ui-border-soft);
    background: transparent;
  }

  .org-directory-table.mobile-record-table tbody td:last-child {
    border-bottom: 0;
  }

  .org-directory-table.mobile-record-table tbody td::before {
    content: attr(data-mobile-label);
    color: var(--ui-ink-650);
    font-size: 12px;
    font-weight: 650;
  }

  .org-directory-table.mobile-record-table tbody td > :is(input, select, details, button),
  .org-directory-table.mobile-record-table .org-project-dropdown,
  .org-directory-table.mobile-record-table .org-module-dropdown > summary {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .erp-main .org-employee-permission-table {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
  }

  .org-employee-permission-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    overflow: visible;
  }

  .org-employee-permission-table thead {
    display: none;
  }

  .org-employee-permission-table tbody,
  .org-employee-permission-table tbody tr {
    width: 100%;
    min-width: 0;
    display: block;
  }

  .org-employee-permission-table tbody tr {
    border-bottom: 1px solid var(--ui-border);
  }

  .org-employee-permission-table tbody tr:not(.is-expanded) td:not(:first-child) {
    display: none;
  }

  .org-employee-permission-table tbody td,
  .org-employee-permission-table tbody td:nth-child(n) {
    position: static;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--ui-border-soft);
    background: #ffffff;
    box-shadow: none;
  }

  .org-employee-permission-table tbody td:first-child,
  .org-employee-permission-table tbody td:first-child:nth-child(n) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-height: 56px;
    padding: 6px 8px;
  }

  .org-employee-permission-table tbody tr:not(.is-expanded) td:first-child > input {
    display: none;
  }

  .org-employee-permission-table tbody td::before {
    flex: 0 0 82px;
    color: var(--ui-ink-650);
    font-size: 12px;
    font-weight: 650;
  }

  .org-employee-permission-table tbody td:first-child::before {
    display: none;
  }

  .org-employee-permission-table tbody td:nth-child(2)::before { content: "部门"; }
  .org-employee-permission-table tbody td:nth-child(3)::before { content: "角色"; }
  .org-employee-permission-table tbody td:nth-child(4)::before { content: "分配项目"; }
  .org-employee-permission-table tbody td:nth-child(5)::before { content: "开放模块"; }
  .org-employee-permission-table tbody td:nth-child(6)::before { content: "操作权限"; }
  .org-employee-permission-table tbody td:nth-child(7)::before { content: "审批人"; }
  .org-employee-permission-table tbody td:nth-child(8)::before { content: "状态"; }
  .org-employee-permission-table tbody td:nth-child(9)::before { content: "操作"; }

  .org-employee-permission-table tbody td > :is(input, select, details),
  .org-employee-permission-table tbody td > .org-project-checks {
    min-width: 0;
    flex: 1 1 auto;
  }

  .org-employee-mobile-toggle {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--ui-radius-sm);
    color: var(--ui-ink-950);
    background: transparent;
    text-align: left;
  }

  .org-employee-mobile-toggle > span {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .org-employee-mobile-toggle :is(strong, small) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .org-employee-mobile-toggle i {
    font-style: normal;
    transition: transform 180ms ease-out;
  }

  .org-employee-permission-table tbody tr.is-expanded .org-employee-mobile-toggle {
    background: var(--ui-primary-050);
  }

  .org-employee-permission-table tbody tr.is-expanded .org-employee-mobile-toggle i {
    transform: rotate(180deg);
  }

  .approval-template-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: visible;
  }

  .approval-template-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
  }

  .approval-template-list-head {
    grid-column: 1 / -1;
  }

  .approval-template-editor {
    width: 100%;
    min-width: 0;
    padding: 10px;
    box-sizing: border-box;
  }

  .approval-tree-head {
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .approval-tree-head > label {
    width: min(360px, 100%);
    flex: 1 1 280px;
  }

  .approval-tree-node {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .approval-tree-node-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .approval-tree-node-fields > label {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .approval-tree-node-actions {
    grid-column: 2;
    justify-content: flex-end;
  }

  .approval-tree-node-actions button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .construction-log-summary-panel > .data-table-shell {
    max-height: min(46dvh, 460px);
    overflow: auto;
    border-top: 1px solid var(--ui-border-soft);
    scrollbar-gutter: stable;
  }

  .construction-log-summary-panel .data-table {
    min-width: 560px;
  }

  .dashboard-project-scroll-hint {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 7px 12px;
    border-bottom: 1px solid var(--ui-border-soft);
    color: var(--ui-ink-650);
    background: #f7f9fb;
    font-size: 11px;
  }

  .workbench-project-table-scroll {
    scrollbar-gutter: stable;
  }

  .workbench-project-table {
    min-width: 720px;
  }
}

@media (max-width: 760px) {
  #erp-flow-launch-dialog .flow-form-progress {
    position: sticky;
  }

  #erp-flow-launch-dialog .flow-form-progress::after {
    content: none;
  }

  #erp-flow-launch-dialog .flow-form-progress:has(#flow-section-nav button:nth-child(3))::after {
    content: "›";
    width: 24px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: grid;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--ui-primary-800);
    border-left: 1px solid var(--ui-border-soft);
    background: #ffffff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav {
    padding-right: 24px;
    scrollbar-width: thin;
  }

  #erp-flow-launch-dialog .flow-form-progress:not(:has(#flow-section-nav button:nth-child(3))) #flow-section-nav {
    padding-right: 8px;
  }

  #erp-flow-launch-dialog .flow-form-state small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .org-employee-mobile-toggle i {
    transition: none;
  }
}

/* Operator approval and surface detail audit 2026-08-14-40 */
@media (min-width: 761px) and (max-width: 920px) {
  .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench {
    scroll-padding-bottom: 104px;
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: 12px -16px -16px;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--ui-border);
    background: #ffffff;
    box-shadow: 0 -2px 8px rgba(15, 52, 118, 0.08);
  }
}

/* Operator interaction detail audit 2026-08-14-41 */
.project-ledger > .data-table-scroll-hint,
.contract-ledger-table > .data-table-scroll-hint,
.schedule-table-scroll-hint {
  display: none;
}

.global-search-panel {
  border-color: var(--ui-border-strong);
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 52, 118, 0.18);
}

.global-search-item + .global-search-item {
  border-top: 1px solid var(--ui-border-soft);
}

.global-search-item:is(:hover, :focus-visible, .is-keyboard-active) {
  background: var(--ui-primary-050);
}

@media (min-width: 761px) and (max-width: 1180px) {
  :is(.project-ledger, .contract-ledger-table) > .data-table-scroll-hint,
  .schedule-table-scroll-hint {
    min-height: 34px;
    display: flex;
    justify-content: flex-start;
    padding: 7px 12px;
    border-top: 0;
    border-bottom: 1px solid var(--ui-border-soft);
    color: var(--ui-ink-650);
    background: var(--ui-surface-subtle);
    font-size: 11px;
  }

  .schedule-table-scroll-hint {
    margin-bottom: -12px;
    border: 1px solid var(--ui-border);
    border-bottom: 0;
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  }

  .schedule-table-wrap {
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  }
}

@media (min-width: 761px) and (max-width: 920px) {
  .org-role-summary {
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    grid-template-areas:
      "name members"
      "approver actions";
    align-items: end;
    gap: 10px 12px;
  }

  .org-role-name-field {
    grid-area: name;
    width: 100%;
    max-width: none;
  }

  .org-role-name-field input {
    width: 100%;
    max-width: none;
  }

  .org-role-members {
    grid-area: members;
    min-width: 0;
  }

  .org-role-summary .org-inline-check {
    grid-area: approver;
    width: max-content;
    justify-self: start;
  }

  .org-role-summary > .table-action {
    grid-area: actions;
    grid-column: auto;
    justify-self: end;
  }
}

@media (max-width: 760px) {
  .construction-log-summary-panel > .data-table-shell {
    max-height: min(50dvh, 480px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px;
    background: var(--ui-surface-subtle);
  }

  .construction-log-summary-panel .construction-log-summary-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    border: 0;
    background: transparent;
  }

  .construction-log-summary-table thead {
    display: none;
  }

  .construction-log-summary-table tbody {
    width: 100%;
    display: grid;
    gap: 8px;
    padding: 0;
  }

  .construction-log-summary-table tbody tr {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "date status action"
      "submitter submitter submitter";
    align-items: center;
    gap: 8px 10px;
    padding: 10px 11px 8px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: #ffffff;
    box-shadow: none;
  }

  .construction-log-summary-table tbody td,
  .construction-log-summary-table tbody td:nth-child(n) {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0;
    display: flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    white-space: normal;
  }

  .construction-log-summary-table tbody td::before {
    display: none;
  }

  .construction-log-summary-table tbody td:nth-child(1) { grid-area: date; }
  .construction-log-summary-table tbody td:nth-child(2) { grid-area: status; }
  .construction-log-summary-table tbody td:nth-child(3) {
    grid-area: submitter;
    min-height: 28px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 8px;
    padding-top: 7px;
    border-top: 1px solid var(--ui-border-soft);
    color: var(--ui-ink-650);
    font-size: 12px;
  }
  .construction-log-summary-table tbody td:nth-child(3)::before {
    content: "填报人";
    display: block;
    color: var(--ui-ink-650);
    font-weight: 650;
  }
  .construction-log-summary-table tbody td:nth-child(4) {
    grid-area: action;
    justify-content: flex-end;
  }

  .construction-log-summary-date {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .construction-log-summary-date strong {
    color: var(--ui-ink-950);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }

  .construction-log-summary-date small {
    color: var(--ui-ink-650);
    font-size: 11px;
  }

  .construction-log-summary-table .table-action {
    min-width: 58px;
    min-height: 44px;
    justify-content: center;
  }

  .construction-log-summary-pending {
    max-width: 76px;
    color: var(--ui-ink-650);
    font-size: 11px;
    line-height: 1.35;
    text-align: right;
  }
}

@media (max-width: 760px) {
  .construction-log-summary-panel > .data-table-shell {
    padding: 0 8px 8px;
  }

  .construction-log-summary-panel .construction-log-summary-table thead {
    width: 100%;
    display: block;
  }

  .construction-log-summary-panel .construction-log-summary-table :is(thead tr, tbody tr) {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(64px, 0.72fr) minmax(64px, 0.72fr) 64px;
    box-sizing: border-box;
  }

  .construction-log-summary-panel .construction-log-summary-table thead tr {
    min-height: 36px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--ui-border);
    border-bottom: 0;
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
    background: var(--ui-surface-soft);
  }

  .construction-log-summary-panel .construction-log-summary-table thead th,
  .construction-log-summary-panel .construction-log-summary-table thead th:nth-child(n) {
    width: auto;
    min-width: 0;
    padding: 0 4px;
    border: 0;
    color: var(--ui-ink-650);
    background: transparent;
    font-size: 11px;
    text-align: left;
  }

  .construction-log-summary-panel .construction-log-summary-table tbody {
    gap: 0;
  }

  .construction-log-summary-panel .construction-log-summary-table tbody tr {
    grid-template-areas: none;
    min-height: 64px;
    gap: 0;
    padding: 9px 10px;
    border-radius: 0;
    border-bottom: 0;
  }

  .construction-log-summary-panel .construction-log-summary-table tbody tr:last-child {
    border-bottom: 1px solid var(--ui-border);
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  }

  .construction-log-summary-panel .construction-log-summary-table tbody td,
  .construction-log-summary-panel .construction-log-summary-table tbody td:nth-child(n) {
    grid-area: auto;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 4px;
  }

  .construction-log-summary-panel .construction-log-summary-table tbody td::before {
    display: none;
    content: none;
  }

  .construction-log-summary-panel .construction-log-summary-table tbody td:nth-child(3) {
    min-height: 0;
    display: block;
    padding: 0 4px;
    border-top: 0;
    color: var(--ui-ink-650);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .construction-log-summary-panel .construction-log-summary-table tbody td:nth-child(4) {
    justify-content: flex-end;
  }

  .construction-log-summary-panel .construction-log-summary-table .table-action {
    width: 60px;
    min-width: 60px;
  }

  .construction-log-summary-panel .construction-log-summary-pending {
    width: 60px;
    max-width: 60px;
    overflow-wrap: normal;
    white-space: nowrap;
  }
}

/* Operator responsive state and recovery audit 2026-08-14-42 */
.data-table-shell:focus-visible,
.workbench-project-table-scroll:focus-visible,
.schedule-table-wrap:focus-visible {
  outline: 2px solid var(--ui-accent-600);
  outline-offset: -2px;
}

.empty-state {
  min-height: 96px;
  padding: 16px 18px;
  line-height: 1.6;
}

.account-required-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  text-align: left;
}

.account-required-state > span {
  max-width: 58ch;
}

.cashier-empty-workspace {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

@media (max-width: 760px) {
  .cashier-empty-workspace {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .cashier-empty-workspace > .table-action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
  }

  .account-required-state {
    align-items: stretch;
    flex-direction: column;
  }

  .account-required-state > .table-action {
    width: 100%;
    min-height: 44px;
  }
}

@media (min-width: 761px) and (max-width: 920px) {
  .contract-ledger-table .data-table :is(th, td):nth-child(3) {
    width: 164px;
    min-width: 164px;
  }

  .contract-ledger-table .data-table :is(th, td):nth-child(5) {
    width: 206px;
    min-width: 206px;
  }

  .contract-ledger-table .ledger-static-metric {
    grid-template-columns: minmax(60px, 1fr) auto;
  }

  .contract-ledger-table .ledger-static-metric span {
    overflow: visible;
    text-overflow: clip;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Operator readable status contrast audit 2026-08-14-45 */
:is(.dashboard-health.risk, .boss-kpi-card.risk, .dashboard-exposure-item.risk) strong {
  color: #b42318;
}

.construction-calendar-selection small {
  color: var(--ui-ink-650);
}

/* Operator organization tablet fit audit 2026-08-14-46 */
@media (min-width: 761px) and (max-width: 920px) {
  .org-department-row {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px max-content;
    justify-content: stretch;
  }

  .org-department-row :is(input, select) {
    width: 100%;
    max-width: 100%;
  }
}

/* Operator approval financial readability audit 2026-08-14-47 */
.flow-record-preview-panel.is-approval-mode .flow-approval-business-overview {
  grid-template-columns: minmax(0, 1fr);
}

/* Operator responsive dashboard chart audit 2026-08-14-48 */
.dashboard-line-canvas {
  height: auto;
  overflow: hidden;
}

.dashboard-line-canvas svg {
  width: 100%;
  min-width: 0;
  max-width: 760px;
  height: auto;
  margin-inline: auto;
}

@media (max-width: 760px) {
  :is(.table-column-menu > summary, .contract-material-control-details > summary) {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* Operator form navigation and permission table audit 2026-08-14-49 */
.org-employee-permission-table {
  table-layout: fixed;
}

.org-employee-permission-table.org-editor-table .org-module-dropdown,
.org-employee-permission-table.org-editor-table .org-module-dropdown:not(.org-action-dropdown) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 760px) {
  #erp-flow-launch-dialog .flow-form-progress:has(#flow-section-nav button:nth-child(3))::after {
    content: none;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav {
    display: flex;
    padding-inline: 8px;
    overflow-x: hidden;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav > button {
    min-width: 0;
    flex: 1 1 0;
    display: grid;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    gap: 1px;
    padding: 4px 5px;
    text-align: center;
  }

  #erp-flow-launch-dialog .flow-form-progress #flow-section-nav > button > :is(span, small) {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Operator primary action contrast audit 2026-08-14-50 */
.workbench-primary-action > span {
  color: #ffffff;
}

/* Operator tablet touch and workbench indicator audit 2026-08-14-51 */
.workbench-next-action-arrow {
  color: var(--ui-ink-800);
}

@media (min-width: 761px) and (max-width: 920px), (pointer: coarse) {
  .module-nav :is(button, summary),
  .erp-main :is(
    button,
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea,
    summary
  ) {
    min-height: 44px;
  }
}

/* Operator short-landscape approval actions audit 2026-08-14-53 */
@media (min-width: 761px) and (max-width: 920px) and (max-height: 500px) {
  .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 {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .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 {
    width: 100vw;
    min-height: 64px;
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-modal);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 -2px 6px rgba(15, 52, 118, 0.08);
  }
}

/* Operator coarse-pointer target width audit 2026-08-14-54 */
@media (min-width: 761px) and (max-width: 920px), (pointer: coarse) {
  .erp-main button {
    min-width: 44px;
  }
}

/* Operator construction-log upload target audit 2026-08-14-56 */
.construction-log-upload-input {
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
}

@media (max-width: 760px), (pointer: coarse) {
  .construction-log-form .construction-log-upload-field label.construction-log-upload-trigger {
    min-height: 44px;
  }
}

/* Operator mobile template action target audit 2026-08-14-57 */
@media (max-width: 760px), (pointer: coarse) {
  #erp-flow-launch-dialog .flow-template-tools-body .table-action {
    min-height: 44px;
  }
}

/* Operator flow-dialog tablet targets audit 2026-08-14-58 */
@media (min-width: 761px) and (max-width: 920px), (pointer: coarse) {
  #erp-flow-launch-dialog :is(
    button,
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea,
    summary
  ) {
    min-height: 44px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) {
    height: 44px;
    min-height: 44px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined :is(.readonly-link, .percent-input-control, .flow-related-trigger) {
    height: 44px;
    min-height: 44px;
  }

  #erp-flow-launch-dialog .flow-document-number {
    height: 44px;
    min-height: 44px;
  }
}

/* Operator short-landscape flow action rail audit 2026-08-14-61 */
@media (min-width: 761px) and (max-width: 920px) and (max-height: 500px) {
  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
    padding-right: 170px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-form {
    width: min(656px, calc(100vw - 186px));
    max-width: calc(100vw - 186px);
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions {
    position: fixed;
    inset: 71px 12px auto auto;
    width: 144px;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: #ffffff;
    box-shadow: var(--ui-shadow-2);
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions button {
    width: 100%;
    min-width: 0;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions #clear-flow-form {
    margin-right: 0;
    order: 3;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions #save-draft {
    order: 2;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions #submit-flow {
    order: 1;
  }
}

/* Operator mobile approval utility targets audit 2026-08-14-62 */
@media (max-width: 760px), (pointer: coarse) {
  .flow-record-preview-panel.is-approval-mode .flow-approval-opinion-upload,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-opinion-upload,
  .flow-record-preview-panel.is-approval-mode .flow-approval-utility-actions .table-action,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-utility-actions .table-action {
    min-height: 44px;
  }
}

/* Contract ledger and mobile line-item audit 2026-08-15-63 */
.panel > .context-grid.compact-context.contract-ledger-summary--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .panel > .context-grid.compact-context.contract-ledger-summary--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .mobile-editable-table .line-item-table :is(
    td.business-line-cell--name,
    td.business-line-cell--specification,
    td.business-line-cell--workContent,
    td.business-line-cell--remark,
    td.business-line-cell--equipmentName,
    td.business-line-cell--equipmentModel
  ) {
    grid-template-columns: minmax(68px, 22%) minmax(0, 1fr);
  }

  .mobile-editable-table .line-item-table :is(
    td.business-line-cell--quantity,
    td.business-line-cell--unitPrice,
    td.business-line-cell--totalPrice,
    td.business-line-cell--equipmentQuantity,
    td.business-line-cell--dailyRent,
    td.business-line-cell--shiftDays,
    td.business-line-cell--contractQuantity,
    td.business-line-cell--acceptedQuantity,
    td.business-line-cell--availableQuantity,
    td.business-line-cell--settlementQuantity,
    td.business-line-cell--settlementAmount,
    td.business-line-cell--differenceQuantity
  ) {
    grid-template-columns: minmax(76px, 32%) minmax(0, 1fr);
  }

  .mobile-editable-table .line-item-table :is(
    td.business-line-cell--name,
    td.business-line-cell--specification,
    td.business-line-cell--workContent,
    td.business-line-cell--remark,
    td.business-line-cell--equipmentName,
    td.business-line-cell--equipmentModel,
    td.business-line-cell--quantity,
    td.business-line-cell--unitPrice,
    td.business-line-cell--totalPrice,
    td.business-line-cell--equipmentQuantity,
    td.business-line-cell--dailyRent,
    td.business-line-cell--shiftDays,
    td.business-line-cell--contractQuantity,
    td.business-line-cell--acceptedQuantity,
    td.business-line-cell--availableQuantity,
    td.business-line-cell--settlementQuantity,
    td.business-line-cell--settlementAmount,
    td.business-line-cell--differenceQuantity
  ) :is(input, select, textarea) {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 14px;
  }
}

/* Keep mobile line-item controls in the value column after the streamlined-form grid rules. */
@media (max-width: 760px) {
  #erp-flow-launch-dialog:not(.is-picker)
  .flow-form-streamlined
  .form-grid
  .mobile-editable-table
  .line-item-table
  tbody
  td
  > :is(input, select, textarea) {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Apple Design audit 2026-08-15 */
:root {
  --ui-surface-soft: #f6f8fa;
  --ui-focus-strong: 0 0 0 3px rgba(54, 156, 151, 0.3);
}

.login-brand-title {
  min-width: 0;
  margin: 0;
  font: inherit;
}

html {
  scrollbar-gutter: stable;
}

/* Keep the working area connected to the sidebar on very wide screens. */
@media (min-width: 1700px) {
  .erp-main .view-root {
    margin-inline: 0 auto;
  }

  .erp-main .workspace-tabs {
    margin-inline: 0 auto;
  }
}

/* Read-only values are system-linked or calculated, not another input to fill. */
#erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(
  input[readonly],
  textarea[readonly],
  select:disabled
) {
  border-color: var(--ui-border);
  color: var(--ui-ink-800);
  background: var(--ui-surface-soft);
  cursor: default;
}

#erp-flow-launch-dialog .flow-form-streamlined .readonly-link {
  border-color: var(--ui-border);
  color: var(--ui-primary-900);
  background: var(--ui-surface-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

#erp-flow-launch-dialog .flow-form-streamlined .form-grid > label:has(> :is(input[readonly], .readonly-link)) > span::after {
  content: "自动";
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--ui-accent-200);
  border-radius: 999px;
  color: var(--ui-accent-700);
  background: var(--ui-accent-100);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

@media (min-width: 921px) {
  #erp-flow-launch-dialog .flow-form-streamlined .form-grid > label > span {
    font-size: 12px;
  }

  #erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select,
    textarea,
    .readonly-link
  ) {
    font-size: 13px;
  }
}

@media (prefers-contrast: more) {
  #erp-flow-launch-dialog .flow-form-streamlined .form-grid :is(
    input[readonly],
    textarea[readonly],
    select:disabled
  ) {
    border-color: var(--ui-border-strong);
    color: var(--ui-ink-950);
  }
}

/* Design engineers implementation 2026-08-15 */
.dashboard-empty-workspace {
  min-height: 144px;
  padding: 20px 24px;
}

@media (min-width: 921px) {
  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-grid {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
    scroll-padding-block-end: calc(84px + env(safe-area-inset-bottom));
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid > label {
    min-height: 40px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid > label > span {
    min-height: 39px;
    padding-block: 6px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .flow-related-field {
    min-height: 40px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select,
    .readonly-link,
    .percent-input-control,
    .flow-related-trigger
  ) {
    height: 39px;
    min-height: 39px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined .form-grid textarea {
    min-height: 76px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions {
    min-height: 52px;
    padding-block: 8px;
  }

  #erp-flow-launch-dialog:not(.is-picker) .flow-form.is-document-layout.flow-form-streamlined > .form-actions .table-action {
    min-height: 36px;
  }
}

/* Keep completion checks and approval routing readable in the narrow task rail. */
#erp-flow-launch-dialog:not(.is-picker) .flow-form-streamlined > .flow-task-rail {
  grid-template-columns: minmax(0, 1fr);
}

/* macOS productivity visual system 2026-08-16 */
:root {
  color-scheme: light;
  --macos-accent: #0a84ff;
  --macos-accent-strong: #0066cc;
  --macos-accent-soft: rgba(10, 132, 255, 0.12);
  --macos-window: #f5f5f7;
  --macos-surface: #ffffff;
  --macos-surface-raised: rgba(255, 255, 255, 0.94);
  --macos-sidebar: rgba(246, 248, 252, 0.88);
  --macos-label: #1d1d1f;
  --macos-label-secondary: #6e6e73;
  --macos-label-tertiary: #8e8e93;
  --macos-separator: rgba(60, 60, 67, 0.16);
  --macos-separator-soft: rgba(60, 60, 67, 0.1);
  --macos-control: rgba(118, 118, 128, 0.1);
  --macos-control-hover: rgba(118, 118, 128, 0.16);
  --macos-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(15, 23, 42, 0.05);
  --macos-window-shadow: 0 22px 70px rgba(15, 23, 42, 0.2), 0 2px 10px rgba(15, 23, 42, 0.08);
}

html,
body {
  background: var(--macos-window);
}

body,
button,
input,
select,
textarea {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body {
  color: var(--macos-label);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.erp-shell {
  background: transparent;
}

.app-tech-canvas {
  opacity: 0.045;
}

/* Functional layer: toolbar */
.app-header {
  border-bottom: 1px solid var(--macos-separator);
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(24px) saturate(1.24);
  backdrop-filter: blur(24px) saturate(1.24);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.app-header-brand {
  border-right: 1px solid var(--macos-separator);
  background: rgba(246, 248, 252, 0.72);
}

.brand strong {
  color: var(--macos-label);
  font-size: 15px;
  font-weight: 650;
}

.brand img {
  filter: drop-shadow(0 1px 2px rgba(15, 52, 118, 0.14));
}

.topbar,
.topbar.is-compact {
  background: transparent;
}

.app-header .global-search input {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--macos-label);
  background: var(--macos-control);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
}

.app-header .global-search input:hover {
  border-color: var(--macos-separator);
  background: var(--macos-control-hover);
}

.app-header .global-search input:focus {
  border-color: var(--macos-accent);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.18);
}

.app-header .global-search input::placeholder {
  color: var(--macos-label-tertiary);
}

.user-name-button,
.user-avatar-button {
  border: 1px solid var(--macos-separator);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-name-button:hover,
.user-avatar-button:hover {
  border-color: rgba(10, 132, 255, 0.3);
  background: rgba(255, 255, 255, 0.96);
}

/* Functional layer: desktop sidebar */
.erp-sidebar {
  border-right: 1px solid var(--macos-separator);
  color: var(--macos-label);
  background: rgba(246, 248, 252, 0.88);
  -webkit-backdrop-filter: blur(28px) saturate(1.22);
  backdrop-filter: blur(28px) saturate(1.22);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.62);
}

.erp-shell > .erp-sidebar {
  border-right: 1px solid var(--macos-separator);
  color: var(--macos-label);
  background: rgba(246, 248, 252, 0.88);
  -webkit-backdrop-filter: blur(28px) saturate(1.22);
  backdrop-filter: blur(28px) saturate(1.22);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.62);
  scrollbar-color: rgba(60, 60, 67, 0.22) transparent;
}

.app-header-brand .brand strong {
  color: var(--macos-label);
}

.module-nav {
  background: transparent;
}

.module-nav-title {
  color: var(--macos-label-tertiary);
  font-size: 10px;
  font-weight: 600;
}

.erp-sidebar .module-nav-group {
  border-bottom-color: var(--macos-separator-soft);
}

.erp-sidebar .module-nav-title {
  color: var(--macos-label-tertiary);
}

.module-nav button,
.module-subnav button {
  border: 1px solid transparent;
  border-radius: 7px;
  color: #3a3a3c;
  background: transparent;
  font-weight: 520;
}

.module-nav button:hover,
.module-subnav button:hover {
  color: var(--macos-label);
  background: rgba(118, 118, 128, 0.09);
}

.module-nav button[aria-current="page"] {
  border-color: rgba(10, 132, 255, 0.08);
  color: var(--macos-accent-strong);
  background: rgba(10, 132, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 1px 2px rgba(10, 132, 255, 0.06);
  font-weight: 650;
}

.module-nav button[aria-current="page"]::before,
.module-nav button[aria-current="page"] .module-nav-chevron {
  color: var(--macos-accent);
  opacity: 1;
}

.module-nav button::before {
  background-color: currentColor;
}

.module-nav button[aria-current="page"]::before {
  background-color: var(--macos-accent);
}

.module-nav button[data-nav-icon][aria-current="page"]::before {
  background-color: var(--macos-accent);
}

.module-nav button[aria-current="page"]::after {
  display: none;
}

.module-subnav {
  margin-left: 18px;
  padding-left: 8px;
  border-left: 1px solid var(--macos-separator);
  background: transparent;
}

.module-subnav button {
  color: var(--macos-label-secondary);
}

/* Content layer */
.erp-main {
  color: var(--macos-label);
  background: var(--macos-window);
}

.view-root {
  color: var(--macos-label);
}

.view-semantic-title,
.workspace-page-head h1,
.workbench-heading h1 {
  color: var(--macos-label);
  font-weight: 700;
}

.workspace-page-head,
.workbench-heading {
  border-bottom-color: var(--macos-separator);
  background: transparent;
}

.workspace-page-head :is(p, span, small),
.workbench-heading :is(p, span, small) {
  color: var(--macos-label-secondary);
}

:is(
  .workbench-task-center,
  .workbench-flow-status-bar,
  .panel,
  .data-table-shell,
  .context-panel,
  .flow-summary-panel
) {
  border: 1px solid var(--macos-separator);
  border-radius: 8px;
  background: var(--macos-surface);
  box-shadow: var(--macos-shadow);
}

.panel-title,
.workbench-next-action-head,
.workbench-flow-status-intro {
  border-bottom-color: var(--macos-separator-soft);
  background: rgba(250, 250, 252, 0.82);
}

:is(.panel-title, .workbench-next-action-head, .workbench-flow-status-intro) strong {
  color: var(--macos-label);
  font-weight: 650;
}

:is(.panel-title, .workbench-next-action-head, .workbench-flow-status-intro) :is(span, small, p) {
  color: var(--macos-label-secondary);
}

.metric-card {
  border-color: var(--macos-separator-soft);
  color: var(--macos-label-secondary);
  background: transparent;
  box-shadow: none;
}

.metric-card strong {
  color: var(--macos-label);
  font-variant-numeric: tabular-nums;
}

.metric-card :is(span, small) {
  color: var(--macos-label-secondary);
}

.workbench-primary-action,
.table-action.primary,
.form-actions #submit-flow:not(:disabled),
.bottom-actions .primary {
  border-color: var(--macos-accent);
  color: #ffffff;
  background: var(--macos-accent);
  box-shadow: 0 1px 2px rgba(0, 84, 180, 0.18);
}

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

.view-root:has(> .workbench-heading) .workbench-primary-action > span {
  color: #ffffff;
  background: transparent;
}

.workbench-flow-status-overview[aria-pressed="true"] {
  border-color: rgba(10, 132, 255, 0.28);
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
}

.table-action:not(.primary):not(.danger),
.form-actions button:not(#submit-flow) {
  border-color: var(--macos-separator);
  color: var(--macos-label);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

.table-action:not(.primary):not(.danger):hover,
.form-actions button:not(#submit-flow):hover {
  border-color: rgba(60, 60, 67, 0.24);
  background: #ffffff;
}

.table-action.danger,
.form-actions #clear-flow-form {
  border-color: rgba(255, 59, 48, 0.24);
  color: #d70015;
  background: rgba(255, 59, 48, 0.06);
}

.org-department-actions button {
  border: 1px solid var(--macos-separator);
  border-radius: 7px;
  color: var(--macos-label);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

.org-department-actions button:last-child {
  border-color: var(--macos-accent);
  color: #ffffff;
  background: var(--macos-accent);
}

button:disabled,
.table-action:disabled {
  border-color: var(--macos-separator-soft);
  color: var(--macos-label-tertiary);
  background: rgba(118, 118, 128, 0.07);
  box-shadow: none;
  opacity: 0.68;
}

.tabs {
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 8px;
  background: rgba(118, 118, 128, 0.12);
}

.tab-button {
  border: 0;
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: transparent;
}

.tab-button.is-active,
.tab-button[aria-selected="true"] {
  color: var(--macos-label);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Standard controls */
:is(
  .view-root,
  #erp-flow-launch-dialog,
  .global-overlay-root
) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
) {
  border-color: rgba(60, 60, 67, 0.2);
  border-radius: 7px;
  color: var(--macos-label);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
}

:is(
  .view-root,
  #erp-flow-launch-dialog,
  .global-overlay-root
) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
):hover:not(:disabled):not([readonly]) {
  border-color: rgba(60, 60, 67, 0.32);
}

:is(
  .view-root,
  #erp-flow-launch-dialog,
  .global-overlay-root
) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
):focus {
  border-color: var(--macos-accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16);
  outline: none;
}

:is(
  .view-root,
  #erp-flow-launch-dialog,
  .global-overlay-root
) :is(input, textarea)::placeholder {
  color: var(--macos-label-tertiary);
}

.data-table {
  color: var(--macos-label);
  background: var(--macos-surface);
}

.data-table thead th,
.line-item-table thead th {
  border-color: var(--macos-separator);
  color: var(--macos-label-secondary);
  background: #f7f7f9;
  font-size: 11px;
  font-weight: 650;
}

.data-table tbody td,
.line-item-table tbody td {
  border-color: var(--macos-separator-soft);
}

.data-table tbody tr:hover,
.line-item-table tbody tr:hover {
  background: rgba(10, 132, 255, 0.045);
}

.bottom-actions,
.form-actions {
  border-top-color: var(--macos-separator);
  background: rgba(250, 250, 252, 0.86);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 -8px 24px rgba(15, 23, 42, 0.04);
}

/* Transient functional surfaces */
:is(
  .user-menu-dropdown,
  .global-search-panel,
  .flow-template-tools-body,
  .org-module-dropdown-options
) {
  border: 1px solid var(--macos-separator);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.global-search-item:is(:hover, :focus-visible, .is-keyboard-active) {
  color: var(--macos-label);
  background: var(--macos-accent-soft);
}

/* Login material */
.login-gate-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(28px) saturate(1.22);
  backdrop-filter: blur(28px) saturate(1.22);
  box-shadow: var(--macos-window-shadow);
}

.login-mode-toggle,
.admin-login-form input,
.login-account-submit {
  border-radius: 7px;
}

/* Focused desktop document window */
#erp-flow-launch-dialog {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  background: rgba(29, 29, 31, 0.14);
  -webkit-backdrop-filter: blur(10px) saturate(0.94);
  backdrop-filter: blur(10px) saturate(0.94);
}

#erp-flow-launch-dialog::backdrop {
  background: rgba(29, 29, 31, 0.2);
}

#erp-flow-launch-dialog > .erp-flow-launch-dialog-shell {
  width: min(1400px, calc(100vw - 32px));
  height: calc(100dvh - 32px);
  max-height: none;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: var(--macos-surface-raised);
  box-shadow: var(--macos-window-shadow);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-head {
  min-height: 52px;
  border-bottom: 1px solid var(--macos-separator);
  background: rgba(250, 250, 252, 0.86);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  backdrop-filter: blur(24px) saturate(1.18);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-head h2 {
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--macos-label-secondary);
  background: var(--macos-control);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-close:hover {
  color: var(--macos-label);
  background: var(--macos-control-hover);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-body {
  background: var(--macos-window);
}

#erp-flow-launch-dialog .flow-document-head {
  border-color: var(--macos-separator);
  background: var(--macos-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

#erp-flow-launch-dialog .flow-document-category,
#erp-flow-launch-dialog .flow-form-state > span {
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
}

#erp-flow-launch-dialog .flow-form-progress {
  border-color: var(--macos-separator);
  background: rgba(250, 250, 252, 0.9);
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button {
  color: var(--macos-label-secondary);
  background: transparent;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button[aria-current="step"] {
  color: var(--macos-accent-strong);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

#erp-flow-launch-dialog .form-grid,
#erp-flow-launch-dialog .flow-task-rail-card {
  border-color: var(--macos-separator);
  background: var(--macos-surface);
}

#erp-flow-launch-dialog .form-section-label {
  border-bottom-color: var(--macos-separator);
  color: var(--macos-label);
  background: transparent;
}

#erp-flow-launch-dialog .flow-task-rail-progress-track {
  background: rgba(118, 118, 128, 0.14);
}

#erp-flow-launch-dialog .flow-task-rail-progress-track > i {
  background: var(--macos-accent);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header,
  .erp-sidebar,
  .bottom-actions,
  .form-actions,
  .login-gate-card,
  :is(.user-menu-dropdown, .global-search-panel, .flow-template-tools-body, .org-module-dropdown-options) {
    background: #ffffff;
  }

  #erp-flow-launch-dialog {
    background: rgba(29, 29, 31, 0.24);
  }
}

@media (prefers-contrast: more) {
  .app-header,
  .erp-sidebar,
  :is(.panel, .data-table-shell, .workbench-task-center, .workbench-flow-status-bar),
  #erp-flow-launch-dialog > .erp-flow-launch-dialog-shell {
    border-color: rgba(29, 29, 31, 0.42);
  }

  .module-nav button[aria-current="page"] {
    border-color: var(--macos-accent-strong);
    color: #004f9f;
    background: rgba(10, 132, 255, 0.18);
  }
}

@media (prefers-reduced-motion: no-preference) {
  #erp-flow-launch-dialog[open] > .erp-flow-launch-dialog-shell {
    animation: macos-window-enter 160ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
  }

  .module-nav button,
  .table-action,
  .workbench-primary-action {
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  }
}

@keyframes macos-window-enter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .app-header {
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(18px) saturate(1.16);
    backdrop-filter: blur(18px) saturate(1.16);
  }

  .erp-sidebar {
    border-top: 1px solid var(--macos-separator);
    border-right: 0;
    background: rgba(250, 250, 252, 0.92);
    -webkit-backdrop-filter: blur(22px) saturate(1.18);
    backdrop-filter: blur(22px) saturate(1.18);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.72), 0 -8px 28px rgba(15, 23, 42, 0.08);
  }

  .module-nav button[aria-current="page"] {
    border-color: transparent;
    color: var(--macos-accent-strong);
    background: rgba(10, 132, 255, 0.1);
    box-shadow: none;
  }

  #erp-flow-launch-dialog {
    width: 100vw;
    height: 100dvh;
    padding: 0;
    background: var(--macos-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

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

  #erp-flow-launch-dialog .erp-flow-launch-dialog-head {
    min-height: calc(56px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: rgba(255, 255, 255, 0.94);
  }

  .form-actions,
  .bottom-actions {
    background: rgba(250, 250, 252, 0.94);
  }

  #erp-flow-launch-dialog:not(.is-picker)
  .flow-form.is-document-layout.flow-form-streamlined > .form-actions {
    grid-area: auto;
    position: fixed;
    inset: auto 0 0 0;
    display: grid;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(96px, 1.2fr);
    gap: 8px;
    box-sizing: border-box;
  }

  #erp-flow-launch-dialog:not(.is-picker)
  .flow-form.is-document-layout.flow-form-streamlined > .form-actions button {
    width: 100%;
    min-width: 0;
  }

  #erp-flow-launch-dialog:not(.is-picker)
  .flow-form.is-document-layout.flow-form-streamlined > .form-actions #clear-flow-form {
    margin-right: 0;
  }

  :is(.workbench-task-center, .workbench-flow-status-bar, .panel, .data-table-shell) {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }
}

/* macOS productivity depth pass 2026-08-16 */
:root {
  --macos-chart-blue: #0a84ff;
  --macos-chart-green: #34c759;
  --macos-chart-orange: #ff9f0a;
  --macos-chart-cyan: #5ac8fa;
  --macos-chart-indigo: #5e5ce6;
  --macos-selection: rgba(10, 132, 255, 0.1);
  --macos-selection-strong: rgba(10, 132, 255, 0.16);
}

/* Keep the current module and its controls visible like a desktop toolbar. */
.view-root > :is(.workspace-page-head, .view-semantic-title) {
  position: sticky;
  top: var(--ui-header-height);
  z-index: 72;
  border-bottom-color: var(--macos-separator);
  background: rgba(245, 245, 247, 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(1.16);
  backdrop-filter: blur(20px) saturate(1.16);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.app-header .global-search {
  max-width: 680px;
}

.app-header .global-search input {
  height: 36px;
  min-height: 36px;
  padding-inline: 14px;
  font-size: 13px;
}

.workbench-heading {
  min-height: 82px;
  padding-block: 12px 16px;
}

.workbench-heading h1 {
  font-size: 25px;
  font-weight: 720;
  line-height: 1.2;
}

.workbench-heading-title-row > span {
  color: var(--macos-label-secondary);
  font-variant-numeric: tabular-nums;
}

.workbench-heading-summary {
  margin-top: 5px;
}

:is(.workbench-task-center, .workbench-flow-status-bar, .workbench-recent-activity) {
  border: 1px solid var(--macos-separator);
  border-top: 1px solid var(--macos-separator);
  border-radius: 8px;
  background: var(--macos-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.045), 0 10px 30px rgba(15, 23, 42, 0.04);
}

:is(.workbench-next-action-head, .workbench-recent-activity > header, .workbench-flow-status-intro) {
  border-bottom: 1px solid var(--macos-separator-soft);
  background: rgba(250, 250, 252, 0.82);
}

.workbench-next-action-list > button,
.workbench-recent-list > button {
  min-height: 64px;
  border-bottom: 1px solid var(--macos-separator-soft);
  background: transparent;
  transition: background-color 120ms ease;
}

.workbench-next-action-list > button:last-child,
.workbench-recent-list > button:last-child {
  border-bottom: 0;
}

.workbench-next-action-list > button:is(:hover, :focus-visible) {
  background: var(--macos-accent-soft);
}

.workbench-recent-list > button:is(:hover, :focus-visible) {
  background: var(--macos-selection);
}

.workbench-next-action-list > button:focus-visible,
.workbench-recent-list > button:focus-visible {
  outline: 2px solid var(--macos-accent);
  outline-offset: -2px;
}

.workbench-next-action-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(10, 132, 255, 0.16);
  border-radius: 7px;
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.workbench-next-action-copy strong,
.workbench-next-action-owner strong {
  color: var(--macos-label);
  font-weight: 650;
}

.workbench-next-action-copy em,
.workbench-next-action-owner small {
  color: var(--macos-label-secondary);
}

.workbench-flow-status-button {
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: transparent;
}

.workbench-flow-status-button:is(:hover, :focus-visible) {
  color: var(--macos-label);
  background: var(--macos-control);
}

.workbench-flow-status-button:is(.is-active, [aria-pressed="true"]) {
  border-color: rgba(10, 132, 255, 0.14);
  color: var(--macos-accent-strong);
  background: var(--macos-selection-strong);
}

.workbench-flow-status-button strong,
.workbench-flow-status-overview strong {
  font-variant-numeric: tabular-nums;
}

/* Executive dashboard uses one data language instead of unrelated card themes. */
.dashboard-project-picker.compact select {
  border-color: transparent;
  color: var(--macos-label);
  background: var(--macos-control);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
}

.dashboard-project-picker.compact select:is(:hover, :focus) {
  border-color: rgba(10, 132, 255, 0.26);
  background: rgba(255, 255, 255, 0.96);
}

.dashboard-filter-trigger {
  border-color: var(--macos-label-secondary);
}

.dashboard-executive,
.dashboard-chart-panel,
.workbench-project-overview,
.workbench-exception-center,
.dashboard-detail-drawer {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: var(--macos-surface);
  box-shadow: var(--macos-shadow);
}

.dashboard-command,
.dashboard-panel-head,
.workbench-section-head {
  border-bottom-color: var(--macos-separator-soft);
  background: rgba(250, 250, 252, 0.82);
}

.dashboard-command-main .dashboard-eyebrow {
  color: var(--macos-accent-strong);
}

.dashboard-command-main h2,
.dashboard-panel-head h2,
.workbench-section-head h2 {
  color: var(--macos-label);
  font-weight: 650;
}

.boss-kpi-card {
  border-right-color: var(--macos-separator-soft);
  color: var(--macos-label);
  background: transparent;
}

.boss-kpi-card:is(:hover, :focus-visible) {
  background: var(--macos-selection);
}

.boss-kpi-card:focus-visible,
.dashboard-chart-bar:focus-visible,
.dashboard-donut-legend button:focus-visible,
.dashboard-trend-legend button:focus-visible {
  outline: 2px solid var(--macos-accent);
  outline-offset: -2px;
}

.boss-kpi-card strong {
  color: var(--macos-label);
  font-size: 24px;
  font-weight: 650;
}

.boss-kpi-card.receive strong {
  color: #18864b;
}

.boss-kpi-card.pay strong {
  color: #b35a00;
}

.boss-kpi-card.cash strong {
  color: var(--macos-accent-strong);
}

.boss-kpi-card.risk strong,
.boss-kpi-card.cash.risk strong {
  color: #d70015;
}

.dashboard-chart-suite {
  gap: 12px;
}

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

.dashboard-comparison-bars {
  border-bottom-color: var(--macos-separator);
  background: #ffffff;
}

.dashboard-chart-bar > i {
  width: min(38px, 62%);
  border-radius: 7px 7px 2px 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.dashboard-chart-bar.income { --chart-color: var(--macos-chart-blue); }
.dashboard-chart-bar.cost { --chart-color: var(--macos-chart-orange); }
.dashboard-chart-bar.output { --chart-color: var(--macos-chart-indigo); }
.dashboard-chart-bar.receivable { --chart-color: var(--macos-chart-cyan); }
.dashboard-chart-bar.received { --chart-color: var(--macos-chart-green); }
.dashboard-chart-bar.paid { --chart-color: #ff7a00; }

.dashboard-donut-track {
  stroke: rgba(118, 118, 128, 0.14);
}

.dashboard-donut-segment {
  stroke-linecap: round;
}

.dashboard-donut-segment.received {
  stroke: var(--macos-chart-green);
}

.dashboard-donut-segment.unreceived {
  stroke: var(--macos-chart-orange);
}

.dashboard-donut-legend button,
.dashboard-trend-legend button {
  border-color: transparent;
  color: var(--macos-label-secondary);
  background: var(--macos-control);
}

.dashboard-donut-legend button:is(:hover, :focus-visible),
.dashboard-trend-legend button:is(:hover, :focus-visible) {
  border-color: rgba(10, 132, 255, 0.22);
  color: var(--macos-label);
  background: var(--macos-selection);
}

.dashboard-donut-legend button > i,
.dashboard-trend-legend .received i {
  background: var(--macos-chart-green);
}

.dashboard-donut-legend button.unreceived > i,
.dashboard-trend-legend .paid i {
  background: var(--macos-chart-orange);
}

.dashboard-trend-legend i {
  background: var(--macos-chart-indigo);
}

.dashboard-line-grid line {
  stroke: rgba(60, 60, 67, 0.12);
}

.dashboard-line-grid text,
.dashboard-line-months text {
  fill: var(--macos-label-secondary);
}

.dashboard-line-series,
.dashboard-line-point {
  stroke: var(--macos-chart-indigo);
}

.dashboard-line-series.received,
.dashboard-line-point.received {
  stroke: var(--macos-chart-green);
}

.dashboard-line-series.paid,
.dashboard-line-point.paid {
  stroke: var(--macos-chart-orange);
}

/* Finder-style ledgers and segmented scope controls. */
.contract-ledger-group-switch {
  width: fit-content;
  max-width: calc(100% - 28px);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(132px, auto);
  gap: 2px;
  margin: 10px 14px;
  padding: 3px;
  border: 0;
  border-radius: 8px;
  background: var(--macos-control);
}

.contract-ledger-group-switch > button {
  min-height: 30px;
  padding: 5px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.contract-ledger-group-switch > button:is(:hover, :focus-visible) {
  color: var(--macos-label);
  background: rgba(255, 255, 255, 0.58);
}

.contract-ledger-group-switch > button.is-active {
  color: var(--macos-label);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.erp-main :is(.data-table, .workbench-project-table) {
  border-collapse: separate;
  border-spacing: 0;
}

.erp-main :is(.data-table, .workbench-project-table) thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid var(--macos-separator);
  color: var(--macos-label-secondary);
  background: rgba(247, 247, 249, 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  backdrop-filter: blur(14px) saturate(1.12);
  font-weight: 600;
}

.erp-main :is(.data-table, .workbench-project-table) tbody td {
  border-bottom-color: var(--macos-separator-soft);
  color: var(--macos-label);
  background: #ffffff;
}

.erp-main :is(.data-table, .workbench-project-table) tbody tr:nth-child(even) td {
  background: #ffffff;
}

.erp-main :is(.data-table, .workbench-project-table) tbody tr:is(:hover, :focus-within) td {
  background: var(--macos-selection);
}

.business-ledger,
.data-table-shell,
.workbench-project-table-scroll {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
  scrollbar-color: rgba(60, 60, 67, 0.24) transparent;
}

.context-grid.compact-context {
  border-color: var(--macos-separator);
  background: #ffffff;
}

.context-grid.compact-context > div {
  border-color: var(--macos-separator-soft);
}

/* Approval is a document plus inspector, matching a desktop review task. */
.flow-record-preview-panel.is-approval-mode {
  background: var(--macos-window);
}

body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-record-preview-layout.has-approval-workbench {
  height: 100%;
  min-height: 0;
}

.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  border-bottom: 1px solid var(--macos-separator);
  background: rgba(250, 250, 252, 0.9);
  -webkit-backdrop-filter: blur(22px) saturate(1.16);
  backdrop-filter: blur(22px) saturate(1.16);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  background: var(--macos-window);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip,
.flow-record-preview-panel.is-approval-mode .flow-approval-content-section,
.flow-record-preview-panel.is-approval-mode .flow-approval-focus {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip > div,
.flow-record-preview-panel.is-approval-mode .flow-approval-content-section > header {
  border-color: var(--macos-separator-soft);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-main-checks .flow-approval-system-checks {
  border-radius: 8px;
  box-shadow: none;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  border-left: 1px solid var(--macos-separator);
  background: rgba(246, 248, 252, 0.9);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  backdrop-filter: blur(24px) saturate(1.18);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.64);
}

body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
.global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  border-left-color: var(--macos-separator);
  background: rgba(246, 248, 252, 0.9);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  backdrop-filter: blur(24px) saturate(1.18);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > :is(section, label, .flow-approval-workbench-head) {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
  border-top-color: var(--macos-separator);
  background: rgba(250, 250, 252, 0.92);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-actions .primary {
  border-color: var(--macos-accent);
  color: #ffffff;
  background: var(--macos-accent);
  box-shadow: 0 1px 2px rgba(0, 84, 180, 0.18);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-actions .primary:hover {
  border-color: var(--macos-accent-strong);
  background: var(--macos-accent-strong);
}

/* System popover for the signed-in person. */
.app-header .user-menu-dropdown {
  width: 280px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--macos-separator);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
}

.app-header .user-menu-profile {
  min-height: 82px;
  padding: 14px;
  border-bottom: 1px solid var(--macos-separator-soft);
  background: transparent;
}

.app-header .user-menu-profile strong {
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
}

.app-header .user-menu-profile :is(span, small) {
  color: var(--macos-label-secondary);
}

.app-header .user-preview-avatar {
  border: 1px solid rgba(10, 132, 255, 0.2);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.app-header .user-menu-logout {
  width: 100%;
  min-height: 40px;
  padding: 9px 14px;
  border: 0;
  border-radius: 0;
  color: #d70015;
  background: transparent;
  text-align: left;
}

.app-header .user-menu-logout:is(:hover, :focus-visible) {
  color: #b40012;
  background: rgba(255, 59, 48, 0.08);
}

@media (max-width: 760px) {
  .view-root > :is(.workspace-page-head, .view-semantic-title) {
    position: static;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  .workbench-heading {
    min-height: 68px;
    padding-block: 8px 12px;
  }

  .workbench-heading h1 {
    font-size: 21px;
  }

  :is(.workbench-task-center, .workbench-flow-status-bar, .workbench-recent-activity) {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .contract-ledger-group-switch {
    width: calc(100% - 20px);
    max-width: none;
    grid-auto-columns: minmax(0, 1fr);
    margin: 8px 10px;
  }

  .contract-ledger-group-switch > button {
    min-width: 0;
    min-height: 40px;
    padding-inline: 6px;
    white-space: normal;
  }

  body .erp-sidebar .module-nav.ui-system-v2 {
    border-top: 1px solid var(--macos-separator);
    background: rgba(250, 250, 252, 0.94);
    -webkit-backdrop-filter: blur(22px) saturate(1.18);
    backdrop-filter: blur(22px) saturate(1.18);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.72), 0 -8px 28px rgba(15, 23, 42, 0.08);
  }

  body .erp-sidebar .module-nav button[data-mobile-primary],
  body .erp-sidebar .module-nav #mobile-more-toggle {
    border-color: transparent;
    color: var(--macos-label-secondary);
    background: transparent;
    box-shadow: none;
  }

  body .erp-sidebar .module-nav button[data-mobile-primary]::before,
  body .erp-sidebar .module-nav #mobile-more-toggle::before {
    color: currentColor;
    background-color: currentColor;
    opacity: 0.82;
  }

  body .erp-sidebar .module-nav button[data-mobile-primary][aria-current="page"] {
    border-color: transparent;
    color: var(--macos-accent-strong);
    background: var(--macos-accent-soft);
    box-shadow: none;
  }

  body .erp-sidebar .module-nav.ui-system-v2.is-mobile-open {
    border: 1px solid var(--macos-separator);
    border-radius: 8px;
    background: rgba(250, 250, 252, 0.98);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  }

  body .erp-sidebar .module-nav.is-mobile-open button[data-view] {
    border-color: transparent;
    color: var(--macos-label);
    background: var(--macos-control);
  }

  body .erp-sidebar .module-nav.is-mobile-open button[data-view]:is(:hover, :focus-visible) {
    color: var(--macos-accent-strong);
    background: var(--macos-accent-soft);
  }

  body .erp-sidebar .module-nav.is-mobile-open button[data-view][aria-current="page"] {
    color: var(--macos-accent-strong);
    background: var(--macos-accent-soft);
  }

  .dashboard-chart-panel {
    min-height: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
  body.flow-detail-only .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    border-left: 0;
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-record-preview-layout.has-approval-workbench {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions,
  .global-overlay-root .flow-record-preview-panel.is-decision-mode .flow-approval-workbench > .flow-approval-actions {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-modal);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.45fr);
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    gap: 8px;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--macos-separator);
    border-radius: 0;
    box-sizing: border-box;
    background: rgba(250, 250, 252, 0.96);
  }

  .app-header .user-menu-dropdown {
    right: -2px;
    width: min(300px, calc(100vw - 16px));
    background: rgba(255, 255, 255, 0.98);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .app-header,
  .erp-sidebar,
  .view-root > :is(.workspace-page-head, .view-semantic-title),
  .app-header .user-menu-dropdown,
  .flow-record-preview-panel.is-approval-mode > .flow-record-preview-head,
  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench,
  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions,
  .erp-main :is(.data-table, .workbench-project-table) thead th {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* macOS module density refinement 2026-08-16 */
:root {
  --module-label-size: 12px;
  --module-text-size: 13px;
  --module-caption-size: 11px;
  --module-control-height: 36px;
  --module-touch-height: 44px;
  --module-section-gap: 16px;
  --module-panel-padding: 16px;
  --module-row-height: 44px;
}

/* Shared page rhythm. Every module starts with the same title-to-content cadence. */
.view-root {
  font-size: var(--module-text-size);
}

.view-root :is(h1, h2, h3, p, dl, ul, ol) {
  margin-block-start: 0;
}

.view-root :is(h1, h2, h3) {
  letter-spacing: 0;
  text-wrap: balance;
}

.view-root :is(p, small, span) {
  line-height: 1.45;
}

.view-root :is(.panel, .grid-2, .finance-detail-grid, .cashier-grid, .approval-template-layout, .construction-log-layout, .material-management-layout) {
  min-width: 0;
}

.panel {
  overflow: hidden;
  margin: 0;
}

.panel + .panel {
  margin-top: 0;
}

.panel-title {
  min-height: 48px;
  padding: 11px var(--module-panel-padding);
  gap: 12px;
  border-bottom: 1px solid var(--macos-separator-soft);
  background: #fafafd;
}

.panel-title > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.panel-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.panel-title span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--macos-label-secondary);
  font-size: var(--module-caption-size);
  line-height: 1.4;
}

.panel-title :is(.table-action, button) {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.panel-body {
  padding: var(--module-panel-padding);
}

.panel-body > :first-child,
.panel > :not(.panel-title):first-child {
  margin-top: 0;
}

.panel-body > :last-child,
.panel > :last-child {
  margin-bottom: 0;
}

/* Linked summary cells use one compact grid instead of a stack of oversized cards. */
.context-grid {
  gap: 0;
  margin: 0;
  padding: 0;
  border-color: var(--macos-separator-soft);
  background: #ffffff;
}

.context-grid > div {
  min-width: 0;
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 11px 14px;
  border-color: var(--macos-separator-soft);
}

.context-grid > div > span,
.context-grid > div > small {
  color: var(--macos-label-secondary);
  font-size: var(--module-caption-size);
  line-height: 1.4;
}

.context-grid > div > strong,
.context-grid > div > a,
.context-grid > div > button {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.context-grid.compact-context > div {
  min-height: 60px;
  padding: 9px 12px;
}

/* Forms: labels stay close to controls, sections create the only strong rhythm break. */
.form-grid,
.flow-form .form-grid,
.cashier-form .form-grid,
.org-settings,
.schedule-editor-toolbar,
.construction-log-form,
.material-movement-form {
  font-size: var(--module-text-size);
}

.form-grid label,
.flow-form .form-grid label,
.cashier-form label,
.org-settings label,
.schedule-editor-toolbar label,
.material-movement-form label,
.construction-log-form label {
  min-width: 0;
  gap: 5px;
}

.form-grid label > span,
.flow-form .form-grid label > span,
.cashier-form label > span,
.org-settings label > span,
.schedule-editor-toolbar label > span,
.material-movement-form label > span,
.construction-log-form label > span {
  min-height: 17px;
  color: var(--macos-label);
  font-size: var(--module-label-size);
  font-weight: 650;
  line-height: 1.4;
}

.form-grid :is(input, select, textarea),
.flow-form .form-grid :is(input, select, textarea),
.cashier-form :is(input, select, textarea),
.org-settings :is(input, select, textarea),
.schedule-editor-toolbar :is(input, select, textarea),
.material-movement-form :is(input, select, textarea),
.construction-log-form :is(input, select, textarea) {
  font-size: var(--module-text-size);
  line-height: 1.4;
}

.form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.flow-form .form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.cashier-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.org-settings :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.schedule-editor-toolbar :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.material-movement-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select),
.construction-log-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) {
  height: var(--module-control-height);
  min-height: var(--module-control-height);
  padding-inline: 10px;
}

.form-grid textarea,
.flow-form .form-grid textarea,
.cashier-form textarea,
.org-settings textarea,
.material-movement-form textarea,
.construction-log-form textarea {
  min-height: 78px;
  padding: 8px 10px;
}

.form-section-label,
.flow-section-title {
  min-height: 36px;
  margin-block-start: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--macos-separator);
  border-bottom: 1px solid var(--macos-separator-soft);
  color: var(--macos-label);
  background: #fafafd;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.form-section-label:first-child,
.flow-section-title:first-child {
  margin-block-start: 0;
}

.flow-related-field,
.attachment-upload-control,
.contract-lines,
.cashier-voucher-control,
.material-contract-reference {
  min-width: 0;
  margin-block-start: 4px;
  border-color: var(--macos-separator-soft);
  border-radius: 7px;
  background: #ffffff;
}

.line-table-head,
.attachment-upload-control > header,
.cashier-voucher-control > header {
  min-height: 40px;
  padding: 8px 10px;
  border-bottom-color: var(--macos-separator-soft);
  background: #fafafd;
}

.line-table-head > span,
.attachment-upload-control > header strong,
.cashier-voucher-control > header strong {
  color: var(--macos-label);
  font-size: 12px;
  font-weight: 650;
}

/* Every business table shares one readable row rhythm and numeric alignment. */
.erp-main :is(
  .data-table,
  .workbench-project-table,
  .payroll-table,
  .org-directory-table,
  .org-editor-table,
  .schedule-editor-table,
  .line-item-table,
  .template-attachment-table,
  .construction-log-summary-table
) {
  font-size: 12px;
  line-height: 1.45;
}

.erp-main :is(
  .data-table,
  .workbench-project-table,
  .payroll-table,
  .org-directory-table,
  .org-editor-table,
  .schedule-editor-table,
  .line-item-table,
  .template-attachment-table,
  .construction-log-summary-table
) :is(th, td) {
  padding: 8px 10px;
  line-height: 1.45;
}

.erp-main :is(
  .data-table,
  .workbench-project-table,
  .payroll-table,
  .org-directory-table,
  .org-editor-table,
  .schedule-editor-table,
  .line-item-table,
  .template-attachment-table,
  .construction-log-summary-table
) thead th {
  height: 38px;
  color: var(--macos-label-secondary);
  font-size: 11px;
  font-weight: 650;
  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,
  .template-attachment-table,
  .construction-log-summary-table
) tbody td {
  min-height: var(--module-row-height);
  color: var(--macos-label);
  vertical-align: middle;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table) :is(td, th):has(.amount, .money, .is-money),
.erp-main :is(.data-table, .workbench-project-table, .payroll-table) .amount,
.erp-main :is(.data-table, .workbench-project-table, .payroll-table) .money {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.erp-main :is(.data-table, .workbench-project-table) td > :is(button, a, input, select) {
  max-width: 100%;
}

.data-table-scroll-hint,
.schedule-table-scroll-hint {
  min-height: 28px;
  padding: 6px 10px;
  color: var(--macos-label-secondary);
  background: #fafafd;
  font-size: var(--module-caption-size);
  line-height: 1.4;
}

/* Finance and cashier surfaces use one two-column working rhythm. */
.finance-subnav {
  display: inline-flex;
  max-width: 100%;
  gap: 2px;
  margin: 0 0 var(--module-section-gap);
  padding: 3px;
  border-radius: 8px;
  background: var(--macos-control);
}

.finance-subnav button {
  min-height: 32px;
  padding: 6px 11px;
  border: 0;
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.finance-subnav button.is-active {
  color: var(--macos-label);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.cashier-grid,
.finance-detail-grid,
.material-management-layout,
.approval-template-layout {
  gap: var(--module-section-gap);
}

.cashier-form,
.cashier-empty-workspace,
.cashier-type-list,
.cashier-type-grid,
.cashier-summary-grid {
  min-width: 0;
}

.cashier-form {
  padding: var(--module-panel-padding);
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.cashier-form .form-grid.compact {
  gap: 12px 14px;
  padding: 0;
}

.cashier-summary-grid,
.cashier-type-grid {
  gap: 12px;
}

.cashier-voucher-control {
  padding: 0;
}

.type-chip-list,
.cashier-type-list {
  gap: 6px;
  padding: 10px 12px 12px;
}

.type-chip {
  min-height: 28px;
  padding: 4px 7px 4px 9px;
  border-color: var(--macos-separator-soft);
  color: var(--macos-label-secondary);
  background: #fafafd;
  box-shadow: none;
  font-size: 11px;
}

.payroll-filters {
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--macos-separator-soft);
  background: #fafafd;
}

.payroll-filters label {
  gap: 5px;
  color: var(--macos-label);
  font-size: var(--module-label-size);
  font-weight: 650;
}

/* Project management: calendars, schedules, material movement and logs. */
.schedule-editor {
  gap: 12px;
  padding: var(--module-panel-padding);
}

.schedule-editor-toolbar {
  gap: 12px;
  padding: 12px;
  border-color: var(--macos-separator-soft);
  border-radius: 7px;
  background: #fafafd;
}

.schedule-editor-toolbar label {
  min-width: 220px;
  gap: 5px;
}

.schedule-table-wrap,
.org-table-wrap,
.finance-detail-grid > div {
  border-color: var(--macos-separator);
  border-radius: 7px;
  background: #ffffff;
}

.schedule-editor-table input,
.schedule-editor-table select,
.schedule-editor-table textarea,
.org-editor-table input,
.org-editor-table select {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.construction-log-layout {
  gap: var(--module-section-gap);
  padding: var(--module-panel-padding);
  border-top-color: var(--macos-separator-soft);
  background: #f8f8fa;
}

.construction-log-calendar,
.construction-log-form {
  padding: 14px;
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.construction-log-header-controls {
  gap: 10px;
}

.construction-log-project-picker,
.construction-log-engineer-picker {
  gap: 5px;
}

.construction-log-project-picker > span,
.construction-log-engineer-picker > span {
  color: var(--macos-label);
  font-size: var(--module-label-size);
  font-weight: 650;
}

.construction-calendar-toolbar {
  min-height: 38px;
  margin-bottom: 8px;
}

.construction-calendar-title strong {
  color: var(--macos-label);
  font-size: 16px;
  font-weight: 650;
}

.construction-calendar-week,
.construction-calendar-grid {
  gap: 4px;
}

.construction-calendar-grid button {
  border-color: transparent;
  border-radius: 6px;
  color: var(--macos-label);
  background: #f7f7f9;
  font-size: 12px;
}

.construction-calendar-grid button.is-selected {
  border-color: var(--macos-accent);
  color: #ffffff;
  background: var(--macos-accent);
  box-shadow: none;
}

.construction-log-upload-field,
.construction-log-photo-section,
.construction-log-pending-section {
  padding: 10px;
  border-color: var(--macos-separator-soft);
  border-radius: 7px;
  background: #fafafd;
}

.construction-log-photo-section-head {
  gap: 8px;
  margin-bottom: 8px;
}

.construction-log-photo-grid {
  gap: 8px;
}

.construction-log-photo-card {
  border-color: var(--macos-separator);
  border-radius: 7px;
  background: #ffffff;
}

.material-management-layout {
  padding: var(--module-panel-padding);
}

.material-movement-entry,
.material-inventory-section,
.material-contract-reference {
  min-width: 0;
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
}

.material-movement-entry,
.material-inventory-section {
  padding: 14px;
}

.material-inventory-heading {
  min-height: 40px;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom-color: var(--macos-separator-soft);
}

/* Organization and approval settings need hierarchy without oversized admin cards. */
.org-module-grid,
.org-role-list,
.org-table-wrap {
  gap: 12px;
  padding: var(--module-panel-padding);
}

.org-role-row {
  gap: 10px;
  padding: 12px;
  border-color: var(--macos-separator);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: none;
}

.org-role-members-label,
.org-role-members-empty {
  font-size: var(--module-caption-size);
}

.org-role-member {
  min-height: 26px;
  border-color: var(--macos-separator-soft);
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: #fafafd;
  font-size: 11px;
}

.org-module-checks,
.org-inline-check {
  gap: 6px;
}

.org-module-checks label,
.org-inline-check {
  min-height: 30px;
  padding: 5px 8px;
  border-color: var(--macos-separator-soft);
  border-radius: 7px;
  color: var(--macos-label-secondary);
  background: #fafafd;
  font-size: 11px;
}

.approval-template-layout {
  align-items: start;
}

.approval-template-list,
.approval-template-editor,
.approval-tree-editor {
  min-width: 0;
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
}

.approval-template-list-head,
.approval-tree-head,
.template-editor-fields-head {
  min-height: 44px;
  padding: 10px 12px;
  border-bottom-color: var(--macos-separator-soft);
  background: #fafafd;
}

.approval-assignment-row,
.approval-tree-step,
.approval-tree-node {
  gap: 8px;
  padding: 9px 10px;
  border-color: var(--macos-separator-soft);
}

/* Contract template work: make the document and required navigation equally calm. */
.template-grid {
  gap: 12px;
  padding: var(--module-panel-padding);
}

.template-card {
  min-height: 204px;
  gap: 8px;
  padding: 14px;
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.template-card > strong {
  color: var(--macos-label);
  font-size: 15px;
  font-weight: 650;
}

.template-card > span,
.template-card small {
  color: var(--macos-label-secondary);
  font-size: var(--module-caption-size);
}

.template-meta {
  gap: 6px;
}

.template-field-legend,
.template-actions {
  gap: 6px;
}

.template-field-legend span {
  padding: 5px 7px;
  border-color: var(--macos-separator-soft);
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: #fafafd;
  font-size: 11px;
}

.template-step-strip {
  gap: 4px;
  padding: 4px;
  border-color: var(--macos-separator-soft);
  border-radius: 7px;
  background: #fafafd;
}

.template-step-strip span {
  padding: 6px 5px;
  border-radius: 5px;
  color: var(--macos-label-secondary);
  background: transparent;
  font-size: 10px;
  font-weight: 650;
}

.template-step-strip span.is-active,
.template-step-strip span[aria-current="step"] {
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
}

.template-document-layout {
  gap: 12px;
  padding: 12px;
  background: var(--macos-window);
}

.template-document-viewer,
.template-required-sidebar,
.template-editor-fields {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
}

.template-required-head,
.template-editor-fields-head {
  padding: 10px 12px;
}

.template-required-list,
.template-editor-grid {
  padding: 8px;
}

.template-required-group {
  gap: 4px;
  margin-bottom: 8px;
}

.template-required-group > strong {
  padding: 4px 6px;
  color: var(--macos-label-secondary);
  font-size: 11px;
}

.template-required-group button {
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--macos-label-secondary);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.template-required-group button.is-active,
.template-required-group button:is(:hover, :focus-visible) {
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
}

/* Flow and approval details: title, evidence, decision are separated by spacing, not decoration. */
.flow-form-streamlined .form-grid {
  gap: 12px 14px;
}

.flow-document-head {
  min-height: 68px;
  padding: 14px 16px;
}

.flow-document-head h3,
.flow-document-head h2 {
  font-size: 17px;
  line-height: 1.3;
}

.flow-form-progress {
  padding: 10px;
}

.flow-form-progress #flow-section-nav {
  gap: 4px;
}

.flow-form-progress #flow-section-nav button {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 11px;
}

.flow-task-rail,
.flow-task-rail-card {
  gap: 10px;
}

.flow-task-rail-card {
  padding: 12px;
}

.flow-record-preview-main {
  padding: 16px;
}

.flow-approval-content-section,
.flow-approval-focus,
.flow-approval-context-strip,
.flow-approval-account-brief,
.flow-approval-system-checks {
  margin-bottom: 12px;
}

.flow-approval-content-section > header,
.flow-approval-focus-head,
.flow-approval-workbench-head {
  min-height: 42px;
  padding: 10px 12px;
}

.flow-approval-content-section > header strong,
.flow-approval-focus-head strong,
.flow-approval-workbench-head strong {
  color: var(--macos-label);
  font-size: 13px;
  font-weight: 650;
}

.flow-approval-content-section > header span,
.flow-approval-focus-head span,
.flow-approval-workbench-head span {
  color: var(--macos-label-secondary);
  font-size: var(--module-caption-size);
}

.flow-approval-business-overview,
.flow-approval-business-details,
.flow-approval-financial-comparison,
.flow-approval-review-brief {
  gap: 10px;
  padding: 12px;
}

.flow-approval-workbench {
  gap: 10px;
  margin: 12px 12px 12px 0;
  padding: 12px;
}

.flow-approval-workbench > :is(section, label, .flow-approval-workbench-head) {
  padding: 10px;
}

.flow-approval-comment-field textarea {
  min-height: 84px;
}

.flow-approval-actions {
  gap: 8px;
  padding-top: 10px;
}

/* Popups: a short head, scrollable body, and a single action rhythm. */
.global-overlay-root .dashboard-preview-panel {
  border-radius: 8px;
}

.global-overlay-root .dashboard-preview-head {
  min-height: 52px;
  padding: 10px 14px;
}

.global-overlay-root .dashboard-preview-head strong {
  font-size: 14px;
  font-weight: 650;
}

.global-overlay-root .dashboard-preview-body,
.global-overlay-root .dashboard-preview-table {
  padding: 14px;
}

.global-overlay-root .dashboard-preview-actions {
  gap: 8px;
  padding: 10px 14px;
}

@media (max-width: 1100px) and (min-width: 761px) {
  .cashier-grid,
  .material-management-layout,
  .approval-template-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .org-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .panel-title {
    min-height: 52px;
    padding: 11px 14px;
  }

  .panel-title strong {
    font-size: 14px;
  }

  .panel-title :is(.table-action, button) {
    min-height: 40px;
  }

  .panel-body {
    padding: 14px;
  }

  .context-grid,
  .cashier-grid,
  .finance-detail-grid,
  .material-management-layout,
  .approval-template-layout {
    grid-template-columns: 1fr;
  }

  .context-grid > div {
    min-height: 58px;
    padding: 10px 12px;
  }

  .form-section-label,
  .flow-section-title {
    min-height: 38px;
    padding-inline: 14px;
  }

  .erp-main :is(
    .data-table,
    .workbench-project-table,
    .payroll-table,
    .org-directory-table,
    .org-editor-table,
    .schedule-editor-table,
    .line-item-table,
    .template-attachment-table,
    .construction-log-summary-table
  ) {
    font-size: 13px;
  }

  .erp-main :is(
    .data-table,
    .workbench-project-table,
    .payroll-table,
    .org-directory-table,
    .org-editor-table,
    .schedule-editor-table,
    .line-item-table,
    .template-attachment-table,
    .construction-log-summary-table
  ) :is(th, td) {
    padding: 9px 10px;
  }

  .cashier-form,
  .construction-log-form,
  .construction-log-calendar,
  .material-movement-entry,
  .material-inventory-section {
    padding: 12px;
  }

  .schedule-editor,
  .construction-log-layout,
  .material-management-layout {
    padding: 12px;
  }

  .template-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .template-card {
    min-height: 0;
  }

  .template-document-layout {
    gap: 10px;
    padding: 10px;
  }

  .template-required-list,
  .template-editor-grid {
    padding: 6px;
  }

  .flow-record-preview-main {
    padding: 12px;
  }

  .flow-approval-content-section,
  .flow-approval-focus,
  .flow-approval-context-strip,
  .flow-approval-account-brief,
  .flow-approval-system-checks {
    margin-bottom: 10px;
  }

  .flow-approval-workbench {
    margin: 0;
    padding: 10px;
  }

  .global-overlay-root .dashboard-preview-body,
  .global-overlay-root .dashboard-preview-table {
    padding: 12px;
  }
}

/* macOS productivity refinement 2026-08-16 */
:root {
  --ui-sidebar-width: 216px;
  --ui-header-height: 58px;
  --ui-content-max: 1480px;
  --macos-window: #f5f5f7;
  --macos-surface: #ffffff;
  --macos-surface-raised: #ffffff;
  --macos-sidebar: #f0f0f3;
  --macos-separator: rgba(60, 60, 67, 0.18);
  --macos-separator-soft: rgba(60, 60, 67, 0.1);
  --macos-control: rgba(118, 118, 128, 0.1);
  --macos-control-hover: rgba(118, 118, 128, 0.16);
  --macos-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 12px rgba(15, 23, 42, 0.045);
  --macos-window-shadow: 0 12px 28px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* The application is a work tool; the old decorative canvas must not compete with tasks. */
.login-tech-canvas,
.app-tech-canvas {
  display: none !important;
}

html,
body {
  background: var(--macos-window);
}

body {
  color: var(--macos-label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Login window: quiet, centered, and recognizable as an application entry point. */
.login-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  color: var(--macos-label);
  background: var(--macos-window);
}

.login-gate-card {
  position: relative;
  width: min(100%, 430px);
  min-height: 0;
  display: grid;
  gap: 20px;
  padding: 34px 32px 30px;
  border: 1px solid var(--macos-separator);
  border-radius: 8px;
  background: var(--macos-surface);
  box-shadow: var(--macos-window-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.login-gate-brand {
  display: grid;
  justify-items: center;
  margin: 0;
  padding: 8px 48px 0;
  text-align: center;
}

.login-brand-heading {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.login-gate-brand img {
  width: 64px;
  height: 58px;
  object-fit: contain;
  filter: none;
}

.login-gate-brand strong,
.login-gate-brand span {
  display: block;
}

.login-gate-brand strong {
  color: var(--macos-label);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.login-gate-brand span,
.login-gate-quote {
  color: var(--macos-label-secondary);
}

.login-gate-quote {
  display: none;
}

.login-mode-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--macos-label-secondary);
  background: var(--macos-control);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}

.login-mode-toggle:hover,
.login-mode-toggle:focus-visible {
  border-color: var(--macos-separator);
  color: var(--macos-label);
  background: var(--macos-control-hover);
}

.login-mode-toggle span {
  width: 8px;
  height: 8px;
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.login-mode-panel {
  min-width: 0;
}

.admin-login-form {
  display: grid;
  gap: 14px;
}

.admin-login-form label {
  display: grid;
  gap: 6px;
  color: var(--macos-label);
  font-size: 13px;
  font-weight: 600;
}

.admin-login-form input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--macos-separator);
  border-radius: 7px;
  color: var(--macos-label);
  background: #f7f7f9;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
  font-size: 14px;
}

.admin-login-form input:hover {
  border-color: rgba(60, 60, 67, 0.3);
  background: #ffffff;
}

.admin-login-form input:focus {
  border-color: var(--macos-accent);
  outline: 0;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16);
}

.login-account-submit,
.login-gate-dingtalk .table-action.primary {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--macos-accent);
  border-radius: 7px;
  color: #ffffff;
  background: var(--macos-accent);
  box-shadow: 0 1px 2px rgba(0, 84, 180, 0.18);
  font-size: 14px;
  font-weight: 650;
}

.login-account-submit:hover,
.login-gate-dingtalk .table-action.primary:hover {
  border-color: var(--macos-accent-strong);
  background: var(--macos-accent-strong);
}

.login-gate-dingtalk {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.login-gate-dingtalk > span {
  color: var(--macos-label-secondary);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.login-gate-ding-qr {
  width: 276px;
  min-height: 276px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--macos-separator);
  border-radius: 7px;
  background: #ffffff;
}

.login-gate-ding-qr iframe {
  display: block;
  margin: 0 auto;
}

.login-gate-qr-loading {
  min-height: 276px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  padding: 22px;
  color: var(--macos-label-secondary);
  font-size: 13px;
  text-align: center;
}

.login-gate-qr-loading.is-error {
  color: #b00020;
  background: #fafafd;
}

#login-gate-message {
  min-height: 18px;
  margin: -4px 0 0;
  color: #b00020;
  font-size: 12px;
  text-align: center;
}

/* Desktop shell: one quiet toolbar, one readable sidebar, one stable content canvas. */
.erp-shell {
  min-height: 100dvh;
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--ui-header-height) minmax(0, 1fr);
  background: var(--macos-window);
}

.app-header {
  height: var(--ui-header-height);
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  border-bottom: 1px solid var(--macos-separator);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.78);
}

.app-header-brand {
  padding: 0 14px;
  border-right: 1px solid var(--macos-separator);
  background: var(--macos-sidebar);
}

.app-header-brand .brand {
  gap: 9px;
}

.app-header-brand .brand img {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  filter: none;
}

.app-header-brand .brand strong {
  color: var(--macos-label);
  font-size: 15px;
  font-weight: 650;
}

.app-header-workspace {
  padding: 0 20px;
}

.app-header .topbar.is-compact {
  min-height: 42px;
  grid-template-columns: minmax(280px, 620px) auto;
  gap: 18px;
}

.app-header .global-search input {
  height: 34px;
  min-height: 34px;
  padding-inline: 34px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--macos-label);
  background: var(--macos-control);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
  font-size: 13px;
}

.app-header .global-search input:hover {
  border-color: var(--macos-separator);
  background: var(--macos-control-hover);
}

.app-header .global-search input:focus {
  border-color: var(--macos-accent);
  outline: 0;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16);
}

.topbar-actions {
  gap: 8px;
}

.cloud-sync-status {
  width: 26px;
  height: 26px;
  min-height: 26px;
}

.cloud-sync-status::before {
  width: 7px;
  height: 7px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--macos-separator);
}

.user-name-button.user-avatar-button,
.app-header .topbar.is-compact .topbar-actions .user-name-button.user-avatar-button {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--macos-separator);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-name-button.user-avatar-button:hover,
.user-name-button.user-avatar-button[aria-expanded="true"] {
  border-color: rgba(10, 132, 255, 0.32);
  background: var(--macos-accent-soft);
}

.user-toolbar-avatar {
  width: 30px;
  height: 30px;
  border-color: var(--macos-separator);
  background: var(--macos-accent);
  font-size: 13px;
}

.erp-sidebar,
.erp-shell > .erp-sidebar {
  width: var(--ui-sidebar-width);
  height: calc(100dvh - var(--ui-header-height));
  top: var(--ui-header-height);
  padding: 14px 10px 24px;
  border-right: 1px solid var(--macos-separator);
  color: var(--macos-label);
  background: var(--macos-sidebar);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.56);
  scrollbar-color: rgba(60, 60, 67, 0.22) transparent;
}

.module-nav.ui-system-v2 {
  gap: 10px;
}

.erp-sidebar .module-nav-group {
  gap: 2px;
  padding-bottom: 10px;
  border-bottom-color: var(--macos-separator-soft);
}

.erp-sidebar .module-nav-title {
  padding: 4px 10px 5px;
  color: var(--macos-label-tertiary);
  font-size: 10px;
  font-weight: 650;
}

.erp-sidebar .module-nav button,
.erp-sidebar .module-subnav button {
  min-height: 35px;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #3a3a3c;
  background: transparent;
  font-size: 13px;
  font-weight: 550;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.erp-sidebar .module-nav button:hover,
.erp-sidebar .module-subnav button:hover {
  color: var(--macos-label);
  background: var(--macos-control);
}

.erp-sidebar .module-nav button[aria-current="page"] {
  border-color: rgba(10, 132, 255, 0.12);
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36), 0 1px 2px rgba(10, 132, 255, 0.06);
  font-weight: 650;
}

.erp-sidebar .module-nav button[aria-current="page"]::before,
.erp-sidebar .module-nav button[aria-current="page"] .module-nav-chevron {
  color: var(--macos-accent);
  opacity: 1;
}

.erp-sidebar .module-subnav {
  margin-left: 19px;
  padding: 2px 0 2px 9px;
  border-left-color: var(--macos-separator);
}

.erp-sidebar .module-subnav button {
  min-height: 31px;
  color: var(--macos-label-secondary);
  font-size: 12px;
}

/* Stable content geometry keeps ultra-wide displays from stretching business forms. */
.erp-main {
  width: 100%;
  max-width: var(--ui-content-max);
  min-width: 0;
  margin-inline: auto;
  padding: 24px 28px 40px;
  color: var(--macos-label);
  background: var(--macos-window);
}

.view-root {
  width: 100%;
  max-width: 1380px;
  margin-inline: auto;
  gap: 16px;
  color: var(--macos-label);
}

.view-semantic-title,
.workspace-page-head,
.workbench-heading {
  min-height: 52px;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--macos-separator);
  background: transparent;
}

.view-semantic-title h1,
.workspace-page-head h1,
.workbench-heading h1 {
  color: var(--macos-label);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
}

.view-semantic-title :is(p, span, small),
.workspace-page-head :is(p, span, small),
.workbench-heading :is(p, span, small) {
  color: var(--macos-label-secondary);
}

:is(
  .workbench-task-center,
  .workbench-flow-status-bar,
  .workbench-recent-activity,
  .workbench-project-overview,
  .dashboard-executive,
  .dashboard-chart-panel,
  .dashboard-detail-drawer,
  .panel,
  .data-table-shell,
  .business-ledger,
  .context-panel,
  .flow-summary-panel,
  .context-grid,
  .settings-panel
) {
  border: 1px solid var(--macos-separator);
  border-radius: 8px;
  background: var(--macos-surface);
  box-shadow: var(--macos-shadow);
}

:is(.workbench-task-center, .workbench-flow-status-bar, .workbench-recent-activity, .workbench-project-overview) {
  overflow: hidden;
}

.panel-title,
.workbench-next-action-head,
.workbench-flow-status-intro,
.workbench-section-head,
.dashboard-command,
.dashboard-panel-head {
  border-bottom-color: var(--macos-separator-soft);
  background: #fafafd;
}

.panel-title strong,
.workbench-next-action-head h2,
.workbench-flow-status-intro strong,
.workbench-section-head h2,
.dashboard-command-main h2,
.dashboard-panel-head h2 {
  color: var(--macos-label);
  font-weight: 650;
}

.panel-title :is(span, small),
.workbench-next-action-head :is(p, span, small),
.workbench-flow-status-intro small,
.dashboard-command-main :is(small, span),
.dashboard-panel-head span {
  color: var(--macos-label-secondary);
}

/* Consistent controls: compact enough for desktop, still tappable on mobile. */
:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
) {
  border-color: var(--macos-separator);
  border-radius: 7px;
  color: var(--macos-label);
  background: #ffffff;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
):hover:not(:disabled):not([readonly]) {
  border-color: rgba(60, 60, 67, 0.32);
}

:is(.view-root, #erp-flow-launch-dialog, .global-overlay-root) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
):focus {
  border-color: var(--macos-accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16);
}

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

.form-grid,
.flow-form .form-grid {
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 14px 16px;
  padding: 18px 20px 22px;
  background: var(--macos-surface);
}

.form-grid label > span,
.flow-form .form-grid label > span,
.schedule-editor-toolbar label,
.material-movement-form label > span {
  color: var(--macos-label);
  font-size: 12px;
  font-weight: 650;
}

.form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid select,
.flow-form .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.flow-form .form-grid select,
.material-movement-form input:not([type="radio"]):not([type="file"]),
.material-movement-form select,
.org-directory-table input,
.org-directory-table select {
  height: 36px;
  min-height: 36px;
  font-size: 13px;
}

.form-grid textarea,
.flow-form .form-grid textarea,
.material-movement-form textarea {
  min-height: 78px;
  font-size: 13px;
}

.form-section-label {
  min-height: 36px;
  margin: 8px -20px 0;
  padding: 7px 20px;
  border-top: 1px solid var(--macos-separator);
  border-bottom: 1px solid var(--macos-separator-soft);
  color: var(--macos-label);
  background: #fafafd;
  font-size: 13px;
  font-weight: 700;
}

.line-table-head {
  min-height: 40px;
  padding: 7px 10px;
  border-bottom-color: var(--macos-separator);
  background: #fafafd;
}

.line-table-head > span {
  color: var(--macos-label);
  font-size: 12px;
  font-weight: 650;
}

.form-actions,
.bottom-actions {
  min-height: 56px;
  padding: 9px 16px;
  border-top-color: var(--macos-separator);
  background: rgba(250, 250, 252, 0.96);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  backdrop-filter: blur(16px) saturate(1.08);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 -5px 12px rgba(15, 23, 42, 0.035);
}

.table-action,
.form-actions button,
.workbench-secondary-action,
.workbench-primary-action {
  min-height: 36px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.table-action:not(.primary):not(.danger),
.form-actions button:not(#submit-flow),
.workbench-secondary-action {
  border-color: var(--macos-separator);
  color: var(--macos-label);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

.table-action:not(.primary):not(.danger):hover,
.form-actions button:not(#submit-flow):hover,
.workbench-secondary-action:hover {
  border-color: rgba(60, 60, 67, 0.3);
  background: #fafafd;
}

.table-action.primary,
.form-actions #submit-flow:not(:disabled),
.workbench-primary-action,
.bottom-actions .primary {
  border-color: var(--macos-accent);
  color: #ffffff;
  background: var(--macos-accent);
  box-shadow: 0 1px 2px rgba(0, 84, 180, 0.18);
}

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

/* Workbench: task first, status second, history last. */
.workbench-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workbench-task-center {
  box-shadow: var(--macos-shadow);
}

.workbench-next-action-head {
  min-height: 54px;
  padding: 10px 16px;
}

.workbench-next-action-list {
  gap: 0 20px;
  padding: 0 16px 8px;
}

.workbench-next-action-list > button {
  min-height: 62px;
  padding: 8px 0;
  border-bottom-color: var(--macos-separator-soft);
}

.workbench-next-action-list > button:hover,
.workbench-next-action-list > button:focus-visible {
  color: var(--macos-label);
  background: var(--macos-accent-soft);
}

.workbench-next-action-mark,
.workbench-next-action-check {
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
}

.workbench-flow-status-bar {
  min-height: 76px;
  border-block: 0;
}

.workbench-flow-status-intro {
  padding-inline: 16px;
  border-right-color: var(--macos-separator-soft);
}

.workbench-flow-status-button:is(:hover, :focus-visible) {
  color: var(--macos-label);
  background: var(--macos-control);
}

.workbench-flow-status-button:is(.is-active, [aria-pressed="true"]) {
  border-color: rgba(10, 132, 255, 0.16);
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
}

.workbench-section-head {
  min-height: 48px;
  padding: 8px 16px;
}

.workbench-flow-list {
  padding: 0 16px 2px;
}

/* Dashboard: simple system surfaces make the charts do the explaining. */
.dashboard-executive,
.dashboard-chart-panel,
.dashboard-detail-drawer {
  box-shadow: var(--macos-shadow);
}

.dashboard-command,
.dashboard-panel-head {
  padding: 12px 16px;
}

.dashboard-command-main h2,
.dashboard-panel-head h2 {
  font-size: 15px;
}

.dashboard-project-picker.compact {
  width: 198px;
  height: 34px;
}

.dashboard-project-picker.compact select {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--macos-label);
  background: var(--macos-control);
}

.dashboard-project-picker.compact select:hover,
.dashboard-project-picker.compact select:focus {
  border-color: rgba(10, 132, 255, 0.28);
  background: #ffffff;
}

.dashboard-filter-trigger {
  right: 12px;
  width: 8px;
  height: 8px;
  border-color: var(--macos-label-secondary);
}

.boss-kpi-card {
  border-right-color: var(--macos-separator-soft);
  color: var(--macos-label-secondary);
  background: transparent;
}

.boss-kpi-card:is(:hover, :focus-visible) {
  background: var(--macos-accent-soft);
}

.boss-kpi-card strong {
  color: var(--macos-label);
  font-size: 23px;
  font-weight: 650;
}

.dashboard-chart-suite {
  gap: 14px;
}

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

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

.dashboard-comparison-bars {
  border-bottom-color: var(--macos-separator);
  background: #ffffff;
}

.dashboard-chart-bar > i {
  border-radius: 6px 6px 2px 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Tables read like Finder lists: clear columns, calm rows, stable numeric alignment. */
.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) {
  border-collapse: separate;
  border-spacing: 0;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--macos-separator);
  color: var(--macos-label-secondary);
  background: #f7f7f9;
  font-size: 11px;
  font-weight: 650;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody td {
  min-height: 44px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--macos-separator-soft);
  color: var(--macos-label);
  background: #ffffff;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table, .org-directory-table) tbody tr:is(:hover, :focus-within) td {
  background: rgba(10, 132, 255, 0.045);
}

.erp-main :is(.data-table, .workbench-project-table) :is(td, th, .money) {
  font-variant-numeric: tabular-nums;
}

.status-pill {
  min-height: 23px;
  padding: 3px 8px;
  border-color: var(--macos-separator);
  border-radius: 999px;
  color: var(--macos-label-secondary);
  background: var(--macos-control);
}

/* Flow editor and approval inspector remain the same product, not a separate visual world. */
#erp-flow-launch-dialog {
  padding: 16px;
  background: rgba(29, 29, 31, 0.16);
  -webkit-backdrop-filter: blur(9px) saturate(0.96);
  backdrop-filter: blur(9px) saturate(0.96);
}

#erp-flow-launch-dialog > .erp-flow-launch-dialog-shell {
  width: min(1360px, calc(100vw - 32px));
  height: calc(100dvh - 32px);
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: var(--macos-surface-raised);
  box-shadow: var(--macos-window-shadow);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-head,
.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head {
  min-height: 52px;
  border-bottom-color: var(--macos-separator);
  background: #fafafd;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-head h2,
.flow-record-preview-panel.is-approval-mode > .flow-record-preview-head h2 {
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--macos-label-secondary);
  background: var(--macos-control);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-close:hover {
  color: var(--macos-label);
  background: var(--macos-control-hover);
}

#erp-flow-launch-dialog .erp-flow-launch-dialog-body,
.flow-record-preview-panel.is-approval-mode .flow-record-preview-main {
  background: var(--macos-window);
}

#erp-flow-launch-dialog .flow-document-head,
#erp-flow-launch-dialog .flow-form-progress,
#erp-flow-launch-dialog .flow-task-rail-card,
.flow-record-preview-panel.is-approval-mode .flow-approval-context-strip,
.flow-record-preview-panel.is-approval-mode .flow-approval-content-section,
.flow-record-preview-panel.is-approval-mode .flow-approval-focus {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button {
  color: var(--macos-label-secondary);
  background: transparent;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav button[aria-current="step"] {
  color: var(--macos-accent-strong);
  background: var(--macos-accent-soft);
  box-shadow: none;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  border-left-color: var(--macos-separator);
  background: #f0f0f3;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.62);
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > :is(section, label, .flow-approval-workbench-head) {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: #ffffff;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > .flow-approval-actions {
  border-top-color: var(--macos-separator);
  background: #fafafd;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Popovers and previews use one predictable system layer. */
:is(.user-menu-dropdown, .global-search-panel, .flow-template-tools-body, .org-module-dropdown-options) {
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
  box-shadow: var(--macos-window-shadow);
}

.global-search-item:is(:hover, :focus-visible, .is-keyboard-active) {
  color: var(--macos-label);
  background: var(--macos-accent-soft);
}

.app-header .user-menu-dropdown {
  width: 272px;
  border-color: var(--macos-separator);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--macos-window-shadow);
}

.app-header .user-menu-profile {
  min-height: 78px;
  padding: 14px;
  border-bottom-color: var(--macos-separator-soft);
}

.app-header .user-menu-profile strong {
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
}

.app-header .user-menu-profile :is(span, small) {
  color: var(--macos-label-secondary);
}

.app-header .user-menu-logout {
  min-height: 40px;
  color: #b00020;
  background: transparent;
}

.app-header .user-menu-logout:is(:hover, :focus-visible) {
  color: #8f001a;
  background: rgba(255, 59, 48, 0.08);
}

@media (min-width: 1440px) {
  .erp-main {
    padding-inline: 40px;
  }
}

@media (max-width: 1100px) and (min-width: 761px) {
  :root {
    --ui-sidebar-width: 196px;
  }

  .erp-main {
    padding-inline: 20px;
  }

  .form-grid,
  .flow-form .form-grid {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --ui-header-height: 56px;
  }

  .login-gate {
    padding: 18px 14px;
  }

  .login-gate-card {
    width: min(100%, 410px);
    padding: 30px 18px 22px;
  }

  .login-gate-brand {
    padding-inline: 30px;
  }

  .login-gate-brand strong {
    font-size: 22px;
  }

  .login-mode-toggle {
    top: 12px;
    right: 12px;
  }

  .login-gate-ding-qr {
    width: min(276px, 100%);
  }

  .erp-shell {
    display: block;
    min-height: 100dvh;
  }

  .app-header {
    height: var(--ui-header-height);
    position: sticky;
    top: 0;
    grid-template-columns: 1fr;
  }

  .app-header-brand {
    display: none;
  }

  .app-header-workspace {
    padding: 0 12px;
  }

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

  .app-header .global-search input {
    height: 36px;
    min-height: 36px;
    font-size: 14px;
  }

  .erp-sidebar,
  .erp-shell > .erp-sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-sticky);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--macos-separator);
    border-right: 0;
    background: rgba(250, 250, 252, 0.97);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
    backdrop-filter: blur(18px) saturate(1.08);
    box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.08);
  }

  .erp-sidebar .module-nav.ui-system-v2 {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 3px;
    overflow: visible;
  }

  .erp-sidebar .module-nav-group {
    display: contents;
    border: 0;
  }

  .erp-sidebar .module-nav-title,
  .erp-sidebar .module-subnav {
    display: none;
  }

  .erp-sidebar .module-nav button[data-mobile-primary],
  .erp-sidebar .module-nav #mobile-more-toggle {
    width: auto;
    min-width: 0;
    min-height: 44px;
    flex: 1 1 0;
    display: grid;
    grid-template-rows: 16px minmax(0, 1fr);
    justify-items: center;
    align-content: center;
    gap: 2px;
    padding: 5px 4px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--macos-label-secondary);
    background: transparent;
    font-size: 10px;
    text-align: center;
  }

  .erp-sidebar .module-nav button[data-mobile-primary]::before,
  .erp-sidebar .module-nav #mobile-more-toggle::before {
    width: 16px;
    height: 16px;
    margin: 0;
    color: currentColor;
    background-color: currentColor;
    opacity: 0.82;
  }

  .erp-sidebar .module-nav button[data-mobile-primary][aria-current="page"] {
    border-color: transparent;
    color: var(--macos-accent-strong);
    background: var(--macos-accent-soft);
    box-shadow: none;
  }

  .erp-sidebar .module-nav.ui-system-v2.is-mobile-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--macos-separator);
    border-radius: 8px;
    background: rgba(250, 250, 252, 0.99);
    box-shadow: var(--macos-window-shadow);
  }

  .erp-sidebar .module-nav.is-mobile-open button[data-view] {
    min-height: 42px;
    display: flex;
    grid-template-rows: none;
    justify-items: initial;
    gap: 8px;
    padding: 8px 10px;
    color: var(--macos-label);
    background: var(--macos-control);
    text-align: left;
  }

  .erp-sidebar .module-nav.is-mobile-open button[data-view]::before {
    margin: 0;
  }

  .erp-sidebar .module-nav.is-mobile-open button[data-view][aria-current="page"] {
    color: var(--macos-accent-strong);
    background: var(--macos-accent-soft);
  }

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

  .view-root {
    gap: 12px;
  }

  .view-semantic-title,
  .workspace-page-head,
  .workbench-heading {
    min-height: 48px;
    padding-bottom: 10px;
  }

  .view-semantic-title h1,
  .workspace-page-head h1,
  .workbench-heading h1 {
    font-size: 19px;
  }

  :is(.workbench-task-center, .workbench-flow-status-bar, .workbench-recent-activity, .workbench-project-overview, .dashboard-executive, .dashboard-chart-panel, .panel, .data-table-shell, .business-ledger, .context-panel, .flow-summary-panel, .context-grid, .settings-panel) {
    border-radius: 7px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.045);
  }

  .form-grid,
  .flow-form .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 14px 18px;
  }

  .form-section-label {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .form-grid select,
  .flow-form .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .flow-form .form-grid select,
  .material-movement-form input:not([type="radio"]):not([type="file"]),
  .material-movement-form select {
    height: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  .form-grid textarea,
  .flow-form .form-grid textarea,
  .material-movement-form textarea {
    min-height: 96px;
    font-size: 14px;
  }

  .workbench-heading {
    align-items: start;
  }

  .workbench-next-action-list {
    grid-template-columns: 1fr;
    padding-inline: 12px;
  }

  .workbench-flow-status-bar {
    grid-template-columns: 1fr;
  }

  .workbench-flow-status-intro {
    min-height: 54px;
    border-right: 0;
    border-bottom: 1px solid var(--macos-separator-soft);
  }

  .workbench-flow-status-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-project-picker.compact {
    width: 164px;
  }

  .dashboard-chart-panel {
    min-height: 0;
  }

  #erp-flow-launch-dialog {
    width: 100vw;
    height: 100dvh;
    padding: 0;
    background: var(--macos-surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

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

  #erp-flow-launch-dialog .erp-flow-launch-dialog-head {
    min-height: calc(56px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: rgba(255, 255, 255, 0.97);
  }

  .form-actions,
  .bottom-actions {
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }
}

@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;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .app-header,
  .erp-sidebar,
  .form-actions,
  .bottom-actions,
  :is(.user-menu-dropdown, .global-search-panel, .flow-template-tools-body, .org-module-dropdown-options) {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  #erp-flow-launch-dialog {
    background: rgba(29, 29, 31, 0.24);
  }
}

/* macOS module layout authority 2026-08-16 */
:root {
  --module-label-size: 12px;
  --module-text-size: 13px;
  --module-caption-size: 11px;
  --module-control-height: 36px;
  --module-touch-height: 44px;
  --module-section-gap: 16px;
  --module-panel-padding: 16px;
  --module-row-height: 44px;
}

/* Keep the reading column stable on wide displays and give each page one clear rhythm. */
.erp-main {
  max-width: var(--ui-content-max);
  min-width: 0;
  padding: 28px 32px 44px;
}

.view-root {
  min-width: 0;
  max-width: 1380px;
  gap: 18px;
}

.view-root > * {
  min-width: 0;
}

.view-root > :is(.view-semantic-title, .workspace-page-head, .workbench-heading) {
  min-height: 58px;
  padding: 0 2px 14px;
  align-items: end;
}

.view-root > :is(.view-semantic-title, .workspace-page-head, .workbench-heading) h1 {
  margin: 0;
  color: var(--macos-label);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0;
  text-wrap: balance;
}

.view-root > :is(.view-semantic-title, .workspace-page-head, .workbench-heading) :is(p, span, small) {
  line-height: 1.45;
}

/* Panels use one border, one soft shadow, and one consistent title-to-body interval. */
.view-root :is(
  .panel,
  .workbench-task-center,
  .workbench-flow-status-bar,
  .workbench-recent-activity,
  .workbench-project-overview,
  .dashboard-executive,
  .dashboard-chart-panel,
  .dashboard-detail-drawer,
  .data-table-shell,
  .business-ledger,
  .context-panel,
  .flow-summary-panel,
  .settings-panel
) {
  min-width: 0;
  border-radius: 9px;
  box-shadow: var(--macos-shadow);
}

.view-root :is(.panel, .data-table-shell, .business-ledger, .context-panel, .settings-panel) {
  overflow: visible;
}

.view-root :is(.workbench-task-center, .workbench-flow-status-bar, .workbench-recent-activity, .workbench-project-overview) {
  overflow: hidden;
}

.panel-title,
.workbench-next-action-head,
.workbench-flow-status-intro,
.workbench-section-head,
.dashboard-command,
.dashboard-panel-head {
  min-height: 48px;
  padding: 11px var(--module-panel-padding);
  gap: 12px;
}

.panel-title > div,
.dashboard-command-main,
.dashboard-panel-head > div,
.workbench-next-action-head > div,
.workbench-section-head > div {
  min-width: 0;
}

.panel-title strong,
.workbench-next-action-head h2,
.workbench-flow-status-intro strong,
.workbench-section-head h2,
.dashboard-command-main h2,
.dashboard-panel-head h2 {
  margin: 0;
  color: var(--macos-label);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.panel-title :is(span, small),
.workbench-next-action-head :is(p, span, small),
.workbench-flow-status-intro small,
.workbench-section-head :is(p, span, small),
.dashboard-command-main :is(small, span),
.dashboard-panel-head span {
  color: var(--macos-label-secondary);
  font-size: var(--module-caption-size);
  line-height: 1.45;
}

.panel-body {
  min-width: 0;
  padding: var(--module-panel-padding);
}

/* Form rhythm: label, control, and helper copy stay close; sections provide the visual break. */
.form-grid,
.flow-form .form-grid,
.cashier-form .form-grid,
.material-movement-form,
.construction-log-form .form-grid,
.schedule-editor-toolbar,
.enterprise-profile-form .form-grid,
.finance-account-row .form-grid.compact {
  gap: 14px 16px;
}

.form-grid > label,
.flow-form .form-grid > label,
.cashier-form .form-grid > label,
.material-movement-form > label,
.construction-log-form .form-grid > label,
.schedule-editor-toolbar label,
.enterprise-profile-form .form-grid > label,
.finance-account-row .form-grid.compact > label {
  min-width: 0;
  gap: 5px;
}

.form-grid label > span,
.flow-form .form-grid label > span,
.cashier-form label > span,
.material-movement-form label > span,
.construction-log-form label > span,
.schedule-editor-toolbar label > span,
.enterprise-profile-form label > span,
.finance-account-row label > span {
  min-height: 17px;
  color: var(--macos-label);
  font-size: var(--module-label-size);
  font-weight: 650;
  line-height: 1.4;
}

.view-root :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
),
#erp-flow-launch-dialog :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
) {
  font-size: var(--module-text-size);
  line-height: 1.4;
}

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

.view-root textarea,
#erp-flow-launch-dialog textarea {
  min-height: 78px;
  padding: 8px 10px;
}

.form-section-label,
.flow-section-title {
  min-height: 36px;
  margin-block-start: 8px;
  padding: 8px 16px;
  color: var(--macos-label);
  background: #fafafd;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

/* Tables are information surfaces, not decorative cards. Preserve scan width and numeric alignment. */
.erp-main :is(
  .data-table,
  .workbench-project-table,
  .payroll-table,
  .org-directory-table,
  .org-editor-table,
  .schedule-editor-table,
  .line-item-table,
  .template-attachment-table,
  .construction-log-summary-table
) {
  font-size: 12px;
  line-height: 1.45;
}

.erp-main :is(
  .data-table,
  .workbench-project-table,
  .payroll-table,
  .org-directory-table,
  .org-editor-table,
  .schedule-editor-table,
  .line-item-table,
  .template-attachment-table,
  .construction-log-summary-table
) :is(th, td) {
  padding: 8px 10px;
  line-height: 1.45;
  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,
  .template-attachment-table,
  .construction-log-summary-table
) thead th {
  height: 38px;
  color: var(--macos-label-secondary);
  font-size: 11px;
  font-weight: 650;
}

.erp-main :is(.data-table, .workbench-project-table, .payroll-table) :is(.amount, .money, .is-money) {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.erp-main :is(.data-table, .workbench-project-table) td > :is(button, a, input, select) {
  max-width: 100%;
}

/* Workbench: the daily entry point gets enough hierarchy without growing into a dashboard. */
.workbench-heading {
  min-height: 58px;
}

.workbench-task-center,
.workbench-flow-status-bar,
.workbench-recent-activity,
.workbench-project-overview {
  min-width: 0;
}

.workbench-next-action-head {
  min-height: 52px;
}

.workbench-next-action-list,
.workbench-recent-list,
.workbench-flow-status-groups {
  min-width: 0;
  gap: 0;
}

.workbench-next-action-list > button,
.workbench-recent-list > button {
  min-width: 0;
  min-height: 60px;
  padding: 9px 0;
}

.workbench-flow-status-bar {
  min-height: 72px;
}

.workbench-flow-status-button {
  min-width: 0;
  min-height: 56px;
  padding: 8px 12px;
}

/* Dashboard: one command strip, then charts; empty states remain compact and actionable. */
.dashboard-command,
.dashboard-panel-head {
  min-width: 0;
}

.dashboard-command-main h2,
.dashboard-panel-head h2 {
  font-size: 15px;
}

.dashboard-project-picker.compact {
  width: 196px;
  max-width: 100%;
}

.dashboard-chart-suite {
  min-width: 0;
  gap: 16px;
}

.dashboard-chart-panel {
  min-width: 0;
  min-height: 300px;
}

.dashboard-empty-workspace {
  min-height: 150px;
  padding: 20px;
}

/* Feature modules keep a predictable two-column working geometry on desktop. */
.cashier-grid,
.finance-detail-grid,
.material-management-layout,
.approval-template-layout,
.construction-log-layout {
  min-width: 0;
  gap: var(--module-section-gap);
}

.cashier-form,
.cashier-empty-workspace,
.cashier-type-list,
.cashier-type-grid,
.cashier-summary-grid,
.material-movement-entry,
.material-inventory-section,
.construction-log-calendar,
.construction-log-form,
.approval-template-list,
.approval-template-editor,
.approval-tree-editor,
.template-document-viewer,
.template-required-sidebar,
.template-editor-fields {
  min-width: 0;
}

.cashier-form,
.construction-log-calendar,
.construction-log-form,
.material-movement-entry,
.material-inventory-section {
  padding: var(--module-panel-padding);
}

.schedule-editor,
.construction-log-layout,
.material-management-layout,
.template-grid {
  padding: var(--module-panel-padding);
}

.schedule-editor-toolbar {
  gap: 12px;
  padding: 12px;
}

.org-module-grid,
.org-role-list,
.org-table-wrap,
.approval-template-layout,
.template-grid {
  gap: 12px;
}

.approval-template-list-head,
.approval-tree-head,
.template-editor-fields-head,
.template-required-head {
  min-height: 44px;
  padding: 10px 12px;
}

.approval-assignment-row,
.approval-tree-step,
.approval-tree-node,
.org-role-row {
  min-width: 0;
  gap: 8px;
  padding: 10px;
}

/* Contract template navigation and document preview remain usable when the document is long. */
.template-document-layout {
  min-width: 0;
  gap: 14px;
  padding: 14px;
}

.template-required-sidebar,
.template-document-viewer,
.template-editor-fields {
  overflow: hidden;
}

.template-required-list,
.template-editor-grid {
  min-width: 0;
  padding: 8px;
}

/* Fixed bars must never cover the last editable row or approval action. */
.form-actions,
.bottom-actions {
  min-height: 58px;
  padding: 10px 16px;
  z-index: var(--z-sticky);
}

#erp-flow-launch-dialog .flow-form,
.flow-record-preview-panel {
  min-width: 0;
}

#erp-flow-launch-dialog .flow-document-head,
#erp-flow-launch-dialog .flow-form-progress,
#erp-flow-launch-dialog .flow-task-rail-card,
.flow-record-preview-panel.is-approval-mode :is(.flow-approval-context-strip, .flow-approval-content-section, .flow-approval-focus),
.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  min-width: 0;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
  gap: 12px;
  padding: 14px;
}

.flow-record-preview-panel.is-approval-mode .flow-approval-workbench > :is(section, label, .flow-approval-workbench-head) {
  padding: 10px 12px;
}

/* Portalled organization pickers keep their own scroll area and never inherit panel clipping. */
.org-module-dropdown-options.is-floating-open {
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - 24px));
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.org-module-dropdown-options.is-floating-open > label {
  min-height: 36px;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.org-module-dropdown-options.is-floating-open > label:is(:hover, :focus-within) {
  background: var(--macos-accent-soft);
}

/* Secondary guidance stays readable across frequently used business modules. */
.workbench-flow-status-group > span,
.template-step-strip > span,
.org-module-grid .metric-card > small {
  font-size: 11px;
  line-height: 1.45;
}

#erp-flow-launch-dialog :is(
  .flow-template-tools-body > label > span,
  #flow-section-nav button,
  #flow-section-nav button small,
  .flow-section-incomplete-count,
  .flow-attachment-checklist small,
  .flow-task-rail-card > header span,
  .flow-task-rail-card > header small,
  .flow-task-rail-note,
  .flow-task-rail-checks li,
  #flow-task-approval-route li
) {
  font-size: 11px;
  line-height: 1.45;
}

#erp-flow-launch-dialog .flow-form-progress #flow-section-nav small {
  font-size: 11px;
  line-height: 1.45;
}

#erp-flow-launch-dialog :is(.flow-task-rail-checks, #flow-task-approval-route) li > i {
  font-size: 10px;
}

#erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
  scroll-padding-bottom: 88px;
}

@media (min-width: 1440px) {
  .erp-main {
    padding-inline: 40px;
  }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .erp-main {
    padding-inline: 20px;
  }

  .form-grid,
  .flow-form .form-grid {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }

  .cashier-grid,
  .finance-detail-grid,
  .material-management-layout,
  .approval-template-layout,
  .construction-log-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .erp-main {
    padding: 16px 12px calc(96px + env(safe-area-inset-bottom));
  }

  .view-root {
    gap: 12px;
  }

  .view-root > :is(.view-semantic-title, .workspace-page-head, .workbench-heading) {
    min-height: 50px;
    padding-bottom: 10px;
  }

  .view-root > :is(.view-semantic-title, .workspace-page-head, .workbench-heading) h1 {
    font-size: 19px;
  }

  .panel-title,
  .workbench-next-action-head,
  .workbench-flow-status-intro,
  .workbench-section-head,
  .dashboard-command,
  .dashboard-panel-head {
    min-height: 52px;
    padding: 11px 14px;
  }

  .panel-body {
    padding: 14px;
  }

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

  .view-root textarea,
  #erp-flow-launch-dialog textarea {
    min-height: 96px;
    font-size: 14px;
  }

  .form-grid,
  .flow-form .form-grid,
  .cashier-form .form-grid,
  .material-movement-form,
  .construction-log-form .form-grid,
  .enterprise-profile-form .form-grid,
  .finance-account-row .form-grid.compact {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .form-grid > label,
  .flow-form .form-grid > label,
  .cashier-form .form-grid > label,
  .material-movement-form > label,
  .construction-log-form .form-grid > label,
  .enterprise-profile-form .form-grid > label,
  .finance-account-row .form-grid.compact > label {
    width: 100%;
    max-width: none;
  }

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

  .workbench-flow-status-bar,
  .workbench-flow-status-groups {
    grid-template-columns: 1fr;
  }

  .workbench-flow-status-intro {
    border-right: 0;
    border-bottom: 1px solid var(--macos-separator-soft);
  }

  .workbench-flow-status-button {
    min-height: 48px;
  }

  .dashboard-project-picker.compact {
    width: 164px;
  }

  .dashboard-chart-suite,
  .cashier-grid,
  .finance-detail-grid,
  .material-management-layout,
  .approval-template-layout,
  .construction-log-layout,
  .template-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-chart-panel {
    min-height: 0;
  }

  .erp-main :is(
    .data-table,
    .workbench-project-table,
    .payroll-table,
    .org-directory-table,
    .org-editor-table,
    .schedule-editor-table,
    .line-item-table,
    .template-attachment-table,
    .construction-log-summary-table
  ) {
    font-size: 13px;
  }

  .erp-main :is(
    .data-table,
    .workbench-project-table,
    .payroll-table,
    .org-directory-table,
    .org-editor-table,
    .schedule-editor-table,
    .line-item-table,
    .template-attachment-table,
    .construction-log-summary-table
  ) :is(th, td) {
    padding: 9px 10px;
  }

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

  #erp-flow-launch-dialog:not(.is-picker) .erp-flow-launch-dialog-body.is-form {
    scroll-padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

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

  .flow-record-preview-panel.is-approval-mode .flow-approval-workbench {
    margin: 0;
    padding: 10px;
  }

  .template-document-layout {
    gap: 10px;
    padding: 10px;
  }

  .template-required-list,
  .template-editor-grid {
    padding: 6px;
  }
}

/* Pre-launch form sizing final authority. */
#change-order-form .change-order-form-grid,
.enterprise-profile-form .form-grid {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

#change-order-form .change-order-form-grid > label,
.enterprise-profile-form .form-grid > label {
  width: 100%;
  max-width: none;
}

#change-order-form .change-order-form-grid > label.field-wide,
.enterprise-profile-form .form-grid > label.field-wide {
  grid-column: span 2;
  width: 100%;
  max-width: none;
}

#change-order-form .change-order-form-grid > .change-order-attachment-control {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
}

@media (max-width: 1060px) and (min-width: 761px) {
  #change-order-form .change-order-form-grid,
  .enterprise-profile-form .form-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  #change-order-form .change-order-form-grid,
  .enterprise-profile-form .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #change-order-form .change-order-form-grid > label.field-wide,
  .enterprise-profile-form .form-grid > label.field-wide {
    grid-column: 1;
  }
}
