/* Shared density pass: reduce wasted height while keeping labels readable. */
#appPage .accounting-panel {
  padding: 16px 18px;
  margin-block: 12px;
}

#appPage .section-heading {
  gap: 10px 14px;
  margin-bottom: 10px;
}

#appPage .section-heading h2,
#appPage .accounting-panel > h2 {
  margin-block: 0 4px;
  line-height: 1.35;
}

#appPage button.primary-button,
#appPage button.secondary-button,
#appPage button.module-toggle,
#appPage button.member-remove,
#appPage .module-actions > button {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.25;
}

#appPage .accounting-table-wrap {
  max-width: 100%;
  overflow: auto;
  border-radius: 9px;
}

#appPage .accounting-table th,
#appPage .accounting-table td {
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  vertical-align: middle;
}

#appPage .accounting-table th {
  font-weight: 600;
}

#appPage .accounting-table td small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
}

#appPage .accounting-table td button {
  min-height: 29px;
  padding: 4px 8px;
  font-size: 12px;
}

/* Do not truncate labels in dense rows; let the table scroll instead. */
#appPage .accounting-table td select {
  min-width: 150px;
  max-width: none;
  text-overflow: clip;
}
#appPage .accounting-table td button,
#appPage .document-actions button,
#appPage .document-revision-form button {
  min-width: max-content;
  max-width: 100%;
  height: auto;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}
.document-revision-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end !important;
  gap: 10px !important;
}
.document-revision-file-label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #666879;
  font-size: 11px;
  line-height: 1.45;
}
.document-revision-file-label input[type="file"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font: inherit;
  font-size: 12px;
}
@media (max-width: 560px) {
  .document-revision-form { grid-template-columns: minmax(0, 1fr); }
  .document-revision-form button { justify-self: start; }
}

#appPage .accounting-form {
  gap: 10px 12px;
}

#appPage .accounting-form label {
  gap: 5px;
  line-height: 1.4;
}

#appPage .accounting-form input:not([type="checkbox"]):not([type="radio"]),
#appPage .accounting-form select {
  min-height: 36px;
  padding: 6px 9px;
  font-size: 13px;
}

#appPage .accounting-form textarea {
  min-height: 68px;
  padding: 7px 9px;
  font-size: 13px;
}

#appPage .task-list-filters + .accounting-table-wrap .task-register-table th,
#appPage .task-list-filters + .accounting-table-wrap .task-register-table td {
  padding: 9px 9px;
}

#appPage .task-assignee-board {
  gap: 7px;
  margin-block: 9px;
}

#appPage .task-assignee-card {
  gap: 3px;
  padding: 8px 10px;
}

@media (max-width: 760px) {
  #appPage .accounting-panel {
    padding: 12px;
  }

  #appPage .accounting-table th,
  #appPage .accounting-table td {
    padding: 7px 8px;
  }
}

:root[data-theme="dark"] #appPage .accounting-panel {
  color: var(--text, #f0eff6);
}

/* Keep native dropdown text inside its control despite the global accessible type scale. */
/* Keep every in-app native select consistent, including dialogs mounted outside #appPage. */
body select:not(#landingLanguage) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  padding-block: 5px;
  /* In RTL native arrows sit at the left edge; reserve room so option text
     never collides with the arrow or the control border. */
  padding-inline: 10px 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: end;
  line-height: 1.3;
  font-size: 15px !important;
  font-family: "Alahmadi", Arial, "Noto Sans", "Microsoft YaHei UI", sans-serif !important;
  font-weight: 400 !important;
  vertical-align: middle;
}

body select:not(#landingLanguage) option {
  font-family: "Alahmadi", Arial, "Noto Sans", "Microsoft YaHei UI", sans-serif;
  font-size: 15px !important;
  font-weight: 400;
  line-height: 1.45;
  padding: 6px 9px;
  white-space: normal;
}

/* Keep compact filter selects compact; the native menu can show its full option labels. */
#appPage :is(.app-list-filters, .accounting-filters, .crm-toolbar,
  .service-request-filters, .order-case-filters, .shipment-registry-filters,
  .delivery-list-filters, .document-library-filters, .project-list-filters,
  .employee-directory-filter, .quality-inspection-filters,
  .translation-job-filters, .event-filter-controls) select {
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.3;
}

#appPage :is(.app-list-filters, .accounting-filters, .crm-toolbar,
  .service-request-filters, .order-case-filters, .shipment-registry-filters,
  .delivery-list-filters, .document-library-filters, .project-list-filters,
  .employee-directory-filter, .quality-inspection-filters,
  .translation-job-filters, .event-filter-controls) label {
  min-width: 0;
  line-height: 1.35 !important;
}

/* App styles set tiny select text in several workspaces. Keep every choice
   readable without changing the compact height or width of its filter. */
#appPage select:not(#landingLanguage),
.overlay select:not(#landingLanguage) {
  font-family: "Alahmadi", Arial, "Noto Sans", "Microsoft YaHei UI", sans-serif !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  line-height: 1.25 !important;
}

#appPage select:not(#landingLanguage) option,
.overlay select:not(#landingLanguage) option {
  font-family: "Alahmadi", Arial, "Noto Sans", "Microsoft YaHei UI", sans-serif !important;
  font-size: 15px !important;
  font-weight: 400 !important;
}

