.payroll-detail-page {
  --pd-ink: #18392e;
  --pd-muted: #637a6d;
  --pd-line: #dce9df;
  --pd-wash: #f2f8f4;
  --pd-green: #176c49;
  --pd-deep: #104933;
  color: var(--pd-ink);
}

.payroll-detail-page .company-header h1,
.payroll-detail-page .company-header p {
  max-width: 780px;
}

.pd-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
}

.pd-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--pd-green);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.pd-back:hover { text-decoration: underline; }

.pd-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.payroll-detail-page .pd-top-actions .btn {
  width: auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 12px 14px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.35;
}

.pd-view-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 0 0 19px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--pd-line);
  scrollbar-width: thin;
}

.pd-view-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 37px !important;
  margin: 0 !important;
  padding: 8px 13px !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: #587365 !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  text-decoration: none;
}

.pd-view-link:hover,
.pd-view-link.is-current {
  border-color: #c9e0cf !important;
  background: #e9f4ec !important;
  color: var(--pd-deep) !important;
}

.pd-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(130px, .7fr));
  gap: 12px;
  margin-bottom: 18px;
}

.pd-summary-cell {
  min-height: 108px;
  padding: 20px 22px;
  border: 1px solid var(--pd-line);
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 10%, var(--pd-wash));
}

.pd-summary-cell span,
.pd-summary-cell small {
  display: block;
  color: var(--pd-muted);
  font-size: 12px;
  line-height: 1.5;
}

.pd-summary-cell strong {
  display: block;
  margin: 6px 0 3px;
  color: var(--pd-deep);
  font-size: clamp(21px, 3vw, 31px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}

.pd-summary-cell.is-primary {
  border-color: #c6dfcd;
  background: #e9f4ec;
}

.pd-scope-note,
.pd-info-note {
  color: var(--pd-muted);
  font-size: 13px;
  line-height: 1.6;
}

.pd-scope-note {
  margin: -5px 0 18px;
  padding-left: 2px;
}

.pd-section-card {
  margin: 0 0 18px;
  padding: clamp(16px, 2.5vw, 24px);
  border: 1px solid var(--pd-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(35, 82, 55, .045);
}

.pd-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.pd-section-head h2 {
  margin: 0;
  color: var(--pd-ink);
  font-size: clamp(19px, 2.2vw, 24px);
  letter-spacing: -.025em;
}

.pd-section-head p {
  max-width: 700px;
  margin: 5px 0 0;
  color: var(--pd-muted);
  font-size: 13px;
  line-height: 1.55;
}

.pd-filter-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(130px, .8fr));
  gap: 12px;
  align-items: end;
  margin: 0 0 17px;
}

.pd-filter label {
  display: block;
  margin: 0 0 6px;
  color: #527062;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: normal;
  text-transform: none;
}

.pd-filter input,
.pd-filter select {
  box-sizing: border-box;
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid var(--pd-line);
  border-radius: 10px;
  outline: none;
  background: #fbfdfb;
  color: var(--pd-ink);
  font: inherit;
  font-size: 14px;
}

.pd-filter input:focus,
.pd-filter select:focus {
  border-color: #76ac8a;
  box-shadow: 0 0 0 3px rgba(67, 143, 94, .12);
}

.pd-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-bottom: 17px;
}

.pd-filter-actions button { width: auto; margin: 0; }

.pd-table-wrap {
  overflow: auto;
  border: 1px solid #e5eee7;
  border-radius: 13px;
}

.pd-table {
  width: 100%;
  min-width: 750px;
  border-collapse: collapse;
  font-size: 13px;
}

