/* StemJee CRM — warm & approachable, M365-aligned */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  /* STEMJEE PALETTE — navy dominant, cyan + orange accents */
  --cream-50:  #F7F9FC;
  --cream-100: #EEF3F9;
  --cream-200: #E1E9F2;
  --cream-300: #CBD6E4;

  --ink-900: #0B1B33;   /* deep navy (primary) */
  --ink-700: #1B3358;
  --ink-500: #3D5778;
  --ink-400: #6B7E97;
  --ink-300: #9CA9BC;
  --ink-200: #C8D1DD;

  /* Cyan secondary */
  --terra-50:  #E0F2FB;
  --terra-100: #B8DEF3;
  --terra-300: #5FB3E0;
  --terra-500: #2D8FC8;  /* StemJee cyan */
  --terra-600: #1F6FA0;
  --terra-700: #154C72;

  /* Orange accent (used sparingly like the site) */
  --sage-50:  #FFF1E4;
  --sage-300: #F6B576;
  --sage-500: #E88836;
  --sage-600: #C76D1F;
  --sage-700: #8C4A12;

  --amber-300: #F6B576;
  --amber-500: #E88836;
  --plum-500:  #5B7BAA;
  --rose-500:  #C95A3F;

  /* Stage colors — gradient navy → cyan → orange (Tranche 2.5: stages français) */
  --stage-exploration: #6B7E97;
  --stage-proposition: #2D8FC8;
  --stage-validation:  #5FB3E0;
  --stage-negociation: #1F6FA0;
  --stage-conclu:      #E88836;
  --stage-perdu:       #B8716C;
  /* Legacy aliases for backwards compat in case du CSS résiduel */
  --stage-discover:  var(--stage-exploration);
  --stage-qualify:   var(--stage-exploration);
  --stage-propose:   var(--stage-proposition);
  --stage-negotiate: var(--stage-negociation);
  --stage-won:       var(--stage-conclu);
  --stage-lost:      var(--stage-perdu);

  /* === Tranche 2.5 — Pill tokens (org/projet/mandat/priority) === */
  --org-ppe: var(--terra-300);
  --org-pme: var(--terra-500);
  --org-me:  var(--terra-700);
  --org-ge:  var(--ink-700);

  --project-petit: var(--cream-300);
  --project-moyen: var(--sage-300);
  --project-grand: var(--sage-600);

  --mandate-app:    var(--terra-500);
  --mandate-optim:  var(--sage-500);
  --mandate-plan:   var(--ink-500);
  --mandate-doc:    var(--terra-700);
  --mandate-accomp: var(--sage-700);

  --priority-high: var(--rose-500);
  --priority-med:  var(--sage-600);
  --priority-low:  var(--text-3);

  /* Surface tokens (light) */
  --bg:        var(--cream-50);
  --surface:   #FFFFFF;
  --surface-2: var(--cream-100);
  --surface-3: var(--cream-200);
  --border:    rgba(74, 60, 46, 0.10);
  --border-strong: rgba(74, 60, 46, 0.18);
  --text:      var(--ink-900);
  --text-2:    var(--ink-700);
  --text-3:    var(--ink-500);
  --text-4:    var(--ink-400);

  --shadow-sm: 0 1px 2px rgba(74, 60, 46, 0.06), 0 1px 3px rgba(74, 60, 46, 0.04);
  --shadow-md: 0 4px 12px rgba(74, 60, 46, 0.08), 0 2px 4px rgba(74, 60, 46, 0.04);
  --shadow-lg: 0 12px 32px rgba(74, 60, 46, 0.12), 0 4px 8px rgba(74, 60, 46, 0.06);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --bg:        #060E1C;
  --surface:   #0B1B33;
  --surface-2: #142849;
  --surface-3: #1E3358;
  --border:    rgba(200, 220, 245, 0.10);
  --border-strong: rgba(200, 220, 245, 0.20);
  --text:      #EEF3F9;
  --text-2:    #C8D1DD;
  --text-3:    #8FA0BA;
  --text-4:    #6B7E97;

  --terra-500: #5FB3E0;
  --terra-600: #2D8FC8;
  --sage-500:  #F6B576;
  --sage-600:  #E88836;
  --sage-700:  #F6B576;
  --terra-700: #5FB3E0;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { min-height: 100vh; }

/* === LAYOUT === */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--terra-500), var(--terra-600));
  display: grid;
  place-items: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-section-title {
  padding: 12px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--terra-50);
  color: var(--terra-700);
  font-weight: 600;
}
[data-theme="dark"] .nav-item.active {
  background: rgba(232, 154, 110, 0.15);
  color: var(--terra-500);
}
.nav-item-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item-count {
  margin-left: auto;
  font-size: 12px;
  background: var(--surface-3);
  padding: 1px 8px;
  border-radius: 10px;
  color: var(--text-3);
}
.nav-item.active .nav-item-count {
  background: rgba(199, 109, 63, 0.15);
  color: var(--terra-700);
}
[data-theme="dark"] .nav-item.active .nav-item-count {
  background: rgba(232, 154, 110, 0.2);
  color: var(--terra-500);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 4px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-500), var(--sage-600));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
}

/* === MAIN === */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.topbar-sub {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 2px;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--text-3);
  font-size: 13px;
  min-width: 220px;
}
.search input {
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  flex: 1;
  font-family: inherit;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible {
  outline: 2px solid var(--terra-500);
  outline-offset: 2px;
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--terra-500);
  color: white;
  border-color: var(--terra-500);
}
.btn-primary:hover { background: var(--terra-600); border-color: var(--terra-600); }
.btn-ghost { border-color: transparent; }

.content {
  flex: 1;
  padding: 28px;
  overflow: auto;
}

/* === CARDS === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.card-header > div:first-child { min-width: 0; flex: 1; }
.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

/* === KPIs === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 8px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}
.kpi-accent {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--terra-500);
}
.kpi.sage .kpi-accent { background: var(--sage-500); }
.kpi.amber .kpi-accent { background: var(--amber-500); }
.kpi.plum .kpi-accent { background: var(--plum-500); }

/* === STAGE CHIPS === */
.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}
.stage-chip::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--stage);
}
/* Stages français (Tranche 2.5) */
.stage-chip.exploration { --stage: var(--stage-exploration); }
.stage-chip.proposition { --stage: var(--stage-proposition); }
.stage-chip.validation  { --stage: var(--stage-validation); }
.stage-chip.negociation { --stage: var(--stage-negociation); }
.stage-chip.conclu      { --stage: var(--stage-conclu); background: var(--sage-50); color: var(--sage-700); }
.stage-chip.perdu       { --stage: var(--stage-perdu); }
/* Legacy class aliases */
.stage-chip.discover { --stage: var(--stage-exploration); }
.stage-chip.qualify  { --stage: var(--stage-exploration); }
.stage-chip.propose  { --stage: var(--stage-proposition); }
.stage-chip.negotiate{ --stage: var(--stage-negociation); }
.stage-chip.won      { --stage: var(--stage-conclu); background: var(--sage-50); color: var(--sage-700); }
.stage-chip.lost     { --stage: var(--stage-perdu); }

[data-theme="dark"] .stage-chip.conclu,
[data-theme="dark"] .stage-chip.won {
  background: rgba(159, 190, 142, 0.15);
  color: var(--sage-500);
}

/* === TABLE === */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table.crm {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.crm thead th {
  background: var(--surface-2);
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.crm tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.crm tbody tr {
  cursor: pointer;
  transition: background 100ms;
}
table.crm tbody tr:hover { background: var(--surface-2); }
table.crm tbody tr:last-child td { border-bottom: none; }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-bold { font-weight: 600; color: var(--text); }

.company-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.company-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  background: var(--terra-500);
  flex-shrink: 0;
}
.company-mark.amber { background: linear-gradient(135deg, #F6B576, #E88836); }
.company-mark.sage  { background: linear-gradient(135deg, #5FB3E0, #2D8FC8); }
.company-mark.terra { background: linear-gradient(135deg, #1F6FA0, #0B1B33); }
.company-mark.plum  { background: linear-gradient(135deg, #6B7E97, #3D5778); }

/* === PROBABILITY BAR === */
.prob-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.prob-track {
  flex: 1;
  min-width: 60px;
  height: 6px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.prob-fill {
  height: 100%;
  background: var(--terra-500);
  border-radius: 99px;
  transition: width 200ms;
}
.prob-fill.sage { background: var(--sage-500); }
.prob-num { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 32px; text-align: right; }

/* === FILTERS === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-2);
  transition: all 120ms;
}
.filter-pill:hover { background: var(--surface-2); }
.filter-pill.active {
  background: var(--ink-900);
  color: var(--cream-50);
  border-color: var(--ink-900);
}
[data-theme="dark"] .filter-pill.active {
  background: var(--cream-50);
  color: var(--ink-900);
  border-color: var(--cream-50);
}

/* === KANBAN === */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}
.kanban-col-title::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--col-color);
}
.kanban-col-meta {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 150ms;
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.kanban-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  line-height: 1.35;
}
.kanban-card-company {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.kanban-card-revenue {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.kanban-card-date {
  color: var(--text-3);
  font-size: 11px;
}

/* === COMPANY DETAIL === */
.company-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.company-mark-lg {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  flex-shrink: 0;
}
.company-mark-lg.amber { background: linear-gradient(135deg, #F6B576, #E88836); }
.company-mark-lg.sage  { background: linear-gradient(135deg, #5FB3E0, #2D8FC8); }
.company-mark-lg.terra { background: linear-gradient(135deg, #1F6FA0, #0B1B33); }
.company-mark-lg.plum  { background: linear-gradient(135deg, #6B7E97, #3D5778); }
.company-meta {
  flex: 1;
}
.company-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
}
.company-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-3);
  font-size: 13px;
}
.company-tags > span:not(:last-child)::after {
  content: "•";
  margin-left: 8px;
  color: var(--text-4);
}

.company-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) { .company-grid { grid-template-columns: 1fr; } }

/* Opportunity item in detail page */
.opp-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.opp-row:last-child { border-bottom: none; }
.opp-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.opp-row-title-text {
  font-weight: 600;
  font-size: 14px;
}
.opp-row-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}
.opp-row-meta-money { font-size: 13px; }
.opp-row-meta-tags {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.opp-row-meta-old-flex {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.opp-row-meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Contact card */
.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.contact-card:last-child { border-bottom: none; }
.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  background: linear-gradient(135deg, var(--sage-500), var(--sage-600));
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: 14px; }
.contact-title { font-size: 12px; color: var(--text-3); }
.contact-email {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Email timeline */
.email-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.email-item:last-child { border-bottom: none; }
.email-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-3);
}
.email-icon.out { background: rgba(199, 109, 63, 0.12); color: var(--terra-600); }
.email-icon.in  { background: rgba(110, 158, 92, 0.12); color: var(--sage-600); }
.email-body { flex: 1; min-width: 0; }
.email-row1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.email-from { font-weight: 600; font-size: 13px; }
.email-date { font-size: 11px; color: var(--text-4); white-space: nowrap; }
.email-subject { font-size: 13px; color: var(--text); margin-bottom: 4px; font-weight: 500; }
.email-preview {
  font-size: 12px;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.email-tag {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-3);
  margin-left: 8px;
}

/* === DASHBOARD CHART === */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 360px;
  padding: 12px 0;
}
.chart-svg { width: 100%; height: 100%; overflow: visible; display: block; }
.chart-axis-label { font-size: 11px; fill: var(--text-3); font-family: var(--font-sans); font-weight: 500; letter-spacing: 0.01em; }
.chart-grid-line { stroke: var(--border); stroke-dasharray: 2 4; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink-900);
  color: var(--cream-50);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  transform: translate(-50%, -110%);
  z-index: 100;
}
[data-theme="dark"] .chart-tooltip {
  background: var(--cream-50);
  color: var(--ink-900);
}
.chart-tooltip-title { font-weight: 600; font-family: var(--font-display); margin-bottom: 4px; }
.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.chart-tooltip-dot {
  width: 8px; height: 8px; border-radius: 50%;
}

.chart-legend {
  display: flex;
  gap: 20px;
  font-size: 12px;
  margin-top: 12px;
  color: var(--text-3);
  align-items: center;
  justify-content: center;
}
.chart-legend-item { display: flex; align-items: center; gap: 8px; }
.chart-legend-swatch { width: 14px; height: 12px; border-radius: 3px; }

/* === Pipeline detail panel side === */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 95vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.detail-panel.open { transform: translateX(0); }
.detail-panel-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}
.detail-panel-close {
  border: none;
  background: var(--surface-2);
  color: var(--text-2);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.detail-panel-close:hover { background: var(--surface-3); }
.detail-panel-body { padding: 22px; }
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 33, 24, 0.4);
  z-index: 49;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

[data-theme="dark"] .backdrop { background: rgba(0,0,0,0.6); }

/* Pipeline visual mini */
.pipeline-mini {
  display: flex;
  gap: 4px;
  margin: 12px 0;
}
.pipeline-step {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
}
.pipeline-step.active { background: var(--terra-500); }
.pipeline-step.done { background: var(--sage-500); }

/* Detail key/value */
.kv-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 18px;
  margin: 16px 0;
  align-items: start;
}
.kv-label { color: var(--text-3); font-size: 12px; padding-top: 2px; }
.kv-value { font-size: 13px; font-weight: 500; }
/* Tranche 2.5 HF-1: empêche les pills de s'étirer verticalement quand leur
   conteneur flex est lui-même dans un parent stretch (kv-grid, form-field).
   On force avec height: auto + align-self pour battre les valeurs par défaut
   user-agent des <button> et tout parent stretch. */
.pills-group,
.kanban-card-pills {
  align-items: flex-start;
  align-content: flex-start;
}
.pill,
button.pill,
.pills-group > *,
.kanban-card-pills > * {
  align-self: flex-start;
  height: auto !important;
  min-height: 0 !important;
  flex: 0 0 auto;
}

/* Section heading */
.section-h {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin: 24px 0 10px;
}

/* Tab strip */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--terra-500);
  font-weight: 600;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
}

/* Scroll bars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  border-radius: 99px;
  border: 2px solid var(--bg);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); background-clip: padding-box; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--ink-500); background-clip: padding-box; border: 2px solid var(--bg); }

/* Won/lost row dim */
tr.dim td { opacity: 0.6; }
tr.dim:hover td { opacity: 1; }

/* === MATCH RULE BADGE === */
.match-rule-badge {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

/* === AUTO-LINK EXPLAINER (re-uses .card) === */
.owner-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.owner-pill .dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-500), var(--sage-600));
  color: white;
  font-size: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
}

/* === DRAG & DROP KANBAN === */
.kanban-card.dragging { opacity: 0.4; }
.kanban-col.drop-target {
  background: var(--terra-50);
  outline: 2px dashed var(--terra-500);
  outline-offset: -4px;
}
[data-theme="dark"] .kanban-col.drop-target {
  background: rgba(95, 179, 224, 0.08);
}

/* === EDITABLE FIELDS === */
.editable {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background 100ms;
  border: 1px solid transparent;
  display: inline-block;
}
.editable:hover { background: var(--surface-2); border-color: var(--border); }
.editable input, .editable select {
  border: 1px solid var(--terra-500);
  background: var(--surface);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* Stage selector chips inline */
.stage-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 8px 0 6px;
}
.stage-picker .stage-chip {
  cursor: pointer;
  opacity: 0.45;
  transition: all 120ms;
  border: 1px solid transparent;
}
.stage-picker .stage-chip:hover { opacity: 0.8; }
.stage-picker .stage-chip.selected { opacity: 1; border-color: var(--border-strong); transform: scale(1.05); }

/* Sortable column headers */
table.crm thead th.sortable { cursor: pointer; user-select: none; position: relative; }
table.crm thead th.sortable:hover { color: var(--text); background: var(--surface-3); }
.sort-arrow { display: inline-block; margin-left: 4px; opacity: 0.4; font-size: 10px; }
table.crm thead th.sorted .sort-arrow { opacity: 1; color: var(--terra-500); }

/* Column filter row */
table.crm thead tr.filter-row th { padding: 6px 14px; background: var(--surface); }
.col-filter {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  outline: none;
}
.col-filter:focus { border-color: var(--terra-500); }

/* === MATRIX TABLE (forecast by company × month) === */
.matrix-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.matrix {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
table.matrix th, table.matrix td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
table.matrix thead th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-strong);
}
table.matrix th:first-child, table.matrix td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  border-right: 1px solid var(--border);
  min-width: 220px;
}
table.matrix thead th:first-child { background: var(--surface-2); z-index: 2; }
table.matrix tr.total-row td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  border-bottom: none;
  font-size: 13px;
}
table.matrix tr.total-row td:first-child { background: var(--surface-2); }
.matrix-cell-paying { color: var(--text); font-weight: 500; }
.matrix-cell-pipeline { color: var(--terra-600); }
[data-theme="dark"] .matrix-cell-pipeline { color: var(--terra-500); }
.matrix-cell-empty { color: var(--text-4); }
.matrix-month-future { background: linear-gradient(180deg, transparent 0%, rgba(232, 136, 54, 0.04) 100%); }
table.matrix td.col-today { border-left: 2px solid var(--sage-500); }
table.matrix th.col-today { border-left: 2px solid var(--sage-500); color: var(--sage-600); }

/* List view for companies */
.companies-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.view-toggle button {
  padding: 5px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.view-toggle button.active {
  background: var(--ink-900);
  color: var(--cream-50);
}
[data-theme="dark"] .view-toggle button.active {
  background: var(--terra-500);
  color: white;
}

/* Segmented toggle (clients/prospects/all) */
.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
}
.segmented button {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 99px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-3);
  font-family: inherit;
  font-weight: 500;
}
.segmented button.active {
  background: var(--terra-500);
  color: white;
}