/* Selected workspace navigation always uses the purple primary action color. */
#appPage nav.workspace-section-tabs > button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
#appPage nav.accounting-tabs > button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
#appPage nav.employee-workspace-tabs > button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
#appPage nav.employee-recruitment-tabs > button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
#appPage nav.academy-tabs > button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
#appPage nav [role="tab"][aria-selected="true"]{background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Some workspace tab rows are mounted outside #appPage and/or omit a tab class.
   Treat selected buttons in the app navigation as tabs and keep them purple. */
body .app-shell nav button[aria-selected="true"],
body .app-shell nav button[aria-current="page"],
body .app-shell nav button[aria-pressed="true"],
body .app-shell nav button:is(.active,.selected){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Generic workspace tabs can be mounted outside a nav element. Keep their
   selected state on the same purple action color used by the Tasks control. */
body .app-shell :is([role="tab"],[class*="workspace-section-tab"],[class*="employee-workspace-tabs"] button,[class*="accounting-tabs"] button):is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"]){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Keep the selected workspace tab purple even when an app theme supplies a green active style. */
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab[aria-selected="true"],
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab[data-active-tab="true"],
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab[aria-current="page"],
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab.active,
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab.selected{background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Explicit selected-state hook for app section tabs (including inventory). */
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab.workspace-active-primary{background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* The inventory workspace tabs can be mounted outside #appPage in the
   production shell. Keep their selected state purple regardless of wrapper. */
html body nav.workspace-section-tabs > button.workspace-section-tab[aria-selected="true"],
html body nav.workspace-section-tabs > button.workspace-section-tab[data-active-tab="true"],
html body nav.workspace-section-tabs > button.workspace-section-tab.workspace-active-primary{background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Apply the selected purple state even if the shared section tabs are mounted
   outside their expected nav wrapper by an app-specific renderer. */
html body :is(#appPage,.app-shell) .workspace-section-tab:is([aria-selected="true"],[data-active-tab="true"],.workspace-active-primary){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Keep every selected in-app control on the same purple active state. Some
   inventory and logistics views use standalone active buttons outside navs. */
html body #appPage button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"],[data-active="true"],[data-state="active"]),
html body #appPage [role="tab"]:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"],[data-active="true"],[data-state="active"]){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Keep selected application controls purple even when an app renders its tabs
   outside #appPage or applies a component-specific green active background. */
html body .app-shell nav button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"],[data-active="true"],[data-state="active"]),
html body .app-shell button:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"],[data-active="true"],[data-state="active"]),
html body .app-shell [role="tab"]:is(.active,.selected,[aria-selected="true"],[aria-current="page"],[aria-pressed="true"],[data-active="true"],[data-state="active"]){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Some app sections expose selection as data-active-tab instead of the usual
   tab ARIA state. Keep these selected controls on the same purple primary color. */
html body .app-shell :is(button,a,[role="tab"])[data-active-tab="true"],
html body #appPage :is(button,a,[role="tab"])[data-selected="true"]{background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Cover active-state names used by app-specific controls that do not use the
   shared tab classes. JavaScript also corrects an inline green active color. */
html body .app-shell button:is(.is-active,[aria-current="step"],[data-selected="true"]),
html body .app-shell [role="tab"]:is(.is-active,[aria-current="step"],[data-selected="true"]){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Explicit fallback for the inventory forecast control, including non-button tab markup. */
html body [data-midadd-purple-action="inventory-forecast"]{background:#6754c7!important;background-color:#6754c7!important;background-image:none!important;border-color:#6754c7!important;color:#fff!important;-webkit-text-fill-color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}
html body [data-midadd-purple-action="inventory-forecast"]::before,
html body [data-midadd-purple-action="inventory-forecast"]::after{background:transparent!important;background-color:transparent!important;background-image:none!important;border-color:transparent!important;box-shadow:none!important}

/* Set the inventory tab identity at creation time so its purple state is not dependent on later DOM observation. */
html body #appPage nav.workspace-section-tabs > button.workspace-section-tab[data-midadd-purple-action="inventory-forecast"]{background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}
/* Global fallback for selected application controls rendered outside app wrappers. */
html body :is(button,[role="tab"]):is(.active,.selected,.is-active,[aria-selected="true"],[aria-current="page"],[aria-current="step"],[aria-pressed="true"],[data-active="true"],[data-active-tab="true"],[data-state="active"]){background:#6754c7!important;background-color:#6754c7!important;border-color:#6754c7!important;color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}

/* Final override for selected workspace tabs. Keep this after app themes so
   inventory's legacy teal active state cannot recolor the selected tab. */
html body #appPage .workspace-section-tabs > .workspace-section-tab[aria-selected="true"],
html body #appPage .workspace-section-tabs > .workspace-section-tab.workspace-active-primary,
html body .app-shell .workspace-section-tabs > .workspace-section-tab[aria-selected="true"],
html body .app-shell .workspace-section-tabs > .workspace-section-tab.workspace-active-primary{background:#6754c7!important;background-color:#6754c7!important;background-image:none!important;border-color:#6754c7!important;color:#fff!important;-webkit-text-fill-color:#fff!important;outline-color:#6754c7!important;box-shadow:0 2px 6px #6754c724!important}
