/* ─── STAT ROW ─── */

.stat-row { display: flex; gap: 16px; margin-bottom: 24px; }

.stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  min-height: 90px;
}

.stat-card-bottom { display: flex; flex-direction: column; gap: 3px; }

.stat-row-num { display: flex; align-items: center; gap: 8px; }

.stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label { color: var(--text-sec); font-size: 13px; }
.stat-sub   { font-size: 10px; color: var(--text-tert); }

/* ─── FLAT LEAD ROWS ─── */

.leads { display: flex; flex-direction: column; gap: 10px; }

.lead-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.lead-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.25);
}

.lead-row.is-live { border-left: 3px solid var(--green); background: var(--green-dim); }

.lead-id         { flex: 0 0 180px; min-width: 0; }
.lead-note-area  { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }

.lead-note-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--text-sec);
  font-size: 13px;
}

.lead-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.sms-sent   { color: var(--green); font-size: 12px; font-weight: 500; }
.chev       { color: var(--text-tert); font-size: 12px; }

/* ─── ACCORDION LEAD CARDS ─── */

.leads-cards { display: flex; flex-direction: column; gap: 8px; }

.lead-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}

.lead-card.is-live { border-left: 3px solid var(--green); background: var(--green-dim); }
.lead-card.is-done { border-left: 3px solid var(--border); }

/* ─── LEAD CARD EDGE COLOURS (after is-live/is-done to win cascade) ─── */
.lead-card.edge-green     { border-left: 3px solid var(--green);         }
.lead-card.edge-urgent    { border-left: 3px solid var(--tag-urgent);    }
.lead-card.edge-quote     { border-left: 3px solid var(--tag-quote);     }
.lead-card.edge-general   { border-left: 3px solid var(--border);        }
.lead-card.edge-cold      { border-left: 3px solid var(--tag-cold);      }
.lead-card.edge-complaint { border-left: 3px solid var(--tag-complaint); }
.lead-card.edge-callback  { border-left: 3px solid var(--tag-callback);  }

.lead-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.25);
}

.lead-collapsed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.lead-collapsed:hover { background: rgba(255,255,255,0.018); }

.lead-collapsed-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lead-collapsed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.lead-info  { flex: 1; min-width: 0; }

.lead-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-phone {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-tert);
  margin-bottom: 3px;
}

.lead-note {
  font-size: 12px;
  color: var(--text-sec);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.status-pill {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 500;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}

.status-pill.new      { background: rgba(34,197,94,0.12); color: var(--green);     }
.status-pill.sms-sent { background: var(--green-dim);     color: var(--green);     }
.status-pill.pending  { background: var(--surface-hi);    color: var(--text-tert); }
.status-pill.failed   { background: var(--tag-urgent-bg); color: var(--red);       }
.status-pill.complete { background: var(--surface-hi);    color: var(--text-tert); }

/* ─── PROGRESSION STATUS ─── */

.lead-prog {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

.lead-prog.prog-urgent    { color: var(--red); }
.lead-prog.prog-complaint { color: var(--tag-complaint); }
.lead-prog.prog-replied   { color: var(--green); }
.lead-prog.prog-complete  { color: var(--text-tert); }
.lead-prog.prog-default   { color: var(--text-tert); }

.lead-time { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-tert); white-space: nowrap; }

.lead-chevron {
  color: var(--text-tert);
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ─── EXPANDED STATE ─── */

.lead-expanded {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface-hi);
  padding: 14px;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin-bottom: 14px;
}

.detail-label { font-size: 11px; color: var(--text-tert); margin-bottom: 2px; }

.detail-value { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-primary); }

.detail-value a       { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.detail-value a:hover { color: var(--accent-hi); }

.lead-actions { display: flex; gap: 8px; }

/* ─── REPLY SECTION ─── */

.reply-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-bottom: 12px;
}

.reply-text { font-size: 12px; color: var(--text-sec); margin-top: 4px; line-height: 1.5; }

/* ─── DATA TABLE ─── */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tert);
  text-align: left;
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.td-name    { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.td-phone   { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-tert); white-space: nowrap; }
.td-enquiry { font-size: 12px; color: var(--text-sec); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-source  { font-size: 11px; color: var(--text-tert); white-space: nowrap; }
.td-time    { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-tert); white-space: nowrap; }
.td-masked  { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-sec); white-space: nowrap; }
.td-msg     { font-size: 12px; color: var(--text-sec); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── STATUS ROWS (Settings) ─── */

.status-row {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
}

.status-row-name { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 3px; }
.status-row-desc { font-size: 12px; color: var(--text-sec); }

.system-health {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tert);
  margin-top: 16px;
  margin-bottom: 24px;
}

/* ─── SETTINGS ─── */

.settings-subheader { font-size: 12px; color: var(--text-sec); margin-bottom: 16px; }

.settings-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-field:last-of-type { border-bottom: none; }
.settings-label { font-size: 11px; color: var(--text-tert); }
.settings-value { font-size: 13px; color: var(--text-primary); }

.settings-note { font-size: 10px; color: var(--text-tert); font-style: italic; margin-top: 16px; }

/* ─── SETTINGS V2 ─── */

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.setting-row {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
}

.setting-sub-row {
  background: var(--surface-hi);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-left: 20px;
}

.setting-text        { flex: 1; min-width: 0; }
.setting-name        { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 3px; }
.setting-desc        { font-size: 12px; color: var(--text-sec); line-height: 1.4; }

.setting-input {
  background: var(--bg-card, #1a1a1a);
  color: var(--text-primary, #e8e2d9);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  width: 140px;
  outline: none;
}
.setting-input:focus {
  border-color: var(--accent, #FF4D00);
}

.quiet-hours-inputs  { display: flex; gap: 20px; align-items: flex-end; flex-shrink: 0; }

.time-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-label > span {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tert);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.time-label input[type="time"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
  width: 100px;
}

.time-label input[type="time"]:focus { border-color: var(--accent); }

@media (max-width: 480px) {
  .setting-sub-row     { flex-direction: column; align-items: flex-start; }
  .quiet-hours-inputs  { gap: 12px; }
}
