:root {
  --navy: #073889;
  --navy-dark: #052963;
  --orange: #f46015;
  --orange-dark: #d44d08;
  --sky: #009cdc;
  --sky-light: #e6f5fc;
  --gray-50: #f7f9fc;
  --gray-100: #eef2f7;
  --gray-200: #dfe5ee;
  --gray-300: #c5cfdc;
  --gray-500: #6b7688;
  --gray-700: #3a4354;
  --gray-900: #171e2c;
  --danger: #d93025;
  --success: #1e7e34;
  --warning: #e6a500;
  --shadow-sm: 0 1px 2px rgba(7, 56, 137, 0.06);
  --shadow: 0 4px 12px rgba(7, 56, 137, 0.08);
  --shadow-lg: 0 12px 32px rgba(7, 56, 137, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3, h4, h5 { font-family: 'Exo', sans-serif; font-weight: 600; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
p { margin: 0 0 10px; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--orange-dark); }
.btn-secondary { background: var(--navy); color: white; }
.btn-secondary:hover:not(:disabled) { background: var(--navy-dark); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--gray-300); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--gray-900);
  transition: border 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px var(--sky-light);
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* Login screen */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--sky));
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 14px;
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.login-card img { height: 48px; margin-bottom: 24px; }
.login-card h1 { color: var(--navy); margin-bottom: 8px; }
.login-card p { color: var(--gray-500); margin-bottom: 28px; }
.btn-ms {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: var(--navy);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  width: 100%;
  justify-content: center;
}
.btn-ms:hover { background: var(--navy-dark); }
.ms-logo { display: inline-grid; grid-template-columns: 1fr 1fr; width: 18px; height: 18px; gap: 2px; }
.ms-logo span { display: block; }
.ms-logo span:nth-child(1) { background: #f25022; }
.ms-logo span:nth-child(2) { background: #7fba00; }
.ms-logo span:nth-child(3) { background: #00a4ef; }
.ms-logo span:nth-child(4) { background: #ffb900; }

/* Main layout */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--navy);
  color: white;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand img { height: 30px; filter: brightness(0) invert(1); }
.sidebar-brand-text { font-family: 'Exo'; font-weight: 600; font-size: 14px; }
.sidebar-brand-text small { display: block; font-size: 11px; opacity: 0.7; font-weight: 400; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: rgba(255,255,255,0.1); color: white; border-left-color: var(--orange); }
.nav-icon { font-size: 18px; width: 22px; display: inline-flex; justify-content: center; }
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}
.sidebar-footer .email { opacity: 0.7; font-size: 12px; margin-bottom: 8px; word-break: break-all; }
.logout {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
}
.logout:hover { background: rgba(255,255,255,0.08); }

.main {
  padding: 32px 40px;
  max-width: 1400px;
  width: 100%;
}
@media (max-width: 640px) { .main { padding: 20px; } }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { color: var(--navy); }
.page-header p { color: var(--gray-500); margin: 4px 0 0; }

.contact-info-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--coral);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.contact-info-row {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.contact-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}
.contact-info-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.contact-info-value {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.contact-info-value label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 2px;
}
.contact-link {
  color: var(--navy);
  font-weight: 500;
  text-decoration: none;
  word-break: break-all;
  font-size: 14px;
}
.contact-link:hover { color: var(--coral); text-decoration: underline; }
.contact-empty { color: var(--gray-400); font-style: italic; font-size: 13px; }
.contact-edit-btn { flex-shrink: 0; }
.contact-edit-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.enrich-note {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fffbea;
  border-left: 3px solid #f5c96b;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gray-600, #4a5568);
  line-height: 1.4;
}
.contact-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.contact-plain {
  color: var(--navy);
  font-weight: 500;
  font-size: 14px;
  word-break: break-all;
  user-select: all;
}
.copy-btn {
  flex-shrink: 0;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--navy);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: all 0.15s ease;
}
.copy-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.copy-btn.copied { background: #2ea96a; color: #fff; border-color: #2ea96a; }

.contact-info-card.editing .contact-info-item {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.contact-info-card.editing label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  font-weight: 600;
}
.contact-info-card.editing input {
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.contact-info-card.editing input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 2px rgba(255,107,94,0.15);
}
.page-actions { display: flex; gap: 8px; }

.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.card-title h3 { color: var(--navy); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.badge-navy { background: var(--navy); color: white; }
.badge-orange { background: var(--orange); color: white; }
.badge-sky { background: var(--sky); color: white; }
.badge-high { background: #ffebee; color: var(--danger); }
.badge-mid { background: #fff8e1; color: #b07800; }
.badge-low { background: #e8f5e9; color: var(--success); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }

.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.contact-card:hover { box-shadow: var(--shadow); border-color: var(--sky); }
.contact-card h4 { color: var(--navy); margin-bottom: 4px; }
.contact-card .meta { font-size: 13px; color: var(--gray-500); display: flex; gap: 10px; flex-wrap: wrap; }
.contact-card .meta strong { color: var(--gray-700); }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
  background: white;
  border-radius: var(--radius);
  border: 1px dashed var(--gray-300);
}
.empty h3 { color: var(--gray-700); margin-bottom: 6px; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-navy { border-color: rgba(7,56,137,0.2); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--gray-500);
  gap: 12px;
}

.phase {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  margin-bottom: 12px;
}
.phase-header {
  width: 100%;
  padding: 14px 18px;
  background: var(--gray-50);
  border: none;
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  font-size: 16px;
  color: inherit;
  text-align: left;
  transition: background 0.12s;
}
.phase-header:hover { background: var(--gray-100); }
.phase.closed .phase-header { border-bottom: none; }
.phase-title { color: var(--navy); font-weight: 600; flex: 1; }
.phase-count {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}
.phase-count.partial { background: #fff4e3; color: #b07800; }
.phase-count.complete { background: #e8f5e9; color: var(--success); }
.phase-chevron {
  color: var(--gray-500);
  font-size: 11px;
  width: 16px;
  text-align: center;
  transition: transform 0.15s;
}
.phase-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--orange);
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}
.phase-body { padding: 18px; }
.phase-attention {
  background: var(--sky-light);
  border-left: 3px solid var(--sky);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 14px;
}

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  font-size: 14px;
  animation: slideIn 0.2s ease-out;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 25, 50, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px; animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 { color: var(--navy); margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.dept-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  background: var(--sky-light);
  color: var(--navy);
}

.ai-result {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-left: 3px solid var(--orange);
  margin-bottom: 10px;
  white-space: pre-wrap;
  font-size: 14px;
}
.ai-result strong { color: var(--navy); }

.prospecting-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
}
.prospecting-card .company-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.prospecting-card h4 { color: var(--navy); }
.prospecting-contact {
  background: var(--gray-50);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.prospecting-contact .c-name { font-weight: 600; color: var(--gray-900); }
.prospecting-contact .c-meta { font-size: 12px; color: var(--gray-500); }
.prospecting-contact .c-meta a { color: var(--sky); }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { background: var(--gray-100); color: var(--gray-700); font-size: 11px; padding: 3px 8px; border-radius: 10px; }
.chip.navy { background: var(--navy); color: white; }
.chip.orange { background: var(--orange); color: white; }

.slides-preview { display: flex; flex-direction: column; gap: 10px; }
.slide-preview {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.slide-preview h4 { color: var(--navy); margin-bottom: 6px; font-size: 15px; }
.slide-preview ul { margin: 0; padding-left: 20px; font-size: 13px; color: var(--gray-700); }

textarea.email-body { font-family: inherit; min-height: 260px; }

.pill-select { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-select button {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}
.pill-select button.active { background: var(--navy); color: white; border-color: var(--navy); }

hr.sep { border: 0; border-top: 1px solid var(--gray-200); margin: 16px 0; }


/* Email mode buttons */
.email-mode-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.email-mode {
  text-align: left;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: inherit;
  width: 100%;
}
.email-mode:hover:not(:disabled) { border-color: var(--orange); background: #fff7ef; }
.email-mode.active { border-color: var(--orange); background: #fff7ef; box-shadow: 0 0 0 2px rgba(244, 96, 21, 0.15); }
.email-mode:disabled { opacity: 0.5; cursor: not-allowed; }
.email-mode-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.email-mode-icon { font-size: 18px; }
.email-mode-label { font-weight: 600; color: var(--navy); font-size: 14px; }
.email-mode-sub { color: var(--gray-700); font-size: 13px; }
.email-mode-loading { color: var(--orange); font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* Sidebar sub-items */
.nav-subgroup { padding: 4px 0 10px; border-left: 1px solid rgba(255,255,255,0.08); margin-left: 20px; }
.nav-sub {
  display: block;
  padding: 6px 14px 6px 12px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1.25;
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.nav-sub:hover { color: white; background: rgba(255,255,255,0.04); }
.nav-sub.active { color: white; background: rgba(255,255,255,0.08); border-left-color: var(--orange); }
.nav-sub .nav-sub-meta { display: block; font-size: 11px; opacity: 0.65; margin-top: 1px; }
.nav-empty { padding: 4px 14px 10px 12px; color: rgba(255,255,255,0.4); font-size: 12px; font-style: italic; margin-left: 20px; }


/* Live notes tijdens gesprek */
textarea.live-notes {
  width: 100%;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--sky-light);
  color: var(--gray-900);
  resize: vertical;
  min-height: 200px;
}
textarea.live-notes:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(0, 156, 220, 0.15); background: white; }


/* Gesprek mode switcher */
.mode-switcher {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.mode-switcher-label { font-weight: 600; color: var(--navy); font-size: 14px; }
.mode-switcher-tabs { display: flex; gap: 8px; flex: 1; min-width: 260px; flex-wrap: wrap; }
.mode-tab {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.mode-tab:hover { border-color: var(--orange); background: white; }
.mode-tab.active { border-color: var(--orange); background: #fff7ef; box-shadow: 0 0 0 2px rgba(244, 96, 21, 0.15); }
.mode-tab-icon { font-size: 22px; flex-shrink: 0; }
.mode-tab-text { display: flex; flex-direction: column; line-height: 1.25; }
.mode-tab-text strong { color: var(--navy); font-size: 14px; }
.mode-tab-text small { color: var(--gray-500); font-size: 12px; }
.mode-tab.active .mode-tab-text strong { color: var(--orange-dark); }