/* Sub-link / clickable text */
.link {
  color: var(--terra-600);
  cursor: pointer;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }
[data-theme="dark"] .link { color: var(--terra-500); }

/* Outlook button */
.btn-outlook {
  background: #0078D4;
  color: white;
  border-color: #0078D4;
}
.btn-outlook:hover { background: #106EBE; border-color: #106EBE; }

/* Pipeline summary bar (top of pipeline view) */
.summary-bar {
  display: flex;
  gap: 28px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.summary-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-bar-item .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
  line-height: 1;
}
.summary-bar-item .value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

/* Closing soon badge */
.due-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.due-badge.urgent { color: var(--terra-600); font-weight: 600; }
.due-badge.warn { color: var(--amber-500); font-weight: 600; }
[data-theme="dark"] .due-badge.urgent { color: var(--terra-500); }

/* Inbox layout (emails view) */
.inbox-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: calc(100vh - 200px);
  overflow: hidden;
}
.inbox-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface-2);
}
.inbox-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 100ms;
}
.inbox-list-item:hover { background: var(--surface-3); }
.inbox-list-item.active {
  background: var(--surface);
  border-left: 3px solid var(--terra-500);
  padding-left: 13px;
}
.inbox-list-row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.inbox-reading {
  padding: 28px 32px;
  overflow-y: auto;
}
.inbox-reading h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 16px;
}
.inbox-reading-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.inbox-reading-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
}
.inbox-related {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.inbox-related-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 10px;
}
.inbox-related-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-2);
}



/* ============ NOTES TIMELINE ============ */
.notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notes-empty {
  text-align: center;
  padding: 28px 20px;
  color: var(--text-4);
  font-size: 13px;
  font-style: italic;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

/* Note card */
.note-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 120ms, box-shadow 120ms;
}
.note-card:hover { border-color: var(--border-strong, var(--text-4)); }
.note-rail {
  width: 3px;
  background: var(--terra-400, var(--text-4));
  flex-shrink: 0;
}
.note-source-voice .note-rail { background: var(--plum-500, #8B5A8E); }
.note-source-text .note-rail  { background: var(--terra-400, #C28B6E); }
.note-body {
  flex: 1;
  padding: 11px 14px;
  min-width: 0;
}
.note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.note-spacer { flex: 1; }
.note-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.note-source-chip-voice {
  background: rgba(139, 90, 142, 0.12);
  color: var(--plum-600, #6F4572);
}
.note-source-chip-text {
  background: var(--surface-2);
  color: var(--text-2);
}
[data-theme="dark"] .note-source-chip-voice {
  background: rgba(180, 130, 184, 0.18);
  color: #D4A8D6;
}
.note-author { font-weight: 600; color: var(--text-2); }
.note-date { color: var(--text-4); }
.note-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.note-action {
  border: none;
  background: transparent;
  color: var(--text-4);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms;
  opacity: 0;
}
.note-card:hover .note-action { opacity: 1; }
.note-action:hover { background: var(--surface-2); color: var(--text-2); }
.note-action-danger:hover { color: #B0464A; background: rgba(176, 70, 74, 0.08); }

.note-edit textarea {
  width: 100%;
  border: 1px solid var(--terra-400, var(--text-4));
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  resize: none;
  box-shadow: 0 0 0 3px rgba(194, 139, 110, 0.15);
  outline: none;
}
.note-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* Composer */
.note-composer-collapsed {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong, var(--text-4));
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  transition: all 120ms;
  font-family: inherit;
  text-align: left;
}
.note-composer-collapsed:hover {
  background: var(--surface);
  border-color: var(--terra-500);
  color: var(--text);
}
.note-composer-plus {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--terra-500);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.note-composer {
  background: var(--surface);
  border: 1px solid var(--terra-400);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: 0 0 0 3px rgba(194, 139, 110, 0.12);
}
.note-composer textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  resize: none;
  outline: none;
  min-height: 72px;
}
.note-composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.note-composer-hint {
  flex: 1;
  font-size: 11px;
  color: var(--text-4);
}


/* ============ VOICE DICTATION ============ */
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--terra-50, #F8EFE9), var(--cream-100, #F0E8DD));
  border-color: var(--terra-300, #D9B79F);
  color: var(--terra-700, #7A4A2C);
  font-weight: 500;
  position: relative;
}
.voice-btn:hover {
  background: linear-gradient(135deg, var(--terra-100, #F2DDCD), var(--cream-200, #E8DCC9));
  border-color: var(--terra-500);
}
[data-theme="dark"] .voice-btn {
  background: linear-gradient(135deg, rgba(194,139,110,0.18), rgba(20,40,73,0.6));
  color: var(--terra-200, #E5C4AB);
  border-color: rgba(194,139,110,0.3);
}
.voice-btn-label { font-size: 13px; }
@media (max-width: 900px) {
  .voice-btn-label { display: none; }
}

/* Modal */
.voice-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 14, 8, 0.45);
  backdrop-filter: blur(4px);
  z-index: 90;
  animation: voice-fade 180ms ease-out;
}
@keyframes voice-fade { from { opacity: 0; } }
.voice-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 30px 60px -20px rgba(20, 14, 8, 0.45);
  z-index: 91;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: voice-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes voice-pop {
  from { opacity: 0; transform: translate(-50%, -45%) scale(0.96); }
}
.voice-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.voice-modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.voice-modal-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.45;
}
.voice-close {
  border: none;
  background: var(--surface-2);
  color: var(--text-2);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 120ms;
}
.voice-close:hover { background: var(--surface-3); color: var(--text); }
.voice-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.voice-modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* Capture surface */
.voice-capture {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 14px;
}
.voice-mic-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: none;
  background: var(--terra-500);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 150ms;
  box-shadow: 0 6px 18px -8px rgba(176, 95, 56, 0.6);
}
.voice-mic-big:hover { background: var(--terra-600); transform: translateY(-1px); }
.voice-listening {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.voice-mic-stop {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--terra-500);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  animation: voice-pulse 1.6s ease-in-out infinite;
}
.voice-mic-stop:hover { background: var(--terra-600); }
.voice-mic-stop-inner {
  display: block;
  width: 18px; height: 18px;
  background: white;
  border-radius: 3px;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(176, 95, 56, 0.45); }
  50%      { box-shadow: 0 0 0 14px rgba(176, 95, 56, 0); }
}
.voice-listening-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.voice-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}
.voice-bar {
  width: 3px;
  height: 100%;
  background: var(--terra-500);
  border-radius: 2px;
  animation: voice-bar 1s ease-in-out infinite;
  transform-origin: center;
}
@keyframes voice-bar {
  0%, 100% { transform: scaleY(0.25); }
  50%      { transform: scaleY(1); }
}
.voice-unsupported {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}

/* Transcript editor */
.voice-transcript-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  margin-bottom: 6px;
}
.voice-transcript textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 120ms;
}
.voice-transcript textarea:focus {
  border-color: var(--terra-500);
  box-shadow: 0 0 0 3px rgba(194, 139, 110, 0.15);
}
.voice-transcript textarea[readonly] {
  background: var(--surface-2);
  color: var(--text-2);
}

