/* PVG brand palette — deep navy (#050E3D), accent red, off-white */
:root {
  --navy-900: #050E3D;
  --navy-800: #0c1a52;
  --navy-700: #162868;
  --navy-600: #23397f;
  --navy-500: #3a5399;
  --navy-100: #e1e5f2;
  --navy-50:  #eef0f8;

  --gold-700: #9a7327;
  --gold-600: #b58a31;
  --gold-500: #cfa64b;
  --gold-400: #dfbb6c;
  --gold-100: #f5e8c5;
  --gold-50:  #faf3df;

  --bg:        #f4f4f4;     /* light bg per brand */
  --bg-card:   #ffffff;
  --bg-soft:   #efe9dd;
  --ink:       #0e1a2f;
  --ink-soft:  #495a76;
  --ink-mute:  #7d8aa0;

  --line:      #e2dcd0;
  --line-strong: #cfc5b1;

  --success:   #2f7a4f;
  --warning:   #b07b1f;
  --danger:    #a83b3b;

  --shadow-sm: 0 1px 2px rgba(5, 14, 61, 0.05), 0 1px 3px rgba(5, 14, 61, 0.04);
  --shadow-md: 0 4px 12px rgba(5, 14, 61, 0.08), 0 1px 3px rgba(5, 14, 61, 0.05);
  --shadow-lg: 0 16px 40px rgba(5, 14, 61, 0.14), 0 4px 10px rgba(5, 14, 61, 0.07);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
*, *::before, *::after { box-sizing: border-box; }

a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

.serif { font-family: var(--font-serif); letter-spacing: 0.01em; }

/* ─── Login ───────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(195, 32, 51, 0.12), transparent),
    radial-gradient(900px 500px at 100% 100%, rgba(5, 14, 61, 0.20), transparent),
    var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 56px 56px 48px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}
.login-logo {
  font-family: var(--font-serif);
  font-size: 44px;
  letter-spacing: 0.03em;
  color: var(--navy-900);
  font-weight: 500;
}
.login-logo img {
  display: block;
  margin: 0 auto;
  width: 320px;
  max-width: 100%;
  height: auto;
}
.login-logo .accent { color: #C32033; }
.login-tag {
  color: var(--ink-soft);
  margin: 8px 0 36px;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.login-button {
  background: #C32033;
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 14px 32px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-md);
}
.login-button:hover { background: #a51b2b; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.login-meta { margin-top: 28px; font-size: 12px; color: var(--ink-mute); }

/* ─── App shell ───────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--navy-900);
  color: #d9e1ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-brand .logo {
  font-family: var(--font-serif);
  font-size: 26px;
  color: white;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.sidebar-brand .logo img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  background: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  box-sizing: border-box;
}
.sidebar-brand .logo .accent { color: var(--gold-500); }
.sidebar-brand .sub { font-size: 11px; opacity: 0.6; margin-top: 4px; letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: #c0cbe0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.nav-item.active { background: rgba(207, 166, 75, 0.16); color: white; }
.nav-item.active .icon { color: var(--gold-400); }
.nav-item .icon { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 16px 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-signout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}
.sidebar-signout:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.sidebar-version { font-size: 10px; opacity: 0.5; padding-left: 4px; }

/* Main content area */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  margin: 0;
  color: var(--navy-900);
  letter-spacing: 0.01em;
}
.topbar .crumb { font-size: 12px; color: var(--ink-mute); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-50);
  color: var(--gold-700);
  border: 1px solid var(--gold-400);
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.demo-badge .dot { width: 6px; height: 6px; background: var(--gold-600); border-radius: 50%; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}
.user-chip .avatar {
  width: 32px; height: 32px;
  background: var(--navy-700); color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.user-menu { position: relative; }
.user-chip-btn {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 8px;
  font: inherit;
}
.user-chip-btn:hover { background: var(--bg-soft); border-color: var(--line); }
.user-chip-btn .chevron { color: var(--ink-mute); font-size: 10px; margin-left: 2px; }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 30;
  overflow: hidden;
  animation: fadeIn 0.12s ease;
}
.user-menu-info { padding: 12px 14px; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.user-menu-item:hover { background: var(--bg-soft); }

.content { padding: 28px 32px 64px; max-width: 1400px; width: 100%; }
/* Contacts view opts out of the 1400px cap so its wide table can fill the viewport. */
.content-wide { max-width: none; }

/* ─── Cards / panels ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }

.section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--navy-900);
  margin: 0 0 4px;
}
.section-sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 18px; }

/* ─── Dashboard ───────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
@media (max-width: 800px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi .label { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi .value { font-family: var(--font-serif); font-size: 30px; color: var(--navy-900); margin-top: 4px; line-height: 1.1; }
.kpi .delta { font-size: 12px; margin-top: 4px; color: var(--success); }
.kpi .delta.neg { color: var(--danger); }
/* Multi-stat breakdown (e.g. Total contacts): each stat is a non-wrapping chip
   in a flex-wrap row so a narrow card breaks between whole items rather than
   mid-phrase, with even spacing instead of squished "·" separators. */
.kpi .kpi-breakdown { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 5px; font-size: 12px; color: var(--ink-mute); }
.kpi .kpi-breakdown .kpi-stat { white-space: nowrap; }

.channel-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.channel-tile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
  min-width: 0;
}
.channel-tile .name { font-weight: 600; color: var(--navy-900); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-tile .meta { color: var(--ink-mute); font-size: 11px; margin-top: 2px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.channel-tile .status {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
}
.channel-tile .status .dot { width: 7px; height: 7px; border-radius: 50%; }
.channel-tile.connected .status { color: var(--success); }
.channel-tile.connected .status .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(47, 122, 79, 0.15); }
.channel-tile.disconnected { background: var(--bg-soft); border-color: var(--line); }
.channel-tile.disconnected .status { color: var(--ink-mute); }
.channel-tile.disconnected .status .dot { background: var(--ink-mute); }
.channel-tile.disconnected .name { color: var(--ink-soft); }

.upcoming-list { display: flex; flex-direction: column; gap: 10px; }
.upcoming-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.15s;
  cursor: pointer;
}
.upcoming-item:hover { border-color: var(--gold-400); box-shadow: var(--shadow-md); }
.upcoming-item .date-block {
  width: 56px; flex-shrink: 0; text-align: center;
  background: var(--navy-50); border-radius: 8px; padding: 8px 6px;
}
.upcoming-item .date-block .month { font-size: 10px; color: var(--navy-700); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.upcoming-item .date-block .day { font-family: var(--font-serif); font-size: 24px; color: var(--navy-900); line-height: 1; margin-top: 2px; }
.upcoming-item .body { flex: 1 1 auto; min-width: 0; }
.upcoming-item .name { overflow: hidden; text-overflow: ellipsis; }
.upcoming-item .name { font-weight: 600; color: var(--navy-900); font-size: 14px; }
.upcoming-item .meta { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.upcoming-item .btn-tiny {
  background: var(--gold-600); color: white;
  border: 0; padding: 7px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.upcoming-item .btn-tiny:hover { background: var(--gold-700); }

.year-glance-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.year-glance-cell {
  cursor: pointer;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 12px 10px;
  min-height: 88px;
  border: 1px solid var(--line);
  transition: background 0.12s;
}
.year-glance-cell:hover { background: var(--bg-card); }
.year-glance-month { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.year-glance-count { font-size: 20px; font-family: var(--font-serif); color: var(--navy-900); margin-top: 2px; line-height: 1.1; }
.year-glance-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.year-glance-dot { width: 8px; height: 8px; border-radius: 2px; }

.segment-pills { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.segment-pill {
  background: var(--navy-50);
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--navy-800);
  display: flex; align-items: center; gap: 8px;
}
.segment-pill strong { color: var(--navy-900); font-size: 15px; font-weight: 700; }

/* ─── Calendar (year view) ────────────────────────────────────────────── */
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.cal-year-nav { display: flex; align-items: center; gap: 10px; }
.cal-year-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: var(--bg-card); color: var(--navy-900);
  border-radius: 6px;
  font-size: 18px; font-weight: 600; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-year-btn:hover:not(:disabled) { background: var(--navy-50); border-color: var(--navy-500); }
.cal-year-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.cal-year-today {
  background: transparent; border: 1px solid var(--gold-400);
  color: var(--gold-700);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; margin-left: 4px;
}
.cal-year-today:hover { background: var(--gold-50); }
.cal-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-soft); flex-wrap: wrap; }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; }
.legend-chip .swatch { width: 12px; height: 12px; border-radius: 3px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) { .cal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .cal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .cal-grid { grid-template-columns: minmax(0, 1fr); } }

.cal-month {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.cal-month h3 {
  font-family: var(--font-serif);
  font-size: 18px; margin: 0 0 10px;
  color: var(--navy-900);
  letter-spacing: 0.02em;
}
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 11px;
}
.cal-day-name { color: var(--ink-mute); font-size: 9px; font-weight: 600; text-align: center; padding: 2px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  color: var(--ink-soft);
  font-size: 10px;
}
.cal-day.muted { color: var(--ink-mute); opacity: 0.4; }
.cal-day.today { background: var(--navy-900); color: white; font-weight: 700; }
.cal-day.has-event { background: var(--gold-50); color: var(--navy-900); font-weight: 600; cursor: pointer; transition: all 0.12s; }
.cal-day.has-event:hover { background: var(--gold-100); transform: scale(1.08); }
.cal-day .dots { position: absolute; bottom: 1px; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; }
.cal-day .dots .dot { width: 4px; height: 4px; border-radius: 50%; }

.cal-month-events { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.cal-event-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
}
.cal-event-row:hover { background: var(--bg-soft); }
.cal-event-row .swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.cal-event-row .date { color: var(--ink-mute); font-weight: 600; min-width: 24px; }
.cal-event-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Contacts ────────────────────────────────────────────────────────── */
.contacts-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.search-input {
  flex: 1; min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
}
.search-input:focus { outline: 2px solid var(--gold-400); outline-offset: -1px; border-color: var(--gold-400); }
.select {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  min-width: 140px;
}

.tag-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.tag-toggle {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.12s;
}
.tag-toggle:hover { border-color: var(--navy-500); }
.tag-toggle.active { background: var(--navy-900); color: white; border-color: var(--navy-900); }

.contacts-table {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.contacts-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--navy-50);
  font-size: 11px;
  color: var(--navy-800);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.contacts-table thead th:first-child { border-top-left-radius: var(--radius); }
.contacts-table thead th:last-child { border-top-right-radius: var(--radius); }
.contacts-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: top;
}
.contacts-table tbody tr:last-child td { border-bottom: 0; }
.contacts-table tbody tr:hover td { background: var(--bg-soft); }

