/* =========================================================
   LIT CRM – Lead Management
   Theme-aligned styling
   ========================================================= */

body[data-page="leadmanagement.php"] {
  background-color: #f8fafc;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ------------------ PAGE HEAD ------------------ */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  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 {
  margin-top: 6px;
  font-size: 15px;
  color: #64748b;
}

/* ------------------ MAIN GRID ------------------ */
.lm-grid {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* ------------------ CARDS ------------------ */
.lm-card {
  background: #fff;
  border: 1px solid rgba(226,232,240,.85);
  border-radius: 18px;
  box-shadow: 0 3px 10px rgba(0,0,0,.04);
  overflow: hidden;
}

.lm-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.lm-card .card-body {
  padding: 18px 20px 20px;
}

/* ------------------ FORM ------------------ */
.lm-form-grid {
  display: grid;
  gap: 14px;
}

.lm-span-2 {
  grid-column: 1 / -1;
}

.lm-form-grid .input,
.lm-form-grid textarea.input,
.lm-form-grid select.input {
  width: 100%;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  color: #0f172a;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.lm-form-grid .input:focus,
.lm-form-grid textarea.input:focus,
.lm-form-grid select.input:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}

/* Multi select */
#lmAllowedAssignees,
.lm-inline-select[multiple] {
  min-height: 120px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.lm-help {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.45;
}

.lm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.lm-status {
  color: #64748b;
  font-size: 13px;
}

.lm-status.is-error {
  color: #b91c1c;
}

.lm-status.is-success {
  color: #047857;
}

/* ------------------ TABLE ------------------ */
.lm-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}

.lm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.lm-table th {
  text-align: left;
  padding: 12px 14px;
  background: #f9fafb;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: 12px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.lm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f5;
  color: #0f172a;
  vertical-align: top;
}

.lm-table tr:hover {
  background: #f9fafb;
}

.lm-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(20,184,166,.10);
  border-color: rgba(20,184,166,.20);
  color: #0f766e;
}

.lm-badge.is-muted {
  background: rgba(148,163,184,.12);
  border-color: rgba(148,163,184,.22);
  color: #475569;
}

/* Inline controls inside table */
.lm-inline-select {
  min-width: 210px;
  max-width: 100%;
}

.lm-inline-select[multiple] {
  min-width: 240px;
  min-height: 110px;
}

.lm-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lm-empty {
  color: #94a3b8;
  font-size: 14px;
  padding: 14px 0;
}

/* ------------------ MODAL ------------------ */
.lm-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lm-modal[hidden] {
  display: none !important;
}

.lm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.58);
}

.lm-modal-card {
  position: relative;
  width: min(1120px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
  border: 1px solid rgba(226,232,240,.9);
}

.lm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid #eef2f7;
}

.lm-modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.lm-modal-body {
  padding: 18px 20px 20px;
}

.lm-modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: #475569;
}

/* ------------------ LEADS GRID ------------------ */
.lm-leads-grid {
  display: grid;
  gap: 12px;
}

.lm-lead-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
}

.lm-lead-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.lm-lead-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.lm-lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 13px;
}

.lm-lead-meta span:not(:last-child)::after {
  content: "•";
  margin-left: 14px;
  color: #cbd5e1;
}

/* ------------------ RESPONSIVE ------------------ */
@media (max-width: 1100px) {
  .lm-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .lm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .lm-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .lm-card .card-header,
  .lm-card .card-body,
  .lm-modal-header,
  .lm-modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lm-row-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .lm-inline-select,
  .lm-inline-select[multiple] {
    width: 100%;
    min-width: 0;
  }

  .lm-lead-item-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .lm-lead-meta {
    flex-direction: column;
    gap: 6px;
  }

  .lm-lead-meta span:not(:last-child)::after {
    content: "";
    margin: 0;
  }
}