/* LIT CRM - Opportunities module */

body[data-page="opportunities.php"] {
  background-color: #f8fafc;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.page-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

.page-head .muted {
  font-size: 15px;
  color: #64748b;
}

.opp-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 18px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.opp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 22px;
  align-items: start;
}

.opp-top-grid {
  margin-bottom: 20px;
}

.opp-top-grid {
  align-items: stretch;
}

.opp-top-grid .opp-col {
  height: 100%;
}

.opp-top-grid .opp-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.opp-top-grid .opp-card .card-body {
  flex: 1;
}

.opp-upcoming-card {
  margin-bottom: 20px;
}

.opp-col {
  display: grid;
  gap: 22px;
}

.opp-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.opp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.opp-section-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.opp-dev-cleanup-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.24);
  color: #0369a1;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.opp-section-header[role="button"] {
  cursor: pointer;
}

.opp-section-header[role="button"]:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.28);
  outline-offset: -3px;
}

.opp-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.opp-card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.opp-card .card-body {
  padding: 18px 20px 20px;
}

.opp-dev-cleanup-toolbar {
  display: grid;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
}

.opp-dev-cleanup-summary,
.opp-dev-cleanup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.opp-dev-cleanup-summary {
  color: #475569;
  font-size: 12px;
}

.opp-dev-cleanup-summary strong {
  color: #0f172a;
  font-size: 13px;
}

.opp-dev-cleanup-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.opp-dev-cleanup-actions .btn,
.opp-dev-lead-tools .btn {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.opp-dev-cleanup-status {
  min-height: 18px;
  color: #64748b;
  font-size: 12px;
}

.opp-dev-cleanup-status.is-error {
  color: #b91c1c;
  font-weight: 700;
}

.opp-dev-lead-row {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.opp-dev-lead-row + .opp-dev-lead-row {
  margin-top: 12px;
}

.opp-dev-lead-row .opp-item + .opp-item {
  margin-top: 0;
}

.opp-dev-lead-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.opp-dev-lead-tools.is-compact {
  align-content: center;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.opp-dev-lead-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.opp-dev-lead-select input {
  width: 16px;
  height: 16px;
}

.opp-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
}

.opp-item + .opp-item {
  margin-top: 12px;
}

.opp-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.opp-item-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.opp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(20, 184, 166, 0.12);
  color: #0f766e;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.opp-badge-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.2);
}

.opp-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 13px;
}

.opp-item-meta span {
  position: relative;
}

.opp-item-meta span:not(:last-child)::after {
  content: "•";
  margin-left: 14px;
  color: #cbd5e1;
}

#oppNewLeads .muted,
#oppAppointmentsToday .muted,
#oppPendingCustomers .muted,
#oppPriorityItems .muted {
  color: #94a3b8;
  font-size: 14px;
}

.opp-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.opp-link:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.opp-latest-lead {
  position: relative;
  border-color: rgba(20, 184, 166, 0.32);
  background: #f8fffd;
}

.opp-latest-lead::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  border: 1px solid rgba(20, 184, 166, 0.24);
  opacity: .75;
}

.opp-hot-lead {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  background:
    radial-gradient(circle at 12% 10%, rgba(20, 184, 166, 0.16), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #f0fdfa 54%, #f8fafc 100%);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(255,255,255,.6) inset;
}

.opp-hot-lead.is-live {
  animation: oppHotLeadPulse 2.45s ease-in-out infinite;
}

.opp-hot-lead.is-live .opp-hot-kicker {
  animation: oppHotBadgePulse 2.45s ease-in-out infinite;
}

.opp-hot-lead:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.32);
  outline-offset: 3px;
}

.opp-hot-lead-top,
.opp-hot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.opp-hot-kicker {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #0f766e;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .2);
}

.opp-hot-badges,
.opp-hot-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.opp-source-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  background: rgba(239, 246, 255, .86);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.opp-hot-main h3 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
}

.opp-hot-main p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}

.opp-hot-chip {
  display: inline-grid;
  gap: 2px;
  min-width: 106px;
  border-radius: 14px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255,255,255,.76);
}

.opp-hot-chip span {
  color: #64748b;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.opp-hot-chip strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.2;
  word-break: break-word;
}

.opp-hot-open {
  box-shadow: 0 12px 22px rgba(20, 184, 166, 0.22);
}

.opp-hot-view-all {
  border: 0;
  background: transparent;
  color: #0f766e;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  padding: 8px 2px;
}

.opp-hot-view-all:hover {
  color: #0f172a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.opp-hot-footnote {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.opp-expanded-leads {
  display: grid;
  gap: 12px;
}

.opp-expanded-leads .opp-item + .opp-item {
  margin-top: 0;
}

.opp-compact-lead {
  background: #fff;
}

.opp-leads-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  flex-wrap: wrap;
}

.opp-leads-helper {
  color: #64748b;
  font-size: 13px;
}

.opp-leads-toggle {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  color: #0f172a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 14px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.opp-leads-toggle:hover {
  border-color: #14b8a6;
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.12);
  transform: translateY(-1px);
}

@keyframes oppHotLeadPulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08), 0 0 0 0 rgba(20, 184, 166, 0.28);
  }
  42% {
    transform: translateY(-2px) scale(1.006);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.1), 0 0 0 8px rgba(20, 184, 166, 0);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08), 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

@keyframes oppHotBadgePulse {
  0%, 100% {
    filter: brightness(1);
  }
  45% {
    filter: brightness(1.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .opp-hot-lead.is-live,
  .opp-hot-lead.is-live .opp-hot-kicker,
  .opp-latest-lead,
  .opp-link,
  .opp-leads-toggle {
    animation: none;
    transition: none;
  }
}

.opp-collapsed {
  display: none !important;
}

@media (max-width: 1100px) {
  .opp-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .opp-card .card-body,
  .opp-card .card-header {
    padding-left: 16px;
    padding-right: 16px;
  }

  .opp-item {
    padding: 12px 14px;
  }

  .opp-item-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .opp-item-meta {
    flex-direction: column;
    gap: 6px;
  }

  .opp-item-meta span:not(:last-child)::after {
    content: "";
    margin: 0;
  }

  .opp-card-header-flex {
    align-items: flex-start;
    flex-direction: column;
  }

  .opp-hot-main h3 {
    font-size: 21px;
  }

  .opp-hot-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .opp-dev-lead-row {
    grid-template-columns: 1fr;
  }

  .opp-dev-cleanup-actions .btn,
  .opp-dev-lead-tools .btn {
    width: 100%;
    justify-content: center;
  }
}

.opp-legend-card { margin-bottom: 18px; }
.opp-legend-card .card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