.tag {
  display: inline-block;
  background: var(--navy-50);
  color: var(--navy-800);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  margin: 1px 2px 1px 0;
  font-weight: 500;
}
.tag.luxury { background: var(--gold-50); color: var(--gold-700); }
.tag.investor { background: #e8f0e8; color: #345e3a; }
.tag.spanish { background: #f3e8f0; color: #6b3056; }
.tag-xs { font-size: 10px; padding: 1px 6px; vertical-align: middle; }
.tag-sms { background: #e8f0e8; color: #2d5c35; }
.tag-email { background: #e8eef8; color: #1a3a6b; }

.segment-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.segment-tag.active { background: #e0f0e7; color: #1f5b3a; }
.segment-tag.past { background: var(--navy-50); color: var(--navy-800); }
.segment-tag.lead { background: var(--gold-50); color: var(--gold-700); }

/* Lead pipeline status pill — one color per stage */
.lead-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.lead-badge.new        { background: #eef2f7; color: #45577a; }
.lead-badge.contacted  { background: #e7eefb; color: #2f4f9e; }
.lead-badge.qualified  { background: #e0f0e7; color: #1f5b3a; }
.lead-badge.nurturing  { background: var(--gold-50); color: var(--gold-700); }
.lead-badge.contract   { background: #fdeccf; color: #8a5a12; }
.lead-badge.closed     { background: #e3f7e3; color: #2a6b2a; }
.lead-badge.past       { background: var(--navy-50); color: var(--navy-800); }

/* Inline checkbox + label row used in forms (do-not-contact, agent active) */
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* Grouped sub-heading inside the contact modal */
.form-group-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft, #9aa3b2);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--navy-50, #eef2f7);
}
.form-group-head:first-child { margin-top: 0; }

/* Campaigns page — filter bar */
.cmp-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 14px;
}
@media (max-width: 768px) { .cmp-filter-row { grid-template-columns: minmax(0, 1fr); gap: 12px; } }
.cmp-filter-group { min-width: 0; }
.cmp-filter-group .field-label { margin-bottom: 8px; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  background: var(--bg-card);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
}
.filter-chip:hover { border-color: var(--navy-500); color: var(--navy-900); }
.filter-chip.active {
  background: var(--navy-900);
  color: white;
  border-color: var(--navy-900);
}

.cmp-search-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cmp-search-row .search-input { flex: 1; min-width: 200px; }

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-500);
  color: white;
  border-radius: 100px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Event-only campaigns */
.status-pill.event-pill {
  background: #e8f0e8;
  color: #345e3a;
}
.event-detail {
  max-width: 720px;
  margin: 0 auto;
}
.event-hero { position: relative; }
.event-date-block {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: white;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  text-align: center;
}
.event-month {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--gold-400);
}
.event-day {
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  margin: 2px 0 4px;
}
.event-dow {
  font-size: 12px;
  opacity: 0.85;
  letter-spacing: 0.04em;
}
.event-notes {
  min-height: 200px;
  font-size: 14px;
  line-height: 1.6;
}

/* NJMLS listings grid */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.listing-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
}
.listing-card:hover {
  border-color: var(--gold-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.listing-photo {
  position: relative;
  aspect-ratio: 16/10;
  background: var(--navy-50);
  overflow: hidden;
}
.listing-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-photo-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: var(--navy-100);
}
.listing-mls {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(5, 14, 61, 0.85);
  color: white;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.listing-source {
  position: absolute;
  top: 8px; right: 8px;
  color: white;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.listing-source-njmls { background: rgba(42, 77, 122, 0.92); }   /* navy — NJMLS */
.listing-source-hcmls { background: rgba(168, 59, 59, 0.92); }   /* brick — HCMLS */
.listing-source-gsmls { background: rgba(46, 122, 79, 0.92); }   /* green — GSMLS */
.listing-rent { font-size: 13px; font-weight: 500; color: var(--ink-mute); margin-left: 2px; }
.listing-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.listing-price {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 22px;
  color: var(--navy-900);
  letter-spacing: 0.01em;
}
.listing-address {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
}
.listing-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.listing-view-link {
  margin-top: auto;
  padding-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold-400);
}
.listing-card:hover .listing-view-link { text-decoration: underline; }
.listing-card.listing-card-oh {
  border-color: #C32033;
  box-shadow: 0 0 0 2px rgba(195,32,51,0.15), var(--shadow-sm);
}
.listing-oh-badge {
  position: absolute;
  top: 8px; left: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #C32033;
  color: #fff;
  padding: 5px 11px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  max-width: 70%;
  z-index: 2;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.listing-oh-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: oh-pulse 1.6s ease-in-out infinite;
}
@keyframes oh-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.listing-oh-text strong {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.listing-oh-when {
  font-weight: 500;
  font-size: 10px;
  opacity: 0.92;
}
.oh-count-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #C32033;
  vertical-align: middle;
}
.oh-count-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #C32033;
  animation: oh-pulse 1.6s ease-in-out infinite;
}
@media (max-width: 600px) {
  .listings-grid { grid-template-columns: 1fr; }
}

/* Template detail layout — single-column streamlined view */
.template-detail-single {
  max-width: 720px;
  margin: 0 auto;
}

.show-sent-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.show-sent-toggle:hover { color: var(--ink); }

/* Recurring series */
.series-row td { background: var(--bg-soft); font-weight: 600; }
.series-row:hover td { background: var(--gold-50); }
.instance-row td:first-child { padding-left: 24px; }
.instance-row .instance-name { color: var(--ink-soft); padding-left: 12px; }
.series-toggle {
  background: transparent;
  border: 0;
  font-size: 14px;
  color: var(--navy-700);
  width: 24px; height: 24px;
  cursor: pointer;
  border-radius: 4px;
}
.series-toggle:hover { background: var(--navy-50); }
/* Bigger tap target on mobile */
.series-toggle-mobile {
  width: 44px;
  height: 44px;
  font-size: 18px;
  background: var(--navy-50);
  flex-shrink: 0;
}
.freq-badge {
  display: inline-block;
  background: var(--gold-50);
  color: var(--gold-700);
  border: 1px solid var(--gold-400);
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
}
.series-card {
  background: var(--bg-soft);
  border-color: var(--gold-400);
}
.instance-card {
  margin-left: 12px;
  border-left: 3px solid var(--navy-500);
}
.recurrence-field {
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 14px 16px;
}
.recurrence-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.recurrence-toggle .check { accent-color: var(--navy-900); }
.recurrence-options code {
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

/* Multi-segment selector + display */
.seg-tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.segment-pill-mini {
  display: inline-block;
  background: var(--navy-50);
  color: var(--navy-800);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.segment-multi { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-close {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  margin-left: 6px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
}
.chip-close:hover { opacity: 1; }

.ai-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}
.ai-tag.generated { background: #e0f0e7; color: var(--success); }
.ai-tag.empty { background: var(--bg-soft); color: var(--ink-mute); }

input.check {
  width: 16px; height: 16px;
  accent-color: var(--navy-900);
  cursor: pointer;
}

/* Mobile campaign card */
@media (max-width: 768px) {
  .cmp-card .contact-card-meta { gap: 4px; }
  .cmp-card .channel-pill { font-size: 10px; padding: 2px 7px; }
}

/* List toolbar (sort + count summary above the list) */
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.list-count { font-size: 13px; color: var(--ink-soft); }
.list-count strong { color: var(--navy-900); font-weight: 700; }
.list-sort { display: flex; align-items: center; gap: 8px; }
.list-sort .select { padding: 7px 10px; font-size: 12.5px; min-width: 160px; }

/* Pagination control below the list */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 4px 4px;
  margin-top: 8px;
}
.pager-summary { font-size: 12.5px; }
.pager-summary strong { color: var(--navy-900); }
.pager-buttons { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager-btn {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  min-width: 32px;
  transition: all 0.12s;
}
.pager-btn:hover:not(:disabled):not(.active) {
  border-color: var(--navy-500);
  color: var(--navy-900);
}
.pager-btn.active {
  background: var(--navy-900);
  color: white;
  border-color: var(--navy-900);
}
.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pager-ellipsis {
  padding: 0 4px;
  color: var(--ink-mute);
  font-size: 12.5px;
}

.audience-count {
  background: var(--navy-50);
  color: var(--navy-900);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  border-left: 4px solid var(--gold-500);
  margin-bottom: 16px;
}
.audience-count strong { font-size: 18px; font-family: var(--font-serif); }

.saved-segments-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.saved-segment-chip {
  background: var(--bg-card);
  border: 1px solid var(--gold-400);
  color: var(--gold-700);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.saved-segment-chip:hover { background: var(--gold-50); }
.saved-segment-del {
  margin-left: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--gold-700);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
}
.saved-segment-del:hover { opacity: 1; color: #b00020; }

/* ─── Contacts list: persistent search, sortable headers, virtual scroll,
       inline editing, bulk selection ──────────────────────────────────── */

/* Persistent search bar */
.contacts-search {
  position: relative;
  flex: 1 1 320px;
  min-width: 220px;
  display: flex;
  align-items: center;
}
.contacts-search-icon {
  position: absolute;
  left: 12px;
  color: var(--ink-mute);
  font-size: 16px;
  pointer-events: none;
}
.contacts-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 34px 9px 32px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
}
.contacts-search-input:focus {
  outline: 2px solid var(--gold-400);
  outline-offset: -1px;
  border-color: var(--gold-400);
}
.contacts-search-clear {
  position: absolute;
  right: 8px;
  width: 20px; height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--navy-50);
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.contacts-search-clear:hover { background: var(--navy-100); color: var(--navy-900); }

/* Clickable sortable column headers */
.contacts-table thead th.th-sort { cursor: pointer; user-select: none; transition: color 0.12s, background 0.12s; }
.contacts-table thead th.th-sort:hover { background: var(--navy-100); color: var(--navy-900); }
.contacts-table thead th.th-sort.active { color: var(--navy-900); }
.th-sort-inner { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.th-arrow { font-size: 9px; opacity: 0.35; transition: opacity 0.12s; }
.contacts-table thead th.th-sort.active .th-arrow { opacity: 1; color: var(--gold-600); }
.contacts-table thead th.th-sort:hover .th-arrow { opacity: 0.7; }

/* Virtual-scroll container: fixed-height, scrollable, sticky header */
.contacts-scroll {
  max-height: min(64vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.contacts-table.virtual {
  border: 0;
  border-radius: 0;
  table-layout: fixed;
  width: 100%;        /* fills the (now full-width) container; min-width set inline */
}
.contacts-table.virtual thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
/* th-sort is the positioning context for its drag-resize grip. */
.contacts-table.virtual thead th.th-sort { position: sticky; }
.contacts-table.virtual tbody tr:not(.v-spacer) { height: 52px; }
.contacts-table.virtual tbody td {
  vertical-align: middle;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.contacts-table.virtual tbody tr.v-spacer:hover td,
.contacts-table.virtual tbody tr.v-spacer td { background: transparent; padding: 0; border: 0; }
.contacts-table.virtual tbody tr.row-selected td { background: var(--gold-50); }
.contacts-table.virtual tbody tr.row-selected:hover td { background: var(--gold-100); }

/* Trailing flex column: soaks up leftover width on wide monitors so the table
   fills the viewport, collapses to 0 when the table hits its min-width. */
.contacts-table.virtual .th-spacer, .contacts-table.virtual .td-spacer { padding: 0; }

/* Drag-to-resize grip on the right edge of each sortable header. */
.col-resize-grip {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  user-select: none;
}
.col-resize-grip::after {
  content: "";
  position: absolute;
  top: 18%;
  right: 3px;
  width: 2px;
  height: 64%;
  background: transparent;
  border-radius: 1px;
  transition: background 0.12s;
}
.col-resize-grip:hover::after { background: var(--gold-500); }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing .col-resize-grip::after { background: var(--gold-500); }

/* Column sizing comes from the <colgroup>; these just handle padding/alignment. */
.contacts-table.virtual th.th-check, .contacts-table.virtual td.td-check { padding-left: 14px; padding-right: 0; text-align: center; }
.td-check input, .th-check input { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
.td-name-inner { display: flex; align-items: center; gap: 6px; min-width: 0; }
.td-name-text { font-weight: 600; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; }
.td-tags-inner { display: flex; gap: 0; flex-wrap: nowrap; overflow: hidden; }
.td-tags-inner .tag { flex-shrink: 0; }
.cell-empty { color: var(--ink-mute); opacity: 0.5; }

/* Inline-edit selects (Lead Owner / Assigned Agent). Reads as plain text until
   hovered/focused, then reveals an editable affordance — single click opens it. */
.cell-editable { padding: 0 !important; }
.inline-edit-select {
  width: 100%;
  height: 100%;
  min-height: 36px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 6px 22px 6px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-mute) 50%), linear-gradient(135deg, var(--ink-mute) 50%, transparent 50%);
  background-position: calc(100% - 12px) 47%, calc(100% - 8px) 47%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  opacity: 0.92;
  transition: border-color 0.12s, background-color 0.12s, opacity 0.12s;
}
.inline-edit-select:hover {
  border-color: var(--line-strong);
  background-color: var(--bg-card);
  opacity: 1;
}
.inline-edit-select:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 2px var(--gold-50);
  background-color: var(--bg-card);
}
.cell-editable:hover .inline-edit-select { border-color: var(--line-strong); background-color: var(--bg-card); }

/* Floating bulk action bar */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--navy-900);
  color: white;
  padding: 10px 12px 10px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: bulkBarIn 0.18s ease;
  max-width: calc(100vw - 32px);
}
@keyframes bulkBarIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.bulk-count { font-size: 13px; white-space: nowrap; }
.bulk-count strong { font-size: 15px; color: var(--gold-400); }
.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: white;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.bulk-btn:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.32); }
.bulk-btn.active { background: var(--gold-500); border-color: var(--gold-500); color: var(--navy-900); }
.bulk-clear {
  width: 30px; height: 30px;
  border: 0;
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.bulk-clear:hover { background: rgba(255,255,255,0.2); }

/* Bulk picker popover above the bar */
.bulk-picker {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: min(360px, calc(100vw - 32px));
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px;
}
.bulk-picker-title { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.bulk-picker-title strong { color: var(--navy-900); }
.bulk-picker-row { display: flex; gap: 8px; align-items: center; }
.bulk-picker-row .select { flex: 1 1 auto; min-width: 0; }
.bulk-picker-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.bulk-picker-actions .btn-primary, .bulk-picker-actions .btn-secondary { padding: 8px 16px; font-size: 13px; }

/* Mobile contact-card inline edits + selection */
.card-check { width: 17px; height: 17px; cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.contact-card.card-selected { border-color: var(--gold-400); box-shadow: 0 0 0 1px var(--gold-400); }
.contact-card-edit-row { display: flex; gap: 8px; margin: 8px 0; }
.card-edit-field { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.card-edit-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); font-weight: 600; }
.inline-edit-select.boxed {
  border: 1px solid var(--line);
  background-color: var(--bg-card);
  min-height: 34px;
  opacity: 1;
}

/* ─── Campaign Detail ─────────────────────────────────────────────────── */
.campaign-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .campaign-grid { grid-template-columns: minmax(0, 1fr); } }

.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 6px; }
.field-input, .field-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}
.field-textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.field-input:focus, .field-textarea:focus { outline: 2px solid var(--gold-400); outline-offset: -1px; border-color: var(--gold-400); }

.channel-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.channel-chip {
  background: var(--navy-50);
  color: var(--navy-800);
  border: 1px solid transparent;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex; align-items: center; gap: 6px;
}
.channel-chip:hover { border-color: var(--navy-500); }
.channel-chip.active { background: var(--navy-900); color: white; }

.ai-panel {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--gold-50) 130%);
  border: 1px solid var(--gold-400);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-md);
}
.ai-panel h3 {
  font-family: var(--font-serif);
  margin: 0;
  font-size: 22px;
  color: var(--navy-900);
  display: flex; align-items: center; gap: 10px;
}
.ai-sparkle {
  width: 28px; height: 28px;
  background: var(--gold-500); color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.ai-generate-btn {
  background: var(--navy-900); color: white;
  border: 0; border-radius: 8px;
  padding: 12px 22px;
  font-size: 14px; font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.ai-generate-btn:hover { background: var(--navy-800); box-shadow: var(--shadow-md); }
.ai-generate-btn:disabled { opacity: 0.6; cursor: progress; }
.ai-generate-btn .glyph { color: var(--gold-400); }

.ai-secondary-btn {
  background: var(--bg-card); color: var(--navy-900);
  border: 1px solid var(--navy-500);
  border-radius: 8px; padding: 10px 18px;
  font-size: 13px; font-weight: 600;
}
.ai-secondary-btn:hover { background: var(--navy-50); }
.ai-secondary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-status {
  font-size: 12px; color: var(--ink-soft);
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 8px;
}

/* Channel previews */
.preview-personalize {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink);
  padding: 8px 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: 6px;
  margin: 10px 0 14px;
  cursor: pointer;
  user-select: none;
}
.preview-personalize input { margin: 0; cursor: pointer; }
.preview-personalize .muted { display: inline-block; }
.preview-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.preview-tab {
  background: transparent; border: 0;
  padding: 9px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.preview-tab:hover { color: var(--ink); }
.preview-tab.active { color: var(--navy-900); border-bottom-color: var(--gold-500); }

.preview-stage {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 24px;
  min-height: 280px;
}

/* Email preview */
.email-mock {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  font-size: 14px;
}
.email-mock .email-rendered { background: #f4f1ea; padding: 12px; border-radius: 0 0 8px 8px; }
.email-mock .email-rendered a { pointer-events: none; }

/* Email template editor */
.tmpl-editor { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; }
@media (max-width: 900px) { .tmpl-editor { grid-template-columns: minmax(0,1fr); } }
.tmpl-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; cursor: pointer; }
.tmpl-toggle input { margin: 0; }
.tmpl-link-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.tmpl-link-row input[type=checkbox] { margin: 0; flex: 0 0 auto; }

/* Social/website status rows (email template editor) */
.social-row-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 8px;
}
.social-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 10px 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.12s, background 0.12s;
}
.social-row:hover { border-color: var(--line-strong); }
.social-row.is-disabled { background: var(--bg-soft); opacity: 0.65; }
.social-row-icon {
  flex: 0 0 20px;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.social-row-name {
  flex: 0 0 88px;
  font-weight: 600;
  font-size: 13px;
  color: var(--navy-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.social-row-name-input {
  flex: 0 0 88px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--navy-900);
  min-width: 0;
}
.social-row-name-input:focus { outline: 2px solid var(--gold-400); outline-offset: -1px; border-style: solid; border-color: var(--gold-400); }
.social-row-body { flex: 1; min-width: 0; display: flex; align-items: center; }
.social-row-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  padding: 6px 4px;
  margin: 0;
  font: inherit;
  color: var(--ink-mute);
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  min-width: 0;
  width: 100%;
  border-radius: 4px;
}
.social-row-status:hover { background: var(--bg-soft); }
.social-row-status.is-connected { color: var(--success); }
.social-row-status.is-empty { color: var(--ink-mute); }
.social-row-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
  background: var(--ink-mute);
}
.social-row-status.is-connected .social-row-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(47, 122, 79, 0.15);
}
.social-row-status-label { font-weight: 600; }
.social-row-sep { color: var(--line-strong); }
.social-row-url {
  color: var(--ink-soft);
  font-weight: 500;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.social-row-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--gold-400);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--ink);
  outline: 2px solid var(--gold-400);
  outline-offset: -1px;
  min-width: 0;
}
.social-row-visible {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-mute);
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
}
.social-row-visible input { margin: 0; }
.social-row-visible span {
  position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.social-row-edit {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  cursor: pointer;
  flex: 0 0 auto;
  transition: all 0.12s;
}
.social-row-edit:hover { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.social-row-remove {
  background: transparent;
  border: 0;
  font-size: 14px;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  flex: 0 0 auto;
}
.social-row-remove:hover { color: #c5221f; background: rgba(197,34,31,0.08); }
.social-row-aside {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 4px 0 8px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
@media (max-width: 540px) {
  .social-row { flex-wrap: wrap; gap: 8px; }
  .social-row-name { flex: 1 1 auto; }
  .social-row-body { flex: 1 1 100%; order: 5; }
  .social-row-visible { order: 6; }
  .social-row-edit { order: 7; }
}

.tmpl-preview { position: sticky; top: 12px; align-self: start; }
.tmpl-preview-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f4f1ea;
  max-height: 620px;
  overflow-y: auto;
}
.tmpl-preview-frame a { pointer-events: none; }
.email-mock .header {
  background: var(--navy-900);
  color: white;
  padding: 22px 28px;
  text-align: center;
}
.email-mock .header .brand { font-family: var(--font-serif); font-size: 26px; letter-spacing: 0.04em; }
.email-mock .header .brand .accent { color: var(--gold-500); }
.email-mock .header .tag { font-size: 10px; opacity: 0.7; letter-spacing: 0.16em; text-transform: uppercase; margin-top: 4px; }
.email-mock .subject {
  font-family: var(--font-serif); font-size: 22px; color: var(--navy-900);
  padding: 22px 28px 0;
  font-weight: 500;
}
.email-mock .preheader { padding: 4px 28px 0; font-size: 12px; color: var(--ink-mute); font-style: italic; }
.email-mock .body { padding: 16px 28px 24px; white-space: pre-wrap; line-height: 1.65; color: var(--ink); }
.email-mock .footer {
  background: var(--navy-50); padding: 16px 28px;
  font-size: 11px; color: var(--ink-mute); text-align: center; border-top: 1px solid var(--line);
}

/* SMS preview */
.sms-mock {
  max-width: 320px; margin: 0 auto;
  background: #1f1f1f;
  border-radius: 32px;
  padding: 18px 14px 28px;
  box-shadow: var(--shadow-lg);
}
.sms-mock .topbar-phone {
  display: flex; justify-content: space-between;
  color: white; font-size: 11px; font-weight: 600; padding: 0 12px 12px;
}
.sms-mock .sender { color: white; text-align: center; font-size: 12px; padding-bottom: 12px; opacity: 0.8; }
.sms-mock .bubble {
  background: #34495e;
  color: white;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  font-size: 14px;
  line-height: 1.4;
  max-width: 240px;
  margin: 4px 0;
}
.sms-mock .char-count { color: rgba(255,255,255,0.5); font-size: 10px; text-align: center; margin-top: 10px; }


/* Event preview */
.event-mock {
  max-width: 540px; margin: 0 auto;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.event-mock .banner {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: white; padding: 28px 28px 20px; text-align: center;
}
.event-mock .banner h2 { font-family: var(--font-serif); margin: 0; font-size: 26px; font-weight: 500; }
.event-mock .banner .date { font-size: 12px; opacity: 0.7; margin-top: 6px; letter-spacing: 0.08em; text-transform: uppercase; }
.event-mock .body { padding: 22px 26px; font-size: 13px; line-height: 1.6; }
.event-mock .body .blurb { font-size: 15px; color: var(--navy-900); margin-bottom: 10px; font-style: italic; }
.event-mock .rsvp-bar {
  background: var(--bg-soft); padding: 14px 26px;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line);
}
.event-mock .rsvp-btn { background: var(--gold-600); color: white; padding: 8px 18px; border: 0; border-radius: 6px; font-weight: 600; font-size: 13px; }

/* Postcard preview */
.postcard-mock { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.postcard-side {
  width: 280px; height: 200px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 20px;
  position: relative;
  font-size: 12px;
}
.postcard-side.front {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: white;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
}
.postcard-side.front .headline { font-family: var(--font-serif); font-size: 24px; line-height: 1.1; }
.postcard-side.front .subhead { font-size: 12px; opacity: 0.8; margin-top: 8px; }
.postcard-side.front .pvg { position: absolute; bottom: 12px; right: 16px; font-family: var(--font-serif); font-size: 14px; color: var(--gold-400); letter-spacing: 0.06em; }
.postcard-side.back { background: white; }
.postcard-side.back .stamp {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 44px;
  background: var(--gold-50); border: 1px solid var(--gold-400);
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--gold-700); font-weight: 600; text-align: center;
  line-height: 1.1;
}
.postcard-side.back .message { padding-right: 56px; white-space: pre-wrap; font-size: 11.5px; line-height: 1.5; color: var(--ink); }

/* Send / status */
.send-bar {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; margin-top: 18px;
  flex-wrap: wrap;
}
.send-bar .status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--navy-50); color: var(--navy-800);
  padding: 4px 12px; border-radius: 100px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.status-pill.scheduled { background: #e8eef7; color: var(--navy-800); }
.status-pill.sending { background: var(--gold-50); color: var(--gold-700); animation: pulse 1.4s ease-in-out infinite; }
.status-pill.paused { background: #fdf3d6; color: #7d6a3e; }
.status-pill.cancelled { background: #e6e8eb; color: #555a63; }
.status-pill.sent { background: #e0f0e7; color: var(--success); }
.status-pill.draft { background: var(--bg-soft); color: var(--ink-soft); }
.status-pill.archived { background: #ece9e2; color: #6b6357; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.btn-primary {
  background: #C32033; color: white;
  border: 0; padding: 11px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.04em;
}
.btn-primary:hover { background: #a51b2b; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg-card); color: var(--navy-900);
  border: 1px solid var(--navy-300, var(--line-strong));
  padding: 11px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
}
.btn-secondary:hover { background: var(--bg-soft); }

/* ─── Analytics ───────────────────────────────────────────────────────── */
.analytics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
@media (max-width: 900px) { .analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bot-filter-note { margin: -8px 0 22px; padding: 9px 13px; border-radius: 8px; background: var(--surface-soft, #f4f6fa); border: 1px solid var(--border, #e2e6ee); color: var(--ink-soft, #6b7280); font-size: 12.5px; line-height: 1.45; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; }
.bar-row .label { width: 110px; color: var(--ink-soft); }
.bar-row .bar { flex: 1; background: var(--bg-soft); height: 22px; border-radius: 4px; position: relative; overflow: hidden; }
.bar-row .bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--navy-700), var(--gold-500));
  border-radius: 4px;
  transition: width 0.6s ease;
}
.bar-row .num { width: 60px; text-align: right; font-weight: 600; color: var(--navy-900); }

/* ─── Analytics drill-down ────────────────────────────────────────────── */
.analytics-row-link { cursor: pointer; transition: background 0.12s ease; }
.analytics-row-link:hover td { background: var(--bg-soft); }
.analytics-detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .analytics-detail-cols { grid-template-columns: 1fr; } }

/* Actionable drill-down: hot leads, call buttons, listing chips */
.hot-card { border-top: 3px solid var(--gold-500); }
.hot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.hot-count {
  background: var(--gold-50); color: var(--gold-700);
  border: 1px solid var(--gold-400);
  border-radius: 100px; padding: 2px 11px;
  font-size: 13px; font-weight: 700;
}
.hot-list { display: flex; flex-direction: column; margin-top: 10px; }
.hot-lead { display: flex; gap: 14px; align-items: flex-start; padding: 14px 4px; border-bottom: 1px solid var(--bg-soft); }
.hot-lead:last-child { border-bottom: 0; }
.hot-rank {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy-50); color: var(--navy-700);
  font-family: var(--font-serif); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.hot-body { flex: 1 1 auto; min-width: 0; }
.hot-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; color: var(--navy-900); }
.hot-flag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 100px;
}
.hot-flag.replied { background: #e0f0e7; color: var(--success); }
.hot-flag.dnc { background: #f6e3e3; color: var(--danger); }
.hot-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.hot-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.listing-chip {
  display: inline-block; background: var(--gold-50); border: 1px solid var(--gold-400);
  color: var(--navy-900); border-radius: 8px; padding: 5px 10px;
  font-size: 12.5px; line-height: 1.35;
}
.listing-chip:hover { background: var(--gold-100); }
.listing-chip.generic { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-700); }
.listing-chip strong { color: var(--gold-700); }
.hot-action { flex: 0 0 auto; margin-top: 2px; }
.contact-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.call-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); color: var(--navy-800);
  border: 1px solid var(--navy-100); border-radius: 8px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.call-btn:hover { background: var(--navy-50); color: var(--navy-900); border-color: var(--navy-500); }
.call-btn::before { content: '✆'; font-size: 14px; color: var(--gold-600); }
.call-btn.subtle::before { content: none; }
.call-btn.subtle {
  background: transparent; color: var(--navy-700);
  border: 1px solid var(--navy-100); font-weight: 600; padding: 6px 11px; font-size: 12.5px;
}
.call-btn.subtle:hover { background: var(--navy-50); color: var(--navy-900); }
.warmcold-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--bg-soft); font-size: 13px; }
.warmcold-row:last-child { border-bottom: 0; }
.warmcold-main { flex: 1 1 auto; min-width: 0; }
.warmcold-sub { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbar { margin-bottom: 12px; }
.linkbar:last-child { margin-bottom: 0; }
.linkbar-label { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; min-width: 0; }
.linkbar-label a { color: var(--navy-900); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbar-label a:hover { color: var(--gold-700); }
.linkbar-label .n { color: var(--ink-soft); white-space: nowrap; font-size: 12px; }
.linkbar .bar { background: var(--bg-soft); height: 10px; border-radius: 5px; overflow: hidden; }
.linkbar .bar-fill { height: 100%; background: linear-gradient(90deg, var(--navy-700), var(--gold-500)); border-radius: 5px; transition: width 0.6s ease; }
.attn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
.attn-title { font-size: 13px; font-weight: 700; color: var(--navy-900); margin-bottom: 6px; }
@media (max-width: 800px) {
  .attn-grid { grid-template-columns: 1fr; }
  .hot-lead { flex-wrap: wrap; gap: 10px; }
  .hot-rank { flex-basis: 26px; width: 26px; height: 26px; font-size: 13px; }
  .hot-body { flex-basis: calc(100% - 40px); }
  .hot-action { flex-basis: 100%; margin-left: 0; margin-top: 0; }
  .hot-action .contact-actions { width: 100%; }
  .hot-action .call-btn { flex: 1; justify-content: center; padding: 11px 14px; }
}

/* ─── Audience insights (campaign drill-down) ────────────────────────── */
.insights-table { margin-top: 6px; overflow-x: auto; }
.insights-hdr, .insights-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.5fr) 52px 52px 52px 1fr 1fr;
  gap: 4px 10px; align-items: center; padding: 5px 0;
}
.insights-hdr { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.insights-row { font-size: 13px; border-bottom: 1px solid var(--bg-soft); }
.insights-row:last-child { border-bottom: none; }
.insights-best { background: var(--gold-50, #fffbe6); border-radius: 4px; padding: 5px 4px; }
.insights-seg-name { font-weight: 600; color: var(--navy-900); display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insights-num { text-align: center; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.insights-bar-col { display: flex; align-items: center; gap: 6px; }
.insights-bar { flex: 1; height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; min-width: 40px; }
.insights-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.insights-bar-fill.open { background: var(--navy-400); }
.insights-bar-fill.click { background: var(--gold-500); }
.insights-pct { font-size: 12px; font-weight: 600; color: var(--ink-soft); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.insights-badge { display: inline-block; font-size: 10px; font-weight: 700; color: var(--gold-700); background: var(--gold-100, #fff3c4); padding: 1px 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.05em; }

.reach-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.reach-stat { text-align: center; background: var(--bg-soft); border-radius: 8px; padding: 12px 20px; min-width: 90px; }
.reach-val { font-size: 22px; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.reach-label { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

.suggestions-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.suggestion-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--navy-900); background: var(--bg-soft); border-radius: 6px; padding: 10px 14px; line-height: 1.4; }
.suggestion-icon { flex-shrink: 0; font-size: 15px; }

@media (max-width: 800px) {
  .insights-hdr, .insights-row { grid-template-columns: minmax(80px, 1.2fr) 40px 40px 40px 1fr 1fr; gap: 2px 6px; }
  .insights-seg-name { font-size: 12px; }
  .reach-grid { gap: 10px; }
  .reach-stat { padding: 10px 14px; min-width: 70px; }
}

/* ─── Settings / integrations ─────────────────────────────────────────── */
.integ-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.integ-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; position: relative;
}
.integ-card .logo {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--navy-50); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-serif); font-size: 20px;
}
.integ-card .name { font-weight: 700; color: var(--navy-900); margin-top: 14px; font-size: 14px; }
.integ-card .desc { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.integ-card .status-tag {
  position: absolute; top: 14px; right: 14px;
  background: var(--gold-50); color: var(--gold-700);
  border: 1px solid var(--gold-400);
  padding: 3px 10px; border-radius: 100px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.integ-card .status-tag.connected {
  background: #e0f0e7; color: var(--success); border-color: #b6d8c2;
}
.integ-card .status-tag.pending {
  background: var(--navy-50); color: var(--navy-800); border-color: var(--navy-100);
}
.integ-card-live {
  border-color: var(--gold-400);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--gold-50) 250%);
}
.gmail-help {
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 10px 16px 10px 26px;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
}
.gmail-help li { margin: 2px 0; }
.gmail-help a { color: var(--navy-700); font-weight: 600; }

.btn-link {
  background: transparent;
  border: 0;
  color: var(--navy-700);
  cursor: pointer;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.btn-link:hover { color: var(--navy-900); }

.real-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e0f0e7;
  color: var(--success);
  border: 1px solid #b6d8c2;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.real-badge .dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; flex-shrink: 0; }

.real-send-btn {
  background: var(--success) !important;
}
.real-send-btn:hover { background: #245d3d !important; }

/* ─── Loader ──────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.shimmer {
  height: 14px; margin: 6px 0;
  background: linear-gradient(90deg, var(--bg-soft) 25%, #e8e0cf 50%, var(--bg-soft) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 4px;
}
.shimmer.short { width: 60%; }
.shimmer.long  { width: 100%; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ─── Misc ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-mute);
}
.empty-state h3 { color: var(--ink-soft); font-family: var(--font-serif); font-weight: 500; margin: 8px 0; }

.divider { height: 1px; background: var(--line); margin: 16px 0; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap-8 { gap: 8px; }
.flex-gap-12 { gap: 12px; }
.flex-gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-22 { margin-top: 22px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-22 { margin-bottom: 22px; }
.muted { color: var(--ink-mute); }
.text-sm { font-size: 12px; }

/* ─── Modal / form ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 14, 61, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal.modal-wide { max-width: 860px; }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-700);
  font-weight: 700;
  margin-bottom: 2px;
}
.modal-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  margin: 0;
  color: var(--navy-900);
  letter-spacing: 0.01em;
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-mute);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
}
.modal-close:hover { background: var(--bg-soft); color: var(--ink); }

.modal-form {
  display: contents;    /* layout-transparent so flex parent sees body + footer directly */
}
.modal-body {
  padding: 18px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;        /* enables overflow inside a flex column */
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;       /* never scroll out of view — pinned to bottom */
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid + .form-grid { margin-top: 0; }
.form-grid .field { margin-bottom: 0; }

.field-input.has-error {
  border-color: var(--danger);
  outline-color: var(--danger);
}

.settings-row {
  margin-bottom: 14px;
}
.settings-row .field-label { margin-bottom: 4px; }
.settings-row .settings-value {
  font-size: 14px;
  color: var(--navy-900);
  font-weight: 500;
  line-height: 1.5;
}
.field-error {
  color: var(--danger);
  font-size: 11px;
  margin-top: 4px;
}

/* Action buttons */
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--navy-50); color: var(--navy-900); border-color: var(--navy-500); }
.icon-btn.danger:hover { background: #fce8e8; color: var(--danger); border-color: var(--danger); }

.btn-danger {
  background: var(--danger);
  color: white;
  border: 0;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #8d2f2f; }
.btn-danger-link {
  background: transparent;
  border: 0;
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-danger-link:hover { color: #8d2f2f; }

/* Table rows clickable */
.contacts-table tbody tr.row-clickable { cursor: pointer; }
.row-actions {
  white-space: nowrap;
  text-align: right;
}
.row-actions .icon-btn + .icon-btn { margin-left: 4px; }
.contacts-table tbody tr.row-clickable .row-actions {
  opacity: 0.5;
  transition: opacity 0.12s;
}
.contacts-table tbody tr.row-clickable:hover .row-actions { opacity: 1; }

/* Mobile contact card actions */
.contact-card { cursor: pointer; }
.contact-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.contact-card-actions .icon-btn { width: 28px; height: 28px; font-size: 13px; }

/* Toast */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
}
.toast {
  background: var(--navy-900);
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.2s ease;
  min-width: 240px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.warning { border-left: 4px solid var(--gold-500); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Channel color codes (for calendar legend / event dots) */
.swatch-email { background: #2a4d7a; }
.swatch-sms   { background: var(--gold-500); }
.swatch-event { background: #2f7a4f; }
.swatch-mail  { background: #a83b3b; }

/* ─── Hamburger / mobile nav ──────────────────────────────────────────── */
.hamburger {
  display: none;
  background: var(--navy-900);
  border: 0;
  padding: 0;
  margin-right: 4px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  width: 40px; height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.hamburger:hover { background: var(--navy-800); }
.hamburger:active { transform: scale(0.95); }
.hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--gold-400);
  border-radius: 2px;
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 14, 61, 0.45);
  z-index: 19;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.contacts-mobile { display: none; }

/* ─── Desktop / wide tablet ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px; max-width: 80vw;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-scrim { display: block; }
  .sidebar:not(.mobile-open) ~ * .sidebar-scrim { display: none; }

  .hamburger { display: flex; }

  .topbar {
    padding: 0 12px;
    height: 56px;
    gap: 8px;
  }
  .topbar-title { flex: 1; min-width: 0; }
  .topbar h1 {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .crumb { font-size: 10px; letter-spacing: 0.05em; }
  .topbar-right { gap: 8px; }
  .demo-badge-label { display: none; }
  .demo-badge { padding: 5px 8px; }
  .user-chip-name { display: none; }

  .content { padding: 14px 12px 40px; }

  /* Login: tighten card */
  .login-card { padding: 36px 26px 32px; }
  .login-logo { font-size: 36px; }

  /* Section titles slightly smaller */
  .section-title { font-size: 19px; }
  .card-pad { padding: 16px; }

  /* KPI / dashboard */
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 24px; }
  .kpi .label { font-size: 10px; }
  .kpi .delta { font-size: 11px; }

  .dash-grid { gap: 14px; }
  .channel-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .channel-tile { padding: 12px 12px; }
  .channel-tile .meta { font-size: 10.5px; }

  .upcoming-item { padding: 11px 11px; gap: 9px; }
  .upcoming-item .date-block { width: 42px; padding: 5px 3px; }
  .upcoming-item .date-block .day { font-size: 18px; }
  .upcoming-item .date-block .month { font-size: 9px; }
  .upcoming-item .body { min-width: 0; }
  .upcoming-item .name {
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .upcoming-item .meta {
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .upcoming-item .btn-tiny { padding: 6px 9px; font-size: 10.5px; flex-shrink: 0; }

  .segment-pills { gap: 8px; }
  .segment-pill { font-size: 12px; padding: 6px 12px; }
  .segment-pill strong { font-size: 14px; }

  .year-glance-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px !important; }
  .year-glance-cell { padding: 8px 6px !important; min-height: 64px !important; }
  .year-glance-count { font-size: 16px !important; }
  .year-glance-month { font-size: 10px !important; }

  /* Calendar */
  .cal-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cal-legend { font-size: 11px; gap: 10px; }
  .cal-grid { grid-template-columns: 1fr; gap: 12px; }
  .cal-month { padding: 12px; }
  .cal-month h3 { font-size: 16px; }

  /* Contacts: hide desktop table, show mobile cards */
  .contacts-desktop { display: none; }
  .contacts-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .contact-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
  }
  .contact-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
  }
  .contact-card-name { font-weight: 700; color: var(--navy-900); font-size: 14px; line-height: 1.3; }
  .contact-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--ink-soft);
    margin-bottom: 8px;
  }
  .contact-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
  .contact-card-tags .tag { font-size: 10.5px; padding: 2px 7px; }
  .contact-card-notes {
    margin-top: 8px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--ink-soft);
    white-space: pre-wrap;
    word-break: break-word;
  }

  .contacts-toolbar { gap: 8px; }
  .search-input, .select { padding: 9px 12px; font-size: 13px; }

  .audience-count { padding: 10px 12px; font-size: 13px; }
  .audience-count strong { font-size: 16px; }

  /* Campaign detail: stack settings above the preview, each full width */
  .campaign-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ai-panel { padding: 16px; }
  .ai-panel h3 { font-size: 19px; }
  .ai-generate-btn { padding: 11px 18px; width: 100%; justify-content: center; }
  .ai-secondary-btn { width: 100%; }
  .channel-chip { font-size: 11.5px; padding: 5px 11px; }

  .preview-tabs { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; }
  .preview-tab { padding: 9px 12px; font-size: 12px; flex-shrink: 0; }
  /* Never clip the preview — allow a horizontal scroll as a safety net so the
     email is reachable even on browsers that don't honor the zoom below. */
  .preview-stage { padding: 14px; min-height: 220px; overflow-x: auto; overflow-y: visible; }

  /* The email template is a fixed 600px design. Reflowing it into the ~290px
     mobile column squeezes and clips it, so instead render it at its true
     600px width and shrink the whole thing proportionally to fit. We use
     `zoom` rather than `transform: scale()` because zoom also collapses the
     layout box — transform would leave a tall blank gap below the preview. */
  .channel-preview-container { width: 100%; }
  .channel-preview-container .email-mock {
    width: 600px;
    max-width: 600px;
    margin: 0 auto;
    zoom: 0.46;
  }

  .postcard-mock { gap: 12px; }
  .postcard-side { width: 100%; max-width: 320px; }

  .send-bar { padding: 12px; gap: 8px; }
  .send-bar > .demo-badge { order: -1; }
  .send-bar .btn-primary, .send-bar .btn-secondary {
    flex: 1; min-width: 110px;
    padding: 10px 12px;
  }

  /* Analytics: horizontal scroll on tables */
  .card-pad table.contacts-table { font-size: 11.5px; }
  .card-pad table.contacts-table thead th { padding: 8px 10px; font-size: 9.5px; }
  .card-pad table.contacts-table tbody td { padding: 8px 10px; }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bar-row { font-size: 12px; }
  .bar-row .label { width: 80px; }
  .bar-row .num { width: 50px; font-size: 11px; }

  /* Settings */
  .integ-grid { grid-template-columns: 1fr; gap: 10px; }
  .integ-card { padding: 14px; }
  .integ-card .status-tag { top: 12px; right: 12px; }

  /* Toasts */
  .toast-stack { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: 0; }

  /* Modal: slide-up bottom sheet on mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: modalSlideUp 0.24s ease;
  }
  @keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-head { padding: 16px 18px 12px; }
  .modal-title { font-size: 20px; }
  .modal-body { padding: 14px 18px; }
  .modal-footer { padding: 12px 18px; gap: 8px; }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary { flex: 1; padding: 11px 14px; min-width: 100px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media (max-width: 340px) {
  .channel-tiles { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
}

/* ─── Engagement / activity timeline ──────────────────────────────────── */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--bg-soft);
}
.activity-row:last-child { border-bottom: 0; }
.activity-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.activity-icon.act-send  { background: #e7edf6; color: var(--navy-900); }
.activity-icon.act-open  { background: #fff2cf; color: var(--gold-700); }
.activity-icon.act-click { background: #e3f0e8; color: var(--success); }
.activity-icon.act-reply { background: #f6e3e3; color: var(--danger); }
.activity-icon.act-inbound { background: #e3eaf6; color: var(--navy-900); }
.activity-icon.act-bounce { background: #fdf0e3; color: #b45309; }
.activity-body { flex: 1 1 auto; min-width: 0; }
.activity-line { font-size: 13px; color: var(--ink); }
.activity-name-link { cursor: pointer; }
.activity-name-link:hover { color: var(--navy-900); text-decoration: underline; }
.activity-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.activity-test-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.activity-snippet {
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 3px;
}
.activity-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--ink-mute);
  white-space: nowrap;
  padding-top: 2px;
}
.activity-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ─── AI Campaign Advisor ─────────────────────────────────────────────── */
.advisor-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 980px;
}
.advisor-section { padding: 22px 24px; }
.advisor-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.advisor-snapshot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.advisor-snapshot-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--navy-700);
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  border-radius: 999px;
  padding: 4px 10px;
}

/* Proactive insight cards */
.advisor-insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.advisor-insights-loading, .advisor-insights-empty {
  padding: 24px 6px;
  font-size: 13px;
}
.advisor-insight-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.advisor-insight-card:hover {
  border-color: var(--gold-400);
  box-shadow: 0 2px 10px rgba(5, 14, 61, 0.06);
  transform: translateY(-1px);
}
.advisor-insight-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--navy-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.advisor-insight-body { min-width: 0; }
.advisor-insight-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 2px;
}
.advisor-insight-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.advisor-create-btn {
  padding: 8px 16px;
  font-size: 12.5px;
  white-space: nowrap;
}

/* Chat surface */
.advisor-chat {
  height: 440px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafbfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 18px;
}
.advisor-chat-empty {
  margin: auto;
  text-align: center;
  color: var(--ink-soft);
}
.advisor-chat-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.advisor-chat-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 14px;
}
.advisor-chat-starter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 540px;
  margin: 0 auto;
}
.advisor-starter-chip {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy-700);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.advisor-starter-chip:hover {
  border-color: var(--navy-500);
  background: var(--navy-50);
}

.advisor-msg {
  display: flex;
}
.advisor-msg-user { justify-content: flex-end; }
.advisor-msg-advisor { justify-content: flex-start; }
.advisor-msg-bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}
.advisor-msg-user .advisor-msg-bubble {
  background: var(--navy-900);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.advisor-msg-advisor .advisor-msg-bubble {
  background: #f5f0eb;
  color: var(--navy-900);
  border: 1px solid #ece4d8;
  border-bottom-left-radius: 4px;
  max-width: 88%;
}
.advisor-msg-text { white-space: pre-wrap; }

/* Suggestion mini-cards inside an advisor bubble */
.advisor-msg-suggestions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.advisor-chat-suggestion {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.advisor-chat-suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.advisor-chat-suggestion-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--navy-900);
  flex: 1;
  min-width: 0;
}
.advisor-chat-suggestion-btn {
  padding: 6px 12px;
  font-size: 11.5px;
  border-radius: 6px;
  white-space: nowrap;
}
.advisor-chat-suggestion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.advisor-meta-pill {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy-700);
  background: var(--navy-50);
  border-radius: 999px;
  padding: 2px 8px;
}
.advisor-meta-pill-soft {
  color: var(--gold-700);
  background: var(--gold-50);
}
.advisor-chat-suggestion-hook {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-style: italic;
  margin: 4px 0 6px;
}
.advisor-chat-suggestion-goal {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.5;
}

/* "Thinking…" typing dots */
.advisor-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.advisor-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--navy-500);
  display: inline-block;
  animation: advisor-typing-bounce 1.2s infinite ease-in-out;
}
.advisor-typing span:nth-child(2) { animation-delay: 0.15s; }
.advisor-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes advisor-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* Input row */
.advisor-input-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: stretch;
}
.advisor-input {
  flex: 1;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--navy-900);
  background: #fff;
  font-family: inherit;
}
.advisor-input:focus {
  outline: 2px solid var(--gold-400);
  outline-offset: -1px;
  border-color: var(--gold-400);
}
.advisor-send-btn {
  padding: 11px 22px;
  white-space: nowrap;
}

