/* ==========================================================================
   pds Tech CRM — styled to match the pds Tech Brand Guidelines v1.4
   ========================================================================== */

:root {
  --ink: #12203a;
  --paper: #f7f6f2;
  --accent: #1e9e8c;
  --accent-text: #2bb8a3;
  --accent-dark: #147567;
  --muted: #c3c9d6;
  --line: rgba(247, 246, 242, 0.14);
  --line-soft: rgba(247, 246, 242, 0.16);
  --card: rgba(247, 246, 242, 0.045);
  --card-strong: rgba(247, 246, 242, 0.06);

  --font-display: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100vh; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 140% 40% at 50% 0%, #123a3f 0%, rgba(18, 58, 63, 0) 60%),
    linear-gradient(180deg, #060c18 0%, #0a1c2e 30%, #0b2830 62%, #0e332f 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; color: var(--paper); margin: 0; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
p { color: var(--muted); margin: 0; }

.hidden { display: none !important; }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
  letter-spacing: 0.01em;
  margin: 14px 0 4px;
}

.muted { color: var(--muted); font-size: 0.85em; }
.error { color: #f2879e; font-size: 0.9em; min-height: 1.2em; }
.success { color: var(--accent-text); font-size: 0.9em; min-height: 1.2em; }

/* --------------------------------- Modal ---------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 24, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  width: 320px;
  /* Override .card's near-transparent background — a modal floats over
     busy page content, not the plain page gradient, so it needs to be
     legible on its own rather than letting content behind it show through. */
  background: #0d1522;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}
.modal-box input,
.modal-box select,
.modal-box textarea {
  width: 100%;
  padding: 11px 12px;
  margin: 8px 0;
  background: rgba(6, 12, 24, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  color: var(--paper);
  font-family: var(--font-body);
}
.modal-box textarea { resize: vertical; }
.modal-box select { cursor: pointer; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* --------------------------------- Card ---------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

/* -------------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #0a1220; }
.btn-primary:hover { background: #3dd9c4; }
.btn-outline { background: transparent; color: var(--paper); border-color: var(--line-soft); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; margin-top: 14px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

.link-btn {
  display: inline-block;
  margin-top: 10px;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-text);
  font-size: 0.85em;
  text-decoration: underline;
  cursor: pointer;
  font-family: var(--font-body);
}
.link-btn:hover { color: var(--accent); }

/* ---------------------------------- Login --------------------------------- */
#login-view, #reset-password-view {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.login-box { width: 340px; text-align: left; }
.login-box .logo-img { margin-bottom: 4px; }

.login-box input {
  width: 100%;
  padding: 11px 12px;
  margin: 8px 0;
  background: rgba(6, 12, 24, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  color: var(--paper);
  font-family: var(--font-body);
}
.login-box input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ----------------------------------- Nav ---------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(6, 12, 24, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-text);
  flex: 1;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 28px; }

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------- Funnel --------------------------------- */
.funnel-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.funnel-col {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 220px;
}

.funnel-col h3 {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.deal-card {
  background: rgba(6, 12, 24, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.deal-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.deal-card .amount { color: var(--accent-text); font-size: 0.85em; margin-top: 4px; }

/* --------------------------------- Deal view -------------------------------- */
#deal-section h2 { margin: 6px 0 18px; }

.deal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

#interaction-list { list-style: none; padding: 0; margin: 0; }

#interaction-list li {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 14px;
}
#interaction-list li:last-child { border-bottom: none; }
#interaction-list li strong { color: var(--accent-text); text-transform: capitalize; }

.ai-output {
  white-space: pre-wrap;
  font-family: var(--font-body);
  background: rgba(6, 12, 24, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 14px;
  min-height: 100px;
  color: var(--paper);
  font-size: 14px;
}

#back-btn, .back-link {
  background: transparent;
  border: none;
  color: var(--accent-text);
  cursor: pointer;
  padding: 0 0 14px 0;
  font-size: 0.95em;
  font-weight: 600;
  display: inline-block;
}

#leads-section > p { margin-bottom: 18px; }

.lead-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.lead-card .lead-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.lead-card .lead-who { font-weight: 700; color: var(--paper); }
.lead-card .lead-email { color: var(--accent-text); font-size: 0.85em; }
.lead-card .lead-meta { color: var(--muted); font-size: 0.8em; margin-top: 4px; }
.lead-card .lead-preview { margin-top: 10px; font-size: 13.5px; color: var(--muted); max-height: 3.2em; overflow: hidden; }
.lead-card .lead-enrichment {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  background: rgba(30, 158, 140, 0.08);
  font-size: 13px;
  color: var(--paper);
}
.lead-card .lead-enrichment strong { color: var(--accent-text); display: block; margin-bottom: 3px; }
.lead-card .lead-actions, .row-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.lead-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(30, 158, 140, 0.15);
  color: var(--accent-text);
}
.lead-status.discarded { background: rgba(247, 246, 242, 0.08); color: var(--muted); }
.lead-status.converted { background: rgba(30, 158, 140, 0.3); }

.inline-new-company {
  display: flex;
  gap: 6px;
  margin: -4px 0 10px;
}
.inline-new-company input {
  flex: 1;
  margin: 0 !important;
}

.brief-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#suggested-matches-section {
  background: rgba(224, 161, 60, 0.06);
  border: 1px solid rgba(224, 161, 60, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}
#suggested-matches-section h3 { color: #e0a13c; margin-top: 0; }

.suggestion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.suggestion-row:first-of-type { border-top: none; }
.suggestion-row .suggestion-actions { display: flex; gap: 8px; flex-shrink: 0; }

.funnel-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
#funnel-selector {
  background: rgba(6, 12, 24, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  color: var(--accent-text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 10px;
}

.company-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.company-row .company-name { font-weight: 700; color: var(--paper); }
.company-row .company-meta { color: var(--muted); font-size: 0.85em; margin-top: 4px; }
.company-row .company-notes { color: var(--muted); font-size: 0.85em; margin-top: 6px; max-width: 480px; }

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.contact-row .contact-name { font-weight: 700; color: var(--paper); }
.contact-row .contact-meta { color: var(--muted); font-size: 0.85em; margin-top: 4px; }
.contact-row { flex-wrap: wrap; }
.contact-row .contact-actions { display: flex; gap: 8px; flex-shrink: 0; }
.linkedin-badge {
  display: inline-block;
  color: var(--accent-text);
  font-size: 0.85em;
  margin-top: 4px;
}
.linkedin-note { color: var(--muted); font-size: 0.8em; margin-top: 3px; font-style: italic; }

.ai-research-block {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid #e0a13c;
  background: rgba(224, 161, 60, 0.08);
  font-size: 13px;
  color: var(--paper);
  white-space: pre-wrap;
}
.ai-research-block .ai-disclaimer { color: #e0a13c; font-weight: 600; display: block; margin-bottom: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.ai-research-sources { margin-top: 8px; font-size: 12px; }
.ai-research-sources a { color: var(--accent-text); margin-right: 10px; }
.ai-research-updated { color: var(--muted); font-size: 11px; margin-top: 6px; }

.list-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.list-controls input,
.list-controls select {
  background: rgba(6, 12, 24, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
}
.list-controls input { min-width: 220px; }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-tile { text-align: left; }
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--paper);
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.chart-legend .swatch { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

@media (max-width: 860px) {
  .stat-tiles { grid-template-columns: 1fr; }
  .dashboard-charts { grid-template-columns: 1fr; }
}

.deal-info-card { margin-bottom: 20px; }
.deal-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.deal-info-grid > div { display: flex; flex-direction: column; }
.deal-info-grid .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 3px;
}
.deal-info-grid > div > span:last-child { font-size: 14px; color: var(--paper); font-weight: 600; text-transform: capitalize; }

.callout {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 3px solid var(--accent);
  background: rgba(30, 158, 140, 0.08);
}
.callout strong { color: var(--accent-text); display: block; margin-bottom: 4px; }
.callout p { color: var(--paper); margin: 0; }

.deal-contact-chip {
  display: inline-block;
  background: rgba(6, 12, 24, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin: 0 8px 8px 0;
  font-size: 13px;
}

@media (max-width: 720px) {
  .deal-info-grid { grid-template-columns: repeat(2, 1fr); }
}

.mailbox-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.mailbox-row:last-child { border-bottom: none; }

.brief-controls select {
  background: rgba(6, 12, 24, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
}

@media (max-width: 860px) {
  .funnel-board { grid-template-columns: repeat(2, 1fr); }
  .deal-layout { grid-template-columns: 1fr; }
}
