/* ════════════════════════════════════════════════════════════════════
   T-Go-Hub v18.9.0 — Q2 + Q4 + Q5 Features
   ────────────────────────────────────────────────────────────────────
   Q2 — Reject reason modal
   Q4 — Revision history (enhanced)
   Q5 — BD KPI Dashboard
   ════════════════════════════════════════════════════════════════════ */

/* ─── Q2: REJECT MODAL ─────────────────────────────────────── */
.reject-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  animation: rejectFadeIn 0.15s ease-out;
}
@keyframes rejectFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.reject-modal-box {
  background: #fff;
  border-radius: 14px;
  width: 92%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: rejectSlideIn 0.2s ease-out;
}
@keyframes rejectSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.reject-modal-header {
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  padding: 16px 20px;
  border-bottom: 1px solid #FCA5A5;
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700;
  color: #991B1B;
}
.reject-modal-body {
  padding: 18px 20px;
}
.reject-modal-footer {
  padding: 12px 20px;
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
  display: flex; justify-content: flex-end; gap: 10px;
}

/* แถวเหตุผลปฏิเสธในหน้า approval */
.apr-reject-reason {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 8px 12px;
  background: #FEF2F2;
  border-left: 3px solid var(--rd, #ef4444);
  border-radius: 4px;
  font-size: 13px;
  color: #7f1d1d;
  line-height: 1.5;
}

/* ─── Q4: REVISION HISTORY (enhanced) ──────────────────────── */
.rev-history-box {
  margin: 10px 0;
  background: #F8F7F4;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 8px 14px;
}
.rev-history-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--mu, #6b7280);
  padding: 4px 0;
}
.rev-history-summary:hover {
  color: #1f2937;
}
.rev-history-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rev-history-row {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.rev-history-row:hover {
  border-color: var(--bl, #3b82f6);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.08);
}
.rev-history-row.rev-current {
  background: var(--gnl, #DCFCE7);
  border-color: var(--gn, #10b981);
  cursor: default;
}
.rev-history-row.rev-current:hover {
  box-shadow: none;
}
.rev-history-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.rev-history-rev {
  background: #1f2937;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  min-width: 36px;
  text-align: center;
}
.rev-history-row.rev-current .rev-history-rev {
  background: var(--gn, #10b981);
}
.rev-history-code {
  font-family: monospace;
  font-weight: 500;
  color: #4b5563;
}
.rev-history-date {
  color: var(--mu, #6b7280);
  font-size: 12px;
}
.rev-history-current {
  color: var(--gn, #10b981);
  font-weight: 600;
  margin-left: auto;
}
.rev-history-link {
  color: var(--bl, #3b82f6);
  font-size: 12px;
  margin-left: auto;
}
.rev-history-amounts {
  margin-top: 6px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--mu, #6b7280);
  padding-left: 4px;
}
.rev-history-reason {
  margin-top: 6px;
  font-size: 12px;
  font-style: italic;
}

/* ─── Q5: BD KPI DASHBOARD ─────────────────────────────────── */
.bd-kpi-period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
}

.bd-kpi-team-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.bd-kpi-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px 16px;
}
.bd-kpi-card-label {
  font-size: 12px;
  color: var(--mu, #6b7280);
  margin-bottom: 6px;
  font-weight: 500;
}
.bd-kpi-card-value {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}
.bd-kpi-card-value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--mu, #6b7280);
}
.bd-kpi-card-desc {
  font-size: 11px;
  color: var(--mu, #6b7280);
  margin-top: 4px;
}

.bd-kpi-table-wrap {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.bd-kpi-legend {
  background: #FFFBEB;
  border: 1px solid #FBBF24;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: #78350F;
  line-height: 1.6;
}
.bd-kpi-legend ul {
  margin: 6px 0 0;
  padding-left: 22px;
}
.bd-kpi-legend li {
  margin-bottom: 3px;
}

/* responsive: บนจอเล็ก */
@media (max-width: 800px) {
  .bd-kpi-team-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .bd-kpi-card-value {
    font-size: 22px;
  }
  .bd-kpi-period-bar {
    flex-wrap: wrap;
  }
}
@media (max-width: 480px) {
  .rev-history-amounts {
    flex-direction: column;
    gap: 4px;
  }
}