/* Mobile — keep cards full width, tighten gaps */
@media (max-width: 720px) {
  .advisor-page { max-width: none; }
  .advisor-section { padding: 16px; }
  .advisor-insight-card {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
  }
  .advisor-insight-icon { width: 36px; height: 36px; font-size: 18px; }
  .advisor-create-btn {
    grid-column: 1 / -1;
    width: 100%;
  }
  .advisor-msg-bubble { max-width: 92%; font-size: 13px; }
  .advisor-section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .advisor-chat { height: 380px; }
}

/* ─── SMS Inbox ─────────────────────────────────────────────────────── */
.nav-item-badge {
  margin-left: auto;
  background: #ff7a00;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.4;
  min-width: 18px;
  text-align: center;
}
.inbox-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid #ece7dc;
  cursor: pointer;
  transition: background 0.12s;
}
.inbox-row:hover { background: #faf8f4; }
.inbox-row.unread { background: #fff8ef; }
.inbox-row.unread:hover { background: #fff1de; }
.inbox-row .inbox-from {
  font-weight: 600;
  color: var(--navy-900);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-row.unread .inbox-from::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff7a00;
  flex-shrink: 0;
}
.inbox-row .inbox-when {
  color: #7a8499;
  font-size: 12px;
  white-space: nowrap;
}
.inbox-row .inbox-body {
  grid-column: 1 / -1;
  color: #4a5468;
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-row.expanded .inbox-body { white-space: pre-wrap; }
.inbox-row .inbox-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  margin-top: 2px;
}
.inbox-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 11px;
}
.inbox-tag-campaign { background: #fde8d4; color: #8a4a12; cursor: pointer; }
.inbox-tag-campaign:hover { background: #fbd7b3; }
.inbox-tag-organic  { background: #e0f0e7; color: #1f5b3a; }
.inbox-tag-unknown  { background: #ece7dc; color: #6a6048; }
.inbox-empty {
  padding: 40px 20px;
  text-align: center;
  color: #7a8499;
  font-size: 14px;
}
.inbox-replies-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fde8d4;
  color: #8a4a12;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  transition: background 0.12s;
}
.inbox-replies-badge:hover { background: #fbd7b3; }
.inbox-replies-badge .dot {
  width: 6px;
  height: 6px;
  background: #ff7a00;
  border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════════════════
   SMS MESSAGING — Conversation list + thread view
   ═══════════════════════════════════════════════════════════════════════ */
.inbox-contact-link {
  color: var(--navy-900);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed var(--gold-500);
}
.inbox-contact-link:hover { color: var(--gold-700); }

/* ── Conversation list (iMessage-style) ─────────────────────────────── */
.sms-convo-list {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}
.sms-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.sms-list-search { flex: 1; }
.sms-search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  box-sizing: border-box;
}
.sms-search-input:focus {
  outline: none;
  border-color: var(--gold-500);
}
.sms-search-input::placeholder { color: var(--ink-mute); }
.sms-refresh-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}
.sms-refresh-btn:hover { background: var(--navy-50); }
.sms-refresh-btn:disabled { opacity: 0.5; cursor: default; }
.sms-filter-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.sms-filter-chip {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sms-filter-chip:hover { border-color: var(--gold-500); color: var(--ink); }
.sms-filter-chip.active {
  background: var(--navy-900);
  color: #fff;
  border-color: var(--navy-900);
}
.sms-filter-count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  padding: 0 5px;
  border-radius: 8px;
  min-width: 14px;
  text-align: center;
}
.sms-filter-chip:not(.active) .sms-filter-count {
  background: var(--navy-50);
  color: var(--ink-soft);
}
.sms-list-status {
  font-size: 11px;
  color: var(--ink-mute);
  padding: 4px 14px;
  border-bottom: 1px solid var(--line);
}
.sms-list-body {
  flex: 1;
  overflow-y: auto;
}
.sms-list-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 14px;
}
.sms-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}
.sms-list-item:last-child { border-bottom: none; }
.sms-list-item:hover { background: var(--navy-50); }
.sms-list-item.unread { background: #fff8ef; }
.sms-list-item.unread:hover { background: #fff1de; }
.sms-list-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy-900);
  color: var(--gold-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.sms-list-content {
  flex: 1;
  min-width: 0;
}
.sms-list-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sms-list-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sms-list-item.unread .sms-list-name { font-weight: 700; }
.sms-list-time {
  font-size: 12px;
  color: var(--ink-mute);
  white-space: nowrap;
  flex-shrink: 0;
}
.sms-list-preview {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.35;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sms-list-item.unread .sms-list-preview { color: var(--ink); }
.sms-list-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.sms-unread-badge {
  background: #ff7a00;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.sms-replied-badge {
  font-size: 11px;
  color: var(--ink-mute);
  font-style: italic;
}
.sms-mark-unread-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-mute);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  align-self: center;
  flex-shrink: 0;
  line-height: 1;
  margin-left: 4px;
}
.sms-list-item:hover .sms-mark-unread-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}
.sms-mark-unread-btn:hover {
  background: var(--navy-100, #e8edf5);
  color: #ff7a00;
}

/* ── Thread view (chat bubbles) ─────────────────────────────────────── */
.sms-convo-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.sms-convo-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
}
.sms-back-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--gold-600);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sms-back-btn:hover { background: var(--navy-50); }
.sms-convo-who {
  flex: 1;
  min-width: 0;
}
.sms-convo-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--navy-900);
  display: block;
}
.sms-convo-phone {
  color: var(--ink-mute);
  font-size: 12px;
}
.sms-segment-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e0f0e7;
  color: #1f5b3a;
  flex-shrink: 0;
}
.sms-handled-banner {
  padding: 6px 14px;
  background: #e0f0e7;
  color: #1f5b3a;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.sms-convo-thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--navy-50);
}
.sms-time-divider {
  text-align: center;
  font-size: 11px;
  color: var(--ink-mute);
  padding: 8px 0 4px;
}
.sms-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}
.sms-bubble-wrap.inbound { align-self: flex-start; }
.sms-bubble-wrap.outbound { align-self: flex-end; }
.sms-bubble {
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}
.sms-bubble.inbound {
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.sms-bubble.outbound {
  background: var(--navy-900);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sms-bubble-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 2px;
  padding: 0 6px;
}
.sms-bubble-wrap.outbound .sms-bubble-meta { justify-content: flex-end; }
.sms-sent-by {
  font-size: 10px;
  font-style: italic;
  color: var(--ink-mute);
}
.sms-campaign-dot {
  color: #cfa64b;
  font-size: 11px;
}
.sms-campaign-label {
  font-size: 10px;
  color: var(--ink-mute);
  padding: 0 6px 3px;
  cursor: pointer;
  text-align: right;
}
.sms-campaign-label:hover { color: var(--gold-700); }
.sms-auto-badge {
  font-size: 10px;
  font-weight: 600;
  color: #7c5e10;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}
.sms-needs-human-banner {
  padding: 6px 14px;
  background: #fff3cd;
  color: #856404;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid #ffe69c;
}
.sms-needs-human-pill {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #e67e22;
  padding: 1px 7px;
  border-radius: 4px;
}
.sms-closed-banner {
  padding: 6px 14px;
  background: #e8e8e8;
  color: #555;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid #d0d0d0;
}
.sms-closed-pill {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #999;
  padding: 1px 7px;
  border-radius: 4px;
}
.sms-sender-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  padding: 0 6px 2px;
  margin-top: 4px;
}
.sms-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.sms-attachment-link {
  display: block;
  line-height: 0;
}
.sms-attachment-img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}
.sms-attachment-file {
  font-size: 12px;
  color: inherit;
  text-decoration: underline;
  opacity: 0.85;
  word-break: break-all;
}
.sms-group-badge {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #5b6af0;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: middle;
}
.sms-group-reply-note {
  font-size: 11px;
  color: #888;
  text-align: center;
  padding: 4px 0 2px;
}
.sms-scope-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}
.scope-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.scope-btn:not(:last-child) {
  border-right: 1px solid var(--line);
}
.scope-btn.active {
  background: var(--navy-700);
  color: #fff;
  font-weight: 600;
}
.scope-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

