/* ── BACK BUTTON ── */
.lap-detail-back-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-hover);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}
/* ── FILTER HEADER ── */
.rekap-dist-filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  position: relative;
}

.rekap-dist-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.rekap-dist-filter-btn:hover {
  background: var(--brand-light);
}

.rekap-dist-dropdown {
  position: fixed;
  z-index: 3000;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  min-width: 140px;
  max-height: 240px;
  overflow-y: auto;
}

.rekap-dist-dropdown-option {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border-card);
}
.rekap-dist-dropdown-option:last-child {
  border-bottom: none;
}
.rekap-dist-dropdown-option:hover {
  background: var(--brand-light);
}
.rekap-dist-dropdown-option.selected {
  font-weight: 700;
  color: var(--brand-primary);
}

.rekap-dist-skeleton { pointer-events: none; }
.skeleton-block {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-page) 50%, var(--bg-hover) 75%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-line {
  width: 100%;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── CARD HEADER + RELOAD BTN ── */
.rekap-dist-card-header {
  position: relative;
}
.rekap-dist-reload-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--bg-card);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rekap-dist-reload-btn:hover {
  background: var(--brand-pale);
  color: var(--brand-primary);
}
.rekap-dist-reload-btn.spinning i,
#rekapDistReloadBtn.spinning i {
  animation: rekapDistSpin 0.7s linear infinite;
}
@keyframes rekapDistSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── REKAP DISTRIBUSI GRID ── */
.rekap-dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 4px;
}

/* ── CARD ── */
.rekap-dist-card {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  height: auto;
}
.rekap-dist-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-card);
  background: var(--bg-hover);
}

.rekap-dist-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-pale);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  object-fit: cover;
}

.rekap-dist-nama {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.rekap-dist-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.rekap-dist-card-body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rekap-dist-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* ── TABLE ── */
.rekap-dist-table {
  width: 100%; border-collapse: collapse;
}

.rekap-dist-table th {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-card);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rekap-dist-table th:first-child {
  width: 33.33%;
  text-align: left;
}

.rekap-dist-table th:nth-child(2) {
  width: 33.33%;
  text-align: center;
}

.rekap-dist-table th:nth-child(3) {
  width: 33.33%;
  text-align: right;
}
#assetsPenyusutanInput {
  width: 100% !important;
  max-width: 160px !important;
}

.rekap-dist-table td {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-card);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rekap-dist-table td:first-child {
  text-align: left;
}

.rekap-dist-table td:nth-child(2) {
  text-align: center;
}

.rekap-dist-table td:nth-child(3) {
  text-align: right;
}

.rekap-dist-table tr:last-child td {
  border-bottom: none;
}
.rekap-dist-saldo-kas-group {
  grid-column: 1 / -1;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rekap-dist-saldo-kas-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.rekap-dist-saldo-kas-final {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-primary);
}

/*chart*/
.rekap-dist-chart-wrap {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-card);
  padding: 16px;
}
.rekap-dist-chart-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.rekap-dist-chart-wrap canvas {
  max-height: 320px;
}

/* ── DETAIL WRAPPER KHUSUS REKAP DISTRIBUSI/ASSETS ── */
.rekap-dist-detail-wrapper {
  display: none !important;
  flex: 1 1 0%;
  padding: 0;
  background: var(--bg-page);
  overflow: hidden;
}
.rekap-dist-detail-wrapper.show {
  display: flex !important;
}
.rekap-dist-total-card {
  grid-column: 1 / -1;
}
.rekap-dist-detail-wrapper .lap-detail-panel {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
.rekap-dist-save-assets-btn {
  margin-left: auto;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: var(--brand-primary);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rekap-dist-save-assets-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.rekap-dist-saved-badge {
  margin-left: auto;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #2f7d32;
  background: rgba(47,125,50,0.12);
  padding: 5px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.rekap-dist-mode-toggle {
  margin-left: auto;
  display: flex;
  gap: 4px;
  background: var(--bg-page);
  border-radius: 8px;
  padding: 3px;
}
.rekap-dist-mode-btn {
  width: 30px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rekap-dist-mode-btn.active {
  background: var(--brand-primary);
  color: #fff;
}
.assets-tambah-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  border: 2px dashed var(--border-card);
  background: transparent;
}
.assets-tambah-btn {
  border: none;
  background: transparent;
  color: var(--brand-primary);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
}
.assets-extra-select-wrap {
  position: relative;
  flex: 1;
}
.assets-extra-input {
  height: 34px !important;
  width: 70px !important;
  border: 1px solid var(--border-card) !important;
  border-radius: 8px !important;
  padding: 0 8px !important;
  font-family: 'Poppins', sans-serif !important;
  font-size: 12px !important;
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  outline: none !important;
  text-align: right !important;
  box-sizing: border-box !important;
}
.assets-extra-select-btn {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.assets-extra-select-dd {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 20;
}
.assets-extra-select-opt {
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-card);
}
.assets-extra-select-opt:last-child { border-bottom: none; }
.assets-extra-select-opt:hover { background: var(--bg-hover); }
.assets-extra-remove-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(176,32,32,0.1);
  border-radius: 8px;
  color: #b02020;
  cursor: pointer;
  margin-left: 8px;
  flex-shrink: 0;
}
.assets-extra-card-hunter {
  background: var(--assets-hunter-bg);
  border-color: var(--assets-hunter-border);
}
.assets-extra-card-hunter .rekap-dist-card-header {
  background: var(--assets-hunter-header-bg);
}
.assets-extra-card-sales {
  background: var(--assets-sales-bg);
  border-color: var(--assets-sales-border);
}
.assets-extra-card-sales .rekap-dist-card-header {
  background: var(--assets-sales-header-bg);
}

/* ── PENYUSUTAN PER KURIR (+ / -) ── */
.assets-penyusutan-plus {
  color: #2f7d32 !important;
  font-weight: 800 !important;
}
.assets-penyusutan-minus {
  color: #c62828 !important;
  font-weight: 800 !important;
}
input.assets-penyusutan-plus {
  color: #2f7d32 !important;
}
input.assets-penyusutan-minus {
  color: #c62828 !important;
}

.assets-history-row { cursor: pointer; }
.assets-history-row:hover { background: rgba(0,0,0,0.03); }
.assets-history-chevron { font-size: 11px; margin-right: 6px; transition: transform .15s; color: #888; }
.assets-history-detail-table { margin: 6px 0 4px; }
.assets-history-chart-wrap {
  position: relative;
  width: 100%;
  height: 300px;
}
/* ── MOBILE ── */
@media (max-width: 768px) {
  .rekap-dist-grid {
    grid-template-columns: 1fr;
  }

  .rekap-dist-detail-wrapper {
    padding: 0;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--bg-page);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
  }
  .rekap-dist-detail-wrapper.show {
    display: flex !important;
    transform: translateX(0);
  }
  .rekap-dist-detail-wrapper .lap-detail-panel {
    border-radius: 0;
  }
}