/* E-Sevai Reports Hub */
#esReportsSection.es-rep-hub {
  --es-rep-accent: #0d9488;
  --es-rep-ink: #0f172a;
  --es-rep-muted: #64748b;
  --es-rep-line: #e2e8f0;
  padding: 12px 14px 28px;
  max-width: 1180px;
  margin: 0 auto;
}

.es-rep-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.es-rep-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 1000;
  color: var(--es-rep-ink);
}

.es-rep-head p {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--es-rep-muted);
}

.es-rep-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  background: #fff;
  border: 1px solid var(--es-rep-line);
  border-radius: 14px;
  padding: 10px 12px;
}

.es-rep-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  font-weight: 900;
  color: var(--es-rep-muted);
  text-transform: uppercase;
}

.es-rep-filters input,
.es-rep-filters select {
  border: 1px solid var(--es-rep-line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  min-width: 132px;
  background: #f8fafc;
}

.es-rep-filters .btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  background: var(--es-rep-accent);
  color: #fff;
}

.es-rep-filters .btn--ghost {
  background: #f1f5f9;
  color: var(--es-rep-ink);
}

.es-rep-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.es-rep-card {
  border: 1px solid var(--es-rep-line);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.es-rep-card:hover {
  border-color: #5eead4;
  box-shadow: 0 10px 24px -16px rgba(13, 148, 136, 0.45);
  transform: translateY(-1px);
}

.es-rep-card.is-active {
  border-color: var(--es-rep-accent);
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 70%);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.18);
}

.es-rep-card__n {
  font-size: 11px;
  font-weight: 1000;
  color: var(--es-rep-accent);
  margin-bottom: 4px;
}

.es-rep-card__t {
  font-size: 14px;
  font-weight: 1000;
  color: var(--es-rep-ink);
  margin-bottom: 4px;
}

.es-rep-card__d {
  font-size: 11px;
  font-weight: 700;
  color: var(--es-rep-muted);
  line-height: 1.4;
}

.es-rep-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.es-rep-kpi {
  background: #fff;
  border: 1px solid var(--es-rep-line);
  border-radius: 12px;
  padding: 10px 12px;
}

.es-rep-kpi__k {
  font-size: 10px;
  font-weight: 900;
  color: var(--es-rep-muted);
  text-transform: uppercase;
}

.es-rep-kpi__v {
  font-size: 18px;
  font-weight: 1000;
  color: var(--es-rep-ink);
  margin-top: 2px;
}

.es-rep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.es-rep-actions .btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  background: #0f766e;
  color: #fff;
}

.es-rep-actions .btn--pdf {
  background: #1e293b;
}

.es-rep-actions .btn--ghost {
  background: #e2e8f0;
  color: #0f172a;
}

.es-rep-panel {
  background: #fff;
  border: 1px solid var(--es-rep-line);
  border-radius: 16px;
  padding: 12px;
  overflow: auto;
  max-height: min(62vh, 720px);
}

.es-rep-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 1000;
  color: var(--es-rep-ink);
}

.es-rep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.es-rep-table th,
.es-rep-table td {
  padding: 8px 8px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: top;
}

.es-rep-table th {
  font-size: 10px;
  font-weight: 900;
  color: var(--es-rep-muted);
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

.es-rep-table td.num,
.es-rep-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.es-rep-empty {
  padding: 28px;
  text-align: center;
  color: var(--es-rep-muted);
  font-weight: 800;
}

.es-rep-note {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--es-rep-muted);
}

@media (max-width: 640px) {
  .es-rep-filters input,
  .es-rep-filters select {
    min-width: 0;
    width: 100%;
  }
  .es-rep-filters label {
    flex: 1 1 140px;
  }
}

/* Clickable agent name in report table */
.es-rep-agent-link {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 1000;
  color: #0f766e;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-align: left;
}
.es-rep-agent-link:hover {
  color: #115e59;
}

/* ── Agent dossier (full history) — must live on body, above app chrome ── */
.es-ag-dossier {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 20050 !important;
  width: 100vw !important;
  height: 100dvh !important;
}
.es-ag-dossier.is-open {
  display: block !important;
}
.es-ag-dossier__bg {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}
.es-ag-dossier__sheet {
  position: absolute;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100%;
  background: linear-gradient(165deg, #ecfdf5 0%, #f8fafc 28%, #ffffff 55%);
  box-shadow: -18px 0 48px -20px rgba(15, 23, 42, 0.35);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: es-ag-slide 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes es-ag-slide {
  from {
    transform: translateX(18px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.es-ag-hero {
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 55%, #2dd4bf 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.es-ag-hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.es-ag-hero__close {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 1000;
  cursor: pointer;
  line-height: 1;
}
.es-ag-hero__name {
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.es-ag-hero__meta {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.92;
}
.es-ag-hero__bal {
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 12px 14px;
}
.es-ag-hero__bal-k {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0.9;
}
.es-ag-hero__bal-v {
  font-size: 28px;
  font-weight: 1000;
  letter-spacing: -0.03em;
  line-height: 1;
}
.es-ag-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.es-ag-hero__actions button {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  background: #fff;
  color: #0f766e;
}
.es-ag-hero__actions button.es-ag-ghost {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.es-ag-body {
  padding: 14px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.es-ag-today {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.es-ag-pill {
  background: #fff;
  border: 1px solid #d1fae5;
  border-radius: 14px;
  padding: 12px 10px;
  box-shadow: 0 8px 18px -14px rgba(15, 118, 110, 0.35);
}
.es-ag-pill__k {
  font-size: 10px;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
}
.es-ag-pill__v {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 1000;
  color: #0f172a;
}
.es-ag-pill--warn {
  border-color: #fdba74;
  background: #fff7ed;
}
.es-ag-pill--warn .es-ag-pill__v {
  color: #c2410c;
}
.es-ag-pill--ok .es-ag-pill__v {
  color: #15803d;
}

.es-ag-sec {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
}
.es-ag-sec__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.es-ag-sec__hd h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 1000;
  color: #0f172a;
}
.es-ag-sec__hd span {
  font-size: 11px;
  font-weight: 800;
  color: #0d9488;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 3px 8px;
}

.es-ag-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.es-ag-item:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}
.es-ag-item__t {
  font-size: 13px;
  font-weight: 900;
  color: #0f172a;
}
.es-ag-item__s {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  grid-column: 1 / 2;
}
.es-ag-item__amt {
  font-size: 13px;
  font-weight: 1000;
  color: #0f172a;
  text-align: right;
  white-space: nowrap;
}
.es-ag-item__amt.is-due {
  color: #c2410c;
}
.es-ag-item__amt.is-paid {
  color: #15803d;
}
.es-ag-item__tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 1000;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
  background: #e2e8f0;
  color: #475569;
}
.es-ag-item__tag--pending {
  background: #ffedd5;
  color: #c2410c;
}
.es-ag-item__tag--paid {
  background: #dcfce7;
  color: #166534;
}
.es-ag-item__tag--collect {
  background: #dbeafe;
  color: #1d4ed8;
}
.es-ag-item__tag--work {
  background: #fef3c7;
  color: #92400e;
}

.es-ag-empty {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #94a3b8;
  border: 1px dashed #e2e8f0;
  border-radius: 12px;
}

@media (max-width: 480px) {
  .es-ag-today {
    grid-template-columns: 1fr;
  }
  .es-ag-dossier__sheet {
    width: 100%;
  }
}
