/* BirDesk Standard Skin action and overlay system.
 * This final component layer normalizes shared actions, dialogs and detail
 * surfaces without changing module layout or the Windows 7 skin.
 */
html[data-theme="standard"] {
  --ui-overlay-head-height: 48px;
  --ui-overlay-foot-height: 56px;
  --ui-overlay-padding: 20px;
  --ui-dialog-width: 480px;
  --ui-action-shadow: 0 1px 2px rgba(18, 48, 46, .1), 0 5px 14px rgba(0, 128, 111, .1);
  --ui-action-shadow-hover: 0 2px 4px rgba(18, 48, 46, .12), 0 8px 18px rgba(0, 111, 96, .14);
}

/* The tab strip is the module command bar. Its action belongs to the surface. */
html[data-theme="standard"] #erpApp .workspace-tab-strip {
  min-height: 46px;
  padding: 4px 6px 0 0;
  align-items: stretch;
  gap: 8px;
  background: transparent;
  border-bottom: 1px solid var(--brand-hover);
  box-shadow: none;
}

html[data-theme="standard"] #erpApp .workspace-tab-strip > .cashbox-tabs {
  min-height: 42px;
  align-items: end;
  background: transparent;
  box-shadow: none;
}

html[data-theme="standard"] #erpApp .workspace-tab-actions {
  min-height: 42px;
  padding: 0;
  align-items: center;
}

html[data-theme="standard"] #erpApp .workspace-tab-actions .btn.add-record {
  min-width: 132px;
  height: var(--ui-button-height);
  min-height: var(--ui-button-height);
  padding: 0 13px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--brand-primary);
  color: #fff;
  line-height: var(--ui-line-sm);
  box-shadow: var(--ui-action-shadow);
  transform: none;
}

html[data-theme="standard"] #erpApp .workspace-tab-actions .btn.add-record > span {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 16px;
}

html[data-theme="standard"] #erpApp .workspace-tab-actions .btn.add-record:hover:not(:disabled),
html[data-theme="standard"] #erpApp .workspace-tab-actions .btn.add-record:focus-visible:not(:disabled) {
  border-color: transparent;
  background: var(--brand-hover);
  color: #fff;
  box-shadow: var(--ui-action-shadow-hover);
  transform: none;
}

html[data-theme="standard"] #erpApp .workspace-tab-actions .btn.add-record:active:not(:disabled) {
  border-color: transparent;
  background: var(--brand-active);
  box-shadow: inset 0 1px 3px rgba(0, 51, 45, .2);
  transform: none;
}

/* Shared command hierarchy. */
html[data-theme="standard"] :is(
  #erpApp .btn.primary,
  #erpApp .operation-save,
  #erpApp .modal .footer .btn.primary,
  #erpApp .info-drawer-footer .btn.primary
) {
  border: 1px solid transparent;
  background: var(--brand-primary);
  color: #fff;
  box-shadow: var(--ui-action-shadow);
}

html[data-theme="standard"] :is(
  #erpApp .btn.primary,
  #erpApp .operation-save,
  #erpApp .modal .footer .btn.primary,
  #erpApp .info-drawer-footer .btn.primary
):hover:not(:disabled) {
  border-color: transparent;
  background: var(--brand-hover);
  color: #fff;
  box-shadow: var(--ui-action-shadow-hover);
}

html[data-theme="standard"] #erpApp :is(
  .modal .footer .btn:not(.primary):not(.danger),
  .info-drawer-footer .btn:not(.primary):not(.danger),
  .operation-cancel
) {
  border: 1px solid var(--border-strong);
  background: var(--surface-primary);
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(27, 43, 49, .04);
}

html[data-theme="standard"] #erpApp :is(
  .modal .footer .btn:not(.primary):not(.danger),
  .info-drawer-footer .btn:not(.primary):not(.danger),
  .operation-cancel
):hover:not(:disabled) {
  border-color: var(--brand-border-soft);
  background: var(--surface-hover);
  color: var(--brand-strong);
  box-shadow: 0 3px 9px rgba(27, 43, 49, .07);
}