/* SMS Handoff Panel (dashboard) */
.handoff-panel {
  background: linear-gradient(135deg, #fffbf0, #fff8f0);
  border: 1px solid #ffe0b2;
}
.handoff-count {
  display: inline-block;
  background: #e67e22;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}
.handoff-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.handoff-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.handoff-info {
  flex: 1;
  min-width: 0;
}
.handoff-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.handoff-segment {
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 500;
}
.handoff-phone {
  font-size: 13px;
  color: var(--navy-700);
  text-decoration: none;
  font-weight: 500;
}
.handoff-phone:hover {
  text-decoration: underline;
}
.handoff-reason {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}
.handoff-snippet {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
  line-height: 1.4;
}
.handoff-snippet-label {
  font-weight: 600;
  color: var(--ink-soft);
}
.handoff-time {
  margin-left: 6px;
  font-size: 11px;
  color: var(--ink-mute);
}
.handoff-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.handoff-btn {
  font-size: 11px !important;
  padding: 4px 12px !important;
  white-space: nowrap;
}

.warm-lead-replies {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.warm-lead-quote {
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.4;
  padding-left: 8px;
  border-left: 2px solid var(--line);
}

/* ── SMS lead qualification thread + signals ────────────────────────── */
.sms-thread {
  margin-top: 8px; padding: 6px 0; border-radius: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.sms-thread-msg {
  display: flex; gap: 6px; align-items: baseline;
  font-size: 12px; line-height: 1.4; padding: 3px 0;
}
.sms-thread-role {
  flex: 0 0 auto; font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.03em;
  min-width: 60px;
}
.sms-thread-contact .sms-thread-role { color: var(--navy-700); }
.sms-thread-auto .sms-thread-role { color: var(--gold-700); }
.sms-thread-agent .sms-thread-role { color: var(--success); }
.sms-thread-opt_out .sms-thread-role { color: var(--danger); }
.sms-thread-body {
  color: var(--ink-soft); font-style: italic;
}
.sms-thread-contact .sms-thread-body { color: var(--navy-900); font-style: normal; font-weight: 500; }
.sms-signal-chip {
  font-size: 11px !important; padding: 2px 8px !important;
  background: var(--gold-50) !important; border-color: var(--gold-400) !important;
}
.sms-profile-chip {
  font-size: 11px !important; padding: 2px 8px !important;
  background: var(--navy-50) !important; border-color: var(--navy-100) !important;
  color: var(--navy-700) !important;
}
.sms-tier-divider {
  padding: 12px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.sms-tier-label {
  font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sms-optout-note {
  font-size: 11px; color: var(--ink-mute); margin-top: 4px;
  font-style: italic;
}

/* ── SMS conversation preview modal ─────────────────────────────────── */
.sms-convo-modal { max-width: 540px; }
.sms-convo-modal-body {
  padding: 16px 20px !important;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 200px;
  max-height: 60vh;
}
.sms-convo-modal-body .sms-bubble-wrap { max-width: 85%; }
.sms-convo-modal-phone {
  font-size: 13px; color: var(--ink-mute); margin-top: 2px;
}
.sms-thread-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sms-thread-btn:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
  color: var(--navy-900);
}
.sms-thread-btn svg {
  width: 13px; height: 13px; fill: currentColor; flex-shrink: 0;
}

/* ── Compose bar (always-visible, messaging-app style) ──────────────── */
.sms-convo-compose {
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--bg-card);
}
.sms-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.sms-ai-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}
.sms-ai-btn:hover { background: var(--navy-50); }
.sms-ai-btn:disabled { opacity: 0.5; cursor: default; }
.sms-compose-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  color: var(--ink);
  background: var(--bg);
  box-sizing: border-box;
  line-height: 1.35;
}
.sms-compose-input:focus {
  outline: none;
  border-color: var(--gold-500);
}
.sms-compose-input::placeholder { color: var(--ink-mute); }
.sms-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--navy-900);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.12s;
}
.sms-send-btn:hover { opacity: 0.85; }
.sms-send-btn:disabled { opacity: 0.35; cursor: default; }
.sms-char-counter {
  font-size: 11px;
  color: var(--ink-mute);
  text-align: right;
  padding: 2px 50px 0 0;
}
.sms-char-counter.over {
  color: var(--danger);
  font-weight: 600;
}