.voice-error {
  background: rgba(176, 70, 74, 0.08);
  color: #B0464A;
  border: 1px solid rgba(176, 70, 74, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
}

/* Candidate cards */
.voice-candidates-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  margin-bottom: 8px;
}
.voice-candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 120ms;
  color: var(--text);
}
.voice-candidate:hover {
  border-color: var(--terra-500);
  background: var(--terra-50, var(--surface-2));
  transform: translateX(2px);
}
[data-theme="dark"] .voice-candidate:hover {
  background: rgba(194, 139, 110, 0.1);
}
.voice-candidate-info { flex: 1; min-width: 0; }
.voice-candidate-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-candidate-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}
.voice-candidate-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.voice-candidate-tag-opp {
  background: var(--terra-100, rgba(194,139,110,0.15));
  color: var(--terra-700, #7A4A2C);
}
.voice-candidate-tag-company {
  background: var(--surface-2);
  color: var(--text-2);
}
[data-theme="dark"] .voice-candidate-tag-opp {
  background: rgba(194,139,110,0.2);
  color: var(--terra-200);
}


/* ============ MATRIX TOOLBAR (audience filter + per-opp rows) ============ */
.matrix-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.matrix-audience {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.audience-pill {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 120ms;
}
.audience-pill:hover { color: var(--text); }
.audience-pill.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(20, 14, 8, 0.06);
}
.audience-count {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-3);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.audience-pill.active .audience-count {
  background: var(--terra-100, var(--cream-200));
  color: var(--terra-700, var(--text));
}
.matrix-toolbar-info {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

/* Two sticky frozen columns: company + opp */
table.matrix th.matrix-col-company,
table.matrix td.matrix-col-company {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  min-width: 180px;
  max-width: 200px;
}
table.matrix thead th.matrix-col-company {
  background: var(--surface-2);
  z-index: 3;
}
table.matrix tbody tr:hover td.matrix-col-company { background: var(--surface-2); }
table.matrix th.matrix-col-opp,
table.matrix td.matrix-col-opp {
  position: sticky;
  left: 200px;
  z-index: 1;
  background: var(--surface);
  min-width: 240px;
  max-width: 280px;
  padding: 8px 12px;
  text-align: left;
  border-right: 1px solid var(--border-strong, var(--border));
}
table.matrix thead th.matrix-col-opp {
  background: var(--surface-2);
  z-index: 3;
}
table.matrix tbody tr:hover td.matrix-col-opp { background: var(--surface-2); }
table.matrix tr.total-row td:first-child {
  position: sticky; left: 0; z-index: 2;
}

.matrix-opp-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.matrix-opp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.matrix-opp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
}
.matrix-opp-prob {
  background: var(--surface-2);
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
/* Couleur de la pill probabilité selon la zone : red <30, yellow 30-70, green >=70 */
.matrix-opp-prob.zone-low    { background: var(--rose-100, #fde0e0); color: var(--rose-700, #b91c1c); }
.matrix-opp-prob.zone-mid    { background: var(--cream-200, #fff3d6); color: var(--text-2); }
.matrix-opp-prob.zone-high   { background: var(--sage-100, #e3f1e8); color: var(--sage-700, #1f6b3b); }


/* ===== New company / scrape modal ===== */
.new-company-modal { width: 580px; max-width: 92vw; }

.scrape-input { display: flex; flex-direction: column; gap: 12px; }
.scrape-label {
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.scrape-url-wrap {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s;
}
.scrape-url-wrap:focus-within {
  border-color: var(--terra-500);
  box-shadow: 0 0 0 3px rgba(196, 92, 60, 0.12);
}
.scrape-url-prefix {
  padding: 10px 0 10px 13px;
  font-family: var(--font-mono, ui-monospace, "SF Mono", monospace);
  font-size: 13.5px; color: var(--text-4);
  user-select: none;
}
.scrape-url-input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 10px 13px 10px 4px;
  font-family: var(--font-mono, ui-monospace, "SF Mono", monospace);
  font-size: 13.5px; color: var(--text);
}

.scrape-examples {
  font-size: 11.5px; color: var(--text-4);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.scrape-example {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-3);
  padding: 3px 9px; border-radius: 6px;
  font-family: var(--font-mono, ui-monospace, "SF Mono", monospace);
  font-size: 11.5px; cursor: pointer;
}
.scrape-example:hover {
  border-color: var(--terra-500); color: var(--terra-600);
  border-style: solid;
}

.scrape-explainer {
  font-size: 11.5px; color: var(--text-4); line-height: 1.55;
  background: var(--surface-2); border-radius: 8px;
  padding: 10px 12px; border: 1px solid var(--border);
}
.scrape-explainer strong { color: var(--text-3); }

/* Loading state */
.scrape-loading {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 24px 8px 12px;
}
.scrape-loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--terra-500);
  border-radius: 50%;
  animation: scrape-spin 0.8s linear infinite;
}
@keyframes scrape-spin { to { transform: rotate(360deg); } }
.scrape-loading-steps {
  display: flex; flex-direction: column; gap: 7px;
  width: 100%; max-width: 380px;
}
.scrape-step {
  font-size: 12.5px; color: var(--text-4);
  padding-left: 22px; position: relative;
}
.scrape-step::before {
  content: ""; position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--border);
}
.scrape-step.done { color: var(--text-3); }
.scrape-step.done::before {
  background: var(--sage-500); border-color: var(--sage-500);
}
.scrape-step.done::after {
  content: ""; position: absolute;
  left: 3px; top: 50%; transform: translateY(-65%) rotate(-45deg);
  width: 7px; height: 4px;
  border-left: 1.5px solid white;
  border-bottom: 1.5px solid white;
}
.scrape-step.active {
  color: var(--text); font-weight: 500;
}
.scrape-step.active::before {
  border-color: var(--terra-500);
  border-top-color: transparent;
  animation: scrape-spin 0.8s linear infinite;
}

/* Confidence banner */
.scrape-confidence {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: 9px;
  border: 1px solid var(--border);
}
.scrape-confidence-high { background: rgba(122, 138, 92, 0.07); border-color: rgba(122, 138, 92, 0.25); }
.scrape-confidence-medium { background: rgba(196, 152, 71, 0.07); border-color: rgba(196, 152, 71, 0.25); }
.scrape-confidence-low { background: rgba(176, 70, 74, 0.05); border-color: rgba(176, 70, 74, 0.18); }
.scrape-confidence-dot {
  width: 9px; height: 9px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.scrape-confidence-high .scrape-confidence-dot { background: var(--sage-500); }
.scrape-confidence-medium .scrape-confidence-dot { background: var(--amber-500, #C49847); }
.scrape-confidence-low .scrape-confidence-dot { background: #B0464A; }
.scrape-confidence-label {
  font-size: 12px; font-weight: 600; color: var(--text);
  margin-bottom: 2px;
}
.scrape-confidence-sub {
  font-size: 12px; color: var(--text-3); line-height: 1.5;
}

/* Editable field rows */
.scrape-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.scrape-field { display: flex; flex-direction: column; gap: 5px; }
.scrape-field:nth-child(1), .scrape-field:nth-child(2) { grid-column: 1 / -1; }
.scrape-field-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.scrape-field-input-wrap {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s;
}
.scrape-field-input-wrap:focus-within {
  border-color: var(--terra-500);
  box-shadow: 0 0 0 2px rgba(196, 92, 60, 0.1);
}
.scrape-field-input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 7px 11px;
  font-size: 13px; color: var(--text);
  font-family: inherit;
}

/* Suggested contact */
.scrape-contact { display: flex; flex-direction: column; gap: 6px; }
.scrape-contact-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.scrape-contact-card {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 9px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
}
.scrape-contact-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--plum-200, #E8DDE5);
  color: var(--plum-600, #7A5A6E);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px; font-family: var(--font-display);
  flex-shrink: 0;
}

/* "Nouveau" badge */
.new-badge {
  display: inline-block;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  background: var(--terra-500); color: white;
  vertical-align: middle;
}


/* ===== MOBILE-NAV TOGGLE (hidden on desktop) ===== */
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-nav-toggle:hover { background: var(--surface-2); }
.mobile-nav-backdrop { display: none; }
.topbar-titles { min-width: 0; flex-shrink: 1; overflow: hidden; }

/* ===== TABLET (≤960) ===== */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 270px; height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,0.12);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(20,14,8,0.45);
    z-index: 150;
    animation: voice-fade 0.18s ease;
  }
  .mobile-nav-toggle { display: inline-flex; }

  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar-title { font-size: 18px; }
  .topbar-sub { font-size: 11.5px; }
  .topbar-actions { gap: 6px; }
  .search { display: none; }
  .btn-new-opp-label { display: none; }
  .btn-new-opp { padding: 8px 10px; }

  .content { padding: 16px !important; }
  .content > * { min-width: 0; }
}

/* ===== PHONE (≤640) ===== */
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .topbar-title { font-size: 16px; }
  .topbar-sub { display: none; }

  .content { padding: 12px !important; }

  /* Cards collapse to single column */
  .company-grid,
  div[style*="repeat(auto-fill, minmax(320px"] {
    grid-template-columns: 1fr !important;
  }

  /* Tables become horizontal-scroll containers */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.crm { min-width: 720px; font-size: 12.5px; }
  table.crm th, table.crm td { padding: 8px 10px !important; }

  /* Modals fullscreen on mobile */
  .voice-modal,
  .new-company-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
    display: flex; flex-direction: column;
  }
  .voice-modal-body { flex: 1; }
  .voice-modal-foot { flex-wrap: wrap; }

  /* Detail panels (opp/company) — fullscreen sheet on mobile */
  .detail-panel,
  .panel,
  .drawer {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  /* Pipeline columns / forecast matrix — horizontal scroll */
  .pipeline-board,
  .forecast-matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* KPI cards / dashboard cards collapse */
  .kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .kpi-card { padding: 12px !important; }
  .kpi-value { font-size: 20px !important; }

  /* View toggle compact */
  .view-toggle button { padding: 5px 9px !important; font-size: 11.5px !important; }

  /* Scrape modal fields stack */
  .scrape-fields { grid-template-columns: 1fr !important; }
  .scrape-field:nth-child(1), .scrape-field:nth-child(2) { grid-column: auto; }

  /* Voice button compact */
  .voice-btn { padding: 7px 10px !important; }
}

/* ===== Very small phones (≤380) ===== */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
  .topbar-actions .btn-icon-only { display: none; }
}


/* Title wrapping fix on tablets */
@media (max-width: 960px) {
  .topbar-title { white-space: normal; line-height: 1.15; }
  .topbar { align-items: center; }
}


/* ============================================================
   VOICE — extended (router, prospect flow, query flow)
   ============================================================ */

/* Wider modal for prospect/query phases */
.voice-modal-wide { width: 720px !important; max-width: 95vw; }

/* Router badge — shows detected intent + switch */
.router-badge {
  display: flex; flex-direction: column; gap: 6px;
  padding: 9px 12px; border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.router-badge-detected {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.router-badge-label { color: var(--text-4); }
.router-badge-value { font-weight: 600; color: var(--text); }
.router-badge-conf {
  font-size: 10.5px; padding: 2px 6px; border-radius: 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.router-badge-conf-high { background: rgba(122,138,92,0.15); color: var(--sage-700, #5a6a44); }
.router-badge-conf-medium { background: rgba(196,152,71,0.15); color: #a07a2c; }
.router-badge-conf-low { background: rgba(176,70,74,0.12); color: #B0464A; }
.router-badge-switch {
  font-size: 11px; color: var(--text-4);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.router-badge-switch button {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-3); font-size: 11px;
  padding: 3px 8px; border-radius: 5px; cursor: pointer;
}
.router-badge-switch button:hover {
  border-color: var(--terra-500); color: var(--terra-600);
}
.router-badge-switch-label { margin-right: 2px; }
.router-badge-sep { color: var(--text-4); opacity: 0.5; }
.router-badge-action {
  border: 1px solid var(--terra-500) !important;
  color: var(--terra-600) !important;
  background: rgba(217,127,87,0.06) !important;
  font-weight: 500;
}
.router-badge-action:hover {
  background: rgba(217,127,87,0.12) !important;
}
.router-badge-low {
  background: rgba(176,70,74,0.05);
  border-color: rgba(176,70,74,0.25);
}

/* Ready-screen actions: mic + write fallback */
.voice-ready-actions {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: 100%;
}
.voice-ready-divider {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 280px;
  font-size: 11px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.08em;
}
.voice-ready-divider::before,
.voice-ready-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.voice-type-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.voice-type-btn:hover {
  border-color: var(--terra-500); color: var(--terra-600);
}

/* Typing-only panel (write instead of dictate) */
.voice-typing-panel {
  display: flex; flex-direction: column; gap: 12px;
}
.voice-typing-hint {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px; color: var(--text-3); line-height: 1.55;
}
.voice-typing-hint svg { flex-shrink: 0; margin-top: 2px; color: var(--terra-500); }
.voice-typing-hint em { font-style: italic; color: var(--text-2); }
.voice-typing-textarea {
  width: 100%; box-sizing: border-box;
  border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  font-family: inherit; font-size: 14px; line-height: 1.55;
  resize: vertical; min-height: 110px;
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color 0.15s;
}
.voice-typing-textarea:focus {
  border-color: var(--terra-500);
}

/* Demo / simulation hint */
.demo-badge {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 10px;
  padding: 8px 10px; border-radius: 7px;
  background: rgba(196,152,71,0.08);
  border: 1px solid rgba(196,152,71,0.2);
  font-size: 11.5px; color: var(--text-3); line-height: 1.5;
}
.demo-badge svg { flex-shrink: 0; margin-top: 1px; color: #a07a2c; }
.demo-badge strong { color: #a07a2c; font-weight: 600; }

/* Routing loader */
.voice-routing {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 20px 8px;
}
.voice-routing-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.voice-routing-transcript {
  font-size: 12px; color: var(--text-4); font-style: italic;
  text-align: center; max-width: 440px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--surface-2);
}
.voice-routing-steps {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; max-width: 380px;
}

/* === Prospect flow === */
.prospect-flow { display: flex; flex-direction: column; gap: 16px; }

.prospect-section { display: flex; flex-direction: column; gap: 4px; }
.prospect-section-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.prospect-section-count {
  font-size: 11px; color: var(--text-4);
  font-weight: 500; letter-spacing: 0; text-transform: none;
}
.prospect-section-sub { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }

.prospect-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 640px) {
  .prospect-fields-grid { grid-template-columns: 1fr; }
}

/* Individual field with mic */
.prospect-field { display: flex; flex-direction: column; gap: 4px; }
.prospect-field.missing .prospect-field-input-wrap {
  border-color: rgba(196, 92, 60, 0.45);
  background: rgba(196, 92, 60, 0.04);
}
.prospect-field.filled .prospect-field-input-wrap {
  border-color: rgba(122, 138, 92, 0.35);
}

.prospect-field-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 6px;
}
.prospect-field-req { color: #B0464A; font-weight: 700; }
.prospect-field-missing-tag {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  background: rgba(196, 92, 60, 0.15);
  color: var(--terra-600);
  text-transform: none; letter-spacing: 0;
  margin-left: auto;
}

.prospect-field-row {
  display: flex; gap: 6px; align-items: stretch;
}
.prospect-field-input-wrap {
  flex: 1;
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); transition: border-color 0.15s;
}
.prospect-field-input-wrap:focus-within {
  border-color: var(--terra-500) !important;
  box-shadow: 0 0 0 2px rgba(196,92,60,0.1);
}
.prospect-field-input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 7px 10px;
  font-size: 13px; color: var(--text);
  font-family: inherit;
}
.prospect-field-suffix {
  padding: 0 10px 0 4px;
  font-size: 11.5px; color: var(--text-4);
}
.prospect-field-mic {
  width: 32px; min-width: 32px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 7px; cursor: pointer;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.prospect-field-mic:hover {
  background: var(--terra-50, rgba(196,92,60,0.08));
  border-color: var(--terra-500);
  color: var(--terra-600);
}
.prospect-field-mic.listening {
  background: var(--terra-500);
  border-color: var(--terra-500);
  color: white;
}
.prospect-field-mic-pulse {
  display: block; width: 8px; height: 8px; border-radius: 50%;
  background: white;
  animation: prospect-pulse 1s ease-in-out infinite;
}
@keyframes prospect-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

/* Clarify hint */
.prospect-clarify {
  padding: 10px 12px; border-radius: 8px;
  background: rgba(196, 92, 60, 0.06);
  border: 1px solid rgba(196, 92, 60, 0.2);
}
.prospect-clarify-title {
  font-size: 12.5px; font-weight: 600; color: var(--terra-600);
  display: flex; align-items: center; gap: 6px;
}
.prospect-clarify-sub {
  font-size: 12px; color: var(--text-3);
  margin-top: 4px;
}

/* Duplicate warning */
.prospect-duplicate {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: 9px;
  background: rgba(196, 152, 71, 0.08);
  border: 1px solid rgba(196, 152, 71, 0.3);
}
.prospect-duplicate-icon {
  color: #C49847;
  flex-shrink: 0;
  margin-top: 2px;
}
.prospect-duplicate-content { flex: 1; }
.prospect-duplicate-title { font-weight: 600; color: var(--text); font-size: 13px; }
.prospect-duplicate-sub {
  font-size: 12.5px; color: var(--text-3); margin-top: 4px;
  line-height: 1.5;
}
.prospect-duplicate-actions {
  display: flex; gap: 8px; margin-top: 10px;
}

/* Actions row */
.prospect-actions {
  display: flex; gap: 8px; align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Website candidates */
.website-candidates {
  display: flex; flex-direction: column; gap: 8px;
}
.website-candidate {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono, ui-monospace, monospace);
  cursor: pointer; transition: all 0.15s;
  width: 100%; text-align: left;
}
.website-candidate:hover {
  border-color: var(--terra-500);
  background: var(--terra-50, rgba(196,92,60,0.04));
}
.website-candidate-rank {
  font-size: 11px; font-weight: 700; color: var(--text-4);
  width: 22px;
}
.website-candidate-domain {
  flex: 1; font-size: 13px; color: var(--text);
}
.website-manual {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.website-manual-label {
  font-size: 11.5px; color: var(--text-4);
}

/* Final summary */
.prospect-summary { display: flex; flex-direction: column; gap: 8px; }
.prospect-summary-card {
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.prospect-summary-head {
  display: flex; align-items: center; gap: 12px;
}
.prospect-summary-mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--terra-500), var(--terra-600));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-display); font-size: 16px;
}
.prospect-summary-name {
  font-family: var(--font-display);
  font-weight: 600; font-size: 16px; color: var(--text);
}
.prospect-summary-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.prospect-summary-website {
  font-size: 11.5px; color: var(--terra-600);
  font-family: var(--font-mono, monospace); margin-top: 2px;
}
.prospect-summary-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 10px;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.prospect-summary-row:last-child { border-bottom: none; }
.prospect-summary-label {
  color: var(--text-4); font-weight: 500;
  text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em;
}
.prospect-summary-note {
  align-items: flex-start;
}
.prospect-summary-note span:last-child {
  font-style: italic; color: var(--text-3);
  line-height: 1.5;
}

/* === Query flow === */
.query-flow { display: flex; flex-direction: column; gap: 14px; }
.query-question {
  padding: 11px 13px; border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.query-question-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.query-question-text {
  font-size: 13.5px; color: var(--text);
  margin-top: 4px; font-style: italic;
}
.query-loading {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px;
}
.query-loading-label { font-size: 12.5px; color: var(--text-3); }

.query-answer {
  padding: 14px; border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.query-answer-high { border-left: 3px solid var(--sage-500); }
.query-answer-medium { border-left: 3px solid #C49847; }
.query-answer-low { border-left: 3px solid #B0464A; }

.query-answer-label {
  font-size: 11px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; justify-content: space-between; align-items: center;
}
.query-confidence-badge {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.query-confidence-high { background: rgba(122,138,92,0.15); color: var(--sage-700, #5a6a44); }
.query-confidence-medium { background: rgba(196,152,71,0.15); color: #a07a2c; }
.query-confidence-low { background: rgba(176,70,74,0.12); color: #B0464A; }

.query-answer-text {
  font-size: 14px; line-height: 1.55; color: var(--text);
  margin-top: 8px;
}

.query-citations { display: flex; flex-direction: column; gap: 6px; }
.query-citations-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.query-citations-list { display: flex; flex-direction: column; gap: 6px; }
.query-citation {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color 0.12s;
  font-family: inherit; text-align: left;
}
.query-citation:hover { border-color: var(--terra-500); }
.query-citation-tag {
  font-size: 9.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-2); color: var(--text-3);
}
.query-citation-tag-opp { background: rgba(122,138,92,0.18); color: var(--sage-700, #5a6a44); }
.query-citation-tag-company { background: rgba(196,152,71,0.18); color: #a07a2c; }
.query-citation-tag-contact { background: rgba(157,124,156,0.2); color: #6b4f6a; }
.query-citation-tag-email { background: rgba(196,92,60,0.15); color: var(--terra-600); }
.query-citation-label { flex: 1; font-size: 13px; color: var(--text); }


/* ============================================================
   NEW VIEWS — Contacts grid, Capture box, Calendar, Search, Export, Stage history, Toast, Nav alerts
   ============================================================ */

/* Sidebar nav alert dot + highlight */
.nav-item { position: relative; }
.nav-item-alert {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--terra-500); margin-left: auto; margin-right: 6px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--terra-500) 35%, transparent);
}
.nav-item.highlight { color: var(--terra-700, var(--terra-600)); }
.nav-item.highlight .nav-item-count {
  background: var(--terra-500); color: #fff; border-color: transparent;
}

/* Layout / view toggle pill */
.layout-toggle {
  display: inline-flex; padding: 3px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.layout-toggle button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px; border: none; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-3);
  cursor: pointer; transition: all 0.12s;
}
.layout-toggle button.active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(11,27,51,0.06);
}
.layout-toggle button:hover:not(.active) { color: var(--text-2); }

/* Filter-bar select unified */
.task-priority-select {
  font: inherit; font-size: 13px; padding: 7px 28px 7px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  -webkit-appearance: none; appearance: none;
}
.task-priority-select:focus { outline: 2px solid var(--terra-300, var(--terra-500)); outline-offset: 1px; border-color: var(--terra-500); }

/* Link button (table cells, etc.) */
.link-button {
  background: none; border: none; padding: 0; font: inherit; font-size: inherit;
  color: var(--terra-600); cursor: pointer; text-align: left;
}
.link-button:hover { text-decoration: underline; }

/* Contact active badge */
.contact-active-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: var(--sage-100, color-mix(in srgb, var(--sage-500) 15%, transparent));
  color: var(--sage-700, #5a6a44); font-size: 11px; font-weight: 600;
}

/* === Contacts grid (cards layout) === */
.contacts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.contact-grid-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; cursor: pointer; transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
  display: flex; flex-direction: column; gap: 4px;
}
.contact-grid-card:hover {
  border-color: var(--terra-500);
  box-shadow: 0 4px 14px rgba(11,27,51,0.08);
  transform: translateY(-1px);
}
.contact-grid-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px;
}
.contact-grid-name { font-size: 15px; font-weight: 600; color: var(--text); }
.contact-grid-title { font-size: 12.5px; color: var(--text-3); }
.contact-grid-company {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 3px 0; background: none; border: none; font: inherit;
  font-size: 12px; color: var(--terra-600); cursor: pointer; text-align: left;
}
.contact-grid-company:hover { text-decoration: underline; }
.contact-grid-divider { height: 1px; background: var(--border); margin: 8px 0 6px; }
.contact-grid-detail {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-grid-detail span { overflow: hidden; text-overflow: ellipsis; }
.contact-grid-last {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-size: 11px; color: var(--text-4);
}

/* === Capture box === */
.capture-view { max-width: 920px; margin: 0 auto; }
.capture-banner {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--terra-500) 8%, var(--surface-2)) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); margin-bottom: 18px;
}
.capture-banner-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--terra-500); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.capture-banner-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.capture-banner-sub { font-size: 13px; color: var(--text-3); line-height: 1.5; }

.capture-list { display: flex; flex-direction: column; gap: 14px; }
.capture-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; transition: border-color 0.14s;
}
.capture-card:hover { border-color: color-mix(in srgb, var(--terra-500) 50%, var(--border)); }
.capture-card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  font-size: 11.5px; color: var(--text-3);
}
.capture-card-date { color: var(--text-2); font-weight: 500; }
.capture-card-author { color: var(--text-4); }
.capture-card-delete {
  background: transparent; border: 1px solid transparent; padding: 6px;
  border-radius: 6px; color: var(--text-4); cursor: pointer; transition: all 0.12s;
}
.capture-card-delete:hover { color: var(--terra-600); border-color: var(--border); background: var(--surface-2); }
.capture-card-text {
  font-size: 14px; line-height: 1.55; color: var(--text);
  padding: 12px 14px; background: var(--surface-2); border-radius: 8px;
  border-left: 3px solid var(--terra-500); margin-bottom: 12px;
  white-space: pre-wrap;
}
.capture-card-actions { display: flex; justify-content: flex-end; }

.capture-classify {
  margin-top: 12px; padding: 14px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.capture-classify-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); margin-bottom: 8px;
}
.capture-classify-search {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface); font: inherit; font-size: 13px;
  margin-bottom: 10px;
}
.capture-classify-search:focus { outline: 2px solid var(--terra-300, var(--terra-500)); outline-offset: 1px; border-color: var(--terra-500); }
.capture-candidates { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.capture-candidate {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  overflow: hidden;
}
.capture-candidate-main {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; background: transparent; border: none; cursor: pointer;
  font: inherit; transition: background 0.12s;
}
.capture-candidate-main:hover { background: var(--surface-2); }
.capture-candidate-opps {
  border-top: 1px dashed var(--border); padding: 4px 0; background: var(--surface-2);
}
.capture-candidate-opp {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px 8px 50px; background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 12.5px; text-align: left; color: var(--text-2);
  transition: background 0.12s;
}
.capture-candidate-opp:hover { background: var(--surface); color: var(--text); }

/* === Calendar === */
.calendar-view { max-width: 1200px; }
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 16px; flex-wrap: wrap;
}
.calendar-month-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; min-width: 200px; text-align: center;
}
.calendar-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.calendar-stat { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.calendar-stat-num { font-weight: 600; color: var(--text); }
.calendar-stat-label { color: var(--text-3); }
.calendar-stat-dot { width: 8px; height: 8px; border-radius: 50%; }
.calendar-stat-dot-task { background: var(--text-2); }
.calendar-stat-dot-close { background: var(--terra-500); }

.calendar-grid {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.calendar-dow-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.calendar-dow {
  padding: 10px 8px; font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em;
  text-align: center; border-right: 1px solid var(--border);
}
.calendar-dow:last-child { border-right: none; }

.calendar-cells {
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(90px, 1fr);
}
.calendar-cell {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 6px 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface); cursor: pointer; text-align: left;
  font: inherit; transition: background 0.12s;
  min-height: 90px; overflow: hidden;
}
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell:hover { background: var(--surface-2); }
.calendar-cell.out-of-month { background: var(--surface-2); color: var(--text-4); opacity: 0.55; }
.calendar-cell.today .calendar-cell-num {
  background: var(--terra-500); color: #fff; border-radius: 6px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
}
.calendar-cell.selected {
  background: color-mix(in srgb, var(--terra-500) 8%, var(--surface));
  box-shadow: inset 0 0 0 2px var(--terra-500);
}
.calendar-cell-num {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
}
.calendar-cell-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.calendar-event {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 5px; border-radius: 4px;
  font-size: 11px; line-height: 1.3; overflow: hidden;
}
.calendar-event-task {
  background: var(--surface-2); color: var(--text-2);
  border-left: 2px solid var(--text-3);
}
.calendar-event-task.prio-high { border-left-color: var(--terra-500); background: color-mix(in srgb, var(--terra-500) 10%, var(--surface-2)); }
.calendar-event-task.prio-med { border-left-color: var(--amber-700, #c98a3a); background: color-mix(in srgb, #c98a3a 10%, var(--surface-2)); }
.calendar-event-close {
  background: color-mix(in srgb, var(--terra-500) 15%, var(--surface));
  color: var(--terra-600); font-weight: 500;
}
.calendar-event-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.calendar-event-dot.prio-high { background: var(--terra-500); }
.calendar-event-dot.prio-med { background: var(--amber-700, #c98a3a); }
.calendar-event-dot.prio-low { background: var(--text-4); }
.calendar-event-title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 11px; min-width: 0;
}
.calendar-event-more { font-size: 10.5px; color: var(--text-4); padding: 1px 5px; font-weight: 500; }

.calendar-detail-list { display: flex; flex-direction: column; }
.calendar-detail-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.calendar-detail-item:first-child { border-top: none; }
.calendar-detail-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.calendar-detail-icon-task { background: var(--surface-2); color: var(--text-2); }
.calendar-detail-icon-close { background: color-mix(in srgb, var(--terra-500) 15%, transparent); color: var(--terra-600); }

/* === Global Search === */
.topbar-search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 12px; min-width: 240px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3); cursor: pointer; font: inherit;
  transition: all 0.12s;
}
.topbar-search-trigger:hover { border-color: var(--text-4); color: var(--text-2); }
.topbar-search-placeholder { flex: 1; text-align: left; font-size: 13px; }
.topbar-search-kbd {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10.5px; padding: 2px 6px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-3);
}

.gs-overlay {
  position: fixed; inset: 0; background: rgba(11,27,51,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 88px; z-index: 200;
  animation: voice-fade 0.18s ease;
}
.gs-modal {
  width: 720px; max-width: 92vw; max-height: 75vh;
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(11,27,51,0.32);
  display: flex; flex-direction: column; overflow: hidden;
  animation: voice-pop 0.22s cubic-bezier(0.2,1,0.4,1);
}
.gs-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  color: var(--text-3);
}
.gs-input-wrap input {
  flex: 1; border: none; outline: none; background: none;
  font: inherit; font-size: 16px; color: var(--text);
}
.gs-input-wrap input::placeholder { color: var(--text-4); }
.gs-close {
  background: transparent; border: 1px solid var(--border); padding: 6px;
  border-radius: 6px; color: var(--text-3); cursor: pointer;
}
.gs-close:hover { color: var(--text); background: var(--surface-2); }

.gs-results { flex: 1; overflow-y: auto; padding: 8px 0; }
.gs-section { padding: 4px 0 6px; }
.gs-section-title {
  padding: 8px 18px 6px; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-4);
}
.gs-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 18px; background: transparent; border: none;
  font: inherit; text-align: left; cursor: pointer;
  transition: background 0.1s;
}
.gs-row.active { background: color-mix(in srgb, var(--terra-500) 10%, var(--surface)); }
.gs-row-icon {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gs-row-main { flex: 1; min-width: 0; }
.gs-row-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-row-title-text { font-weight: 400; font-size: 13px; color: var(--text-2); }
.gs-row-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.gs-row-kind { font-size: 10.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.05em; }
.gs-row-sub .stage-chip { transform: scale(0.85); transform-origin: left center; }

.search-highlight { background: color-mix(in srgb, var(--terra-500) 30%, transparent); color: var(--text); padding: 0 2px; border-radius: 2px; font-weight: 600; }

.gs-empty { padding: 60px 24px; text-align: center; }
.gs-empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.gs-empty-sub { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }
.gs-tips { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.gs-tip { font-size: 11.5px; color: var(--text-4); }

.gs-footer {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  font-size: 11px; color: var(--text-3);
}
.gs-footer kbd {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px; padding: 1px 5px; border-radius: 3px; margin-right: 3px;
  background: var(--surface); border: 1px solid var(--border);
}

/* === Export menu === */
.export-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 280px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 36px rgba(11,27,51,0.18);
  padding: 6px; z-index: 50;
  animation: voice-pop 0.16s cubic-bezier(0.2,1,0.4,1);
}
.export-menu-title {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 10px 4px;
}
.export-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; background: transparent; border: none; border-radius: 7px;
  font: inherit; text-align: left; cursor: pointer; transition: background 0.1s;
}
.export-menu-item:hover { background: var(--surface-2); }
.export-menu-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
  background: var(--surface-2); color: var(--text-2);
  flex-shrink: 0;
}
.export-menu-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.export-menu-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* === Stage history mini-timeline === */
.stage-history {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px;
}
.stage-history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stage-history-title { font-size: 13px; font-weight: 600; color: var(--text); }
.stage-history-meta { font-size: 11.5px; color: var(--text-3); }

.stage-pipeline-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0,1fr));
  grid-auto-flow: column; gap: 0;
  align-items: center; padding: 8px 0 18px; position: relative;
}
.stage-pipeline-bar { display: flex; align-items: flex-start; }
.stage-pipeline-connector {
  flex: 1; height: 2px; background: var(--border); margin-top: 7px; min-width: 12px;
}
.stage-pipeline-connector.visited { background: var(--text); }
.stage-pipeline-node {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; position: relative; margin-top: 0;
  display: flex; align-items: center; justify-content: center;
}
.stage-pipeline-node.current::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--terra-500); animation: pulse-stage 2s ease-in-out infinite;
}
@keyframes pulse-stage {
  0%,100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.4); }
}
.stage-pipeline-label {
  position: absolute; top: 30px; transform: translateX(-50%);
  text-align: center; font-size: 10.5px; line-height: 1.3;
}
.stage-pipeline-label-name { font-weight: 600; color: var(--text-2); white-space: nowrap; }
.stage-pipeline-label-date { color: var(--text-4); font-size: 10px; margin-top: 1px; white-space: nowrap; }
/* Position labels under nodes */
.stage-pipeline-bar { position: relative; padding-bottom: 36px; }
.stage-pipeline-bar > .stage-pipeline-label { position: static; transform: none; }
.stage-pipeline-bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(80px, 1fr) 16px; align-items: center; gap: 0; }
.stage-pipeline-bar .stage-pipeline-connector { width: 100%; }
.stage-pipeline-bar .stage-pipeline-node { justify-self: center; }
.stage-pipeline-bar .stage-pipeline-label { justify-self: center; padding-top: 6px; max-width: 90px; }