html[data-theme="standard"] #erpApp :is(.btn.danger, .operation-delete) {
  border: 1px solid transparent;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(81, 25, 25, .08), 0 5px 14px rgba(189, 66, 66, .1);
}

html[data-theme="standard"] #erpApp :is(.btn.danger, .operation-delete):hover:not(:disabled) {
  border-color: transparent;
  background: var(--danger-hover);
  color: #fff;
  box-shadow: 0 2px 4px rgba(81, 25, 25, .1), 0 8px 18px rgba(173, 56, 56, .13);
}

/* Icon commands remain quiet until hover and use one geometry. */
html[data-theme="standard"] #erpApp :is(.icon-btn, button.table-action, .operation-edit-line, .operation-remove-line) {
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

html[data-theme="standard"] #erpApp :is(.icon-btn, button.table-action, .operation-edit-line, .operation-remove-line):hover:not(:disabled) {
  border-color: var(--border-default);
  background: var(--surface-hover);
  color: var(--brand-strong);
  box-shadow: 0 2px 7px rgba(27, 43, 49, .07);
}

html[data-theme="standard"] #erpApp :is(.icon-btn, button.table-action, .operation-edit-line, .operation-remove-line):focus-visible {
  border-color: var(--brand-primary);
  outline: 0;
  box-shadow: var(--focus-ring);
}

/* Keep the frequent detail command visible and move secondary row commands
 * into a viewport-aware menu rendered outside table overflow. */
html:is([data-theme="standard"], [data-theme="windows7"]) #erpApp .data-table .action-col,
html:is([data-theme="standard"], [data-theme="windows7"]) #erpApp .data-table.has-print-action .action-col {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
}

html:is([data-theme="standard"], [data-theme="windows7"]) #erpApp .data-table.inventory-table .action-col {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}

html:is([data-theme="standard"], [data-theme="windows7"]) #erpApp .row-action-menu-trigger svg circle {
  fill: currentColor;
  stroke: none;
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu {
  position: fixed;
  z-index: 7200;
  display: grid;
  width: 184px;
  padding: 5px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-control);
  background: var(--surface-primary);
  box-shadow: var(--shadow-flyout);
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--ui-font-sm);
  font-weight: var(--ui-weight-medium);
  line-height: var(--ui-line-sm);
  text-align: left;
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button:hover:not(:disabled),
html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button:focus-visible:not(:disabled) {
  outline: 0;
  background: var(--surface-hover);
  color: var(--brand-strong);
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button.danger {
  margin-top: 4px;
  border-top: 1px solid var(--border-default);
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  color: var(--danger);
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button.danger:hover:not(:disabled),
html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button.danger:focus-visible:not(:disabled) {
  background: var(--danger-soft, #fff1f1);
  color: var(--danger-hover);
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu > button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

html:is([data-theme="standard"], [data-theme="windows7"]) .row-action-menu svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Dialogs use one crisp enterprise hierarchy. Persistent drawers keep their
 * quieter side-panel treatment below. */
html[data-theme="standard"] #erpApp .modal,
html[data-theme="standard"] .mail-compose-modal,
html[data-theme="standard"] .identity-scan-dialog,
html[data-theme="standard"] #erpApp .info-drawer-inner {
  border: 1px solid var(--border-default);
  background: var(--surface-primary);
  box-shadow: var(--shadow-flyout);
}

html[data-theme="standard"] #erpApp .modal,
html[data-theme="standard"] .mail-compose-modal,
html[data-theme="standard"] .identity-scan-dialog {
  border-color: var(--border-strong);
  box-shadow:
    0 3px 10px rgba(20, 37, 43, .08),
    0 28px 72px rgba(20, 37, 43, .2);
}

html[data-theme="standard"] #erpApp .modal > .section-head,
html[data-theme="standard"] .mail-compose-modal > header.section-head,
html[data-theme="standard"] .identity-scan-dialog > header {
  min-height: var(--ui-overlay-head-height);
  padding: 11px 16px 9px;
  gap: 10px;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: inset 0 3px var(--brand-primary);
}

html[data-theme="standard"] #erpApp .modal > .section-head :is(h3, span),
html[data-theme="standard"] .mail-compose-modal > header.section-head :is(h3, span),
html[data-theme="standard"] .identity-scan-dialog > header :is(h3, small) {
  color: var(--text-primary);
  opacity: 1;
}

html[data-theme="standard"] #erpApp .modal > .section-head span,
html[data-theme="standard"] .mail-compose-modal > header.section-head span,
html[data-theme="standard"] .identity-scan-dialog > header small {
  color: var(--text-muted);
}

html[data-theme="standard"] #erpApp .info-drawer-head {
  min-height: var(--ui-overlay-head-height);
  padding: 10px 14px 10px 16px;
  gap: 10px;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-subtle);
  color: var(--text-primary);
  box-shadow: inset 3px 0 var(--brand-primary), inset 0 1px rgba(255, 255, 255, .86);
}

html[data-theme="standard"] #erpApp .info-drawer-head :is(h3, span) {
  color: var(--text-primary);
  opacity: 1;
}