/* ── Mobile responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sms-convo-list {
    max-height: calc(100vh - 80px);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .sms-convo-container {
    height: calc(100vh - 80px);
    min-height: 300px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .sms-list-avatar {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .sms-list-item { padding: 14px 12px; }
  .sms-list-name { font-size: 15px; }
  .sms-bubble-wrap { max-width: 88%; }
  .sms-convo-thread { padding: 10px; }
  .sms-convo-compose { padding: 6px 8px; }
  .sms-compose-input { padding: 10px 14px; font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   PUBLIC TOUR SCHEDULING PAGE
   ═══════════════════════════════════════════════════════════════════════ */
.tour-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #050E3D 0%, #050E3D 220px, #f4f4f4 220px);
  display: flex;
  justify-content: center;
  padding: 0 16px 40px;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.tour-page-inner {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.tour-header {
  text-align: center;
  padding: 32px 0 24px;
}
.tour-logo {
  width: 200px;
  height: auto;
  margin-bottom: 8px;
}
.tour-header-tagline {
  color: #cfa64b;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.tour-loading {
  text-align: center;
  padding: 80px 20px;
  color: #cfa64b;
  font-size: 15px;
}
.tour-error-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  color: var(--danger);
  font-size: 15px;
  box-shadow: 0 2px 12px rgba(5,14,61,.1);
}
.tour-success-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(5,14,61,.1);
}
.tour-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2f7a4f;
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.tour-success-card h2 {
  margin: 0 0 12px;
  color: var(--navy-900);
  font-size: 22px;
}
.tour-success-card p {
  margin: 0 0 8px;
  color: #555;
  font-size: 15px;
  line-height: 1.5;
}
.tour-success-times {
  background: var(--navy-50);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  text-align: left;
}
.tour-success-time {
  padding: 4px 0;
  color: var(--navy-700);
  font-size: 14px;
}

