/* Spark Agency HR — accounting grid (v38). Screen only. */
@media screen {
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  /* ---------- Payroll ledger ---------- */
  .ledger {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .ledger-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #f7faf9;
    flex-wrap: wrap;
  }
  .ledger-bar input[type="search"] {
    width: min(260px, 100%);
    margin: 0;
    min-height: 36px;
    padding: 7px 11px;
  }
  .ledger-count {
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
    margin-right: auto;
  }
  .ledger-bar button {
    margin: 0;
    min-height: 36px;
    padding: 7px 13px;
  }
  .ledger-scroll {
    overflow: auto;
    max-height: calc(100vh - 210px);
    min-height: 240px;
    overscroll-behavior: contain;
  }
  .ledger-scroll:focus-visible {
    outline: 3px solid #0a9a9c55;
    outline-offset: -3px;
  }
  .ledger-table {
    overflow: visible !important; /* style.css clips tables, which breaks sticky headers */
    width: 100%;
    min-width: 1000px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }
  .ledger-table th,
  .ledger-table td {
    border-right: 1px solid #e6edec;
    border-bottom: 1px solid #e6edec;
    padding: 0 10px;
    height: 38px;
    white-space: nowrap;
    vertical-align: middle;
    background: var(--paper);
  }
  .ledger-table tbody tr:nth-child(even of :not(.ledger-sub):not([hidden])) td {
    background: #fafcfc;
  }
  .ledger-table tbody tr:hover td {
    background: #eef8f7;
  }
  .ledger-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 42px;
    padding: 0;
    background: #eef3f2;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--line-strong);
  }
  .ledger-table th button {
    display: flex;
    align-items: center;
    justify-content: inherit;
    gap: 6px;
    width: 100%;
    height: 100%;
    min-height: 36px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
  }
  .ledger-table th button:hover {
    background: #e3eceb;
    color: var(--teal-deep);
  }
  .ledger-table th button:active {
    transform: none;
  }
  .ledger-table th button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
  }
  .ledger-table th .lbl {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    white-space: normal;
  }
  .ledger-table th.n .lbl {
    align-items: flex-end;
    text-align: right;
  }
  .ledger-table th .lbl small {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-2);
  }
  .ledger-table th i {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0;
  }
  .ledger-table th[aria-sort="ascending"] i {
    border-bottom: 5px solid currentColor;
    opacity: 1;
  }
  .ledger-table th[aria-sort="descending"] i {
    border-top: 5px solid currentColor;
    opacity: 1;
  }
  .ledger-table th.n {
    justify-content: flex-end;
  }
  .ledger-table th.n button {
    justify-content: flex-start;
    flex-direction: row-reverse;
  }
  .ledger-table th.c button {
    justify-content: center;
  }
  /* Frozen columns: row number + employee */
  .ledger-table .rn {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 42px;
    min-width: 42px;
    text-align: center;
    color: #8aa0a5;
    font-size: 11.5px;
    background: #f4f8f7 !important;
  }
  .ledger-table .who {
    position: sticky;
    left: 42px;
    z-index: 2;
    min-width: 160px;
    max-width: 230px;
    white-space: normal;
    box-shadow: 1px 0 0 var(--line-strong);
  }
  .ledger-table th.rn,
  .ledger-table th.who {
    z-index: 4;
    background: #eef3f2 !important;
  }
  .ledger-table .who b {
    font-weight: 700;
  }
  .ledger-table .who .raise-tag {
    display: inline-block;
    margin: 2px 0 4px;
    padding: 2px 7px;
    font-size: 10.5px;
  }
  .ledger-table .c {
    text-align: center;
  }
  .ledger-table .c small {
    color: var(--text-2);
  }
  .ledger-table td.n {
    text-align: right;
    min-width: 92px;
  }
  .ledger-table td.z {
    color: #b6c4c6;
  }
  .ledger-table td.plus:not(.z) {
    color: #1d7a5c;
  }
  .ledger-table td.minus:not(.z) {
    color: #a8434b;
  }
  .ledger-table td.net {
    background: #f3faf9 !important;
    font-size: 13.5px;
  }
  .ledger-table th.net {
    background: #e2f1ef !important;
  }
  .ledger-table td.net small {
    color: var(--text-2);
    font-weight: 600;
  }
  .ledger-table .st {
    min-width: 150px;
  }
  .ledger-table .st .paid-checkbox {
    padding: 3px 9px 3px 7px;
    font-size: 11.5px;
    margin-right: 6px;
  }
  .ledger-table .st .paid-checkbox small {
    display: none;
  }
  .pay-state {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
  }
  .pay-state.is-paid {
    background: #e5f6f0;
    color: #1d6b55;
  }
  .pay-state.is-due {
    background: var(--teal-soft);
    color: var(--teal-deep);
  }
  .pay-state.is-late {
    background: var(--amber-soft);
    color: #8a5a12;
  }
  .ledger-table .act {
    text-align: right;
    min-width: 140px;
  }
  .ledger-table .act button {
    margin: 0 0 0 4px;
    min-height: 28px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 7px;
    background: var(--paper);
    color: var(--text);
    border: 1px solid var(--line-strong);
  }
  .ledger-table .act button:hover {
    background: var(--teal-soft);
    border-color: #9fd3d1;
    color: var(--teal-deep);
  }
  .ledger-table .act button[data-voucher] {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
  }
  .ledger-table .act button[data-voucher]:hover {
    background: var(--teal-deep);
  }
  .ledger-table .act button[data-reverse] {
    color: var(--rose);
  }
  /* Adjustment details under a row */
  .ledger-table tr.ledger-sub td {
    height: auto;
    padding: 5px 10px 7px;
    background: #fbfdfd !important;
    border-bottom-color: #e6edec;
    font-size: 12px;
    color: var(--text-2);
    white-space: normal;
  }
  .ledger-table tr.ledger-sub .adjustment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 14px 2px 0;
    font-size: 12px;
  }
  .ledger-table tr.ledger-sub .adjustment button {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: var(--rose-soft);
    color: var(--rose);
    border: 0;
    font-size: 13px;
    line-height: 1;
  }
  /* Totals */
  .ledger-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 2;
    height: 42px;
    background: #e9f4f2 !important;
    border-top: 2px solid var(--ink);
    border-bottom: 3px double var(--ink);
    font-weight: 800;
  }
  .ledger-table tfoot .rn,
  .ledger-table tfoot .who {
    z-index: 3;
    background: #e3efed !important;
  }
  .ledger-table tfoot .who small {
    margin-left: 6px;
    color: var(--text-2);
    font-weight: 600;
  }
  .pay-sum {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
  }

  .ledger-hint {
    color: var(--text-2);
    font-size: 12px;
  }
  .ledger-table .st .paid-checkbox {
    gap: 0;
    padding: 4px;
    border-radius: 6px;
    font-size: 0;
  }
  .ledger-table .st .paid-checkbox input {
    width: 16px;
    height: 16px;
  }

  /* Export buttons sit quietly next to the main action */
  #csv,
  #advance-export,
  #hr-export,
  #payroll-xlsx,
  #advance-xlsx,
  #report-xlsx {
    background: var(--paper);
    color: var(--text);
    border: 1px solid var(--line-strong);
  }
  #csv:hover,
  #advance-export:hover,
  #hr-export:hover,
  #payroll-xlsx:hover,
  #advance-xlsx:hover,
  #report-xlsx:hover {
    background: var(--teal-soft);
    border-color: #9fd3d1;
    color: var(--teal-deep);
  }

  /* Compact payroll summary strip */
  .payroll-summary-currency {
    padding: 16px 18px !important;
    margin-bottom: 14px;
  }
  .payroll-summary-currency .toolbar {
    margin: 0 0 10px;
  }
  .payroll-summary-currency h2 {
    font-size: 15px;
    margin: 0;
  }
  .payroll-summary-currency .toolbar p {
    margin: 2px 0 0;
    font-size: 12.5px;
  }
  .payroll-summary-grid {
    gap: 0 !important;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
  }
  .payroll-summary-card {
    padding: 10px 14px !important;
    border: 0 !important;
    border-right: 1px solid var(--line) !important;
    border-radius: 0 !important;
    background: var(--paper) !important;
  }
  .payroll-summary-card:last-child {
    border-right: 0 !important;
  }
  .payroll-summary-card > span {
    min-height: 0 !important;
    font-size: 11.5px !important;
  }
  .payroll-summary-card > strong {
    margin-top: 4px !important;
    font-size: 17px !important;
    font-weight: 800;
  }
  .payroll-summary-net {
    background: #eaf6f4 !important;
  }
  .payroll-summary-equation {
    margin: 8px 0 6px !important;
    font-size: 11.5px !important;
  }
  .payroll-summary-payment {
    padding-top: 8px !important;
    font-size: 12.5px !important;
  }
  .payroll-summary-note {
    display: none;
  }

  /* ---------- Other money tables: spreadsheet look ---------- */
  table.sheet-grid {
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
  }
  table.sheet-grid th {
    background: #eef3f2;
    color: var(--text);
    border-bottom: 1px solid var(--line-strong);
  }
  table.sheet-grid td,
  table.sheet-grid th {
    border-right: 1px solid #e9efee;
    padding: 9px 12px;
  }
  table.sheet-grid td:last-child,
  table.sheet-grid th:last-child {
    border-right: 0;
  }
  table.sheet-grid tr:nth-child(even) td {
    background: #fafcfc;
  }
  table.sheet-grid .n {
    text-align: right;
    white-space: nowrap;
  }

  @media (max-width: 700px) {
    .quick-action-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 8px !important;
    }
    .quick-action-grid button {
      min-height: 0 !important;
      padding: 12px !important;
    }
    .quick-action-grid button b,
    .quick-action-grid button small,
    .quick-action-grid button span:not(:first-child) {
      display: none !important;
    }
    .ledger-scroll {
      max-height: calc(100vh - 150px);
    }
    .ledger-table .who {
      min-width: 118px;
      max-width: 150px;
    }
    .ledger-table {
      font-size: 12.5px;
    }
    .ledger-count {
      order: 3;
      width: 100%;
    }
  }
}
