/* Party Ledger */
:root {
  --pl-ink: #1a242c;
  --pl-muted: #5c6b76;
  --pl-line: #d5dde3;
  --pl-surface: rgba(255, 255, 255, 0.92);
  --pl-steel: #2f5263;
  --pl-steel-deep: #16222a;
  --pl-accent: #c45c26;
  --pl-credit: #1f6b4a;
  --pl-debit: #9b2c2c;
  --pl-soft: #e8eef2;
  --pl-radius: 10px;
  --pl-font: 'PT Sans', 'Tahoma', sans-serif;
}

.pl-page {
  font-family: var(--pl-font);
  color: var(--pl-ink);
  min-height: calc(100vh - 70px);
  padding: 28px 2% 48px;
  background:
    radial-gradient(1200px 480px at 8% -10%, rgba(47, 82, 99, 0.18), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(196, 92, 38, 0.10), transparent 50%),
    linear-gradient(180deg, #e9eef2 0%, #f4f6f8 42%, #eef2f5 100%);
  animation: plFadeIn 0.55s ease both;
}

@keyframes plFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes plRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes plPulseSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 82, 99, 0); }
  50% { box-shadow: 0 0 0 4px rgba(47, 82, 99, 0.12); }
}

.pl-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.pl-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(22, 34, 42, 0.12);
  margin-bottom: 22px;
  animation: plRise 0.6s 0.05s ease both;
}

.pl-hero-copy h1 {
  font-family: var(--pl-font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.3;
  margin: 0 0 8px;
  color: var(--pl-steel-deep);
  text-transform: none;
}

.pl-hero-copy p {
  margin: 0;
  max-width: 52ch;
  color: var(--pl-muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
}

.pl-hero-mark {
  flex-shrink: 0;
  text-align: right;
  color: var(--pl-steel);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  opacity: 0.85;
}

.pl-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(140px, 0.7fr)) auto;
  gap: 14px 16px;
  align-items: end;
  padding: 18px 20px;
  background: var(--pl-surface);
  border: 1px solid var(--pl-line);
  border-radius: var(--pl-radius);
  backdrop-filter: blur(8px);
  margin-bottom: 18px;
  animation: plRise 0.6s 0.12s ease both;
}

.pl-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--pl-muted);
}

.pl-field input[type="date"],
.pl-field select,
.pl-entry input,
.pl-entry select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--pl-line);
  border-radius: 8px;
  background: #fff;
  color: var(--pl-ink);
  font-family: var(--pl-font);
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.pl-field input:focus,
.pl-entry input:focus,
.pl-entry select:focus {
  outline: none;
  border-color: var(--pl-steel);
  box-shadow: 0 0 0 3px rgba(47, 82, 99, 0.15);
}

.pl-btn {
  height: 42px;
  padding: 0 22px;
  border: none;
  border-radius: 8px;
  font-family: var(--pl-font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: normal;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}

.pl-btn:active { transform: scale(0.98); }

.pl-btn-primary {
  background: linear-gradient(135deg, var(--pl-steel) 0%, var(--pl-steel-deep) 100%);
  color: #fff;
}

.pl-btn-primary:hover { opacity: 0.92; }

.pl-btn-ghost {
  background: transparent;
  color: var(--pl-muted);
  border: 1px solid var(--pl-line);
}

.pl-btn-ghost:hover {
  color: var(--pl-ink);
  border-color: #b7c2cb;
}

.pl-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--pl-line);
  border: 1px solid var(--pl-line);
  border-radius: var(--pl-radius);
  overflow: hidden;
  margin-bottom: 18px;
  animation: plRise 0.6s 0.18s ease both;
}

.pl-metric {
  background: #fff;
  padding: 16px 18px 18px;
  position: relative;
}

.pl-metric::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: transparent;
}

.pl-metric.is-out::after { background: var(--pl-accent); }
.pl-metric.is-paid::after { background: var(--pl-credit); }