/* Property card */
.tour-photo-wrap {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(5,14,61,.15);
  margin-bottom: -20px;
  position: relative;
  z-index: 1;
}
.tour-photo {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
.tour-property-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px 24px 20px;
  box-shadow: 0 2px 12px rgba(5,14,61,.1);
  margin-bottom: 16px;
}
.tour-property-addr {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--navy-900);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
}
.tour-property-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.tour-detail-chip {
  background: var(--navy-50);
  color: var(--navy-700);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}
.tour-price {
  background: var(--gold-50);
  color: var(--gold-700);
  font-weight: 700;
}
.tour-agent-line {
  color: var(--ink-mute);
  font-size: 13px;
  margin-top: 8px;
}

/* Form layout */
.tour-form {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(5,14,61,.1);
  margin-bottom: 16px;
}
.tour-section {
  margin-bottom: 24px;
}
.tour-section:last-child {
  margin-bottom: 16px;
}
.tour-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--navy-900);
  font-weight: 600;
}
.tour-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.tour-section-desc {
  margin: 0 0 12px;
  color: var(--ink-mute);
  font-size: 13px;
}
.tour-selected-summary {
  background: var(--gold-50);
  color: var(--gold-700);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.tour-check-ok {
  color: var(--success);
}

/* Calendar day buttons */
.tour-calendar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tour-day-group {
  border-bottom: 1px solid var(--line);
}
.tour-day-group:last-child {
  border-bottom: 0;
}
.tour-day-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  transition: background 0.12s;
}
.tour-day-btn:hover {
  background: var(--navy-50);
}
.tour-day-btn.expanded {
  background: var(--navy-50);
  font-weight: 600;
}
.tour-day-btn.has-selection {
  color: var(--navy-700);
}
.tour-day-name {
  font-weight: 600;
  width: 36px;
  flex-shrink: 0;
}
.tour-day-num {
  flex: 1;
}
.tour-day-badge {
  background: var(--gold-500);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tour-times-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 16px 16px;
}
.tour-time-btn {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  position: relative;
}
.tour-time-btn:hover:not(.disabled) {
  border-color: var(--navy-500);
  background: var(--navy-50);
}
.tour-time-btn.selected {
  background: var(--navy-900);
  color: #fff;
  border-color: var(--navy-900);
  font-weight: 600;
}
.tour-time-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.tour-time-check {
  margin-left: 4px;
  font-size: 12px;
}

