/* ===== Person detail ===== */
.detail-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; height: 100%; }
/* Contact detail: linkerkolom en timeline scrollen onafhankelijk van elkaar.
   De page-body scrollt zelf niet meer; elke kolom krijgt een eigen scrollbar. */
#contacts-detail .page-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
#contacts-detail .detail-layout {
  flex: 1;
  height: auto;
  min-height: 0;
}
#contacts-detail .detail-layout > div {
  min-height: 0;
  overflow-y: auto;
  /* kleine zijmarge zodat kaart-schaduwen niet worden afgeknipt door de scroller */
  padding: 2px 4px 60px 2px;
  scrollbar-width: thin;
}
.detail-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}
.detail-avatar {
  width: 52px; height: 52px;
  background: var(--ink);
  color: var(--bg-cream);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
}
.detail-name {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.detail-sub { color: var(--ink-mute); font-size: 13px; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.kv-row { display: flex; padding: 5px 0; font-size: 13px; align-items: center; }
.kv-key { color: var(--ink-mute); width: 110px; flex-shrink: 0; }
.kv-val { color: var(--ink); font-weight: 500; flex: 1; min-width: 0; }
/* Extra e-mailadressen/telefoonnummers in de Summary: eigen regel + label-chip.
   Lange waarden kappen we af met … in plaats van omslaan. */
.kv-sub-line {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 12px; font-weight: 400; margin-top: 3px; color: var(--ink-soft);
}
.kv-sub-line a, .kv-sub-line .kv-sub-text {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kv-sub-line a { color: var(--ink-soft); text-decoration: none; }
.kv-sub-line a:hover { color: var(--accent); text-decoration: underline; }
.kv-sub-label {
  font-size: 10px; font-weight: 600; color: var(--ink-mute);
  background: var(--bg-warm); border-radius: 99px; padding: 1px 7px; margin-left: 6px;
  text-transform: lowercase; flex-shrink: 0;
}
.kv-sub-line .kv-sub-label { margin-left: 0; }
/* Primaire regel (e-mail-anchor / telefoon-tekst): afkappen, chip blijft ernaast passen */
#d-email, .kv-prim-text {
  display: inline-block; max-width: calc(100% - 70px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.kv-edit-btn {
  visibility: hidden; background: none; border: none; cursor: pointer;
  color: var(--ink-mute); padding: 3px 5px; border-radius: 4px;
  display: inline-flex; align-items: center; flex-shrink: 0; margin-left: 4px;
}
.kv-edit-btn:hover { color: var(--accent); background: var(--accent-soft); }
.kv-row:hover .kv-edit-btn { visibility: visible; }
.kv-copy-btn {
  visibility: hidden; background: none; border: none; cursor: pointer;
  color: var(--ink-mute); padding: 3px 5px; border-radius: 4px;
  display: inline-flex; align-items: center; flex-shrink: 0; margin-left: 4px;
}
.kv-copy-btn:hover { color: var(--accent); background: var(--accent-soft); }
.kv-copy-btn.copied { color: var(--accent); visibility: visible; }
.kv-row:hover .kv-copy-btn { visibility: visible; }
.kv-inline-input, .kv-inline-select {
  font-size: 13px; font-family: inherit; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--accent);
  border-radius: 5px; padding: 3px 7px; min-width: 0; flex: 1; outline: none;
}
.kv-inline-actions { display: inline-flex; gap: 3px; margin-left: 5px; flex-shrink: 0; }
.kv-inline-save, .kv-inline-cancel {
  width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--white); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; color: var(--ink-mute);
}
.kv-inline-save:hover { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.kv-inline-cancel:hover { background: #fee2e2; color: #dc2626; border-color: #dc2626; }
.kv-val a { color: var(--accent); text-decoration: none; word-break: break-all; }
.kv-val a:hover { text-decoration: underline; }
.kv-val .linkedin-link {
  color: #0077b5;
  display: inline-flex; align-items: center; gap: 5px;
}

.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 0 4px;
}
.tab {
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.activity-input {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--ink-mute);
  cursor: text;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.activity-input:hover { border-color: var(--accent); color: var(--ink-soft); }

/* ===== Organization detail people list ===== */
.org-person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.org-person-row:hover { background: var(--bg-warm); }
.org-person-row:not(:last-child) { border-bottom: 1px solid var(--border-soft, var(--border)); }
.org-person-avatar {
  width: 32px; height: 32px;
  background: var(--ink-mute);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.org-person-info { flex: 1; min-width: 0; }
.org-person-name { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.org-person-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Contact action bar (Activity / Notes / Email) ===== */
.contact-action-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.cab-tabs {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 6px;
  gap: 2px;
}
.cab-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.cab-tab:hover { color: var(--ink); }
.cab-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.cab-close {
  margin-left: auto;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-mute);
  padding: 0 12px;
  display: inline-flex; align-items: center;
}
.cab-close:hover { color: var(--ink); }
.cab-prompt {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-mute);
  cursor: text;
  display: flex; align-items: center; gap: 10px;
}
.cab-prompt:hover { color: var(--ink-soft); }
.cab-panel { padding: 14px 16px; }
.cab-panel textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  min-height: 100px;
  resize: vertical;
  outline: none;
  color: var(--ink);
  background: var(--white);
}
.cab-panel textarea:focus { border-color: var(--accent); }
.cab-email-grid {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px 12px;
  margin-bottom: 12px;
  align-items: center;
}
.cab-email-grid label {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 500;
}
.cab-email-grid input,
.cab-email-grid select {
  padding: 7px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: var(--white);
  color: var(--ink);
  width: 100%;
  box-sizing: border-box;
}
.cab-email-grid input:focus,
.cab-email-grid select:focus { border-color: var(--accent); }
.cab-email-to-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cab-email-to-row input { flex: 1; }
.cab-email-ccbcc-toggle {
  font-size: 11px;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  user-select: none;
  white-space: nowrap;
}
.cab-email-ccbcc-toggle:hover { background: var(--bg-warm); color: var(--ink); }
.cab-email-editor {
  min-height: 140px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  line-height: 1.55;
}
.cab-email-editor:focus { border-color: var(--accent); }
.cab-email-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--ink-mute);
  pointer-events: none;
}
#tpl-body-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--ink-mute);
  pointer-events: none;
}
#sig-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--ink-mute);
  pointer-events: none;
  white-space: pre-line;
}
.cab-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; position: relative; align-items: center; flex-wrap: wrap; }
/* Opmaakbalk boven de verzendknoppen in de contact/deal e-mailcomposer */
.cab-fmt-row { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
#cab-email-attachments, #dab-email-attachments { margin-top: 8px; }

/* ===== Template variable chips ===== */
.tpl-var {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 1px;
  border-radius: 4px;
  background: var(--accent-soft, #e8ddff);
  color: var(--accent, #6b3fd4);
  font-size: 0.92em;
  font-weight: 600;
  white-space: nowrap;
  user-select: all;
  cursor: default;
}
.tpl-var::before { content: "{ "; opacity: .5; }
.tpl-var::after  { content: " }"; opacity: .5; }
/* Resolved chip: reads as natural text with only a subtle highlight, no braces. */
.tpl-var.tpl-var-filled {
  background: rgba(16, 185, 129, .12);
  color: inherit;
  font-weight: inherit;
}
.tpl-var.tpl-var-filled::before,
.tpl-var.tpl-var-filled::after { content: ""; }
.tpl-var-menu-item:hover { background: var(--bg-warm); }

/* ===== Email recipient chips (tokenized to/cc/bcc fields) ===== */
.email-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.email-tokens > input {
  border: none !important; outline: none !important; background: transparent !important;
  padding: 0 !important; margin: 0; flex: 1 1 90px; min-width: 90px; width: auto !important;
  font: inherit; color: var(--ink); box-sizing: border-box;
}
/* cab/dab grids style the field box on the input itself — move it to the wrapper. */
.cab-email-grid .email-tokens {
  padding: 5px 7px; border: 1px solid var(--border-soft); border-radius: 6px;
  background: var(--white); width: 100%; box-sizing: border-box;
}
.cab-email-grid .email-tokens:focus-within { border-color: var(--accent); }
.cab-email-to-row .email-tokens { flex: 1; }
.compose-field-row .email-tokens,
.reply-field-row .email-tokens { flex: 1; min-width: 0; }
.email-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  background: var(--accent-soft, #e8ddff); color: var(--accent, #6b3fd4);
  border-radius: 12px; padding: 1px 4px 1px 9px; font-size: 12.5px; line-height: 1.7;
}
.email-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.email-chip-x {
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px;
  border-radius: 50%; opacity: .55;
}
.email-chip-x:hover { opacity: 1; background: rgba(0,0,0,.08); }
.email-chip.invalid { background: rgba(239,68,68,.12); color: var(--danger, #ef4444); }

/* ===== Signature picker menu ===== */
.sig-menu {
  background: var(--bg-card, #fff); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.14); min-width: 200px; overflow: hidden; padding: 4px 0;
}
.sig-menu-item { padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--ink); white-space: nowrap; }
.sig-menu-item:hover { background: var(--bg-warm); }

/* ===== Label picker (person modal) ===== */
.label-picker { display: flex; flex-direction: column; gap: 10px; }
.label-picker-selected { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.label-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  user-select: none;
  border: 1.5px solid transparent;
  transition: opacity 0.12s;
}
.label-chip .label-chip-x {
  font-size: 14px; line-height: 1; margin-left: 2px; opacity: 0.6;
}
.label-chip:hover .label-chip-x { opacity: 1; }
.label-picker-options { display: flex; flex-wrap: wrap; gap: 6px; }
.label-option {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  opacity: 0.55;
  transition: opacity 0.12s, border-color 0.12s;
}
.label-option:hover { opacity: 0.9; }
.label-option.selected { opacity: 1; border-color: currentColor; }
.label-option-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.label-add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px dashed var(--border);
  border-radius: 6px; padding: 5px 10px;
  font-family: inherit; font-size: 12px; color: var(--ink-mute);
  cursor: pointer; transition: border-color 0.12s, color 0.12s;
  align-self: flex-start;
}
.label-add-btn:hover { border-color: var(--accent); color: var(--accent); }
.label-new-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg-warm); border-radius: 8px; padding: 10px 30px 10px 10px;
  position: relative;
}
.label-close-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ink-mute);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.label-close-x:hover { background: rgba(0,0,0,0.08); color: var(--ink); }
.label-color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.label-swatch {
  width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.1s;
  flex-shrink: 0;
}
.label-swatch:hover { transform: scale(1.15); }
.label-swatch.selected { border-color: var(--ink); }
/* "Eigen kleur"-swatch: regenboog totdat er een eigen kleur is gekozen */
.label-swatch-custom {
  position: relative; overflow: hidden;
  background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #3b82f6, #8b5cf6, #ec4899, #ef4444);
  display: inline-flex;
}
.label-swatch-custom input[type="color"] {
  position: absolute; inset: -4px; opacity: 0; cursor: pointer; border: none; padding: 0;
}
/* Verwijder-kruisje op label/bron/stage-chips (zichtbaar bij hover) */
.label-option { position: relative; }
.label-option-x {
  display: none; margin-left: 5px; font-weight: 700; opacity: 0.65; cursor: pointer;
}
.label-option:hover .label-option-x { display: inline; }
.label-option-x:hover { opacity: 1; }

/* ── Multi-email rows (contact modal) ───────────────────────────────────── */
.pe-list { display: flex; flex-direction: column; gap: 6px; }
.pe-row {
  display: flex; align-items: center; gap: 6px;
}
.pe-row .pe-email, .pe-row .pe-phone { flex: 1; min-width: 0; }
.pe-row .pe-label-sel { width: 112px; flex-shrink: 0; }
.pe-row .pe-label-sel .cs-trigger { padding: 8px 10px; font-size: 12.5px; }
.pe-star {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink-mute);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pe-star:hover { color: var(--ink); border-color: var(--ink-mute); }
.pe-star.is-primary {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.pe-remove {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.pe-remove:hover { background: rgba(0,0,0,0.06); color: var(--danger); }
.pe-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px dashed var(--border);
  border-radius: 6px; padding: 5px 10px;
  font-family: inherit; font-size: 12px; color: var(--ink-mute);
  cursor: pointer; transition: border-color 0.12s, color 0.12s;
  align-self: flex-start;
  margin-top: 4px;
}
.pe-add:hover { border-color: var(--accent); color: var(--accent); }
.d-email-more {
  display: inline-flex; align-items: center;
  margin-left: 8px;
  padding: 1px 7px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px;
  color: var(--ink-mute);
  cursor: help;
}
.pe-inline-editor,
.lbl-inline-editor {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 4px;
}
.pe-inline-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pe-inline-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.cab-type-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.cab-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 500;
  text-transform: capitalize;
  transition: all 0.12s;
}
.cab-type-option:hover { border-color: var(--ink-mute); }
.cab-type-option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cab-type-option svg { width: 15px; height: 15px; }

.cab-act-grid {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px 12px;
  align-items: start;
}
.cab-act-grid label {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 500;
  padding-top: 8px;
}
.cab-act-grid input,
.cab-act-grid select,
.cab-act-grid textarea {
  padding: 7px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: var(--white);
  color: var(--ink);
  width: 100%;
  box-sizing: border-box;
}
.cab-act-grid input:focus,
.cab-act-grid select:focus,
.cab-act-grid textarea:focus { border-color: var(--accent); }
.cab-act-grid select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7a6e' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.section-label {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 24px 0 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.section-label:first-child { margin-top: 0; }

.history-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
}
.history-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-cream);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.history-icon.email   { background: #fef3c7; color: #b45309; }
.history-icon.call    { background: #dbeafe; color: #1d4ed8; }
.history-icon.meeting { background: #e9d5ff; color: #6b21a8; }
.history-icon.note    { background: #d1fae5; color: #047857; }
.history-icon.task    { background: #fed7aa; color: #c2410c; }
.history-icon.deadline{ background: #fee2e2; color: #b91c1c; }
.history-icon.lunch   { background: #fce7f3; color: #be185d; }

.history-card {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  display: flex; gap: 12px;
}
.history-card.overdue { border-left: 3px solid var(--danger); }
.history-card.done    { opacity: 0.65; background: var(--bg-cream); }
.history-card-body { flex: 1; min-width: 0; }
.history-title { font-weight: 600; color: var(--ink); margin-bottom: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-title.done { text-decoration: line-through; color: var(--ink-mute); }
.history-meta { font-size: 12px; color: var(--ink-mute); }
.history-body { margin-top: 8px; color: var(--ink-soft); line-height: 1.55; }
.overdue-pill {
  background: #fee2e2; color: var(--danger);
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px; letter-spacing: 0.04em;
}
.draft-pill {
  background: var(--accent-soft); color: var(--accent);
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px; letter-spacing: 0.04em;
}
.done-pill {
  background: #d1fae5; color: var(--success);
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px; letter-spacing: 0.04em;
}

/* Task checkbox in history */
.task-checkbox {
  width: 20px; height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  transition: all 0.15s;
  margin-top: 1px;
}
.task-checkbox:hover {
  border-color: var(--success);
  background: rgba(4, 120, 87, 0.06);
}
.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* ===== Contact History Timeline ===== */
.history-filter-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
}
.history-filter-tab {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  transition: color 0.15s;
  white-space: nowrap;
}
.history-filter-tab:hover { color: var(--ink); }
.history-filter-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tl-wrap {
  position: relative;
  padding-left: 48px;
}
.tl-wrap::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 4px;
  bottom: 4px;
  border-left: 2px dashed var(--border-soft);
}
.tl-item {
  display: flex;
  gap: 0;
  padding: 8px 0;
  position: relative;
}
.tl-icon {
  position: absolute;
  left: -48px;
  top: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--ink-soft);
  z-index: 1;
}
.tl-icon.tl-email   { background:#fef3c7; border-color:#fde68a; color:#b45309; }
.tl-icon.tl-act     { background:#dbeafe; border-color:#bfdbfe; color:#1d4ed8; }
.tl-icon.tl-act-done{ background:#d1fae5; border-color:#a7f3d0; color:#047857; }
.tl-icon.tl-note    { background:#f0fdf4; border-color:#bbf7d0; color:#15803d; }
.tl-icon.tl-system  { width:18px;height:18px;left:-42px;top:16px;background:var(--bg-cream);border-color:var(--border-soft); }

.tl-card {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  min-width: 0;
  transition: border-color 0.15s;
}
.tl-card:hover { border-color: var(--border-soft); }
.tl-card.tl-done { opacity: 0.6; background: var(--bg-cream); }
.tl-card.tl-clickable { cursor: pointer; }
.tl-card.tl-clickable:hover { border-color: var(--accent-soft); }
.tl-del-btn {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-mute); opacity: 0; transition: opacity .15s, background .15s, color .15s;
  padding: 0;
}
.tl-card:hover .tl-del-btn { opacity: 1; }
.tl-del-btn:hover { background: #fde8e8; color: var(--danger); }
/* Copy/edit buttons reuse the trash-button layout but with the accent (not danger) hover. */
.tl-copy-btn:hover { background: var(--accent-soft); color: var(--accent); }
.tl-copy-btn.copied { color: var(--accent); opacity: 1; }
.tl-edit-note-btn:hover { background: var(--accent-soft); color: var(--accent); }
/* Inline note editor (timeline) */
.tl-note-edit-input {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px;
  font-family: inherit; font-size: 13px; line-height: 1.5; color: var(--ink);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px;
  background: var(--bg-card, #fff);
}
.tl-note-edit-input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.tl-note-edit-bar { display: flex; gap: 8px; margin-top: 8px; }
.tl-note-edit-bar .btn { font-size: 12px; padding: 5px 12px; }
.tl-edit-btn {
  position: absolute; top: 8px; right: 36px;
  width: 24px; height: 24px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-mute); opacity: 0; transition: opacity .15s, background .15s, color .15s;
  padding: 0;
}
.tl-card:hover .tl-edit-btn { opacity: 1; }
.tl-edit-btn:hover { background: var(--accent-soft); color: var(--accent); }
.tl-subject {
  font-weight: 600; color: var(--ink);
  margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tl-subject.tl-done { text-decoration: line-through; color: var(--ink-mute); }
.tl-meta { font-size: 12px; color: var(--ink-mute); margin-bottom: 4px; }
.tl-snippet {
  font-size: 12px; color: var(--ink-soft); line-height: 1.5;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
/* Full note body in the timeline (clamped until expanded) */
.tl-note-text {
  font-size: 13px; color: var(--ink-soft); line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.tl-note-text.tl-clamped {
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
/* Expanded state — overrides the clamp regardless of base rule */
.tl-expandable.tl-expanded,
.tl-note-text.tl-expanded {
  display: block !important;
  -webkit-line-clamp: unset !important;
  overflow: visible !important;
  white-space: pre-wrap;
}
/* Chevron toggle on note cards (mirrors the email expander) */
.tl-note-chevron { flex-shrink: 0; cursor: pointer; color: var(--ink-mute); transition: transform 0.2s; }
.tl-del-btn.tl-del-inline { position: static; top: auto; right: auto; }
.tl-expand-btn {
  background: none; border: none; padding: 2px 0; margin-top: 4px;
  font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 600;
}
.tl-expand-btn:hover { text-decoration: underline; }
.tl-system-text {
  flex: 1; font-size: 12px; color: var(--ink-mute);
  padding: 2px 0; align-self: center; line-height: 1.6;
}
.tl-system-text strong { color: var(--ink-soft); font-weight: 500; }
.tl-empty { font-size:13px; color:var(--ink-mute); padding: 16px 0; }


/* Contact email/phone: ONE line, no "…", no scrollbar. _fitContactFields() (person-detail.js)
   auto-shrinks the font so the full value fits the available width. overflow:hidden is just a
   safety net for the pathological case where even the min font can't fit. */
#d-email, .kv-prim-text, .kv-sub-line .kv-sub-text {
  display: inline-block; max-width: 100%; vertical-align: middle;
  white-space: nowrap; overflow: hidden; text-overflow: clip; overflow-wrap: normal;
}
.kv-sub-line a { white-space: nowrap; overflow: hidden; text-overflow: clip; }
/* Hide the "work"/"home" label chip next to email & phone — it took up too much room; the value
   now uses the full width of the field. */
#d-email-more, #d-phone .kv-sub-label { display: none; }

/* Task (card) attachments: images as thumbnails + a click-to-enlarge lightbox. */
.card-file-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.card-thumb { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid #3b4148; background: #1d2125; cursor: zoom-in; }
.card-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-del { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; padding: 0; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 18px; cursor: pointer; display: none; }
.card-thumb:hover .card-thumb-del { display: block; }
#task-img-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); z-index: 3000; display: none; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; }
#task-img-lightbox.open { display: flex; }
#task-img-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