.stage-history-list {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 14px; border-top: 1px dashed var(--border);
}
.stage-history-row {
  display: grid; grid-template-columns: 110px 1fr auto;
  gap: 12px; align-items: center; font-size: 12px;
}
.stage-history-date { color: var(--text-3); font-weight: 500; }
.stage-history-line { display: flex; align-items: center; gap: 6px; }
.stage-history-author { font-size: 11.5px; color: var(--text-4); }

/* === App toast === */
.app-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--text); color: var(--surface);
  box-shadow: 0 12px 32px rgba(11,27,51,0.28);
  z-index: 300; max-width: 480px;
  animation: toast-pop 0.24s cubic-bezier(0.2,1,0.4,1);
}
@keyframes toast-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.app-toast-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--sage-500, #94a877); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.app-toast-msg { font-size: 13.5px; flex: 1; }
.app-toast-action {
  background: transparent; border: 1px solid color-mix(in srgb, var(--surface) 30%, transparent);
  color: var(--surface); padding: 5px 10px; border-radius: 6px;
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: background 0.12s;
}
.app-toast-action:hover { background: color-mix(in srgb, var(--surface) 18%, transparent); }
.app-toast-close {
  background: transparent; border: none; color: color-mix(in srgb, var(--surface) 70%, transparent);
  cursor: pointer; padding: 4px; border-radius: 4px;
}
.app-toast-close:hover { color: var(--surface); }