/* Contact form */
.tour-field {
  margin-bottom: 12px;
}
.tour-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.tour-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.12s;
  box-sizing: border-box;
}
.tour-field input:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(58,83,153,.12);
}
.tour-form-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}
.tour-submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: #c32033;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
  letter-spacing: 0.02em;
}
.tour-submit-btn:hover:not(:disabled) {
  background: #a81c2c;
}
.tour-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tour-footer {
  text-align: center;
  padding: 20px 0;
  color: var(--ink-mute);
  font-size: 12px;
}
.tour-footer p {
  margin: 2px 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   IN-APP TOUR REQUEST MANAGEMENT
   ═══════════════════════════════════════════════════════════════════════ */
.tour-mgmt-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.tour-mgmt-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tour-mgmt-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tour-mgmt-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.tour-mgmt-card.pending {
  border-left: 3px solid var(--warning);
}
.tour-mgmt-card.confirmed {
  border-left: 3px solid var(--success);
}
.tour-mgmt-card.declined {
  border-left: 3px solid var(--ink-mute);
}
.tour-mgmt-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 8px;
}
.tour-mgmt-property {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tour-mgmt-property strong {
  font-size: 15px;
  color: var(--navy-900);
}
.tour-mgmt-meta {
  color: var(--ink-mute);
  font-size: 12px;
  white-space: nowrap;
}
.tour-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tour-status-pending   { background: #fef3cd; color: #856404; }
.tour-status-confirmed { background: #d4edda; color: #155724; }
.tour-status-declined  { background: #f0f0f0; color: #666; }
.tour-mgmt-card-body {
  padding: 0 20px 16px;
}
.tour-mgmt-contact {
  margin-bottom: 12px;
}
.tour-mgmt-contact strong {
  font-size: 14px;
  color: var(--ink);
}
.tour-mgmt-contact-details {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.tour-mgmt-contact-details a {
  color: var(--navy-700);
  text-decoration: none;
}
.tour-mgmt-contact-details a:hover {
  text-decoration: underline;
}
.tour-mgmt-times {
  margin-bottom: 8px;
}
.tour-mgmt-times-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.tour-mgmt-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.tour-mgmt-slot:last-child {
  border-bottom: 0;
}
.tour-confirm-slot-btn {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.tour-confirm-slot-btn:hover:not(:disabled) {
  background: #256b3e;
}
.tour-confirm-slot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tour-mgmt-confirmed {
  background: #d4edda;
  color: #155724;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
}
.tour-mgmt-actions {
  padding: 0 20px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Activity feed: tour request type */
.act-tour { color: var(--gold-700); }

@media only screen and (max-width: 620px) {
  .tour-photo {
    height: 180px;
  }
  .tour-times-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tour-property-addr {
    font-size: 18px;
  }
}

/* ── Notes editor (contact form) ───────────────────────────────────────── */
.notes-editor {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(207, 166, 75, 0.18);
}
.notes-add {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--gold-50), rgba(250, 243, 223, 0.35));
  border-bottom: 1px solid var(--line);
}
.notes-add-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  resize: none;
  min-height: 38px;
}
.notes-add-input:focus { outline: 2px solid var(--gold-400); outline-offset: -1px; border-color: var(--gold-400); }
.notes-add-btn {
  flex: none;
  background: var(--navy-900);
  color: var(--gold-400);
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  height: 38px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.notes-add-btn:hover:not(:disabled) { background: var(--navy-700); color: var(--gold-100); }
.notes-add-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.notes-entries { max-height: 46vh; overflow-y: auto; padding: 4px 0; }
.notes-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.notes-entry:last-child { border-bottom: 0; }
.note-date-chip {
  flex: none;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--navy-800);
  background: var(--navy-50);
  border-radius: 100px;
  padding: 2px 9px;
  white-space: nowrap;
}
.note-body { min-width: 0; overflow-wrap: anywhere; }

.notes-entry.is-quote .note-body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16.5px;
  font-style: italic;
  color: var(--navy-800);
  border-left: 2px solid var(--gold-500);
  padding-left: 10px;
}
.notes-entry.is-campaign .note-body { color: var(--ink-mute); font-size: 13px; }
.notes-entry.is-intake .note-body { color: var(--ink-soft); font-size: 13.5px; }
.notes-entry.is-system .note-body { color: var(--navy-700); font-weight: 500; }
.notes-entry.is-system .note-body::before { content: '◆ '; color: var(--gold-500); font-size: 10px; }
.notes-entry.is-alert { background: #fdf3f3; }
.notes-entry.is-alert .note-body { color: var(--danger); font-weight: 600; }

.notes-empty {
  padding: 26px 16px;
  text-align: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mute);
}
.notes-raw {
  width: 100%;
  border: 0;
  display: block;
  padding: 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  resize: none;
  min-height: 180px;
  background: var(--bg-card);
}
.notes-raw:focus { outline: 2px solid var(--gold-400); outline-offset: -2px; }

.notes-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
}
.notes-mode-btn {
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-700);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.notes-mode-btn:hover { background: var(--navy-50); color: var(--navy-900); }
.notes-budget { font-size: 11px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.notes-budget.is-tight { color: var(--warning); font-weight: 600; }
.notes-budget.is-over { color: var(--danger); font-weight: 700; }

@media (max-width: 640px) {
  .notes-entry { font-size: 15px; padding: 11px 12px; flex-direction: column; gap: 4px; }
  .note-date-chip { align-self: flex-start; }
  .notes-entry.is-quote .note-body { font-size: 17.5px; }
  .notes-add-input { font-size: 16px; } /* prevents iOS focus zoom */
  .notes-add-btn { height: 44px; }
  .notes-entries { max-height: none; }
  .notes-raw { font-size: 16px; }
}

/* ─── Automations ────────────────────────────────────────────────────── */
.automations-page { display: flex; flex-direction: column; gap: 18px; }

.auto-card { padding: 24px 26px; }
.auto-card-placeholder { opacity: 0.55; pointer-events: none; }
.auto-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.auto-card-title-row { display: flex; align-items: flex-start; gap: 14px; }
.auto-card-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.auto-card-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--navy-900); font-family: var(--font-serif); }
.auto-card-desc { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; max-width: 500px; }

.toggle-btn {
  display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 20px; padding: 5px 14px 5px 5px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-btn .toggle-knob {
  width: 22px; height: 22px; border-radius: 50%; background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18); transition: transform 0.2s;
}
.toggle-btn.off { background: var(--line-strong); color: var(--ink-mute); }
.toggle-btn.off .toggle-knob { transform: translateX(0); }
.toggle-btn.on  { background: var(--success); color: white; }
.toggle-btn.on  .toggle-knob { transform: translateX(4px); }

.auto-settings { display: flex; flex-wrap: wrap; gap: 14px; }
.auto-field { display: flex; flex-direction: column; gap: 5px; }
.auto-field label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); }
.auto-field input[type="time"] {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--bg-card); color: var(--ink);
}
.auto-field input[type="time"]:focus { outline: 2px solid var(--gold-400); outline-offset: -1px; border-color: var(--gold-400); }
.auto-body-editor {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 13px; line-height: 1.55;
  background: var(--bg-card); color: var(--ink); resize: vertical;
}
.auto-body-editor:focus { outline: 2px solid var(--gold-400); outline-offset: -1px; border-color: var(--gold-400); }