.pl-metric .pl-k {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--pl-muted);
  margin-bottom: 8px;
}

.pl-metric .pl-v {
  font-family: var(--pl-font);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: normal;
  color: var(--pl-steel-deep);
  line-height: 1.2;
  transition: color 0.25s ease;
}

.pl-metric.is-out .pl-v { color: var(--pl-accent); }
.pl-metric.flash { animation: plPulseSoft 0.7s ease; }

.pl-workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  align-items: start;
  animation: plRise 0.65s 0.24s ease both;
}

.pl-panel {
  background: var(--pl-surface);
  border: 1px solid var(--pl-line);
  border-radius: var(--pl-radius);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.pl-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--pl-line);
}

.pl-panel-head h2 {
  margin: 0;
  font-family: var(--pl-font);
  font-size: 16px;
  font-weight: 700;
  color: var(--pl-steel-deep);
}

.pl-panel-head span {
  font-size: 0.78rem;
  color: var(--pl-muted);
}

.pl-entry {
  padding: 16px 18px 20px;
}

.pl-entry .pl-stack {
  display: grid;
  gap: 12px;
}

.pl-entry .pl-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pl-hint {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--pl-muted);
  line-height: 1.35;
}

.pl-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.pl-actions .pl-btn { flex: 1; }

.pl-table-wrap {
  padding: 8px 12px 16px;
}

.pl-table-wrap .dataTables_wrapper {
  font-family: var(--pl-font);
  color: var(--pl-ink);
}

.pl-table-wrap .dataTables_filter input,
.pl-table-wrap .dataTables_length select {
  border: 1px solid var(--pl-line);
  border-radius: 6px;
  padding: 4px 8px;
  height: 32px;
}

.pl-table-wrap .dt-buttons .dt-button {
  background: var(--pl-soft) !important;
  border: 1px solid var(--pl-line) !important;
  border-radius: 6px !important;
  color: var(--pl-ink) !important;
  font-family: var(--pl-font) !important;
  font-size: 0.78rem !important;
  padding: 5px 10px !important;
  box-shadow: none !important;
}

#abc {
  width: 100% !important;
  border-collapse: collapse;
}

#abc thead th {
  background: var(--pl-soft);
  color: var(--pl-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  border: none;
  border-bottom: 1px solid var(--pl-line);
  padding: 12px 10px;
  text-align: left;
}

#abc tbody td {
  border: none;
  border-bottom: 1px solid #eef2f5;
  padding: 11px 10px;
  font-size: 0.9rem;
  color: var(--pl-ink);
  background: #fff;
  vertical-align: middle;
}

#abc tbody tr:hover td {
  background: #f7fafb;
}

#abc tbody tr:nth-child(odd) td {
  background: #fcfdfe;
}

#abc tbody tr:nth-child(odd):hover td {
  background: #f7fafb;
}

.pl-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}