/* Mobile adjustments for new views */
@media (max-width: 720px) {
  .topbar-search-trigger { min-width: 0; padding: 7px 10px; }
  .topbar-search-placeholder { display: none; }
  .topbar-search-kbd { display: none; }
  .gs-modal { padding-top: 60px; }
  .calendar-cells { grid-auto-rows: minmax(64px, 1fr); }
  .calendar-cell { min-height: 64px; padding: 4px 4px 2px; }
  .calendar-event-title { display: none; }
  .calendar-event { padding: 1px 3px; }
  .calendar-stats { gap: 12px; font-size: 11.5px; }
  .stage-history-row { grid-template-columns: 1fr; gap: 4px; }
  .stage-history-date { font-size: 11px; }
  .contacts-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .contact-grid-card { padding: 12px; }
  .layout-toggle button span { display: none; }
}
@media (max-width: 480px) {
  .contacts-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   TASKS — global view + embedded module + editor
   ============================================================ */

.tasks-view, .tasks-module { display: flex; flex-direction: column; gap: 0; }
.tasks-module { gap: 8px; }

/* Filter pill count badge */
.filter-pill-count {
  display: inline-block; margin-left: 6px;
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-3);
  min-width: 18px; text-align: center;
}
.filter-pill.active .filter-pill-count {
  background: color-mix(in srgb, var(--cream-50) 22%, transparent);
  color: var(--cream-50);
}
[data-theme="dark"] .filter-pill.active .filter-pill-count {
  background: color-mix(in srgb, var(--ink-900) 22%, transparent);
  color: var(--ink-900);
}