.auto-merge-fields { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; }
.auto-merge-label { font-size: 12px; color: var(--ink-mute); font-weight: 600; }
.auto-merge-tag {
  font-size: 12px; padding: 3px 8px; background: var(--navy-50); border: 1px solid var(--navy-100);
  border-radius: 4px; cursor: pointer; color: var(--navy-700); font-weight: 500;
}
.auto-merge-tag:hover { background: var(--gold-50); border-color: var(--gold-100); }

.auto-actions { display: flex; gap: 10px; flex: 1 1 100%; justify-content: flex-end; margin-top: 6px; }
.btn-ghost {
  background: transparent; color: var(--navy-700); border: 1px solid var(--line);
  padding: 9px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { background: var(--navy-50); }

.auto-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.auto-stat-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px 22px; text-align: center;
}
.auto-stat-value { font-size: 32px; font-weight: 700; color: var(--navy-900); font-family: var(--font-serif); }
.auto-stat-label { font-size: 12.5px; color: var(--ink-mute); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

.auto-section-title {
  font-family: var(--font-serif); font-size: 17px; font-weight: 600;
  color: var(--navy-900); margin: 0 0 14px;
}
.auto-table-wrap { overflow-x: auto; margin: 0 -26px; padding: 0 26px; }
.auto-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.auto-table th {
  text-align: left; padding: 8px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-mute); font-weight: 600;
  border-bottom: 2px solid var(--line);
}
.auto-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.auto-table tbody tr:last-child td { border-bottom: 0; }
.auto-table tbody tr:hover { background: var(--navy-50); }
.auto-td-name { font-weight: 600; color: var(--navy-900); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-td-name a { color: var(--navy-900); text-decoration: none; cursor: pointer; }
.auto-td-name a:hover { color: var(--gold-500); text-decoration: underline; }
.auto-td-subject { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }

.auto-badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px;
  border-radius: 10px; letter-spacing: 0.03em;
}
.auto-badge.sent { background: #e6f5ec; color: var(--success); }
.auto-badge.pending { background: var(--gold-50); color: var(--gold-700); }
.auto-empty { color: var(--ink-mute); font-size: 14px; text-align: center; padding: 24px 0; }

.auto-preview-modal .modal-head { border-bottom: 1px solid var(--line); }
.auto-preview-subject { padding: 12px 24px; font-size: 13.5px; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.auto-preview-frame { width: 100%; height: 520px; border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* SMS pending replies (approval gate) */
.pending-replies-panel {
  background: linear-gradient(135deg, #f0f7ff, #f5f0ff);
  border: 1px solid #c8d8f0;
}
.pending-replies-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pending-reply-item {
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.pending-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.pending-reply-contact {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pending-reply-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-900);
  cursor: pointer;
  text-decoration: none;
}
.pending-reply-name:hover { text-decoration: underline; }
.pending-reply-time {
  font-size: 11px;
  color: var(--ink-mute);
  white-space: nowrap;
}
.pending-reply-inbound {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-bottom: 6px;
  padding: 6px 10px;
  background: var(--bg-subtle, #f5f5f5);
  border-radius: var(--radius-sm);
}
.pending-reply-draft {
  font-size: 13px;
  color: var(--navy-900);
  line-height: 1.4;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #e8f5e9;
  border-radius: var(--radius-sm);
  border-left: 3px solid #66bb6a;
}
.pending-reply-label {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 4px;
  color: var(--ink-mute);
}
.pending-reply-draft-text {
  white-space: pre-wrap;
}
.pending-reply-edit-area {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.4;
  border: 1.5px solid var(--navy-300);
  border-radius: var(--radius-sm);
  resize: vertical;
  font-family: inherit;
  background: #fff;
  color: var(--navy-900);
}
.pending-reply-edit-area:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.1);
}
.pending-reply-char-count {
  font-size: 11px;
  color: var(--ink-mute);
  text-align: right;
  margin-bottom: 6px;
}
.pending-reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pending-btn {
  font-size: 12px !important;
  padding: 5px 14px !important;
  white-space: nowrap;
}
.pending-btn-approve {
  font-size: 12px !important;
  padding: 5px 16px !important;
}
.pending-btn-decline {
  color: var(--danger-600, #dc2626) !important;
  border-color: var(--danger-200, #fecaca) !important;
}
.pending-btn-decline:hover {
  background: var(--danger-50, #fef2f2) !important;
}
.pending-btn-thread {
  background: var(--bg-subtle, #f0f4f8) !important;
  border-color: var(--navy-300, #94a3b8) !important;
  color: var(--navy-700, #1e3a5f) !important;
  font-weight: 600 !important;
}
.pending-btn-thread:hover {
  background: var(--navy-100, #e2e8f0) !important;
}
.deferred-reply-item {
  border-color: #f59e0b;
  background: #fffbeb;
}
.deferred-reply-draft {
  background: #fef3c7 !important;
  border-left-color: #f59e0b !important;
}
.deferred-badge {
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.deferred-count {
  background: #f59e0b !important;
}
.pending-btn-sendnow {
  color: #b45309 !important;
  border-color: #fde68a !important;
  font-weight: 600 !important;
}
.pending-btn-sendnow:hover {
  background: #fef3c7 !important;
}
.mt-16 { margin-top: 16px; }
.sms-mode-btns {
  display: inline-flex !important;
}
.sms-mode-auto.active {
  background: #059669 !important;
  border-color: #059669 !important;
  color: #fff !important;
}
.sms-mode-approval.active {
  background: #d97706 !important;
  border-color: #d97706 !important;
  color: #fff !important;
}

@media (max-width: 768px) {
  .auto-card { padding: 18px 16px; }
  .auto-card-header { flex-direction: column; gap: 12px; }
  .auto-stats-row { grid-template-columns: 1fr; }
  .auto-stat-card { padding: 16px; }
  .auto-stat-value { font-size: 26px; }
  .auto-table-wrap { margin: 0 -16px; padding: 0 16px; }
  .auto-preview-frame { height: 400px; }
  .pending-reply-actions {
    flex-direction: column;
  }
  .pending-reply-actions button {
    width: 100%;
  }
  .pending-reply-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
