/* Voyageur CRM - styles
   Tokens pulled from design-system.md. Do not hardcode hex values here;
   add new tokens to :root instead. */

:root {
  --ink: #241f1a;
  --parchment: #F9F7F2;
  --rose: #B84A4A;
  --brown: #432812;
  --brown-mid: #735238;
  --sage: #59615F;
  --muted: #6B5947;
  --cream: #F7EADF;
  --cream-soft: #FBF4EC;
  --border: #E0CEBF;
  --wf-line: #e4ddc9;
  --accent: #B05C36;
  --accent-dark: #95492A;
  --white: #ffffff;

  /* Status/interaction tints, one-off shades carried over from the
     mockup reference. Kept as named tokens rather than hardcoded hex. */
  --rose-hover: #a03e3e;
  --status-opened-bg: #EDE7DD;
  --status-replied-bg: #E6EFE7;
  --status-replied-text: #3E6B4A;
  --status-demo-bg: #F3E3D6;
  --status-followup-bg: #FBEAEA;

  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-serif: 'Libre Caslon Text', serif;
  --font-editorial: 'Noto Serif', serif;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--parchment);
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.vc-header {
  background: var(--brown);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.vc-logo {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.28em;
  color: var(--cream);
  text-transform: uppercase;
}
.vc-logo span { color: var(--rose); }
.vc-header-meta {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.75;
}

/* ---------- Layout ---------- */
.vc-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 70px;
}

.vc-eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 8px;
}
.vc-h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 40px);
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.vc-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--brown-mid);
  margin: 0 0 32px;
}

/* ---------- Dashboard cards ---------- */
.vc-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.vc-stat {
  background: var(--white);
  border: 1px solid var(--wf-line);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(67,40,18,.06);
  padding: 20px 20px 18px;
}
.vc-stat-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 10px;
}
.vc-stat-value {
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.vc-stat-target {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.vc-progress-track {
  margin-top: 12px;
  height: 5px;
  border-radius: 999px;
  background: var(--cream);
  overflow: hidden;
}
.vc-progress-fill {
  height: 100%;
  background: var(--rose);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ---------- Toolbar ---------- */
.vc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.vc-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.vc-pill {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.vc-pill:hover { background: var(--ink); color: var(--parchment); }
.vc-pill.active { background: var(--ink); color: var(--parchment); border-color: var(--ink); }

.vc-search {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vc-search input {
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 220px;
}
.vc-search input:focus { border-color: var(--rose); outline: none; }

.vc-btn-primary {
  background: var(--rose);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 22px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.vc-btn-primary:hover {
  background: var(--rose-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(184,74,74,.28);
}
.vc-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.vc-btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.vc-btn-outline:hover { border-color: var(--rose); color: var(--rose); }

/* ---------- Sequence legend ---------- */
.vc-sequence-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: -6px 0 14px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
}
.vc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vc-legend-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--cream-soft);
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--muted);
}

/* ---------- Table ---------- */
.vc-table-wrap {
  background: var(--white);
  border: 1px solid var(--wf-line);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(67,40,18,.08);
  overflow: hidden;
}
table.vc-table { width: 100%; border-collapse: collapse; }
.vc-table thead th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sage);
  background: var(--cream-soft);
  padding: 14px 16px;
  border-bottom: 1px solid var(--wf-line);
  white-space: nowrap;
}
.vc-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--wf-line);
  vertical-align: middle;
}
.vc-table tbody tr:last-child td { border-bottom: none; }
.vc-table tbody tr:hover { background: var(--cream-soft); }

.vc-name { font-weight: 700; }
.vc-village { color: var(--muted); font-size: 13px; }

.vc-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
}

.vc-stage-dots { display: flex; gap: 5px; }
.vc-dot {
  width: 20px; height: 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--muted);
  background: var(--cream-soft);
}
.vc-dot.sent { background: var(--rose); border-color: var(--rose); color: var(--white); }

.vc-status {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  display: inline-block;
  white-space: nowrap;
}
.vc-status.new { background: var(--cream); color: var(--brown-mid); }
.vc-status.opened { background: var(--status-opened-bg); color: var(--sage); }
.vc-status.replied { background: var(--status-replied-bg); color: var(--status-replied-text); }
.vc-status.demo { background: var(--status-demo-bg); color: var(--accent-dark); }
.vc-status.customer { background: var(--rose); color: var(--white); }
.vc-status.followup { background: var(--status-followup-bg); color: var(--rose); }

.vc-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.vc-icon-btn {
  border: 1px solid var(--wf-line);
  background: var(--white);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  color: var(--sage);
  font-family: var(--font-body);
}
.vc-icon-btn:hover { border-color: var(--rose); color: var(--rose); }
.vc-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.vc-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
}

.vc-error-banner {
  background: var(--status-followup-bg);
  color: var(--rose);
  border: 1px solid var(--rose);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}
.vc-error-banner.visible { display: block; }

/* ---------- Modal ---------- */
.vc-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(36,31,26,0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}
.vc-modal-overlay.open { display: flex; }
.vc-modal {
  background: var(--parchment);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 24px 64px rgba(36,31,26,.35);
}
.vc-modal h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 20px;
}
.vc-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.vc-field { margin-bottom: 16px; }
.vc-field label {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 6px;
}
.vc-field input, .vc-field select, .vc-field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.vc-field textarea { resize: vertical; min-height: 64px; }
.vc-field input:focus, .vc-field select:focus, .vc-field textarea:focus {
  border-color: var(--rose); outline: none;
}
.vc-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px;
}

.vc-history-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--brown-mid);
  margin: -12px 0 20px;
}

.vc-history-list {
  border-top: 1px solid var(--wf-line);
  padding-top: 16px;
  max-height: 320px;
  overflow-y: auto;
}

.vc-history-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--wf-line);
}
.vc-history-entry:last-child { border-bottom: none; }

.vc-history-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.vc-history-type {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rose);
}

.vc-history-time {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.vc-history-detail {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.vc-history-empty {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  padding: 8px 0 16px;
}

.vc-email-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.vc-email-body-textarea {
  width: 100%;
  min-height: 340px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
}
.vc-email-body-textarea:focus { border-color: var(--rose); outline: none; }
.vc-email-preview-frame {
  width: 100%;
  min-height: 340px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
}

@media (max-width: 700px) {
  .vc-email-edit-grid { grid-template-columns: 1fr; }
}

.vc-auth-error {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--rose);
  min-height: 18px;
  margin: 8px 0 0;
}

#vc-auth-overlay { z-index: 100; }

@media (max-width: 900px) {
  .vc-stats { grid-template-columns: repeat(2, 1fr); }
  .vc-table-wrap { overflow-x: auto; }
  table.vc-table { min-width: 760px; }
}

@media (max-width: 560px) {
  .vc-field-row { grid-template-columns: 1fr; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
