/* Popup Kỳ lương / Sự kiện */
.pr-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: stretch; justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 0;
}
.pr-overlay[hidden] { display: none !important; }
.pr-modal {
  position: relative;
  display: flex; flex-direction: column;
  width: 100%; max-width: 1100px;
  height: 100%; max-height: 100dvh;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
@media (min-width: 900px) {
  .pr-overlay { padding: 24px; align-items: center; }
  .pr-modal {
    height: min(860px, calc(100dvh - 48px));
    max-height: calc(100dvh - 48px);
    border-radius: 12px;
    overflow: hidden;
  }
}
.pr-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.pr-modal-title { margin: 0; font-size: 1.15rem; color: #1a365d; }
.pr-modal-kicker { font-size: 12px; color: #718096; margin-bottom: 2px; }
.pr-modal-actions { display: flex; gap: 8px; align-items: center; }
.pr-split {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 22%) 1fr;
}
.pr-tree-pane {
  border-right: 1px solid #e2e8f0;
  display: flex; flex-direction: column; min-height: 0;
  background: #f8fafc;
  min-width: 0;
}
.pr-tree {
  flex: 1; overflow: auto; padding: 8px 6px 16px;
  min-width: 0;
}
.pr-tree-footer {
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.pr-tree-footer .pr-btn {
  width: 100%;
}
.pr-mobile-back { display: none; }
.pr-tree-node {
  display: block; width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  padding: 7px 10px; margin: 2px 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit; font-size: 13px; color: #2d3748;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  height: auto;
}
.pr-tree-node.is-period {
  font-weight: 600;
  background: #e8eef7;
  color: #1a365d;
}
.pr-tree-node.is-period:hover { background: #d9e4f2; }
.pr-tree-node.is-period.is-active {
  background: #c5d9f0;
  color: #1a365d;
  box-shadow: inset 3px 0 0 #2b6cb0;
}
.pr-tree-node.is-event {
  padding-left: 22px;
  font-weight: 400;
  color: #4a5568;
  background: #ffffff;
  border: 1px solid transparent;
}
.pr-tree-node.is-event:hover { background: #f7fafc; }
.pr-tree-node.is-event.is-active {
  background: #ebf8ff;
  color: #2b6cb0;
  border-color: #bee3f8;
}
.pr-tree-toggle {
  display: inline-block; width: 1.1em;
  color: #a0aec0; font-size: 11px;
  vertical-align: top;
  margin-top: 2px;
}
.pr-tree-empty { padding: 16px 12px; color: #718096; font-size: 13px; }
.pr-detail-pane {
  overflow: auto; padding: 18px 20px 28px;
  background: #fff;
}
.pr-detail-empty {
  color: #718096; font-size: 14px; padding: 24px 8px;
}
.pr-detail-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}
.pr-detail-title { margin: 0 0 4px; font-size: 1.2rem; color: #1a365d; }
.pr-detail-meta { font-size: 13px; color: #718096; }
.pr-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-dl {
  display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px;
  margin: 0; font-size: 14px;
}
.pr-dl dt { color: #718096; margin: 0; }
.pr-dl dd { margin: 0; color: #2d3748; word-break: break-word; }
.pr-btn {
  appearance: none; border: 1px solid #cbd5e0; background: #fff;
  color: #2d3748; border-radius: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  line-height: 1.3;
}
.pr-btn:hover { background: #edf2f7; }
.pr-btn-icon {
  width: 34px; height: 34px; min-width: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.pr-btn-icon svg { width: 16px; height: 16px; display: block; pointer-events: none; }
.pr-btn-primary,
a.pr-btn.pr-btn-primary {
  background: #2b6cb0; border-color: #2b6cb0; color: #fff !important;
}
.pr-btn-primary:hover,
a.pr-btn.pr-btn-primary:hover {
  background: #2c5282; border-color: #2c5282; color: #fff !important;
}
.pr-btn-danger {
  background: #fff5f5; border-color: #feb2b2; color: #c53030;
}
.pr-btn-danger:hover { background: #fed7d7; }
.pr-btn-close {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
}
.pr-dialog-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  padding: 16px;
}
.pr-dialog-overlay[hidden] { display: none !important; }
.pr-dialog {
  width: min(440px, 100%);
  background: #fff; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.pr-dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #e2e8f0;
}
.pr-dialog-title { margin: 0; font-size: 1rem; }
.pr-dialog-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.pr-dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 14px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}
.pr-field label {
  display: block; font-size: 12px; font-weight: 600; color: #4a5568; margin-bottom: 4px;
}
.pr-field input, .pr-field textarea, .pr-field select {
  width: 100%; padding: 7px 9px; border: 1px solid #cbd5e0; border-radius: 6px;
  font: inherit; font-size: 14px;
  box-sizing: border-box;
}
.pr-field select {
  min-height: 40px;
  height: auto;
  padding: 8px 32px 8px 10px;
  line-height: 1.4;
  appearance: auto;
  -webkit-appearance: menulist;
  overflow: visible;
  vertical-align: middle;
}
.pr-field textarea { min-height: 72px; resize: vertical; }
.pr-msg { font-size: 13px; min-height: 1.2em; color: #718096; }
.pr-msg.is-err { color: #c53030; }
.pr-muted { color: #718096; font-size: 13px; }
.pr-payroll-wrap { margin-top: 4px; }
.pr-payroll-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.pr-payroll-toolbar .pr-btn { text-decoration: none; }
.pr-detail-actions .pr-btn { text-decoration: none; }
.pr-payroll-scroll {
  overflow: auto;
  max-height: min(58vh, 560px);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.pr-payroll-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; background: #fff;
}
.pr-payroll-table th,
.pr-payroll-table td {
  padding: 7px 9px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  white-space: nowrap;
}
.pr-payroll-table th {
  position: sticky; top: 0; z-index: 1;
  background: #f7fafc; color: #4a5568; font-weight: 600;
}
.pr-payroll-table td.name { white-space: normal; min-width: 140px; font-weight: 600; color: #2d3748; }
.pr-payroll-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pr-payroll-table .tone-positive { color: #c53030; font-weight: 600; }
.pr-payroll-table .tone-negative { color: #2b6cb0; font-weight: 600; }
.pr-badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: #edf2f7; color: #4a5568;
}
.pr-badge.is-empty { background: #fff5f5; color: #c53030; }
.pr-badge.is-partial { background: #fffaf0; color: #c05621; }
.pr-badge.is-done { background: #f0fff4; color: #276749; }

@media (max-width: 768px) {
  .pr-split { grid-template-columns: 1fr; }
  .pr-split.is-mobile-detail .pr-tree-pane { display: none; }
  .pr-split:not(.is-mobile-detail) .pr-detail-pane { display: none; }
  .pr-mobile-back {
    display: inline-flex;
    margin-bottom: 10px;
  }
}
