/*
 * Global action-button text-link restyling.
 * Turns all selection-toolbar buttons and known per-row action buttons
 * into blue underlined text links — matching the Customers page style.
 *
 * Does NOT touch: form Save/Submit, dialog Yes/No/OK, filter controls,
 * floating FABs, or primary "Add" buttons.
 *
 * v20260902-2
 */

/* ================================================================
   0. Remove the native per-row "Actions" column from every DataGrid on
      every page, at every window size (the actions live in the selection
      toolbar instead). Survives virtualisation/re-renders via !important.
   ================================================================ */
.MuiDataGrid-root .MuiDataGrid-columnHeader[data-field="actions"],
.MuiDataGrid-root .MuiDataGrid-cell[data-field="actions"] {
  display: none !important;
}

/* ================================================================
   0a. EXCEPTION: re-show the native "Actions" column header + per-row
       buttons on the Payroll Management grids only. The payroll grids
       are identified by their payroll-only columns. All other pages
       keep the Actions column hidden. Higher specificity than rule 0.
   ================================================================ */
.MuiDataGrid-root:has(:is(
  [data-field="basicSalary"],
  [data-field="employeeNumber"],
  [data-field="taxNumber"],
  [data-field="netSalary"],
  [data-field="totalNetSalary"],
  [data-field="loanAmount"],
  [data-field="installmentAmount"],
  [data-field="remainingBalance"],
  [data-field="startMonth"],
  [data-field="endMonth"],
  [data-field="hoursWorked"],
  [data-field="hourlyRate"],
  [data-field="allowanceType"],
  [data-field="deductedMonth"],
  [data-field="approvedBy"]
)) :is(.MuiDataGrid-columnHeader[data-field="actions"], .MuiDataGrid-cell[data-field="actions"]) {
  display: flex !important;
}

/* ================================================================
   1. Selection toolbar buttons  (appears when a DataGrid row is checked)
      Container class: .tables-actions-handle
      Used on: Customers, Staff, Invoicing, Payments, Expenses, Routes,
               RouteMeters, AssignRouteMeters, CustomerMeters, Balances,
               CurrentOffsets, PrepaymentsHistory, AppliedPrepayments,
               PayrollSnapshot, BalanceOffsets, StaffPayRoll, InvoiceFixes
   ================================================================ */
.tables-actions-handle button,
.tables-actions-handle [role="button"] {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}

.tables-actions-handle button:hover,
.tables-actions-handle [role="button"]:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}

.tables-actions-handle button:active,
.tables-actions-handle [role="button"]:active {
  color: #0a3d91 !important;
  border-bottom-color: #0a3d91 !important;
}

/* Override MUI color variants that set background-color */
.tables-actions-handle button.MuiButton-colorPrimary,
.tables-actions-handle button.MuiButton-colorSecondary,
.tables-actions-handle button.MuiButton-colorError,
.tables-actions-handle button.MuiButton-colorSuccess,
.tables-actions-handle button.MuiButton-contained,
.tables-actions-handle button.MuiButton-containedPrimary,
.tables-actions-handle button.MuiButton-containedSecondary,
.tables-actions-handle button.MuiButton-containedError,
.tables-actions-handle button.MuiButton-containedSuccess,
.tables-actions-handle button.MuiButton-outlined,
.tables-actions-handle button.MuiButton-outlinedPrimary,
.tables-actions-handle button.MuiButton-outlinedSecondary {
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  box-shadow: none !important;
  color: #1976d2 !important;
}

/* Remove MUI start-icon margin so icon sits tight to text */
.tables-actions-handle button .MuiButton-startIcon {
  margin-right: 2px !important;
  margin-left: 0 !important;
}

/* ================================================================
   2. Per-row action buttons created by custom JS patches
   ================================================================ */

/* --- system-user-row-actions.js  (Admin > User Management) --- */
.system-user-action {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}
.system-user-action:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}

/* --- staff-login-actions.js  (Staff page) --- */
.staff-account-edit,
.staff-account-status {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}
.staff-account-edit:hover,
.staff-account-status:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}

/* --- account-activities-actions.js  (Customer Details > Account Activities) --- */
[data-wua-action="1"] {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}
[data-wua-action="1"]:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}

/* --- payments-receipt-enhancements.js  (Payments page) --- */
.payments-view-receipt {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}
.payments-view-receipt:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}

/* --- meter-reset-diagnosis.js  (Meter Reading Management) --- */
.wua-run-diagnosis,
.wua-preview-repair,
.wua-execute-repair {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}
.wua-run-diagnosis:hover,
.wua-preview-repair:hover,
.wua-execute-repair:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}

/* --- invoice-excel-recovery.js  (Invoice migration panel) --- */
.wua-recovery-preview,
.wua-recovery-import {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline: none !important;
  font: inherit !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #1976d2 !important;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid #1976d2 !important;
  padding: 0 2px !important;
  box-shadow: none !important;
  text-transform: none !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  margin-left: 10px !important;
  margin-right: 2px !important;
  border-radius: 0 !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}
.wua-recovery-preview:hover,
.wua-recovery-import:hover {
  color: #0d47a1 !important;
  border-bottom-color: #0d47a1 !important;
}