.pd-table th {
  padding: 12px 14px;
  background: #f3f8f4;
  color: #527062;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}

.pd-table td {
  padding: 13px 14px;
  border-top: 1px solid #e8f0ea;
  vertical-align: top;
}

.pd-table tbody tr:hover { background: #fbfdfb; }

.pd-primary-text {
  display: block;
  color: var(--pd-ink);
  font-weight: 750;
}

.pd-secondary-text {
  display: block;
  margin-top: 4px;
  color: var(--pd-muted);
  font-size: 11px;
  line-height: 1.45;
}

.pd-money {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  white-space: nowrap;
}

.pd-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #dbe8de;
  border-radius: 999px;
  background: #f3f8f4;
  color: #4b6557;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.pd-status[data-state="paid"],
.pd-status[data-state="active"],
.pd-status[data-state="success"] {
  border-color: #c5e3ce;
  background: #e9f6ed;
  color: #176c49;
}

.pd-status[data-state="failed"],
.pd-status[data-state="declined"],
.pd-status[data-state="disconnected"] {
  border-color: #efd0cb;
  background: #fcf0ed;
  color: #9d4539;
}

.pd-row-expand {
  width: auto !important;
  min-height: 34px !important;
  margin: 0 !important;
  padding: 6px 10px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
}

.pd-run-disclosure { min-width: 108px; }
.pd-run-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid #d4e5d8;
  border-radius: 8px;
  background: #f5faf6;
  color: var(--pd-green);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  list-style: none;
  white-space: nowrap;
}
.pd-run-trigger::-webkit-details-marker { display: none; }
.pd-run-trigger::before { content: "+"; margin-right: 6px; font-size: 15px; line-height: 10px; }
.pd-run-disclosure[open] > .pd-run-trigger::before { content: "−"; }
.pd-run-detail-row td {
  padding: 0 !important;
  background: #f7fbf8;
}

.pd-run-detail {
  padding: 18px clamp(14px, 3vw, 28px);
  border-top: 1px solid #dce9df;
}

.pd-run-detail h3 {
  margin: 0 0 12px;
  color: var(--pd-ink);
  font-size: 16px;
}

.pd-detail-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.pd-fact {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e1ece4;
  border-radius: 10px;
  background: #fff;
}

.pd-fact span {
  display: block;
  color: var(--pd-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: normal;
  text-transform: none;
}

.pd-fact strong {
  display: block;
  margin-top: 4px;
  color: var(--pd-ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pd-approval-reason {
  margin: 0 0 15px;
  padding: 12px 14px;
  border-left: 3px solid #77a887;
  border-radius: 0 9px 9px 0;
  background: #edf6ef;
  color: #365747;
  font-size: 13px;
  line-height: 1.55;
}

.pd-approval-reason strong { display: block; margin-bottom: 4px; }

.pd-ledger-description {
  max-width: 320px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pd-empty {
  padding: 36px 18px;
  border: 1px dashed #cbded0;
  border-radius: 14px;
  background: #f8fbf8;
  text-align: center;
}

.pd-empty-mark {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0 auto 11px;
  place-items: center;
  border-radius: 12px;
  background: #e7f3e9;
  color: var(--pd-green);
  font-weight: 800;
}

.pd-empty h3 { margin: 0 0 5px; font-size: 16px; }
.pd-empty p { max-width: 470px; margin: 0 auto; color: var(--pd-muted); font-size: 13px; line-height: 1.55; }

.pd-error {
  padding: 22px;
  border: 1px solid #efd0cb;
  border-radius: 14px;
  background: #fff8f6;
  color: #793e36;
}

.pd-error h3 { margin: 0 0 6px; font-size: 17px; }
.pd-error p { margin: 0 0 14px; line-height: 1.5; }
.pd-error button { width: auto; margin: 0; }

.pd-skeleton {
  display: grid;
  gap: 10px;
  padding: 16px 0;
}

.pd-skeleton span {
  height: 46px;
  border-radius: 10px;
  background: #edf4ee;
  animation: pd-pulse 1.4s ease-in-out infinite alternate;
}

@keyframes pd-pulse {
  from { opacity: .55; }
  to { opacity: 1; }
}

.pd-employee-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(120px, .8fr));
  gap: 12px 18px;
  padding: 17px 0;
  border-top: 1px solid #e6eee8;
}

.pd-employee-card:first-child { border-top: 0; }

.pd-employee-name {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.pd-initials {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 12px;
  background: #e8f3ea;
  color: var(--pd-deep);
  font-size: 12px;
  font-weight: 800;
}

.pd-employee-fields { display: contents; }
.pd-employee-field { min-width: 0; }
.pd-employee-field > span { display: block; color: var(--pd-muted); font-size: 11px; font-weight: 600; letter-spacing: normal; text-transform: none; }
.pd-employee-field strong { display: block; margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.pd-link {
  display: inline-flex;
  width: auto;
  min-height: unset !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--pd-green) !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  text-decoration: none;
}
.pd-link:hover { text-decoration: underline; }

.pd-restriction {
  padding: 25px;
  border: 1px solid #e7debb;
  border-radius: 15px;
  background: #fffbec;
  color: #665527;
}
.pd-restriction h2 { margin: 0 0 8px; font-size: 19px; }
.pd-restriction p { margin: 0; line-height: 1.6; }

.pd-transaction-type { font-weight: 750; }
.pd-wallet-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #dbe8de;
  border-radius: 12px;
  background: #f5faf6;
  color: #4c6657;
  font-size: 13px;
  line-height: 1.55;
}
.pd-wallet-callout strong { color: var(--pd-ink); }

@media (max-width: 760px) {
  .pd-topline { align-items: flex-start; flex-direction: column; }
  .pd-top-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .payroll-detail-page .pd-top-actions .btn { width: 100%; }
  .pd-summary { grid-template-columns: 1fr 1fr; }
  .pd-summary-cell.is-primary { grid-column: 1 / -1; }
  .pd-filter-grid { grid-template-columns: 1fr 1fr; }
  .pd-filter:first-child { grid-column: 1 / -1; }
  .pd-detail-facts { grid-template-columns: 1fr 1fr; }
  .pd-employee-card { grid-template-columns: 1fr 1fr; }
  .pd-employee-name { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .pd-summary { gap: 8px; }
  .pd-summary-cell { min-height: 90px; padding: 14px; }
  .pd-summary-cell strong { font-size: 21px; }
  .pd-filter-grid { grid-template-columns: 1fr; }
  .pd-filter:first-child { grid-column: auto; }
  .pd-detail-facts { grid-template-columns: 1fr 1fr; }
  .pd-top-actions .btn { flex: 1; }
  .pd-employee-card { grid-template-columns: 1fr; }
  .pd-employee-name { grid-column: auto; }
}
