/* Nav */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #1e293b;
  color: #f8fafc;
}
.nav-brand { color: #f8fafc; text-decoration: none; font-weight: 600; font-size: 1rem; }
.nav-actor { font-size: 0.8rem; color: #94a3b8; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; color: #1e293b; margin: 0; }

/* Flash */
.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-notice { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-alert  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Page header */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.page-header p  { margin: 0; color: #64748b; }

/* Empty state */
.empty-state { padding: 2rem; text-align: center; color: #64748b; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; }

/* Draft cards */
#draft-cards { display: flex; flex-direction: column; gap: 1rem; }
.draft-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem 1.25rem; }
.draft-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; }
.draft-card-recipient strong { display: block; font-size: 0.95rem; }
.draft-card-recipient .muted { font-size: 0.8rem; color: #64748b; }
.draft-card-meta { display: flex; gap: 0.4rem; flex-shrink: 0; }
.draft-card-subject { font-weight: 500; margin-bottom: 0.35rem; }
.draft-card-preview { font-size: 0.82rem; color: #64748b; margin-bottom: 0.75rem; }
.draft-card-actions { display: flex; gap: 0.5rem; }
.muted { color: #64748b; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 500; }
.badge-bruno   { background: #e0f2fe; color: #0369a1; }
.badge-chris   { background: #f3e8ff; color: #7e22ce; }
.badge-intent  { background: #fef3c7; color: #92400e; }

/* Buttons */
.btn { display: inline-block; padding: 0.45rem 1rem; border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; text-decoration: none; line-height: 1.4; }
.btn-primary   { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: #ef4444; color: #fff; border-color: #ef4444; }

/* Modal dialog */
dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  width: 680px;
  max-width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
dialog::backdrop { background: rgba(0,0,0,0.5); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b; padding: 0; line-height: 1; }
.modal-close:hover { color: #111; }

/* Form elements inside modal */
dialog form, .refine-section, .schedule-section { padding: 1rem 1.25rem; }
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.85rem; }
.form-control {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.form-control:focus { outline: 2px solid #2563eb; border-color: #2563eb; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-weight: 400 !important; }
.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* Divider */
.divider { border: none; border-top: 1px solid #e2e8f0; margin: 0; }

/* Refine & schedule expand sections */
details.refine-section summary,
details.schedule-section summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: #374151;
  padding: 0.6rem 0;
}
.refine-form, .schedule-form { margin-top: 0.75rem; }
#schedule-error .error { color: #ef4444; font-size: 0.85rem; }

/* Trix editor */
trix-editor {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-height: 220px;
  padding: 0.5rem;
  font-size: 0.9rem;
}
trix-toolbar { border: 1px solid #d1d5db; border-bottom: none; border-radius: 6px 6px 0 0; background: #f8fafc; }

/* Sending state */
.draft-card--sending { border-color: #fbbf24; background: #fffbeb; }
.badge-sending { background: #fef3c7; color: #92400e; }
.draft-card-sending-status { margin-bottom: 0.75rem; font-size: 0.82rem; color: #78350f; }
.sending-progress-bar { background: #fde68a; border-radius: 99px; height: 4px; margin-top: 0.4rem; overflow: hidden; }
.sending-progress-fill { background: #d97706; height: 100%; border-radius: 99px; transition: width 1s linear; width: 100%; }

/* Variant toast styles */
.sdr-toast--error { background: #991b1b; }
.sdr-toast--info  { background: #1e293b; }
/* SDR Theme v3 — polished SaaS UX (Linear/Superhuman inspired) */

/* ============ Tokens ============ */
:root {
  /* Surfaces */
  --c-bg: #f6f5fb;
  --c-bg-subtle: #f1eff8;
  --c-surface: #ffffff;
  --c-surface-2: #fafafd;
  --c-surface-hover: #f7f6fc;

  /* Text */
  --c-text: #18172b;
  --c-text-2: #3f3e57;
  --c-muted: #6c6a85;
  --c-muted-2: #98969f;

  /* Borders */
  --c-border: #e9e8f1;
  --c-border-strong: #d6d4e3;

  /* Brand — purple */
  --c-primary: #6e3aff;
  --c-primary-soft: #efeaff;
  --c-primary-soft-2: #e3dbff;
  --c-primary-dark: #5828d8;
  --c-primary-ink: #2a1370;

  /* Status */
  --c-success: #10a070;
  --c-success-soft: #d5f5e8;
  --c-success-ink: #045539;
  --c-warning: #e09312;
  --c-warning-soft: #fdf0d3;
  --c-warning-ink: #6b3f04;
  --c-danger: #d83a52;
  --c-danger-soft: #fde0e5;
  --c-info: #0c81d1;
  --c-info-soft: #d5ecfa;
  --c-info-ink: #064b7a;

  /* Effects */
  --shadow-xs: 0 1px 0 rgba(24,23,43,0.04);
  --shadow-sm: 0 1px 2px rgba(24,23,43,0.06), 0 1px 1px rgba(24,23,43,0.04);
  --shadow-md: 0 6px 18px -4px rgba(24,23,43,0.10), 0 2px 4px rgba(24,23,43,0.04);
  --shadow-lg: 0 24px 48px -12px rgba(24,23,43,0.18), 0 8px 16px rgba(24,23,43,0.06);
  --shadow-focus: 0 0 0 3px rgba(110,58,255,0.22);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 540px at 90% -10%, rgba(110,58,255,0.07), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(110,58,255,0.05), transparent 60%),
    var(--c-bg);
  background-attachment: fixed;
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  min-height: 100vh;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }

/* ============ Nav ============ */
body > nav,
.sdr-nav {
  display: flex; align-items: center; gap: 1.5rem;
  background: linear-gradient(180deg, #14122a 0%, #0c0a1f 100%);
  color: #e2def0;
  padding: 0.7rem 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 8px rgba(0,0,0,0.18);
  position: sticky; top: 0; z-index: 60;
}
body > nav .logo,
.sdr-nav .logo,
.sdr-nav-brand {
  font-weight: 700; font-size: 0.98rem; color: #fff;
  letter-spacing: -0.012em; margin-right: 0.4rem;
  display: inline-flex; align-items: center; gap: 0.55rem;
}
body > nav .logo::before,
.sdr-nav-brand::before {
  content: ""; width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(135deg, #8b5cff 0%, #5828d8 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 4px 10px rgba(110,58,255,0.45);
}
body > nav .logo span,
.sdr-nav-brand .accent { color: #c4b5fd; }
body > nav a,
.sdr-nav-links a {
  color: #bdb9d3 !important; font-weight: 500; font-size: 0.88rem;
  padding: 0.4rem 0.65rem; border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
body > nav a:hover,
.sdr-nav-links a:hover { color: #fff !important; background: rgba(255,255,255,0.07); }
.sdr-nav-links a.active,
body > nav a.active { color: #fff !important; background: rgba(110,58,255,0.22); }

body > nav .user-badge,
.sdr-nav-user {
  margin-left: auto;
  color: #aba8c4;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem 0.3rem 0.65rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
body > nav .user-badge::before,
.sdr-nav-user::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  background: #34d399; box-shadow: 0 0 8px #34d399;
}

/* ============ Layout container ============ */
.sdr-container,
.sdr-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.25rem 2rem 4rem;
}
@media (max-width: 900px) {
  .sdr-container, .sdr-main { padding: 1.25rem 1rem 3rem; }
}

/* ============ Flash ============ */
.flash {
  padding: 0.7rem 1rem; border-radius: 10px; margin-bottom: 1rem;
  font-size: 0.88rem; border: 1px solid transparent;
  display: flex; align-items: center; gap: 0.55rem;
}
.flash-notice { background: var(--c-success-soft); color: var(--c-success-ink); border-color: rgba(16,160,112,0.25); }
.flash-alert  { background: var(--c-danger-soft); color: #7c1d2a; border-color: rgba(216,58,82,0.25); }

/* ============ Page header ============ */
.page-header { margin-bottom: 1.75rem; }
.page-header h1,
.page-h1 {
  font-size: 1.7rem; font-weight: 700; letter-spacing: -0.022em;
  color: var(--c-text); margin: 0 0 0.4rem;
}
.page-header p,
.page-subtitle {
  color: var(--c-muted); margin: 0; font-size: 0.95rem; max-width: 56ch;
}

/* ============ Section header ============ */
.section-header,
.sdr-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.9rem; gap: 1rem;
}
.section-title,
.sdr-section-title {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 1.05rem; font-weight: 650; color: var(--c-text);
  margin: 0; letter-spacing: -0.01em;
}
.section-title::before {
  content: ""; width: 3px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, #8b5cff, #5828d8);
}
.section-badge,
.sdr-count-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.7rem; height: 1.35rem; padding: 0 0.5rem;
  font-size: 0.74rem; font-weight: 700; line-height: 1;
  background: var(--c-primary-soft); color: var(--c-primary-ink);
  border-radius: 999px;
  margin-left: 0.4rem;
}
.sdr-section-divider,
.section-divider {
  border: 0; border-top: 1px solid var(--c-border);
  margin: 2.5rem 0 1.5rem;
}
.section-sub {
  color: var(--c-muted); margin: 0.3rem 0 0;
  font-size: 0.86rem; max-width: 60ch;
}

/* Suggestions toolbar */
.suggestions-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1rem;
}
.suggestions-toolbar .sdr-tabs { margin-bottom: 0; }
.suggestions-toolbar .sdr-subfilters { margin-bottom: 0; }

/* ============ Card ============ */
.sdr-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.sdr-card-compact { padding: 0; }

/* ============ Tabs (segmented control) ============ */
.sdr-tabs {
  display: inline-flex; gap: 4px;
  background: rgba(24,23,43,0.04);
  border: 1px solid var(--c-border);
  border-radius: 11px;
  padding: 4px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1rem;
}
.sdr-tab {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: transparent; border: 0;
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem; font-weight: 600; color: var(--c-muted);
  cursor: pointer; border-radius: 8px;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  letter-spacing: -0.005em;
}
.sdr-tab:hover { color: var(--c-text); background: rgba(110,58,255,0.06); }
.sdr-tab.is-active {
  background: #ffffff; color: var(--c-text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--c-border);
}
.sdr-tab.is-active .sdr-tab-label {
  background: linear-gradient(180deg, var(--c-text) 0%, var(--c-primary-dark) 280%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sdr-tab-label { font-weight: 600; }
.sdr-tab-hint { display: none; }
.sdr-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.15rem; padding: 0 0.42rem;
  background: rgba(24,23,43,0.07); color: var(--c-muted);
  font-size: 0.72rem; font-weight: 700;
  border-radius: 999px; text-align: center;
}
.sdr-tab.is-active .sdr-tab-count {
  background: var(--c-primary-soft);
  color: var(--c-primary-dark);
}

/* ============ Filters ============ */
.sdr-subfilters {
  display: flex; gap: 0.5rem; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.filter-select,
.sdr-subfilters select {
  appearance: none; -webkit-appearance: none;
  background:
    var(--c-surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236c6a85' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 0.7rem center;
  padding: 0.45rem 1.85rem 0.45rem 0.85rem;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: 0.85rem; font-weight: 500; color: var(--c-text);
  cursor: pointer; white-space: nowrap;
  font-family: inherit;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}
.filter-select:hover, .sdr-subfilters select:hover {
  border-color: var(--c-border-strong);
  background-color: var(--c-surface-hover);
}
.filter-select:focus, .sdr-subfilters select:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: var(--shadow-focus);
}

/* ============ Suggestion rows ============ */
.suggestion-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--c-border);
  transition: background 0.1s ease;
  position: relative;
}
.suggestion-row:last-child { border-bottom: 0; }
.suggestion-row:hover { background: var(--c-surface-hover); }
.suggestion-row::before {
  content: ""; position: absolute; left: 0; top: 14%; bottom: 14%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 0.12s;
}
.suggestion-row:hover::before { background: var(--c-primary); }

.suggestion-info-link {
  flex: 1 1 auto; min-width: 0; display: block;
  text-decoration: none; color: inherit;
}

.suggestion-row-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
}

.suggestion-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem;
  color: white;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(24,23,43,0.10), 0 0 0 1px rgba(255,255,255,0.6) inset;
  background: linear-gradient(135deg, #8b5cff, #5828d8);
  text-shadow: 0 1px 0 rgba(0,0,0,0.10);
}
.suggestion-avatar-purple { background: linear-gradient(135deg, #8b5cff, #5828d8); }
.suggestion-avatar-blue   { background: linear-gradient(135deg, #45a8f1, #1773c4); }
.suggestion-avatar-teal   { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.suggestion-avatar-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.suggestion-avatar-green  { background: linear-gradient(135deg, #34d399, var(--c-success)); }
.suggestion-avatar-indigo { background: linear-gradient(135deg, #818cf8, #4338ca); }

.suggestion-info {
  display: flex; flex-direction: column; gap: 0.15rem;
  min-width: 0;
}
.suggestion-name-row {
  display: flex; align-items: baseline; gap: 0.4rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.suggestion-name {
  font-weight: 650; color: var(--c-text); font-size: 0.94rem;
  letter-spacing: -0.008em;
  flex-shrink: 0;
}
.suggestion-info-link:hover .suggestion-name { color: var(--c-primary); }
.suggestion-divider { color: var(--c-muted-2); font-weight: 400; }
.suggestion-company {
  font-size: 0.86rem; color: var(--c-text-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.suggestion-email {
  font-size: 0.8rem; color: var(--c-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.suggestion-meta {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}
.suggestion-actions {
  display: flex; gap: 0.35rem; flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.12s;
}
.suggestion-row:hover .suggestion-actions,
.suggestion-row:focus-within .suggestion-actions {
  opacity: 1;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem; font-weight: 600;
  border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; font-family: inherit;
  text-decoration: none;
  letter-spacing: -0.003em;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.06s, box-shadow 0.12s;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: linear-gradient(180deg, #7e4cff 0%, var(--c-primary) 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 1px 2px rgba(40,15,120,0.25), 0 4px 12px -2px rgba(110,58,255,0.32);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #6e3aff 0%, var(--c-primary-dark) 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 2px 4px rgba(40,15,120,0.28), 0 8px 18px -2px rgba(110,58,255,0.40);
}
.btn-purple { background: var(--c-primary); color: white; border-color: var(--c-primary); }
.btn-purple:hover { background: var(--c-primary-dark); color: white; border-color: var(--c-primary-dark); }
.btn-green, .btn-success {
  background: linear-gradient(180deg, #14b07e 0%, var(--c-success) 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 1px 2px rgba(4,85,57,0.25), 0 3px 10px -2px rgba(16,160,112,0.30);
}
.btn-green:hover, .btn-success:hover {
  background: linear-gradient(180deg, #109b6c 0%, #088457 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 2px 4px rgba(4,85,57,0.30), 0 6px 16px -2px rgba(16,160,112,0.40);
}
.btn-default {
  background: var(--c-surface); color: var(--c-text);
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-default:hover { background: var(--c-surface-hover); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary {
  background: var(--c-surface); color: var(--c-text);
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--c-surface-hover); border-color: var(--c-border-strong); color: var(--c-text); }
.btn-skip {
  background: transparent; color: var(--c-muted);
  border-color: var(--c-border);
}
.btn-skip:hover { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-sm { padding: 0.36rem 0.75rem; font-size: 0.8rem; }
.btn-orange { background: #fb923c; color: white; border-color: #fb923c; }
.btn-orange:hover { background: #ea580c; color: white; border-color: #ea580c; }
.btn-blue { background: var(--c-info); color: white; border-color: var(--c-info); }
.btn-blue:hover { background: #0a6eb0; color: white; }
.btn-teal { background: #0d9488; color: white; border-color: #0d9488; }
.btn-teal:hover { background: #0b7d72; color: white; }

.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* Forms inline */
button[type="submit"]:not(.btn) {
  background: var(--c-primary); color: white;
  padding: 0.5rem 0.95rem; font-size: 0.86rem; font-weight: 600;
  border: 0; border-radius: 8px; cursor: pointer; font-family: inherit;
}
form[data-turbo-stream] { display: inline-block; margin: 0; }

/* ============ Badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.16rem 0.55rem;
  font-size: 0.72rem; font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.005em;
  line-height: 1.4;
}
.badge::before {
  content: ""; width: 5px; height: 5px; border-radius: 999px;
  background: currentColor; opacity: 0.65;
}
.badge-no-dot::before, .badge-mailbox::before, .badge-intent::before { display: none; }

.badge-blue   { background: var(--c-info-soft); color: var(--c-info-ink); }
.badge-purple { background: var(--c-primary-soft); color: var(--c-primary-ink); }
.badge-teal   { background: #ccfbf1; color: #0b5b53; }
.badge-green  { background: var(--c-success-soft); color: var(--c-success-ink); }
.badge-orange { background: var(--c-warning-soft); color: var(--c-warning-ink); }
.badge-gray   { background: rgba(24,23,43,0.06); color: var(--c-text-2); }
.badge-red    { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-mailbox { font-size: 0.7rem; }
.badge-chris  { background: var(--c-info-soft); color: var(--c-info-ink); }
.badge-bruno  { background: var(--c-primary-soft); color: var(--c-primary-ink); }
.badge-intent { background: var(--c-warning-soft); color: var(--c-warning-ink); }

/* ============ Drafts preview card (homepage) ============ */
.draft-preview-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--c-border);
  transition: background 0.12s;
}
.draft-preview-row:hover { background: var(--c-surface-hover); }
.draft-preview-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.draft-preview-row > .btn { flex-shrink: 0; }
.draft-preview-row:last-child { border-bottom: 0; }
.draft-preview-meta { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.draft-preview-meta strong {
  color: var(--c-text); font-size: 0.94rem; font-weight: 650; letter-spacing: -0.005em;
}
.draft-preview-meta .muted { color: var(--c-muted); font-size: 0.82rem; }
.draft-preview-subject {
  color: var(--c-text-2); font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sdr-see-all {
  display: block; text-align: center;
  padding: 0.65rem; border-top: 1px solid var(--c-border);
  font-weight: 600; color: var(--c-primary);
  background: var(--c-surface-2);
  transition: background 0.12s;
}
.sdr-see-all:hover { background: var(--c-primary-soft); color: var(--c-primary-dark); }

/* Loading state for turbo-frame */
.sdr-loading {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 2rem; color: var(--c-muted); font-size: 0.88rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
}
.sdr-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--c-primary-soft);
  border-top-color: var(--c-primary);
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Empty states ============ */
.sdr-empty {
  text-align: center; padding: 3.5rem 1.5rem;
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius-lg);
}
.sdr-empty-icon { font-size: 2.5rem; margin-bottom: 0.65rem; opacity: 0.7; }
.sdr-empty h3 { margin: 0 0 0.4rem; font-size: 1rem; color: var(--c-text); font-weight: 650; }
.sdr-empty p { margin: 0 auto; color: var(--c-muted); font-size: 0.88rem; max-width: 38ch; }
.sdr-empty-inline { color: var(--c-muted); padding: 1.5rem; margin: 0; text-align: center; }

/* ============ Contact panel slide-in ============ */
.contact-panel-slot {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 92vw;
  background: var(--c-surface);
  box-shadow: -12px 0 40px rgba(24,23,43,0.18);
  z-index: 100; overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 1.75rem 1.5rem;
  border-left: 1px solid var(--c-border);
}
.contact-panel-slot:not(:empty) { transform: translateX(0); }
.contact-panel-close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  background: transparent; border: 0;
  font-size: 1.4rem; cursor: pointer;
  color: var(--c-muted); line-height: 1;
  padding: 0.35rem 0.55rem; border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.contact-panel-close:hover { background: var(--c-surface-hover); color: var(--c-text); }

.cp-header {
  padding-right: 2rem; margin-bottom: 1.5rem;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--c-border);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem;
}
.cp-header h3 {
  margin: 0 0 0.25rem; font-size: 1.2rem; font-weight: 650;
  letter-spacing: -0.012em;
}
.cp-header-info { flex: 1 1 auto; min-width: 0; }
.cp-section { margin-bottom: 1.25rem; }
.cp-section-title {
  font-size: 0.72rem; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.cp-kv { display: flex; padding: 0.42rem 0; border-bottom: 1px solid var(--c-border); font-size: 0.85rem; }
.cp-kv:last-child { border-bottom: 0; }
.cp-k { width: 110px; flex-shrink: 0; color: var(--c-muted); }
.cp-v { color: var(--c-text); flex: 1 1 auto; min-width: 0; word-break: break-word; }
.cp-link { color: var(--c-primary); text-decoration: none; }
.cp-link:hover { color: var(--c-primary-dark); text-decoration: underline; }
.cp-empty { font-size: 0.85rem; color: var(--c-muted-2); font-style: italic; padding: 0.3rem 0; }
.cp-list-item {
  padding: 0.6rem 0.75rem; margin-bottom: 0.4rem;
  border-radius: 8px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
}
.cp-list-item .muted { font-size: 0.75rem; color: var(--c-muted); margin-top: 0.2rem; display: block; }
.cp-actions {
  display: flex; gap: 0.5rem; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--c-border);
}
.cp-actions-primary {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
}

/* ============ Tables (voice rules) ============ */
table {
  width: 100%; border-collapse: collapse; background: var(--c-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
thead th {
  background: var(--c-surface-2);
  padding: 0.7rem 1rem; text-align: left;
  font-size: 0.72rem; color: var(--c-muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--c-border);
}
tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--c-border); font-size: 0.88rem; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--c-surface-hover); }

/* ============ Voice rule helpers ============ */
.field-label {
  display: block; font-size: 0.72rem; font-weight: 700;
  color: var(--c-muted); margin: 0.9rem 0 0.3rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.field-input {
  width: 100%; padding: 0.55rem 0.75rem;
  font-size: 0.9rem; font-family: inherit;
  border: 1px solid var(--c-border); border-radius: 8px;
  background: var(--c-surface);
}
.field-input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: var(--shadow-focus);
}

/* ============ Modal dialog ============ */
dialog#draft-review-dialog,
dialog#add-rule-dialog,
dialog {
  border: 0; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 760px; width: 92vw;
  max-height: 90vh;
  background: var(--c-surface);
  overflow: hidden;
}
dialog::backdrop {
  background: rgba(20,18,42,0.55);
  backdrop-filter: blur(4px);
}
dialog[open] {
  animation: dialog-pop 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes dialog-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.05rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  position: sticky; top: 0; z-index: 2;
}
.modal-header h2 {
  margin: 0; font-size: 1.05rem; font-weight: 650;
  letter-spacing: -0.012em;
}
.modal-close {
  background: transparent; border: 0; font-size: 1.5rem;
  color: var(--c-muted); cursor: pointer; padding: 0.2rem 0.45rem;
  line-height: 1; border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { color: var(--c-text); background: var(--c-surface-hover); }
.modal-close:focus { outline: none; }
.modal-close:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

dialog form { padding: 0; }
.form-group { padding: 0.55rem 1.5rem; }
.form-group label,
.field-label {
  display: block;
  font-size: 0.72rem; font-weight: 700;
  color: var(--c-muted); margin: 0 0 0.35rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select,
.form-control {
  width: 100%; padding: 0.55rem 0.75rem;
  font-size: 0.9rem; font-family: inherit;
  border: 1px solid var(--c-border); border-radius: 8px;
  background: var(--c-surface);
  color: var(--c-text);
  box-sizing: border-box;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-control:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: var(--shadow-focus);
}
.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  padding: 0;
}
.form-row .form-group { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.checkbox-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 500 !important; font-size: 0.85rem;
  color: var(--c-text); text-transform: none !important; letter-spacing: 0 !important;
}

.modal-actions,
.modal-footer {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}

/* Refine + Schedule collapsible */
.divider { display: none; }
details.refine-section,
details.schedule-section {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
details.refine-section[open],
details.schedule-section[open] { background: var(--c-surface); }
details.refine-section summary,
details.schedule-section summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1.5rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--c-text-2);
  user-select: none;
  display: flex; align-items: center; gap: 0.55rem;
  transition: color 0.12s, background 0.12s;
}
details.refine-section summary::-webkit-details-marker,
details.schedule-section summary::-webkit-details-marker { display: none; }
details.refine-section summary::before,
details.schedule-section summary::before {
  content: "›"; display: inline-block;
  width: 1rem; text-align: center;
  font-size: 1.05rem; color: var(--c-muted);
  transition: transform 0.16s;
}
details[open] summary::before { transform: rotate(90deg); }
details.refine-section summary:hover,
details.schedule-section summary:hover { color: var(--c-text); background: var(--c-surface-hover); }
.refine-form, .schedule-form { padding-bottom: 1.25rem; }
#schedule-error .error { color: var(--c-danger); font-size: 0.85rem; padding: 0 1.5rem; }

/* Trix editor */
trix-editor {
  display: block;
  border: 1px solid var(--c-border);
  border-radius: 0 0 8px 8px;
  border-top: 0;
  min-height: 240px;
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
  line-height: 1.55;
  background: var(--c-surface);
  font-family: inherit;
}
trix-editor:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: var(--shadow-focus);
}
trix-toolbar {
  display: block;
  border: 1px solid var(--c-border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--c-surface-2);
  padding: 0.35rem 0.5rem;
}
trix-toolbar .trix-button-row {
  display: flex; flex-wrap: wrap; gap: 2px;
}
trix-toolbar .trix-button-group {
  display: inline-flex; border: 1px solid var(--c-border);
  border-radius: 6px; margin-right: 4px;
  background: var(--c-surface);
}
trix-toolbar .trix-button {
  border: 0;
  background: transparent;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  color: var(--c-text-2);
  border-radius: 4px;
}
trix-toolbar .trix-button:hover { background: var(--c-primary-soft); color: var(--c-primary-dark); }
trix-toolbar .trix-button.trix-active { background: var(--c-primary-soft); color: var(--c-primary-dark); }

/* ============ Toast ============ */
.toast-container {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--c-text); color: white;
  padding: 0.75rem 1rem; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 0.88rem;
  animation: toast-in 0.18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ Drafts page cards ============ */
#draft-cards {
  display: flex; flex-direction: column;
  gap: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}
.draft-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.35rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.16s, transform 0.16s, border-color 0.16s;
}
.draft-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--c-border-strong);
}
.draft-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 0.85rem; gap: 0.85rem;
}
.draft-card-identity {
  display: flex; align-items: center; gap: 0.75rem;
  flex: 1 1 auto; min-width: 0;
}
.draft-card-identity-text { flex: 1 1 auto; min-width: 0; }
.draft-card-recipient {
  display: flex; align-items: baseline; gap: 0.45rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.draft-card-recipient strong {
  display: inline-block; font-size: 0.96rem; font-weight: 650;
  letter-spacing: -0.008em; color: var(--c-text);
}
.draft-card-recipient .muted { font-size: 0.82rem; }
.draft-card-meta {
  display: inline-flex; gap: 0.35rem; flex-wrap: wrap;
  margin-top: 0.35rem;
}
.draft-card-body {
  padding: 0.5rem 0 0.85rem;
  border-top: 1px dashed var(--c-border);
  margin-top: 0.5rem;
}
.draft-card-subject {
  font-size: 0.94rem; font-weight: 600; color: var(--c-text);
  letter-spacing: -0.005em; margin: 0.65rem 0 0.4rem;
}
.draft-card-preview {
  font-size: 0.86rem; color: var(--c-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.draft-card-actions {
  display: flex; gap: 0.45rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--c-border);
}

/* ============ Modal layout polish ============ */
.modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 60px);
}
.send-form { padding-bottom: 0; }
.form-group-body label { padding-bottom: 0.25rem; }

dialog#draft-review-dialog[open] {
  display: flex; flex-direction: column;
  max-width: min(1160px, 95vw);
}
dialog#draft-review-dialog:not([open]) { display: none !important; }
dialog#draft-review-dialog .modal-body {
  flex: 1 1 auto;
}
.modal-footer {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
  padding: 0.85rem 1.5rem;
  display: flex; gap: 0.5rem; justify-content: flex-end;
  z-index: 3;
  box-shadow: 0 -4px 12px -8px rgba(24,23,43,0.12);
}

/* ============ Draft review two-column layout ============ */
.draft-modal-layout {
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
}
.draft-modal-editor {
  flex: 3;
  min-width: 0;
  overflow-y: auto;
  max-height: calc(90vh - 60px);
}
.draft-lead-sidebar {
  flex: 2;
  min-width: 0;
  border-left: 1px solid var(--c-border);
  background: var(--c-surface-2);
  overflow-y: auto;
  max-height: calc(90vh - 60px);
}
.draft-lead-sidebar-inner {
  padding: 1.5rem;
}
.draft-lead-sidebar-title {
  font-size: 0.72rem; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 1rem;
}
@media (max-width: 720px) {
  .draft-modal-layout { flex-direction: column; overflow: visible; }
  .draft-modal-editor { max-height: none; }
  .draft-lead-sidebar {
    border-left: 0; border-top: 1px solid var(--c-border);
    flex: none; max-height: 55vh;
  }
  dialog#draft-review-dialog { max-width: 92vw; max-height: 95vh; }
}

/* ============ Contact panel identity polish ============ */
.cp-identity {
  display: flex; gap: 0.85rem; align-items: center;
  margin-bottom: 0.45rem;
}
.cp-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; color: white;
  background: linear-gradient(135deg, #8b5cff, #5828d8);
  box-shadow: 0 2px 8px -2px rgba(110,58,255,0.45), 0 0 0 1px rgba(255,255,255,0.7) inset;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.cp-identity-text { flex: 1 1 auto; min-width: 0; }
.cp-identity-text h3 { margin: 0; }
.cp-email {
  font-size: 0.83rem; color: var(--c-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.cp-company-line {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; color: var(--c-text-2);
  flex-wrap: wrap;
}
.cp-dot { color: var(--c-muted-2); }

/* ============ Misc ============ */
.muted { color: var(--c-muted); }
.sdr-card-compact .draft-preview-row { padding: 0.8rem 1.15rem; }

/* Subtle scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 999px; border: 2px solid var(--c-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--c-muted-2); }
::-webkit-scrollbar-track { background: transparent; }

/* Auth pages */
.auth-card {
  max-width: 400px; margin: 6rem auto 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem 2rem 1.75rem;
}
.auth-brand {
  display: flex; align-items: center; gap: 0.55rem;
  margin-bottom: 1.5rem;
}
.auth-logo {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  width: 1.5rem; height: 1.5rem;
  border-radius: 6px;
  color: transparent; line-height: 1;
}
.auth-brand-text {
  font-size: 1rem; font-weight: 600; color: var(--c-text);
  letter-spacing: -0.01em;
}
.auth-brand-text strong { font-weight: 700; }
.auth-brand-text em { color: var(--c-primary); font-style: normal; font-weight: 700; margin-left: 0.15rem; }
.auth-h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 0.25rem; color: var(--c-text); letter-spacing: -0.01em; }
.auth-sub { color: var(--c-muted); margin: 0 0 1.5rem; font-size: 0.9rem; }
.auth-alert {
  padding: 0.65rem 0.85rem;
  background: #fef2f2; border: 1px solid #fecaca;
  color: #991b1b; border-radius: 8px;
  font-size: 0.85rem; margin-bottom: 1rem;
}
.auth-form .form-group { padding: 0 0 0.85rem; }
.auth-form input[type="email"], .auth-form input[type="password"] {
  width: 100%; padding: 0.65rem 0.85rem;
  font-size: 0.95rem; font-family: inherit;
  border: 1px solid var(--c-border); border-radius: 8px;
  background: white;
}
.auth-form input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.auth-form label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--c-muted); margin-bottom: 0.35rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.auth-submit {
  width: 100%; padding: 0.7rem; font-size: 0.95rem;
  justify-content: center; margin-top: 0.5rem;
}

/* ============ Browse pages (pipeline / leads / companies) ============ */
.browse-filters {
  margin-bottom: 1rem;
}
.filter-input {
  appearance: none;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: 0.85rem; font-weight: 500; color: var(--c-text);
  font-family: inherit;
  box-shadow: var(--shadow-xs);
  background: var(--c-surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.filter-input::placeholder { color: var(--c-muted-2); }
.filter-input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: var(--shadow-focus);
}

.browse-table { min-width: 860px; }
.browse-table thead th { white-space: nowrap; }
.browse-table tbody td { vertical-align: middle; }

.browse-row { cursor: default; }
.browse-actions { opacity: 0.45; transition: opacity 0.12s; white-space: nowrap; }
.browse-row:hover .browse-actions { opacity: 1; }

.browse-lead-link { text-decoration: none; color: inherit; display: block; }
.browse-lead-link:hover .browse-name { color: var(--c-primary); }
.browse-name { font-weight: 600; font-size: 0.9rem; color: var(--c-text); }
.browse-email { font-size: 0.78rem; color: var(--c-muted); }
.browse-email-cell { font-size: 0.88rem; color: var(--c-text); font-variant-numeric: tabular-nums; }
.browse-lead-link:hover .browse-email-cell { color: var(--c-primary); }

.text-muted { color: var(--c-muted); }
.text-right { text-align: right; }

.sdr-pagination {
  display: flex; align-items: center; gap: 0.75rem;
  margin-top: 1rem; justify-content: center;
}
.sdr-pagination-info {
  font-size: 0.84rem; color: var(--c-muted);
}

/* Refine textarea must span the full modal width (override Rails default cols=40) */
.refine-form { display: block; width: 100%; }
.refine-form .form-group { display: block; }
.refine-feedback, .refine-form textarea {
  display: block; width: 100% !important; box-sizing: border-box;
  min-height: 5rem; resize: vertical;
}
/* ============ Kanban Board ============ */
.kanban-board {
  display: flex;
  gap: 0.875rem;
  overflow-x: auto;
  padding-bottom: 1.5rem;
  align-items: flex-start;
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 999px; }

.kanban-col {
  flex: 0 0 256px;
  min-width: 256px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem 0.55rem;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.kanban-col-label {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--c-text-2);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-col-count {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--c-primary-soft);
  color: var(--c-primary-ink);
  border-radius: 999px;
  min-width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
}

.kanban-cards {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0.5rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 60px;
}
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-track { background: transparent; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 999px; }

.kanban-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: box-shadow 0.12s, border-color 0.12s;
  user-select: none;
}
.kanban-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--c-border-strong);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card--ghost {
  opacity: 0.4;
  background: var(--c-primary-soft);
  border-color: var(--c-primary-soft-2);
}
.kanban-card--dragging {
  box-shadow: var(--shadow-md);
  cursor: grabbing;
  opacity: 0.95;
}

.kanban-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.6rem 0.65rem 0.5rem;
}

.kanban-card-body {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.kanban-card-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  margin-top: 1px;
}

.kanban-card-info {
  flex: 1;
  min-width: 0;
}
.kanban-card-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card-link:hover .kanban-card-name { color: var(--c-primary); }
.kanban-card-email {
  font-size: 0.74rem;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}
.kanban-card-company {
  font-size: 0.74rem;
  color: var(--c-text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.kanban-card-time {
  font-size: 0.7rem;
  color: var(--c-muted-2);
  text-align: right;
  margin-top: 0.3rem;
}

.kanban-col-empty {
  font-size: 0.8rem;
  color: var(--c-muted-2);
  text-align: center;
  padding: 1.25rem 0.5rem;
}

.kanban-show-more {
  padding: 0.4rem 0.85rem 0.6rem;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}
.kanban-show-more-link {
  font-size: 0.78rem;
  color: var(--c-primary);
  text-decoration: none;
  display: block;
  text-align: center;
}
.kanban-show-more-link:hover { text-decoration: underline; }

/* Agent trace section in the draft modal */
details.agent-trace-section { border-top: 1px solid var(--c-border); background: var(--c-surface-2); }
details.agent-trace-section[open] { background: var(--c-surface); }
details.agent-trace-section summary {
  cursor: pointer; list-style: none; padding: 0.85rem 1.5rem;
  font-size: 0.86rem; font-weight: 600; color: var(--c-text);
}
details.agent-trace-section summary::-webkit-details-marker { display: none; }
details.agent-trace-section summary::before {
  content: "›"; display: inline-block; width: 1rem; text-align: center;
  font-size: 1.05rem; color: var(--c-muted); transition: transform 0.16s;
}
details.agent-trace-section[open] summary::before { transform: rotate(90deg); }
.agent-trace-pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.75rem; background: var(--c-surface-2);
  padding: 0.75rem; border: 1px solid var(--c-border);
  border-radius: 6px; white-space: pre-wrap; word-wrap: break-word;
  max-height: 360px; overflow-y: auto; color: var(--c-muted);
}


/* Ensure all three modal details sections (refine / schedule / agent-trace) align. */
details.refine-section,
details.schedule-section,
details.agent-trace-section {
  display: block; width: 100%;
}
details.refine-section summary,
details.schedule-section summary,
details.agent-trace-section summary {
  padding: 0.85rem 1.5rem !important;
  cursor: pointer; list-style: none;
  font-size: 0.86rem; font-weight: 600; color: var(--c-text);
  background: var(--c-surface-2);
}
details.refine-section[open] summary,
details.schedule-section[open] summary,
details.agent-trace-section[open] summary {
  background: var(--c-surface);
}

/* Draft modal: From field readonly display + CC checkbox group */
.form-readonly-value {
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  color: var(--c-text);
}
.form-readonly-value strong { font-weight: 600; }
.form-readonly-value .muted { color: var(--c-muted); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.checkbox-group .checkbox-label {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
}
.checkbox-group .checkbox-label:hover { background: var(--c-surface-hover); }


/* Sidebar must not collapse. Editor takes remaining width. */
.draft-modal-layout {
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}
.draft-modal-editor {
  flex: 1 1 auto;
  min-width: 400px;
  overflow-y: auto;
  max-height: calc(90vh - 60px);
}
.draft-lead-sidebar {
  flex: 0 0 340px !important;
  width: 340px;
  min-width: 340px;
  max-width: 340px;
  border-left: 1px solid var(--c-border);
  background: var(--c-surface-2);
  overflow-y: auto;
  max-height: calc(90vh - 60px);
}

/* Widen the dialog so both columns have breathing room */
dialog#draft-review-dialog[open] {
  display: flex; flex-direction: column;
  max-width: min(1280px, 95vw) !important;
  width: 95vw;
}

@media (max-width: 720px) {
  .draft-modal-layout { flex-direction: column; overflow: visible; }
  .draft-modal-editor { max-height: none; min-width: 0; }
  .draft-lead-sidebar {
    border-left: 0; border-top: 1px solid var(--c-border);
    flex: none !important; width: 100% !important; max-width: 100% !important;
    max-height: 50vh;
  }
}

/* Email copy-to-clipboard control */
.email-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  min-width: 0;
}
.email-copy__prefix { color: var(--c-muted); }
.email-copy__addr {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.email-copy__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  color: var(--c-muted);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms, color 120ms, background-color 120ms;
  position: relative;
}
.email-copy:hover .email-copy__btn { opacity: 1; }
.email-copy__btn:hover {
  color: var(--c-fg);
  background-color: rgba(0,0,0,0.05);
  border-color: var(--c-border);
}
.email-copy__btn:focus-visible {
  outline: 2px solid var(--c-accent, #3b82f6);
  outline-offset: 1px;
  opacity: 1;
}
.email-copy__btn.is-copied {
  color: #16a34a;
  background-color: rgba(22,163,74,0.1);
  border-color: rgba(22,163,74,0.3);
  opacity: 1;
}
.email-copy__btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
}

/* ============ Cmd+K Quick Search Palette ============ */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cmdk-trigger:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.2);
}
.cmdk-trigger-icon {
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: -0.01em;
}

dialog.cmdk-overlay {
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(110,58,255,0.12);
  padding: 0;
  width: 600px;
  max-width: 94vw;
  max-height: 80vh;
  background: var(--c-surface);
  overflow: hidden;
  top: 12vh;
  position: fixed;
  margin: 0 auto;
}
dialog.cmdk-overlay::backdrop {
  background: rgba(20,18,42,0.52);
  backdrop-filter: blur(5px);
}
dialog.cmdk-overlay[open] {
  animation: dialog-pop 0.16s cubic-bezier(0.32, 0.72, 0, 1);
}

.cmdk-inner {
  display: flex; flex-direction: column;
}

.cmdk-input {
  width: 100%;
  padding: 1rem 1.1rem;
  font-size: 1rem; font-family: inherit;
  border: 0; border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  outline: none;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.cmdk-input::placeholder { color: var(--c-muted-2); }
.cmdk-input::-webkit-search-cancel-button { display: none; }

.cmdk-results {
  overflow-y: auto;
  max-height: calc(80vh - 62px);
  padding: 0.35rem 0;
}

.cmdk-empty {
  padding: 2rem 1.1rem;
  color: var(--c-muted); font-size: 0.88rem; text-align: center;
}

.cmdk-result {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.62rem 1.1rem;
  text-decoration: none; color: var(--c-text);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.08s, border-color 0.08s;
  outline: none;
}
.cmdk-result:hover,
.cmdk-result.active {
  background: var(--c-surface-hover);
  border-left-color: var(--c-primary);
}
.cmdk-result-primary {
  font-size: 0.9rem; font-weight: 550;
  color: var(--c-text); flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-result-secondary {
  font-size: 0.78rem; color: var(--c-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 0; max-width: 200px;
}

.cmdk-badge {
  display: inline-flex; align-items: center;
  padding: 0.1rem 0.45rem;
  font-size: 0.66rem; font-weight: 700;
  border-radius: 999px; white-space: nowrap;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.cmdk-badge-lead    { background: var(--c-primary-soft); color: var(--c-primary-ink); }
.cmdk-badge-company { background: var(--c-info-soft);    color: var(--c-info-ink); }
.cmdk-badge-draft   { background: var(--c-success-soft); color: var(--c-success-ink); }
.cmdk-badge-command { background: var(--c-warning-soft); color: var(--c-warning-ink); }
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

/* Contact panel slide-in */
.contact-panel-slot {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: white;
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.18s ease-out;
  padding: 1.5rem;
}
.contact-panel-slot:not(:empty) { transform: translateX(0); }

.suggestion-info-link {
  text-decoration: none;
  color: inherit;
  flex: 1 1 auto;
  cursor: pointer;
  display: block;
}
.suggestion-info-link:hover .suggestion-name { color: #7c3aed; }

.contact-panel-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
}
.contact-panel-close:hover { color: #1e293b; }