html[data-theme="standard"] #erpApp .info-drawer-head span {
  color: var(--text-muted);
}

html[data-theme="standard"] #erpApp .modal .body,
html[data-theme="standard"] .mail-compose-body,
html[data-theme="standard"] .identity-scan-body,
html[data-theme="standard"] #erpApp .info-drawer-body {
  padding: var(--ui-overlay-padding);
  background: var(--surface-primary);
}

html[data-theme="standard"] #erpApp .modal :is(.entry-form-panel, .customer-panel) {
  border-color: var(--border-default);
  background: var(--surface-primary);
  box-shadow: 0 1px 3px rgba(20, 37, 43, .055);
}

html[data-theme="standard"] #erpApp .modal :is(
  .entry-form-panel > h4,
  .customer-section-heading
) {
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-muted);
  color: var(--text-primary);
  box-shadow: inset 3px 0 var(--brand-primary), inset 0 1px rgba(255, 255, 255, .8);
}

html[data-theme="standard"] #erpApp .modal .footer,
html[data-theme="standard"] #erpApp .info-drawer-footer,
html[data-theme="standard"] #erpApp .operation-modal-footer,
html[data-theme="standard"] .mail-compose-modal > footer,
html[data-theme="standard"] .identity-scan-dialog > footer {
  min-height: var(--ui-overlay-foot-height);
  padding: 9px 14px;
  gap: 8px;
  border-top: 1px solid var(--border-default);
  background: var(--surface-muted);
  box-shadow: inset 0 1px rgba(255, 255, 255, .82);
}

html[data-theme="standard"] :is(.modal-backdrop, .mail-compose-backdrop, .identity-scan-backdrop) {
  background: var(--overlay);
  backdrop-filter: none;
}

html[data-theme="standard"] #erpApp :is(.modal .footer, .info-drawer-footer, .operation-modal-footer) .btn {
  width: auto;
  min-width: 104px;
  height: var(--ui-button-height);
  min-height: var(--ui-button-height);
  padding: 0 14px;
  border-radius: var(--radius-control);
}

/* Compact system alerts use the same footer and action geometry. */
html[data-theme="standard"] .system-dialog {
  width: min(var(--ui-dialog-width), calc(100vw - 32px));
  max-width: min(var(--ui-dialog-width), calc(100vw - 32px));
}

html[data-theme="standard"] .system-dialog .system-dialog-head {
  min-height: var(--ui-overlay-head-height);
  padding: 8px 12px 8px 16px;
}