/* Group headers */
.tasks-group { margin-bottom: 14px; }
.tasks-group:last-child { margin-bottom: 0; }
.tasks-group-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); padding: 14px 4px 8px;
}
.tasks-group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tasks-group-dot-overdue { background: var(--terra-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--terra-500) 25%, transparent); }
.tasks-group-dot-today { background: var(--amber-700, #c98a3a); box-shadow: 0 0 0 3px color-mix(in srgb, #c98a3a 25%, transparent); }
.tasks-group-dot-soon { background: var(--sage-500, #94a877); }
.tasks-group-dot-later { background: var(--text-4); }
.tasks-group-count {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-3); margin-left: 4px;
  text-transform: none; letter-spacing: 0;
}

/* Task list container */
.tasks-list {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px;
}
.tasks-list-done { opacity: 0.7; }
.tasks-empty {
  padding: 20px; text-align: center; color: var(--text-3);
  font-size: 13px; background: var(--surface); border: 1px dashed var(--border); border-radius: 8px;
}
.tasks-more-hint {
  padding: 8px 12px; text-align: center;
  font-size: 12px; color: var(--text-3); font-style: italic;
}

/* Task row */
.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface); border-radius: 8px;
  transition: background 0.12s;
  border: 1px solid transparent;
}
.task-row:hover { background: var(--surface-2); border-color: var(--border); }
.task-row.task-done { opacity: 0.55; }
.task-row.task-done .task-title { text-decoration: line-through; color: var(--text-3); }

/* Urgency accent — left bar */
.task-row.task-urgency-overdue { border-left: 3px solid var(--terra-500); padding-left: 10px; }
.task-row.task-urgency-today { border-left: 3px solid var(--amber-700, #c98a3a); padding-left: 10px; }
.task-row.task-urgency-soon { border-left: 3px solid var(--sage-500, #94a877); padding-left: 10px; }
.task-row.task-urgency-later { border-left: 3px solid var(--border); padding-left: 10px; }
.task-row.task-urgency-done { border-left: 3px solid transparent; padding-left: 10px; }

/* Checkbox */
.task-checkbox {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--text-4);
  background: var(--surface); flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin-top: 2px; color: transparent;
  transition: all 0.14s;
}
.task-checkbox:hover { border-color: var(--terra-500); background: color-mix(in srgb, var(--terra-500) 8%, transparent); }
.task-checkbox.checked {
  background: var(--sage-500, #94a877);
  border-color: var(--sage-500, #94a877);
  color: #fff;
}

/* Main content */
.task-main { min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding-top: 0; }
.task-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-title {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  overflow-wrap: anywhere;
}
.task-priority-chip {
  font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.task-recur-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 500;
  padding: 1px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--sage-500, #94a877) 12%, transparent);
  color: var(--sage-700, #5a6a44);
}

.task-link-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.task-link-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 11.5px;
  padding: 3px 8px; border-radius: 5px;
  background: color-mix(in srgb, var(--terra-500) 10%, transparent);
  color: var(--terra-600); border: none; cursor: pointer; transition: background 0.1s;
}
.task-link-pill:hover { background: color-mix(in srgb, var(--terra-500) 18%, transparent); }
.task-link-pill-soft {
  background: var(--surface-2); color: var(--text-3);
}
.task-link-pill-soft:hover { background: var(--border); color: var(--text-2); }

.task-notes-preview {
  font-size: 12px; color: var(--text-3); line-height: 1.45;
  margin-top: 2px; padding-left: 0;
  white-space: pre-wrap;
}

/* Right side: due + delete */
.task-side { display: flex; align-items: flex-start; gap: 6px; flex-shrink: 0; }
.task-due {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 5px;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.task-due-overdue { background: color-mix(in srgb, var(--terra-500) 15%, transparent); color: var(--terra-600); }
.task-due-today { background: color-mix(in srgb, #c98a3a 15%, transparent); color: var(--amber-700, #c98a3a); }
.task-due-soon { background: color-mix(in srgb, var(--sage-500, #94a877) 15%, transparent); color: var(--sage-700, #5a6a44); }
.task-due-later { background: var(--surface-2); color: var(--text-3); }
.task-due-done { background: transparent; color: var(--text-4); text-decoration: line-through; }

.task-delete-btn {
  background: transparent; border: 1px solid transparent; padding: 4px 5px;
  border-radius: 5px; color: var(--text-4); cursor: pointer;
  transition: all 0.12s; opacity: 0;
}
.task-row:hover .task-delete-btn { opacity: 1; }
.task-delete-btn:hover { color: var(--terra-600); border-color: var(--border); background: var(--surface); }

/* Quick add */
.task-quick-add {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: 8px;
  font: inherit; font-size: 13px; color: var(--text-3);
  cursor: pointer; transition: all 0.14s; text-align: left;
}
.task-quick-add:hover {
  border-color: var(--terra-500); color: var(--terra-600);
  background: color-mix(in srgb, var(--terra-500) 5%, var(--surface));
}
.task-quick-add-plus {
  font-size: 18px; line-height: 1; font-weight: 400;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; background: var(--surface-2); color: var(--text-3);
  flex-shrink: 0;
}
.task-quick-add:hover .task-quick-add-plus {
  background: var(--terra-500); color: #fff;
}

/* Editor */
.task-editor {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; background: var(--surface);
  border: 1px solid var(--terra-500); border-radius: 10px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--terra-500) 18%, transparent);
}
.task-editor-title {
  font: inherit; font-size: 14.5px; font-weight: 500;
  border: none; outline: none; background: transparent;
  padding: 4px 0; border-bottom: 1.5px solid var(--border);
  color: var(--text);
}
.task-editor-title:focus { border-bottom-color: var(--terra-500); }
.task-editor-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.task-editor-field {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.task-editor-field input,
.task-editor-field select {
  font: inherit; font-size: 13px; font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--text);
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface);
}
.task-editor-field input:focus,
.task-editor-field select:focus { outline: 2px solid var(--terra-300, var(--terra-500)); outline-offset: 1px; border-color: var(--terra-500); }
.task-editor-notes {
  font: inherit; font-size: 13px; color: var(--text);
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); resize: vertical;
}
.task-editor-notes:focus { outline: 2px solid var(--terra-300, var(--terra-500)); outline-offset: 1px; border-color: var(--terra-500); }
.task-editor-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Toggle done section */
.tasks-toggle-done {
  display: flex; align-items: center; gap: 6px; align-self: flex-start;
  margin-top: 8px; padding: 6px 12px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border);
  font: inherit; font-size: 12px; color: var(--text-3);
  cursor: pointer; transition: all 0.12s;
}
.tasks-toggle-done:hover { background: var(--surface-2); color: var(--text-2); }

/* Mobile tweaks */
@media (max-width: 720px) {
  .task-row {
    grid-template-columns: auto 1fr;
    grid-template-areas: "check main" "due due";
  }
  .task-row > .task-checkbox { grid-area: check; }
  .task-row > .task-main { grid-area: main; }
  .task-row > .task-side { grid-area: due; justify-content: flex-end; padding-top: 4px; }
  .task-delete-btn { opacity: 1; }
  .task-editor-row { grid-template-columns: 1fr 1fr; }
}


/* ============================================================
   TODO SYNC INDICATORS — on task rows
   ============================================================ */

.todo-sync-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px;
  letter-spacing: 0.02em;
  cursor: help;
}
.todo-sync-badge .todo-sync-label {
  font-size: 10px;
}
.todo-sync-synced {
  background: color-mix(in srgb, #2364aa 12%, transparent);
  color: #2364aa;
}
[data-theme="dark"] .todo-sync-synced {
  background: color-mix(in srgb, #6ba5e2 18%, transparent);
  color: #8bbce8;
}
.todo-sync-pending {
  background: color-mix(in srgb, #c98a3a 14%, transparent);
  color: var(--amber-700, #c98a3a);
}
.todo-sync-not-synced {
  background: var(--surface-2);
  color: var(--text-4);
}

/* Open in To-Do button */
.task-todo-open {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #2364aa;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
  opacity: 0;
}
.task-row:hover .task-todo-open { opacity: 1; }
.task-todo-open:hover:not(.disabled):not(:disabled) {
  background: color-mix(in srgb, #2364aa 10%, transparent);
  border-color: color-mix(in srgb, #2364aa 25%, transparent);
}
.task-todo-open.disabled,
.task-todo-open:disabled {
  color: var(--text-4);
  cursor: not-allowed;
}
[data-theme="dark"] .task-todo-open { color: #8bbce8; }
@media (max-width: 720px) {
  .task-todo-open { opacity: 1; }
}


/* ============================================================
   CALENDAR — view switcher (Mois / Semaine / Jour)
   ============================================================ */

.calendar-view-switcher {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.calendar-view-btn {
  font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 6px 14px; border-radius: 6px;
  background: transparent; border: none; color: var(--text-3);
  cursor: pointer; transition: all 0.12s;
}
.calendar-view-btn:hover { color: var(--text); }
.calendar-view-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink-900) 8%, transparent);
}

/* ============================================================
   CALENDAR — Week view (7 columns)
   ============================================================ */

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.calendar-week-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 360px;
  padding: 0;
  cursor: pointer;
  transition: all 0.12s;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.calendar-week-col:hover {
  border-color: color-mix(in srgb, var(--terra-500) 30%, var(--border));
}
.calendar-week-col.today {
  border-color: var(--terra-500);
  box-shadow: 0 0 0 1px var(--terra-500);
}
.calendar-week-col.selected {
  background: color-mix(in srgb, var(--terra-500) 5%, var(--surface));
}
.calendar-week-col.weekend {
  background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}
.calendar-week-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}
.calendar-week-col.weekend .calendar-week-col-header {
  background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
}
.calendar-week-dow {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3);
}
.calendar-week-date {
  font-size: 17px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.calendar-week-date.today-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--terra-500); color: var(--cream-50);
  font-size: 14px;
}

.calendar-week-events {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px;
  flex: 1;
  overflow-y: auto;
}
.calendar-week-empty {
  font-size: 11px; color: var(--text-4);
  text-align: center; padding: 24px 4px;
}
.calendar-week-event {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  padding: 6px 8px;
  background: var(--surface-2);
  border-radius: 6px;
  border-left: 2px solid var(--text-4);
  font-size: 11.5px;
  line-height: 1.35;
}
.calendar-week-event-task.prio-high { border-left-color: var(--terra-500); background: color-mix(in srgb, var(--terra-500) 7%, var(--surface)); }
.calendar-week-event-task.prio-med { border-left-color: var(--amber-700, #c98a3a); }
.calendar-week-event-task.prio-low { border-left-color: var(--text-4); }
.calendar-week-event-close {
  border-left-color: var(--sage-500, #94a877);
  background: color-mix(in srgb, var(--sage-500, #94a877) 8%, var(--surface));
}
.calendar-week-event-icon {
  display: flex; align-items: flex-start; padding-top: 2px;
  color: var(--text-3);
}
.calendar-week-event-close .calendar-week-event-icon { color: var(--sage-700, #5a6a44); }
.calendar-week-event-task.prio-high .calendar-week-event-icon { color: var(--terra-600); }
.calendar-week-event-body { min-width: 0; }
.calendar-week-event-title {
  font-weight: 500; color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.calendar-week-event-meta {
  display: block; margin-top: 2px;
  font: inherit; font-size: 10.5px; color: var(--text-3);
  background: transparent; border: none; padding: 0; cursor: pointer;
  text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  width: 100%;
}
.calendar-week-event-meta:hover { color: var(--terra-600); text-decoration: underline; }

/* ============================================================
   CALENDAR — Day view
   ============================================================ */

.calendar-day {
  display: flex; flex-direction: column; gap: 16px;
  margin-top: 12px;
}
.calendar-day-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.calendar-day-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.calendar-day-summary-num {
  font-size: 28px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.calendar-day-summary-label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-3); margin-top: 4px;
}
.calendar-day-empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
}

/* Mobile tweaks for week view */
@media (max-width: 1100px) {
  .calendar-week { grid-template-columns: 1fr; }
  .calendar-week-col { min-height: auto; }
  .calendar-week-col-header { padding: 8px 12px; }
}
@media (max-width: 720px) {
  .calendar-day-summary { grid-template-columns: 1fr; }
}


/* ============================================================
   MODAL — generic backdrop + chrome
   ============================================================ */

.modal-backdrop {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--ink-900) 50%, transparent);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
  backdrop-filter: blur(2px);
  animation: modal-fade-in 0.16s ease-out;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px color-mix(in srgb, var(--ink-900) 30%, transparent),
              0 0 0 1px color-mix(in srgb, var(--ink-900) 5%, transparent);
  animation: modal-slide-up 0.2s cubic-bezier(.2,.9,.3,1);
}
@keyframes modal-slide-up { from { opacity: 0; transform: translateY(6px) scale(0.95); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 4px; line-height: 1.4; max-width: 420px; }
.modal-close {
  background: transparent; border: none; padding: 0;
  width: 28px; height: 28px; border-radius: 6px;
  font-size: 22px; line-height: 1; color: var(--text-3);
  cursor: pointer; flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 40%, var(--surface));
}

/* ============================================================
   NEW CONTACT MODAL — Microsoft Graph email lookup
   ============================================================ */

.new-contact-modal { max-width: 600px; }
.new-contact-body {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}

.form-row {
  display: flex; gap: 12px;
}
.form-field {
  display: flex; flex-direction: column; gap: 5px; flex: 1;
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-field input,
.form-field select {
  font: inherit; font-size: 13.5px; font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--text);
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface);
  transition: all 0.12s;
}
.form-field input:focus,
.form-field select:focus {
  outline: 2px solid color-mix(in srgb, var(--terra-500) 30%, transparent);
  outline-offset: 0;
  border-color: var(--terra-500);
}

/* Email source tag (next to label) */
.email-source-tag {
  display: inline-block; margin-left: 6px;
  font-size: 9.5px; font-weight: 600; padding: 1px 6px; border-radius: 3px;
  text-transform: none; letter-spacing: 0.02em;
  vertical-align: middle;
}
.email-source-graph {
  background: color-mix(in srgb, #2364aa 14%, transparent);
  color: #2364aa;
}
[data-theme="dark"] .email-source-graph { color: #8bbce8; }
.email-source-manual {
  background: var(--surface-2);
  color: var(--text-3);
}

/* Graph lookup state strip */
.graph-lookup {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all 0.2s;
}
.graph-lookup-inner {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-2);
}
.graph-lookup-idle-inner { color: var(--text-3); }
.graph-lookup-searching {
  border-color: color-mix(in srgb, #2364aa 40%, var(--border));
  background: color-mix(in srgb, #2364aa 6%, var(--surface));
}
.graph-lookup-found {
  border-color: color-mix(in srgb, var(--sage-500, #94a877) 50%, var(--border));
  background: color-mix(in srgb, var(--sage-500, #94a877) 8%, var(--surface));
}
.graph-lookup-not-found {
  border-color: color-mix(in srgb, var(--amber-700, #c98a3a) 40%, var(--border));
  background: color-mix(in srgb, var(--amber-700, #c98a3a) 7%, var(--surface));
}

.graph-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, #2364aa 25%, transparent);
  border-top-color: #2364aa;
  animation: graph-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes graph-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 10px; }
}


/* ============================================================
   TRANCHE 1 — ANIMATIONS V2 + DARK POLISH
   ============================================================ */

/* === View switch (sidebar nav) ===
   .content gets key={view} in app.jsx so each view switch remounts
   the wrapper and replays this enter animation. */
.view-enter {
  animation: view-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* === Kanban card stagger on first mount === */
.kanban-card-enter {
  animation: kanban-card-enter 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes kanban-card-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* === Table row stagger on first mount === */
.crm-row-enter {
  animation: crm-row-enter 260ms ease-out both;
}
@keyframes crm-row-enter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* === Toast exit (slide-down + fade) ===
   Class added by app.jsx 180ms before unmount. */
.app-toast.exiting {
  animation: toast-exit 180ms ease-in forwards;
}
@keyframes toast-exit {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* === Sidebar nav-item active indicator ===
   Subtle press-feel on click. */
.nav-item {
  transition: background 120ms, color 120ms, transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nav-item:active { transform: scale(0.98); }

/* === Filter pills + segmented + view-toggle: press feel === */
.filter-pill,
.segmented button,
.view-toggle button,
.tab {
  transition: background 120ms, color 120ms, border-color 120ms, transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.filter-pill:active,
.segmented button:active,
.view-toggle button:active { transform: scale(0.97); }

/* === Kanban card transitions: hover stays, but FLIP wins === */
.kanban-card {
  /* Override the older `transition: all 150ms` so FLIP via Web Animations
     stays clean and hover lift is still smooth. */
  transition: background 120ms, border-color 120ms, box-shadow 150ms, transform 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.kanban-card:active { transform: scale(0.99); }
.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

/* === Stage chip click feel === */
.stage-picker .stage-chip:active { transform: scale(0.97); }

/* === Editable inline focus polish === */
.editable input:focus,
.editable select:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--terra-500) 25%, transparent);
}

/* === Detail panel close button click === */
.detail-panel-close,
.modal-close,
.voice-close,
.app-toast-close,
.app-toast-action {
  transition: background 120ms, color 120ms, transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.detail-panel-close:active,
.modal-close:active,
.voice-close:active,
.app-toast-close:active,
.app-toast-action:active { transform: scale(0.94); }

/* === Disabled state polish (uniform across the app) === */
button:disabled:not(.task-todo-open),
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* === Placeholder color (light + dark) === */
input::placeholder,
textarea::placeholder { color: var(--text-4); opacity: 1; }


/* ============================================================
   DARK MODE POLISH — components missed by the audit
   ============================================================ */

/* Voice backdrop — light is fine; in dark, stronger blackout. */
[data-theme="dark"] .voice-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Voice mic shadow that referenced terra-500 hardcoded rgb in light. */
[data-theme="dark"] .voice-mic-big {
  box-shadow: 0 6px 18px -8px rgba(95, 179, 224, 0.55);
}
[data-theme="dark"] .voice-mic-stop {
  animation: voice-pulse-dark 1.6s ease-in-out infinite;
}
@keyframes voice-pulse-dark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(95, 179, 224, 0.45); }
  50%      { box-shadow: 0 0 0 14px rgba(95, 179, 224, 0); }
}

/* Graph lookup states use hardcoded blue #2364aa; soften in dark. */
[data-theme="dark"] .graph-lookup-searching {
  border-color: color-mix(in srgb, #5FB3E0 40%, var(--border));
  background: color-mix(in srgb, #5FB3E0 8%, var(--surface));
}
[data-theme="dark"] .graph-spinner {
  border-color: color-mix(in srgb, #5FB3E0 25%, transparent);
  border-top-color: #5FB3E0;
}

/* Email source tag in dark. */
[data-theme="dark"] .email-source-graph {
  background: color-mix(in srgb, #8bbce8 14%, transparent);
  color: #8bbce8;
}

/* Outlook brand button — blue stays the same in dark. */
[data-theme="dark"] .btn-outlook { color: #fff; }

/* Match-rule badge: ensure surface fallback in dark. */
[data-theme="dark"] .match-rule-badge { background: var(--surface-2); }

/* Backdrop already handled at line 895; ensure modal-backdrop dark too. */
[data-theme="dark"] .modal-backdrop {
  background: color-mix(in srgb, #000 60%, transparent);
}

/* Scrollbar thumb hover in dark. */
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--ink-400);
  background-clip: padding-box;
  border: 2px solid var(--bg);
}

/* Stage history line color tokens (dotted border already var-based). */
[data-theme="dark"] .stage-history-author { color: var(--text-4); }

/* Sage / amber accents that rely on hardcoded fallbacks need a dark tweak
   (color-mix with surface stays readable but accent tone shifts). */
[data-theme="dark"] .calendar-week-event-close {
  background: color-mix(in srgb, var(--sage-500) 14%, var(--surface));
}
[data-theme="dark"] .calendar-week-event-task.prio-high {
  background: color-mix(in srgb, var(--terra-500) 14%, var(--surface));
}

/* Drop target glow in dark — already partially handled at 1017, expand. */
[data-theme="dark"] .kanban-col.drop-target {
  outline-color: var(--terra-500);
}

/* Charts: when JSX uses inline color="var(--text-3)" these inherit fine.
   But charts that hardcoded #6B7E97 etc should fall back; we cover the
   common axis/grid stroke via attribute selectors used in dashboard svg. */
[data-theme="dark"] svg .axis-line,
[data-theme="dark"] svg .grid-line { stroke: var(--border); }
[data-theme="dark"] svg .axis-text,
[data-theme="dark"] svg .legend-text { fill: var(--text-3); }


/* ============================================================
   prefers-reduced-motion — disable all motion for users who asked
   (must be the LAST rule in the file so it overrides everything)
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Keep the FLIP scale/transform values from sticking — but kill the motion. */
  .kanban-card,
  .btn,
  .filter-pill,
  .segmented button,
  .view-toggle button,
  .nav-item,
  .stage-picker .stage-chip {
    transform: none !important;
  }
}


/* ============================================================
   TRANCHE 2 — LOGIN SCREEN + ADMIN
   ============================================================ */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 10%, color-mix(in srgb, var(--terra-500) 18%, transparent) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, color-mix(in srgb, var(--sage-500) 14%, transparent) 0%, transparent 55%),
    var(--bg);
  padding: 24px;
  overflow-y: auto;
  animation: view-enter 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 32px 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.login-brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--terra-500);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  display: grid; place-items: center;
}
.login-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.login-brand-sub {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
  margin: 0 0 22px;
}

.login-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-user {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background 120ms, border-color 120ms, transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.login-user:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.login-user:active { transform: scale(0.98); }

.login-user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-500), var(--sage-600));
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.login-user.role-commercial .login-user-avatar {
  background: linear-gradient(135deg, var(--terra-300), var(--terra-500));
}
.login-user.role-lecteur .login-user-avatar {
  background: linear-gradient(135deg, var(--ink-300), var(--ink-500));
}

.login-user-body { flex: 1; min-width: 0; }
.login-user-name { font-size: 14px; font-weight: 600; }
.login-user-email { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.login-user-role {
  display: inline-block;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--sage-500) 18%, var(--surface));
  color: var(--sage-700);
}
.login-user-role.role-commercial {
  background: color-mix(in srgb, var(--terra-500) 18%, var(--surface));
  color: var(--terra-600);
}
.login-user-role.role-lecteur {
  background: var(--surface-3);
  color: var(--text-3);
}
.login-user-desc {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 5px;
  line-height: 1.4;
}
.login-user-arrow {
  font-size: 18px;
  color: var(--text-3);
  margin-left: 4px;
}

.login-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-4);
  text-align: center;
  line-height: 1.45;
}

/* Sidebar footer logout */
.sidebar-footer .btn-icon-only {
  padding: 6px;
  width: 30px; height: 30px;
  flex-shrink: 0;
}

/* Admin view */
.admin-view { display: flex; flex-direction: column; gap: 14px; }
.admin-tabs { margin-bottom: 6px; }

.admin-user-add {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.admin-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.integration-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.integration-dot.off { background: var(--text-4); }
.integration-dot.on  { background: var(--sage-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage-500) 25%, transparent); }


/* ============================================================
   TRANCHE 2.5 — Pills (org/projet/mandat/priority) + Add menu
   + Dashboard grid + Voice notes + Resizable columns
   ============================================================ */

/* Generic pill base */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pill-color, var(--text-3)) 14%, var(--surface));
  color: var(--pill-color, var(--text-3));
  white-space: nowrap;
}
.pill-sm { font-size: 9.5px; padding: 1px 6px; }

/* Org size pills */
.org-pill.PPE { --pill-color: var(--org-ppe); }
.org-pill.PME { --pill-color: var(--org-pme); }
.org-pill.ME  { --pill-color: var(--org-me); }
.org-pill.GE  { --pill-color: var(--org-ge); }

/* Project size pills */
.project-pill.petit { --pill-color: var(--project-petit); color: var(--text-2); }
.project-pill.moyen { --pill-color: var(--project-moyen); color: var(--ink-700); }
.project-pill.grand { --pill-color: var(--project-grand); color: white; background: var(--project-grand); }

/* Mandate type pills */
.mandate-pill.app    { --pill-color: var(--mandate-app); }
.mandate-pill.optim  { --pill-color: var(--mandate-optim); }
.mandate-pill.plan   { --pill-color: var(--mandate-plan); }
.mandate-pill.doc    { --pill-color: var(--mandate-doc); }
.mandate-pill.accomp { --pill-color: var(--mandate-accomp); }

/* Priority chip */
.priority-chip { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.priority-chip.high { color: white; background: var(--priority-high); }
.priority-chip.med  { color: var(--ink-900); background: color-mix(in srgb, var(--priority-med) 26%, var(--surface)); }
.priority-chip.low  { color: var(--text-3); background: var(--surface-2); }
[data-theme="dark"] .priority-chip.med { color: var(--text); }

/* Pills group container */
.pills-group { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pills-overflow { font-size: 10.5px; color: var(--text-3); padding: 2px 6px; border-radius: 10px; background: var(--surface-2); }

/* === Add menu (topbar dropdown) === */
.add-menu-wrap { position: relative; }
.add-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 80;
  padding: 6px;
  animation: modal-slide-up 0.14s cubic-bezier(.2,.9,.3,1);
}
.add-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
  transition: background 100ms;
}
.add-menu-item:hover { background: var(--surface-2); }
.add-menu-item-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  flex-shrink: 0;
}
.add-menu-item-body { flex: 1; }
.add-menu-item-title { font-size: 13px; font-weight: 600; }
.add-menu-item-sub   { font-size: 11px; color: var(--text-3); }

/* === Dashboard bottom grid (Tranche 2.5.4, ajusté: pas de scroll interne) === */
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.dashboard-bottom-grid > .card {
  display: flex;
  flex-direction: column;
}

/* === Blocs Prospection / Exécution / Détails sur la fiche opp === */
.opp-block {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.opp-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.opp-block-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}
.opp-block-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.opp-block .kv-grid {
  margin: 0;
}
.opp-block-prospection {
  border-left: 3px solid var(--terra-500);
}
.opp-block-execution {
  border-left: 3px solid var(--border);
}
.opp-block-execution.active {
  border-left-color: var(--sage-500);
  background: var(--surface);
}

/* === Closing soon row — grille alignée (desktop) === */
.closing-row {
  display: grid;
  grid-template-columns:
    auto                  /* logo */
    minmax(150px, 1fr)    /* titres */
    110px                 /* étape */
    130px                 /* prob bar */
    minmax(190px, auto)   /* montant */
    72px;                 /* jours restants (right-aligned) */
  gap: 14px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms;
}
.closing-row:last-child { border-bottom: none; }
.closing-row:hover { background: var(--surface-2); }

.closing-row-titles {
  min-width: 0;             /* permet le truncate du flex/grid item */
  overflow: hidden;
}
.closing-row-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.closing-row-company {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.closing-row-prob {
  width: 100%;
}

.closing-row-money {
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.closing-row-money b { color: var(--text); font-weight: 600; }

/* La DueBadge dans la dernière colonne, alignée à droite */
.closing-row > :last-child {
  justify-self: end;
  white-space: nowrap;
}

/* Panneau étroit / mobile : on retombe en flex wrap */
@media (max-width: 1100px) {
  .closing-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
  }
  .closing-row-titles { flex: 1 1 100%; order: -1; }
  .closing-row-prob { width: 110px; }
  .closing-row > :last-child { margin-left: auto; }
}
@media (max-width: 900px) {
  .dashboard-bottom-grid { grid-template-columns: 1fr; }
}

/* === Voice notes === */
.voicenotes-wrap { display: grid; grid-template-columns: 360px 1fr; gap: 18px; min-height: 480px; }
@media (max-width: 1100px) { .voicenotes-wrap { grid-template-columns: 1fr; } }

.voicenote-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.voicenote-list-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.voicenote-list-items { overflow-y: auto; flex: 1; }
.voicenote-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 100ms;
  position: relative;
}
.voicenote-item:hover { background: var(--surface-2); }
.voicenote-item.active { background: var(--surface-2); border-left: 3px solid var(--terra-500); padding-left: 11px; }
.voicenote-item.status-new::before {
  content: ""; position: absolute; left: 6px; top: 18px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--terra-500);
}
.voicenote-item-body { flex: 1; min-width: 0; }
.voicenote-item-title {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.voicenote-item-meta {
  font-size: 11px; color: var(--text-3);
  display: flex; gap: 6px; align-items: center;
}
.voicenote-item-snippet {
  font-size: 12px; color: var(--text-2);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.voicenote-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.voicenote-detail-head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.voicenote-audio-player {
  flex: 1;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-3);
}
.voicenote-audio-disabled {
  font-style: italic;
  color: var(--text-4);
}
.voicenote-detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}
.voicenote-detail-left, .voicenote-detail-right {
  padding: 18px;
  overflow-y: auto;
}
.voicenote-detail-left { border-right: 1px solid var(--border); }
@media (max-width: 1100px) {
  .voicenote-detail-body { grid-template-columns: 1fr; }
  .voicenote-detail-left { border-right: none; border-bottom: 1px solid var(--border); }
}

.vn-section-h {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 14px 0 8px;
}
.vn-section-h:first-child { margin-top: 0; }

.vn-deduction-line {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
}
.vn-deduction-label { color: var(--text-3); font-size: 12px; }
.vn-confidence {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-4);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 99px;
}

.vn-transcript {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.vn-summary {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--terra-500) 6%, var(--surface));
  border-left: 3px solid var(--terra-500);
  border-radius: 6px;
}

.vn-task-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.vn-task-row input[type="checkbox"] { margin: 0; cursor: pointer; }

.vn-email-card {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  display: flex; flex-direction: column; gap: 6px;
}
.vn-email-subject { font-weight: 600; color: var(--text); }
.vn-email-body { white-space: pre-line; color: var(--text-2); line-height: 1.45; }

/* === Resizable columns === */
table.crm thead th, table.matrix thead th { position: relative; }
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 5;
}
.col-resize-handle:hover,
.col-resize-handle.dragging {
  background: color-mix(in srgb, var(--terra-500) 30%, transparent);
}
.col-resize-handle.dragging { background: var(--terra-500); }

/* Kanban card priority + types */
.kanban-card .kanban-card-pills {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}

/* Read-only styling */
.kanban-card.readonly { cursor: default; opacity: 0.85; }
.kanban-card.readonly:hover { transform: none; box-shadow: var(--shadow-sm); }

/* ============================================================
   DIAGNOSTIC ÉCO — vue Développement des affaires (mockup)
   ============================================================ */

.diag-hero {
  position: relative;
  background: linear-gradient(135deg, #0E2A4D 0%, #081D3A 100%);
  border-radius: 14px;
  overflow: hidden;
  color: #fff;
  margin-bottom: 4px;
}
[data-theme="dark"] .diag-hero {
  background: linear-gradient(135deg, #1F6FA0 0%, #0E2A4D 100%);
}
.diag-hero-band {
  height: 6px;
  background: linear-gradient(90deg, var(--sage-500) 0%, var(--sage-600) 100%);
}
.diag-hero-body {
  padding: 22px 26px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.diag-hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 6px;
  font-weight: 600;
}
.diag-hero-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: #fff;
}
.diag-hero-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  max-width: 560px;
  margin: 0;
}
.diag-hero-actions { display: flex; gap: 8px; flex-shrink: 0; }
.diag-hero-actions .btn-ghost {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}
.diag-hero-actions .btn-ghost:hover { background: rgba(255,255,255,0.18); }
.diag-hero-actions .btn-primary {
  background: var(--sage-500);
  border-color: var(--sage-500);
  color: #fff;
}
.diag-hero-actions .btn-primary:hover { background: var(--sage-600); border-color: var(--sage-600); }

.diag-tabs {
  display: flex;
  gap: 4px;
  margin: 22px 0 16px;
  border-bottom: 1px solid var(--border);
}
.diag-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.diag-tab:hover { color: var(--text); }
.diag-tab.active {
  color: var(--terra-600);
  border-bottom-color: var(--terra-500);
  font-weight: 600;
}

.diag-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 980px) { .diag-grid-2 { grid-template-columns: 1fr; } }

/* Profile bars (overview) */
.diag-profile-bars { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.diag-profile-bar { }
.diag-profile-bar-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  margin-bottom: 4px;
}
.diag-profile-bar-label { flex: 1; font-weight: 500; }
.diag-profile-bar-count { font-weight: 700; color: var(--text-2); }
.diag-profile-bar-track {
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}
.diag-profile-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }

.diag-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.diag-dot-amber { background: var(--amber-500); }
.diag-dot-plum  { background: var(--plum-500); }
.diag-dot-terra { background: var(--terra-500); }
.diag-dot-sage  { background: var(--sage-500); }

/* Recent diagnostics list */
.diag-recent { padding: 8px 0 4px; }
.diag-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
}
.diag-recent-row:first-child { border-top: none; }
.diag-recent-body { flex: 1; min-width: 0; }
.diag-recent-company { font-weight: 600; font-size: 13px; }
.diag-recent-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* Profile tags */
.diag-profile-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.diag-tag-amber { background: rgba(232, 136, 54, 0.14); color: var(--sage-700); }
.diag-tag-plum  { background: rgba(91, 123, 170, 0.14); color: #3D5778; }
.diag-tag-terra { background: var(--terra-50); color: var(--terra-700); }
.diag-tag-sage  { background: rgba(232, 136, 54, 0.10); color: var(--sage-600); }

/* Profile cards grid */
.diag-profile-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.diag-profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.diag-profile-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--terra-500);
}
.diag-card-amber::before { background: var(--amber-500); }
.diag-card-plum::before  { background: var(--plum-500); }
.diag-card-terra::before { background: var(--terra-500); }
.diag-card-sage::before  { background: var(--sage-500); }
.diag-profile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.diag-profile-card-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.diag-profile-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.diag-mark-amber { background: linear-gradient(135deg, var(--amber-500), var(--sage-600)); }
.diag-mark-plum  { background: linear-gradient(135deg, var(--plum-500), #3D5778); }
.diag-mark-terra { background: linear-gradient(135deg, var(--terra-500), var(--terra-700)); }
.diag-mark-sage  { background: linear-gradient(135deg, var(--sage-500), var(--sage-700)); }

.diag-profile-card-title { font-weight: 700; font-size: 14px; }
.diag-profile-card-stat { font-size: 22px; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.diag-profile-card-desc { font-size: 12.5px; color: var(--text-3); margin: 0 0 12px; line-height: 1.45; }
.diag-profile-card-track {
  height: 5px; background: var(--bg-2); border-radius: 3px; overflow: hidden;
  margin-bottom: 10px;
}
.diag-profile-card-fill { height: 100%; border-radius: 3px; }
.diag-profile-card-recent {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 8px;
}
.diag-mini-pill {
  font-size: 10.5px;
  background: var(--bg-2);
  color: var(--text-2);
  padding: 2px 7px;
  border-radius: 8px;
}

/* Cross tables */
.diag-cross th, .diag-cross td {
  text-align: center;
  font-size: 12.5px;
  padding: 9px 10px;
}
.diag-cross th:first-child, .diag-cross td:first-child { text-align: left; }
.diag-heat-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 0.2s;
}

.diag-footnote {
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-left: 3px solid var(--sage-500);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}

/* ============================================================
   TRANCHE 6, OKR (Stratégie / Pilotage interne)
   ============================================================ */

.okr-hero {
  position: relative;
  background: linear-gradient(135deg, #0E2A4D 0%, #081D3A 100%);
  border-radius: 14px;
  overflow: hidden;
  color: #fff;
}
[data-theme="dark"] .okr-hero {
  background: linear-gradient(135deg, #1F6FA0 0%, #0E2A4D 100%);
}
.okr-hero-band {
  height: 6px;
  background: linear-gradient(90deg, var(--terra-500) 0%, var(--terra-600) 100%);
}
.okr-hero-body {
  padding: 22px 26px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.okr-hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 6px;
  font-weight: 600;
}
.okr-hero-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: #fff;
}
.okr-hero-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  max-width: 580px;
  margin: 0;
}
.okr-hero-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.okr-hero-actions .btn-ghost {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}
.okr-hero-actions .btn-ghost:hover { background: rgba(255,255,255,0.18); }
.okr-period-select {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.okr-period-select option { color: var(--text); background: var(--surface); }

.okr-swimlanes {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.okr-swimlane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 14px 22px;
  position: relative;
  overflow: hidden;
}
.okr-swimlane::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--terra-500);
}
.okr-swimlane-terra::before { background: var(--terra-500); }
.okr-swimlane-navy::before  { background: #0E2A4D; }
.okr-swimlane-plum::before  { background: var(--plum-500); }
.okr-swimlane-sage::before  { background: var(--sage-500); }

.okr-swimlane-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 14px;
}
.okr-swimlane-title { font-weight: 700; font-size: 16px; color: var(--text); }
.okr-brand-mark {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.okr-brand-terra { background: linear-gradient(135deg, var(--terra-500), var(--terra-700)); }
.okr-brand-navy  { background: linear-gradient(135deg, #2A5278, #081D3A); }
.okr-brand-plum  { background: linear-gradient(135deg, var(--plum-500), #3D5778); }
.okr-brand-sage  { background: linear-gradient(135deg, var(--sage-500), var(--sage-700)); }

.okr-annual-goal {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 4px;
}
.okr-editable-multiline {
  cursor: text;
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: -6px;
  transition: background 0.15s;
}
.okr-editable-multiline:hover { background: var(--bg-2); }
.okr-textarea-edit {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--terra-500);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.okr-objective-block {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.okr-objective-block:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

.okr-cols {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
}

.okr-objective-card {
  background: var(--terra-50);
  border-left: 3px solid var(--terra-500);
  border-radius: 8px;
  padding: 12px 14px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.okr-objective-card:hover { filter: brightness(0.97); }
.okr-card-terra { border-left-color: var(--terra-500); background: var(--terra-50); }
.okr-card-navy  { border-left-color: #0E2A4D; background: rgba(8,29,58,0.06); }
.okr-card-plum  { border-left-color: var(--plum-500); background: rgba(91,123,170,0.10); }
.okr-card-sage  { border-left-color: var(--sage-500); background: rgba(232,136,54,0.08); }

[data-theme="dark"] .okr-card-terra { background: rgba(45,143,200,0.15); }
[data-theme="dark"] .okr-card-navy  { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .okr-card-plum  { background: rgba(91,123,170,0.18); }
[data-theme="dark"] .okr-card-sage  { background: rgba(232,136,54,0.16); }

.okr-objective-title {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  padding-right: 50px;
}

.okr-card-actions {
  position: absolute;
  top: 6px; right: 6px;
  display: none;
  gap: 2px;
}
.okr-objective-card:hover .okr-card-actions,
.okr-ka-cell:hover .okr-card-actions,
.okr-kr-row:hover .okr-card-actions { display: flex; }
.okr-icon-btn {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-3);
}
.okr-icon-btn:hover { color: var(--terra-600); border-color: var(--terra-500); background: var(--terra-50); }

.okr-col-kas { display: flex; flex-direction: column; gap: 8px; }

.okr-ka-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 10px;
  align-items: stretch;
}
.okr-ka-cell {
  background: var(--bg-2);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.okr-ka-cell:hover { filter: brightness(0.97); }
.okr-ka-title { padding-right: 50px; }

.okr-kr-cell { display: flex; flex-direction: column; gap: 6px; }

.okr-kr-row {
  display: grid;
  grid-template-columns: 1fr 130px auto;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  position: relative;
  font-size: 12.5px;
}
.okr-kr-row:hover { border-color: var(--terra-500); }
.okr-kr-title { font-weight: 500; cursor: pointer; line-height: 1.4; }
.okr-kr-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-3);
}
.okr-kr-values { font-variant-numeric: tabular-nums; font-weight: 500; }
.okr-kr-confidence {
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
}
.okr-conf-low  { background: rgba(225,61,87,0.12); color: #C44060; }
.okr-conf-med  { background: rgba(91,123,170,0.14); color: #3D5778; }
.okr-conf-high { background: rgba(110,158,92,0.16); color: var(--sage-700); }

.okr-kr-progress {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}
.okr-kr-bar {
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.okr-kr-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.okr-zone-red    .okr-kr-bar-fill { background: linear-gradient(90deg, #E74C5E, #C44060); }
.okr-zone-yellow .okr-kr-bar-fill { background: linear-gradient(90deg, var(--amber-500), #D9703A); }
.okr-zone-green  .okr-kr-bar-fill { background: linear-gradient(90deg, #6E9E5C, var(--sage-700)); }
.okr-kr-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 11px;
  text-align: right;
  color: var(--text-2);
}

.okr-kr-actions { position: relative; top: 0; right: 0; }

.okr-add-row {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
}
.okr-add-row:hover { border-color: var(--terra-500); color: var(--terra-600); }
.okr-add-row-mini {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  align-self: flex-start;
  margin-top: 2px;
  transition: border-color 0.15s, color 0.15s;
}
.okr-add-row-mini:hover { border-color: var(--terra-500); color: var(--terra-600); }
.okr-add-kr { margin-top: 0; }

.okr-empty-objective {
  padding: 14px;
  background: var(--bg-2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

.okr-checkin-preview {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.okr-confidence-pills {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.okr-conf-pill {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.okr-conf-pill:hover { border-color: var(--terra-500); }
.okr-conf-pill.active.okr-conf-low  { background: rgba(225,61,87,0.12); border-color: #E74C5E; color: #C44060; }
.okr-conf-pill.active.okr-conf-med  { background: rgba(91,123,170,0.14); border-color: var(--plum-500); color: #3D5778; }
.okr-conf-pill.active.okr-conf-high { background: rgba(110,158,92,0.16); border-color: var(--sage-700); color: var(--sage-700); }

.okr-footnote {
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-left: 3px solid var(--terra-500);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}

.modal .form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s;
}
.modal .form-control:focus { outline: none; border-color: var(--terra-500); }
.modal .form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 5px;
}
.modal textarea.form-control { resize: vertical; line-height: 1.45; }

@media (max-width: 900px) {
  .okr-cols { grid-template-columns: 1fr; }
  .okr-ka-row { grid-template-columns: 1fr; }
  .okr-kr-row { grid-template-columns: 1fr; gap: 6px; }
  .okr-kr-actions { justify-content: flex-end; display: flex; }
}