.pl-badge-pay { background: #e8f5ef; color: var(--pl-credit); }
.pl-badge-adj { background: #eef2f6; color: var(--pl-steel); }
.pl-badge-opn { background: #f8efe8; color: var(--pl-accent); }

.pl-drcr-c { color: var(--pl-credit); font-weight: 600; }
.pl-drcr-d { color: var(--pl-debit); font-weight: 600; }

.pl-act {
  display: inline-flex;
  gap: 6px;
}

.pl-actbtn {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--pl-line);
  background: #fff;
  font-family: var(--pl-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  cursor: pointer;
  color: var(--pl-ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pl-actbtn:hover { background: var(--pl-soft); }
.pl-actbtn.del {
  color: var(--pl-debit);
  border-color: #e8c5c5;
}
.pl-actbtn.del:hover { background: #fdf2f2; }

/* Select2 blend */
.pl-toolbar .select2-container { width: 100% !important; }
.pl-toolbar .select2-container--default .select2-selection--single {
  height: 42px;
  border: 1px solid var(--pl-line);
  border-radius: 8px;
  padding-top: 6px;
}
.pl-toolbar .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px;
}
.pl-toolbar .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--pl-steel);
}

.pl-empty-note {
  display: none;
  margin: 8px 18px 16px;
  padding: 12px 14px;
  background: #f7fafb;
  border-left: 3px solid var(--pl-steel);
  color: var(--pl-muted);
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .pl-workspace { grid-template-columns: 1fr; }
  .pl-metrics { grid-template-columns: repeat(2, 1fr); }
  .pl-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .pl-toolbar .pl-btn { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 560px) {
  .pl-hero { flex-direction: column; align-items: flex-start; }
  .pl-metrics { grid-template-columns: 1fr; }
  .pl-toolbar { grid-template-columns: 1fr; }
  .pl-entry .pl-row2 { grid-template-columns: 1fr; }
}

/* ── Ledger Outstanding report ── */
.plo-page .pl-hero-copy h1,
.plo-page .pl-panel-head h2,
.plo-page .pl-metric .pl-v {
  font-family: var(--pl-font);
  font-weight: 600;
  letter-spacing: normal;
}

.plo-page .pl-hero-copy h1 {
  font-size: 1.5rem;
}

.plo-page .pl-panel-head h2 {
  font-size: 1.05rem;
}

.plo-page .pl-metric .pl-v {
  font-size: 1.25rem;
}

.plo-page .pl-field label,
.plo-page .pl-metric .pl-k,
.plo-page .pl-hero-mark,
.plo-page #abc thead th,
.plo-page #abc tfoot th:first-child {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}

.plo-shell {
  max-width: 1360px;
}

.plo-toolbar {
  grid-template-columns: minmax(140px, 0.8fr) minmax(140px, 0.8fr) auto auto;
}

.plo-link-ledger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

.plo-panel {
  animation: plRise 0.65s 0.24s ease both;
}

.plo-table-wrap {
  padding: 10px 14px 18px;
}

#abc tfoot th {
  background: var(--pl-soft);
  border: none;
  border-top: 1px solid var(--pl-line);
  padding: 12px 10px;
  font-family: var(--pl-font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pl-steel-deep);
  text-align: right;
}

#abc tfoot th:first-child {
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-size: 13px;
  color: var(--pl-muted);
}

#abc .dt-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.plo-party {
  font-weight: 600;
  color: var(--pl-steel-deep);
}

.plo-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pl-amt-out {
  color: var(--pl-accent);
}

#abc tbody tr.plo-row-link {
  cursor: pointer;
  transition: background 0.15s ease;
}

#abc tbody tr.plo-row-link:hover td {
  background: #eef4f7 !important;
}

#abc tbody tr.plo-row-due td:last-child {
  box-shadow: inset 3px 0 0 var(--pl-accent);
}

#abc tbody tr.plo-row-credit td {
  background: #fdf6f6 !important;
}

#abc tbody tr.plo-row-credit:hover td {
  background: #fceeee !important;
}

#abc tbody tr.plo-row-credit td:last-child {
  box-shadow: inset 3px 0 0 var(--pl-credit);
}

/* FixedColumns blend with report chrome */
.DTFC_LeftWrapper table.dataTable thead th,
.DTFC_RightWrapper table.dataTable thead th {
  background: var(--pl-soft) !important;
}

.DTFC_LeftWrapper table.dataTable tbody td,
.DTFC_RightWrapper table.dataTable tbody td {
  background: #fff;
  border-bottom: 1px solid #eef2f5;
}

@media (max-width: 980px) {
  .plo-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .plo-toolbar .pl-btn,
  .plo-toolbar .plo-link-ledger {
    grid-column: span 1;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .plo-toolbar {
    grid-template-columns: 1fr;
  }
  .plo-toolbar .pl-btn,
  .plo-toolbar .plo-link-ledger {
    grid-column: 1;
  }
}