html[data-theme="standard"] .system-dialog-body {
  min-height: 84px;
  padding: 18px var(--ui-overlay-padding);
}

html[data-theme="standard"] .system-dialog-footer {
  min-height: var(--ui-overlay-foot-height);
  padding: 9px 14px;
}

html[data-theme="standard"] .system-dialog-footer .btn {
  min-width: 104px;
  height: var(--ui-button-height);
  min-height: var(--ui-button-height);
  padding: 0 14px;
  font-size: var(--ui-font-sm);
  line-height: var(--ui-line-sm);
}

/* Info/detail typography: readable values, quieter labels, stable numeric tables. */
html[data-theme="standard"] #erpApp .info-drawer-body {
  font-size: var(--ui-font-sm);
  line-height: var(--ui-line-sm);
}

html[data-theme="standard"] #erpApp .drawer-field {
  min-height: 38px;
  padding: 7px 0;
  font-size: var(--ui-font-sm);
  line-height: var(--ui-line-sm);
}

html[data-theme="standard"] #erpApp .drawer-field > span {
  color: var(--text-muted);
  font-size: var(--ui-font-xs);
  font-weight: var(--ui-weight-semibold);
  line-height: var(--ui-line-xs);
}

html[data-theme="standard"] #erpApp .drawer-value {
  min-height: 30px;
  padding: 4px 7px;
  color: var(--text-primary);
  font-size: var(--ui-font-sm);
  font-weight: var(--ui-weight-medium);
  line-height: var(--ui-line-sm);
}

html[data-theme="standard"] #erpApp :is(.info-card, .detail-card, .drawer-history, .credit-detail-section) {
  font-size: var(--ui-font-sm);
  line-height: var(--ui-line-sm);
}

html[data-theme="standard"] #erpApp .credit-detail-section h4 {
  min-height: 34px;
  font-size: var(--ui-font-md);
  font-weight: var(--ui-weight-semibold);
  line-height: var(--ui-line-md);
}

html[data-theme="standard"] #erpApp .credit-summary-grid span {
  font-size: var(--ui-font-xs);
  line-height: var(--ui-line-xs);
}

html[data-theme="standard"] #erpApp .credit-summary-grid strong {
  font-size: var(--ui-font-md);
  line-height: var(--ui-line-md);
}

html[data-theme="standard"] #erpApp .credit-detail-table th {
  height: 34px;
  padding: 6px 7px;
  font-size: var(--ui-font-xs);
  font-weight: var(--ui-weight-semibold);
  line-height: var(--ui-line-xs);
}

html[data-theme="standard"] #erpApp .credit-detail-table td {
  height: 36px;
  padding: 6px 7px;
  font-size: var(--ui-font-sm);
  font-weight: var(--ui-weight-regular);
  line-height: var(--ui-line-sm);
}

html[data-theme="standard"] #erpApp .credit-detail-table .badge {
  font-size: var(--ui-font-xs);
  line-height: 18px;
}

html[data-theme="standard"] #erpApp :is(.debt-info-empty, .credit-table-empty) {
  font-size: var(--ui-font-sm);
  line-height: var(--ui-line-sm);
}

@media (max-width: 720px) {
  html[data-theme="standard"] #erpApp .workspace-tab-strip {
    min-height: 48px;
    padding-right: 4px;
  }

  html[data-theme="standard"] #erpApp .workspace-tab-actions .btn.add-record {
    min-width: 0;
    padding-inline: 11px;
  }

  html[data-theme="standard"] #erpApp .modal .body,
  html[data-theme="standard"] #erpApp .info-drawer-body {
    padding: 14px;
  }

  html[data-theme="standard"] #erpApp :is(.modal .footer, .info-drawer-footer, .operation-modal-footer) .btn,
  html[data-theme="standard"] .system-dialog-footer .btn {
    min-width: 112px;
  }
}
