@import url('/static/fonts/taste-fonts.css');

/* PalmWave Connect - practical messaging UI
   Design read: Textable-style operations dashboard, high readability, clear icons. */

:root {
  color-scheme: light;
  --sidebar-width: 200px;
  --navy: #041b2f;
  --navy-2: #061f37;
  --navy-3: #0b2a46;
  --blue: #0f73cf;
  --blue-2: #0b6fc8;
  --blue-3: #075eaa;
  --brand-solid: var(--blue);
  --on-brand: #ffffff;
  --blue-soft: #e8f3ff;
  --blue-border: #b7dbff;
  --page: #f3f5f8;
  --canvas: #eeeeef;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --line: #d7dde6;
  --line-strong: #b9c4d0;
  --text: #111827;
  --text-soft: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --white: #ffffff;
  --success: #16a34a;
  --success-soft: #eaf8f0;
  --warning: #b7791f;
  --warning-soft: #fff7df;
  --danger: #dc2626;
  --danger-soft: #fff1f0;
  --wa: #087a45;
  --wa-soft: #e9f8ef;
  --sms: #2563eb;
  --sms-soft: #eaf2ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .08);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .12);
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --font-body: "Space Grotesk", "Aptos", "Segoe UI", Arial, sans-serif;
  --font-display: "Space Grotesk", "Aptos Display", "Segoe UI", Arial, sans-serif;
  --focus: rgba(15, 115, 207, .32);
  --transition: 150ms ease;
}

:root[data-theme="dark"] {
  color-scheme: light;
  --navy: #041b2f;
  --navy-2: #061f37;
  --navy-3: #0b2a46;
  --blue: #0f73cf;
  --blue-2: #0b6fc8;
  --blue-3: #075eaa;
  --blue-soft: #e8f3ff;
  --page: #f3f5f8;
  --canvas: #eeeeef;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --line: #d7dde6;
  --line-strong: #b9c4d0;
  --text: #111827;
  --text-soft: #344054;
  --muted: #667085;
  --faint: #98a2b3;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--page); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
body.inbox-view { height: 100dvh; overflow: hidden; }
button, input, select, textarea { font: inherit; }
a { color: var(--blue-3); text-decoration: none; }
a:hover { color: var(--blue); text-decoration: underline; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.15;
}
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
hr { height: 1px; margin: 18px 0; border: 0; background: var(--line); }
* { scrollbar-width: thin; scrollbar-color: #9ca3af transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #aab2bd; border: 2px solid transparent; border-radius: 8px; background-clip: padding-box; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--page);
}
body.inbox-view .app-layout { height: 100dvh; min-height: 0; }
.app-main { min-width: 0; min-height: 0; }

.side-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  width: var(--sidebar-width);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 0;
  overflow-y: auto;
  color: #dbeafe;
  background: var(--navy);
  border-right: 1px solid #0e2f4b;
}
.nav-top, .nav-bottom { display: grid; gap: 8px; }
.nav-links { display: grid; gap: 0; }
.nav-brand,
.side-nav a,
.side-nav .theme-toggle,
.profile-switcher {
  position: relative;
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 20px;
  color: #ffffff;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.nav-brand {
  min-height: 78px;
  padding-top: 6px;
  padding-bottom: 18px;
  align-items: flex-start;
  cursor: default;
}
.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex: 0 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.nav-brand .nav-icon,
.auth-brand .nav-icon {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  color: #ffffff;
  background: var(--blue);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
}
.nav-icon svg,
.icon-button svg,
.field-help svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-copy { min-width: 0; display: grid; gap: 1px; }
.nav-copy strong { overflow: hidden; color: currentColor; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.nav-copy span { overflow: hidden; color: #9fc6e8; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.nav-brand .nav-copy strong { font-size: 15px; }
.nav-divider { height: 1px; margin: 0 20px 12px; background: rgba(255, 255, 255, .14); }
.side-nav a:hover,
.side-nav .theme-toggle:hover,
.profile-switcher:hover { background: rgba(255, 255, 255, .08); color: #ffffff; text-decoration: none; }
.side-nav a.active {
  color: #ffffff;
  background: var(--blue);
}
.side-nav a.active .nav-copy span { color: #ffffff; }
.side-nav a.active .nav-icon { color: #ffffff; }
.side-nav .theme-toggle { font: inherit; }
.theme-toggle .sun-icon { display: none; }
:root[data-theme="light"] .theme-toggle .moon-icon { display: none; }
:root[data-theme="light"] .theme-toggle .sun-icon { display: block; }
.profile-switcher select { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.logout-btn { margin-top: auto; background: var(--blue) !important; }
.logout-btn .nav-copy span { color: #ffffff; }
.logout-btn:hover { background: var(--blue-3) !important; }

button,
.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--on-brand);
  background: var(--brand-solid);
  border: 1px solid var(--brand-solid);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}
button:hover,
.button:hover { color: #ffffff; background: var(--blue-2); border-color: var(--blue-2); text-decoration: none; }
button:active,
.button:active { transform: translateY(1px); }
button:disabled,
.button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
button.secondary,
.button.secondary,
button.bubble-action,
.button.bubble-action {
  color: var(--text-soft);
  background: #ffffff;
  border-color: var(--line-strong);
}
button.secondary:hover,
.button.secondary:hover,
button.bubble-action:hover,
.button.bubble-action:hover { color: var(--blue-3); background: var(--blue-soft); border-color: var(--blue-border); }
button.danger,
.button.danger { color: #ffffff; background: var(--danger); border-color: var(--danger); }
button.danger:hover,
.button.danger:hover { background: #b91c1c; border-color: #b91c1c; }
button.sm,
.button.sm { min-height: 30px; padding: 6px 10px; font-size: 12px; }
.icon-button { width: 36px; min-width: 36px; height: 36px; padding: 0; }

textarea,
input,
select {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #cfd6df;
  border-radius: var(--radius-xs);
  box-shadow: none;
  font-size: 14px;
  font-weight: 400;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
textarea { min-height: 96px; resize: vertical; }
textarea:focus,
input:focus,
select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--focus); }
input:disabled,
textarea:disabled,
select:disabled { opacity: .65; cursor: not-allowed; background: #eef2f6; }
input::placeholder,
textarea::placeholder { color: #98a2b3; opacity: 1; }
label { display: block; margin: 0 0 6px; color: var(--text-soft); font-size: 13px; font-weight: 500; }
.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.form-help,
.field-help { color: var(--muted); font-size: 12px; }
.field-help { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; text-decoration: none; vertical-align: middle; cursor: help; }
.field-help svg { width: 13px; height: 13px; }
.checkbox-row { min-height: 36px; display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 16px; min-height: 16px; height: 16px; flex: 0 0 16px; padding: 0; accent-color: var(--blue); }
.checkbox-row span { color: var(--text); font-size: 14px; }
.form-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.split-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mini-form { display: inline-flex; margin: 0; }
.muted { color: var(--muted); }
.clamp-1 { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel {
  margin: 0;
  padding: 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.panel > h1:first-child,
.panel > h2:first-child { margin: 0 0 14px; }
.panel p { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.chip,
.delivery-chip,
.setup-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--text-soft);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration: none;
}
.chip.hot,
.chip.info,
.chip.pending { color: var(--blue-3); background: var(--blue-soft); border-color: var(--blue-border); }
.chip.ok,
.delivery-chip.sent,
.delivery-chip.delivered,
.setup-pill.ok { color: #137846; background: var(--success-soft); border-color: #b8e6cd; }
.chip.warn,
.setup-pill.warn { color: var(--warning); background: var(--warning-soft); border-color: #f1d28a; }
.chip.danger,
.delivery-chip.failed,
.delivery-chip.dead_letter { color: var(--danger); background: var(--danger-soft); border-color: #fecaca; }
.summary {
  padding: 12px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
}
.empty,
.empty-state {
  min-height: 180px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 32px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  text-align: center;
}
.empty strong,
.empty-state h2 { color: var(--text); font-size: 18px; font-weight: 600; }
.empty-icon,
.empty-icon svg { width: 40px; height: 40px; }
.empty-icon svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.event,
.message-event { padding: 10px 0; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 13px; }
.event:last-child,
.message-event:last-child { border-bottom: 0; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #ffffff;
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-weight: 500;
}
.toast::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.toast.dismissed { opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }

.tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  overflow-x: auto;
}
.tab-btn {
  min-height: 46px;
  padding: 0 0 10px;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
}
.tab-btn:hover { color: var(--blue-3); background: transparent; box-shadow: none; transform: none; }
.tab-btn[aria-selected="true"] { color: var(--blue-3); border-bottom-color: var(--blue); background: transparent; }
.tab-panel[hidden] { display: none; }
.tab-intro { max-width: 78ch; margin: 8px 0 18px; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; color: var(--text); background: var(--surface); }
.table th,
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
.table th { color: var(--text-soft); background: var(--surface-2); font-size: 12px; font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--blue-soft); }
.table a { color: var(--text); font-weight: 500; }
.table a:hover { color: var(--blue-3); }
.table td.actions { white-space: nowrap; }
.modern-table { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; box-shadow: none; }
.modern-table tr.selected td { background: var(--blue-soft); }
.modern-table tr.selected td:first-child { box-shadow: inset 4px 0 0 var(--blue); }
[data-contact-detail-panel].is-loading,
[data-conversation-pane].is-loading,
[data-details-panel].is-loading { opacity: .58; pointer-events: none; }
[data-contact-detail-panel],
[data-conversation-pane],
[data-details-panel] { transition: opacity 120ms ease; }
.contact-primary { display: grid; gap: 4px; }
.contact-muted { color: var(--muted); font-size: 12px; }
.contact-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.page { min-height: 100dvh; overflow-y: auto; background: var(--page); }
.page-inner { width: 100%; max-width: none; margin: 0; padding: 0 20px 40px; }
.ops-hero {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 -20px 18px;
  padding: 14px 20px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.ops-hero.compact { min-height: 56px; }
.ops-hero h1 { margin: 0; color: var(--text); font-size: 20px; font-weight: 600; line-height: 1.2; }
.ops-hero.compact h1 { font-size: 20px; }
.eyebrow {
  display: block;
  margin: 0 0 2px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hero-copy { max-width: 760px; margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.35; }
.hero-status-card {
  min-width: 220px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: none;
}
.hero-status-card strong { font-size: 15px; font-weight: 600; }
.section-title-row,
.panel-title-row,
.profile-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.section-title-row { margin: 4px 0 16px; }
.section-title-row h2,
.panel-title-row h2 { margin: 0 0 4px; }
.section-title-row p,
.panel-title-row p { margin: 0; color: var(--muted); }
.ops-filter-panel,
.quick-create-card,
.table-panel,
.setup-form-panel { padding: 16px; }
.ops-split-grid,
.ops-metrics-grid,
.setup-overview-grid,
.metric-card-grid { display: grid; gap: 16px; }
.ops-split-grid.contacts-layout-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); align-items: start; }
.contacts-main-column,
.contacts-detail-column { min-width: 0; display: grid; gap: 16px; }
.contacts-main-column,
.contacts-detail-column { padding-top: 0; }
.sticky-panel { position: sticky; top: 16px; }
.filter-actions { align-self: end; margin-bottom: 0; }
.quick-create-card,
.contacts-main-column .quick-create-card { width: 100%; margin-left: 0; }

.setup-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; align-items: stretch; }
.setup-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.setup-card:nth-child(2) { transform: none; background: var(--surface); color: var(--text); }
.setup-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.setup-card h2 { margin: 0 0 4px; }
.setup-card p { margin: 0; color: var(--muted); }
.setup-icon { width: 42px; height: 42px; flex: 0 0 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); font-size: 12px; font-weight: 700; }
.setup-icon.sms { color: var(--sms); background: var(--sms-soft); }
.setup-icon.wa { color: var(--wa); background: var(--wa-soft); }
.setup-checklist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.setup-checklist li { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 10px; color: var(--text-soft); }
.setup-pill { width: 68px; flex: 0 0 68px; }
.setup-tabs { margin: 0 0 18px; }
.setup-profile-cards,
.profile-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.profile-card { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.profile-card:nth-child(even) { margin-top: 0; }
.profile-card.is-active { background: var(--blue-soft); color: var(--text); border-color: var(--blue-border); box-shadow: var(--shadow-sm); }
.profile-card-head h3 { margin: 0 0 4px; }
.profile-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.setup-mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.setup-mini-grid div { min-width: 0; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.setup-mini-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.setup-mini-grid strong { display: block; margin-top: 3px; overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.settings-section { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.settings-section-title { margin: 0 0 12px; color: var(--text); font-size: 13px; font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.settings-grid .form-row.full { grid-column: 1 / -1; }
.add-profile-panel { margin-top: 16px; }
.add-profile-panel summary,
details.advanced > summary,
.advanced-filter-drawer > summary,
.new-conversation-panel > summary { color: var(--text); font-weight: 500; cursor: pointer; }
.add-profile-panel summary:hover,
details.advanced > summary:hover,
.advanced-filter-drawer > summary:hover,
.new-conversation-panel > summary:hover { color: var(--blue-3); }
.add-profile-panel > form { margin-top: 12px; }
.profile-edit-details { display: block; }
.profile-edit-details > summary { display: inline-flex; list-style: none; cursor: pointer; }
.profile-edit-details > summary::-webkit-details-marker { display: none; }
.profile-edit-backdrop { display: none; position: fixed; inset: 0; z-index: 58; background: rgba(4, 27, 47, .44); }
.profile-edit-details[open] .profile-edit-backdrop { display: block; }
.profile-edit-panel { position: fixed; top: 50%; left: 50%; z-index: 59; width: min(540px, calc(100vw - 32px)); max-height: 88vh; padding: 18px; overflow-y: auto; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); transform: translate(-50%, -50%); }
.profile-edit-panel.wide { width: min(980px, calc(100vw - 36px)); }
.profile-edit-head { position: sticky; top: -18px; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 12px 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.profile-edit-head h3 { margin: 0; }
.profile-edit-close { min-width: 34px; width: 34px; height: 34px; min-height: 34px; padding: 0; color: var(--text); background: #ffffff; border-color: var(--line-strong); }
.archive-profile-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.archive-profile-form .actions { margin-top: 6px; }
.archive-profile-form input[name="confirm"] { max-width: 170px; }
details.advanced { margin-top: 16px; padding-top: 14px; color: var(--muted); border-top: 1px solid var(--line); }
details.advanced code { padding: 2px 5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs); }

.metric-card-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 16px; align-items: stretch; }
.metric-card { min-height: 118px; display: grid; align-content: space-between; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.metric-card:nth-child(1) { background: var(--blue); color: #ffffff; border-color: var(--blue); }
.metric-card:nth-child(3),
.metric-card:nth-child(5) { transform: none; }
.metric-card span { color: currentColor; opacity: .72; font-size: 12px; font-weight: 500; }
.metric-card strong { color: currentColor; font-size: 34px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.ops-metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.ops-metrics-grid .panel:nth-child(2),
.ops-metrics-grid .panel:nth-child(3) { margin-top: 0; }
.metric-list { display: grid; gap: 0; margin-top: 10px; }
.metric-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.metric-row:last-child { border-bottom: 0; }
.metric-row span:first-child { min-width: 0; overflow: hidden; color: var(--text-soft); text-overflow: ellipsis; white-space: nowrap; }
.metric-row strong { color: var(--text); font-size: 18px; font-weight: 600; line-height: 1; }
.retry-form { margin-top: 12px; }

.shell {
  position: relative;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(420px, 492px) minmax(520px, 1fr) minmax(300px, 360px);
  overflow: hidden;
  background: var(--canvas);
}
.shell.details-collapsed,
.shell:has(.ltr-details.collapsed) { grid-template-columns: minmax(420px, 492px) minmax(0, 1fr); }
.list { min-height: 0; overflow-y: auto; color: var(--text); background: var(--surface); border-right: 1px solid var(--line); }
.list-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px; border-bottom: 1px solid var(--line); }
.list-head strong { display: block; margin-top: 0; color: var(--text); font-size: 18px; font-weight: 600; line-height: 1.2; }
.list .eyebrow { display: none; }
.filter-panel { display: grid; gap: 10px; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.filter-panel .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-panel input,
.filter-panel select { color: var(--text); background: #ffffff; border-color: #cfd6df; }
.search-wrap { position: relative; }
.search-wrap input { min-height: 36px; padding-left: 36px; border-radius: var(--radius-xs); }
.search-icon { position: absolute; top: 50%; left: 11px; width: 18px; height: 18px; color: var(--faint); font-size: 0; pointer-events: none; transform: translateY(-50%); }
.search-icon::before { content: ""; display: block; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' d='m21 21-4.3-4.3M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' d='m21 21-4.3-4.3M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.quick-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.quick-tab { min-height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; color: var(--text-soft); background: #ffffff; border: 0; border-right: 1px solid var(--line); border-radius: 0; font-size: 12px; font-weight: 500; text-decoration: none; }
.quick-tab:last-child { border-right: 0; }
.quick-tab:hover,
.quick-tab.active { color: #ffffff; background: var(--blue); border-color: var(--blue); text-decoration: none; }
.advanced-filter-drawer { padding-top: 8px; border-top: 1px solid var(--line); }
.advanced-filter-drawer .filter-row { margin-top: 8px; }
.new-conversation-panel > summary,
.advanced-filter-drawer > summary,
.add-profile-panel > summary { display: inline-flex; align-items: center; gap: 8px; }
.new-conversation-panel > summary::before,
.add-profile-panel > summary::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / contain no-repeat; }
.advanced-filter-drawer > summary::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M4 6h16M7 12h10M10 18h4'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M4 6h16M7 12h10M10 18h4'/%3E%3C/svg%3E") center / contain no-repeat; }
.new-conversation-panel > form { display: grid; gap: 8px; margin-top: 10px; }
.conversation-list { background: var(--surface); }
.lead-card { color: inherit; text-decoration: none; }
.ltr-lead-card { min-width: 0; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; padding: 14px; background: #ffffff; border-bottom: 1px solid var(--line); transition: background var(--transition), color var(--transition); }
.ltr-lead-card:hover { background: #f5f9ff; text-decoration: none; }
.ltr-lead-card.active { color: #ffffff; background: var(--blue); }
.ltr-lead-card.active .lead-snippet,
.ltr-lead-card.active .lead-preview,
.ltr-lead-card.active .lead-time,
.ltr-lead-card.active .muted { color: #ffffff; }
.ltr-lead-card.needs-response:not(.active) { box-shadow: inset 4px 0 0 var(--blue); }
.avatar { width: 26px; height: 26px; flex: 0 0 26px; display: inline-flex; align-items: center; justify-content: center; color: #ffffff; background: #64748b; border: 0; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.avatar.large { width: 44px; height: 44px; flex-basis: 44px; font-size: 16px; }
.ltr-lead-card.active .avatar,
.conversation-head .avatar { background: #ffffff; color: var(--blue-3); }
.lead-card-main { min-width: 0; }
.lead-card-top,
.lead-card-sub,
.lead-card-preview-row { min-width: 0; display: flex; align-items: center; gap: 8px; }
.lead-card-top strong { flex: 1; min-width: 0; overflow: hidden; color: currentColor; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lead-time { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.lead-preview,
.lead-snippet { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.lead-card-sub { margin-top: 5px; }
.lead-card-sub .lead-snippet { flex: 1; }
.lead-tags,
.lead-property { display: none; }
.unread-badge { min-width: 22px; height: 20px; margin-left: auto; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; color: #ffffff; background: var(--blue-3); border: 0; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; }
.urgent-dot { width: 8px; height: 8px; flex: 0 0 8px; background: var(--blue); border: 0; border-radius: 50%; }
.ltr-lead-card.active .urgent-dot,
.ltr-lead-card.active .unread-badge { background: #ffffff; color: var(--blue-3); }
.list-empty { min-height: 180px; margin: 16px; }
.channel-icon { min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; line-height: 1; }
.channel-icon.wa { color: var(--wa); background: var(--wa-soft); border-radius: var(--radius-xs); font-size: 9px; font-weight: 700; }
.channel-icon.sms-dot { width: auto; max-width: none; padding: 0 5px; color: var(--sms); background: var(--sms-soft); border: 1px solid #c7dfff; border-radius: var(--radius-xs); font-size: 9px; font-weight: 700; }
.channel-badge { display: inline-flex; align-items: center; gap: 5px; }

.conversation-pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--canvas); }
.conversation-head { position: relative; z-index: 1; min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; color: var(--text); background: var(--surface); border-bottom: 1px solid var(--line); }
.conversation-person,
.details-profile { min-width: 0; display: flex; align-items: center; gap: 12px; }
.conversation-person > div:last-child { min-width: 0; }
.conversation-head h1 { margin: 0; }
.conversation-title { max-width: 100%; min-height: 0; padding: 0; overflow: hidden; color: var(--blue-3); background: transparent; border: 0; border-radius: 0; box-shadow: none; font-size: 15px; font-weight: 500; letter-spacing: 0; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title:hover { color: var(--blue); background: transparent; border: 0; box-shadow: none; transform: none; text-decoration: underline; }
.conversation-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 2px; color: var(--text-soft); font-size: 12px; }
.conversation-meta .meta-separator { color: var(--faint); }
.conversation-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; margin-left: 0; }
.conversation-actions .stage-form select { width: 156px; min-width: 156px; min-height: 34px; padding-block: 6px; }
.compact-action { min-width: 64px; }
.wa-window { max-width: 260px; min-height: 30px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; overflow: hidden; color: var(--warning); background: var(--warning-soft); border: 1px solid #f1d28a; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.wa-window.open { color: #137846; background: var(--success-soft); border-color: #b8e6cd; }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; background: currentColor; border-radius: 50%; }
.timeline { position: relative; z-index: 1; flex: 1; min-height: 0; padding: 24px 24px 18px; overflow-y: auto; overscroll-behavior: contain; background: var(--canvas); }
.timeline-date { width: max-content; margin: 0 auto 14px; padding: 4px 8px; color: var(--text-soft); background: #e4e7ec; border: 0; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.bubble { max-width: min(68%, 850px); margin: 0 0 20px; padding: 12px 14px 10px; overflow-wrap: anywhere; word-break: break-word; color: var(--text); background: #ffffff; border: 0; border-radius: var(--radius-md); box-shadow: none; line-height: 1.45; }
.bubble.incoming { margin-right: auto; background: #ffffff; border: 1px solid var(--line); }
.bubble.outgoing,
.bubble.draft { margin-left: auto; color: #ffffff; background: var(--blue); border-color: transparent; }
.bubble.draft { background: var(--warning-soft); color: var(--text); border: 1px solid #f1d28a; }
.bubble-body { display: block; white-space: pre-wrap; }
.bubble small,
.bubble-meta { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; margin-top: 9px; color: var(--text-soft); font-size: 11px; }
.bubble.outgoing .bubble-meta { color: #ffffff; }
.bubble.incoming .bubble-meta { justify-content: flex-start; }
.message-status { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.message-status.failed { color: var(--danger); font-weight: 600; }
.message-check { color: inherit; font-weight: 700; }
.bubble-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 260px)); gap: 10px; align-items: start; margin-top: 10px; }
.media-tile { width: 100%; min-width: 0; display: grid; gap: 7px; padding: 6px; color: var(--text); background: rgba(255, 255, 255, .88); border: 1px solid rgba(255, 255, 255, .65); border-radius: var(--radius-md); box-shadow: none; overflow: hidden; text-align: left; }
button.media-tile { cursor: zoom-in; }
button.media-tile:hover,
.media-tile:hover { border-color: var(--blue-border); background: #ffffff; box-shadow: var(--shadow-sm); transform: none; }
.media-tile img,
.media-tile video { width: 100%; max-height: 270px; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: #111827; border: 0; border-radius: var(--radius-sm); }
.media-tile video { object-fit: contain; }
.media-audio { min-width: min(100%, 280px); }
.media-audio audio { width: 100%; }
.media-caption,
.media-caption-row { min-width: 0; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.25; }
.bubble.outgoing .media-caption,
.bubble.outgoing .media-caption-row { color: var(--text-soft); }
.media-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-caption-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.media-caption-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-open-chip,
.media-file-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 28px; padding: 5px 9px; color: var(--blue-3); background: #ffffff; border: 1px solid var(--blue-border); border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.media-open-chip { cursor: zoom-in; }
.media-open-chip:hover,
.media-file-chip:hover { color: #ffffff; border-color: var(--blue); background: var(--blue); box-shadow: none; transform: none; text-decoration: none; }
.media-lightbox { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: clamp(16px, 4vw, 48px); background: rgba(4, 27, 47, .72); }
.media-lightbox.open { display: flex; }
.media-lightbox-card { width: min(100%, 1040px); max-height: min(92vh, 840px); display: grid; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.media-lightbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); font-size: 13px; font-weight: 500; }
.media-lightbox-close { width: 34px; min-width: 34px; min-height: 34px; padding: 0; color: var(--text); background: #ffffff; border-color: var(--line-strong); }
.media-lightbox-stage { min-height: 180px; display: grid; place-items: center; overflow: hidden; background: #111827; border: 0; border-radius: var(--radius-md); }
.media-lightbox-stage img,
.media-lightbox-stage video { max-width: 100%; max-height: calc(92vh - 112px); display: block; object-fit: contain; }
.delivery-details { max-width: 100%; margin-top: 8px; opacity: .9; }
.delivery-details summary { width: max-content; color: inherit; opacity: .85; font-size: 11px; cursor: pointer; }
.delivery-details summary:hover { color: var(--blue-3); }
.delivery-events { display: grid; gap: 4px; margin: 7px 0 0; padding: 8px 10px; list-style: none; background: rgba(255, 255, 255, .78); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.delivery-event { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; }

.composer { position: relative; z-index: 1; flex: 0 0 auto; display: grid; grid-template-columns: 48px minmax(0, 1fr) 128px; gap: 8px; align-items: end; padding: 12px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.composer-options { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.composer-options.no-whatsapp .wa-fields { display: none; }
.channel-toggle { min-width: 260px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; background: #ffffff; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.channel-option { position: relative; margin: 0; color: var(--text-soft); cursor: pointer; }
.channel-option input { position: absolute; width: 1px; height: 1px; min-height: 1px; opacity: 0; pointer-events: none; }
.channel-pill { min-height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; color: var(--text-soft); border-right: 1px solid var(--line); border-radius: 0; font-size: 12px; font-weight: 500; transition: color var(--transition), background var(--transition); }
.channel-option:last-child .channel-pill { border-right: 0; }
.channel-option input:checked + .channel-pill { color: #ffffff; background: var(--blue); }
.channel-option input:checked + .channel-pill .channel-icon { color: var(--blue-3); background: #ffffff; border-color: #ffffff; }
.channel-option input:focus-visible + .channel-pill { outline: 3px solid var(--focus); outline-offset: 2px; }
.wa-template-drawer { flex: 1 1 320px; min-width: 240px; max-width: 560px; color: var(--muted); }
.wa-template-drawer > summary { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; }
.wa-template-drawer > summary strong { min-width: 0; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.wa-template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.wa-template-grid label { margin: 0; color: var(--muted); }
.wa-template-grid input { min-height: 34px; margin-top: 4px; padding: 7px 9px; font-size: 13px; }
.draft-context { grid-column: 1 / -1; display: none; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--blue-soft); border: 1px solid var(--blue-border); border-radius: var(--radius-sm); }
.draft-context.active { display: flex; }
.composer-hint { grid-column: 2 / 4; grid-row: 3; margin: -2px 0 0; color: var(--muted); font-size: 11px; }
.attachment-row { display: contents; }
.file-trigger { grid-column: 1; grid-row: 2; width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; margin: 0; color: #ffffff; background: var(--blue); border: 1px solid var(--blue); border-radius: var(--radius-sm); font-size: 0; cursor: pointer; }
.file-trigger::before { content: ""; width: 22px; height: 22px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7L10 17.4a2 2 0 0 1-2.8-2.8l8.5-8.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7L10 17.4a2 2 0 0 1-2.8-2.8l8.5-8.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.file-trigger:hover { color: #ffffff; background: var(--blue-2); }
.file-trigger input { display: none; }
.attachment-preview { display: none; grid-column: 1 / -1; min-width: 0; align-items: center; gap: 10px; padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.attachment-preview.visible { display: flex; }
.attachment-preview img { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.attachment-preview div { min-width: 0; overflow: hidden; }
.attachment-preview strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-preview button { margin-left: auto; }
.composer textarea { grid-column: 2; grid-row: 2; min-height: 48px; max-height: 126px; resize: none; border-radius: var(--radius-xs); }
.composer .send-button { grid-column: 3; grid-row: 2; width: 128px; min-width: 128px; min-height: 48px; align-self: stretch; border-radius: var(--radius-sm); }
.send-button::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M22 2 11 13M22 2l-7 20-4-9-9-4 20-7Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M22 2 11 13M22 2l-7 20-4-9-9-4 20-7Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.no-selection { align-self: center; max-width: 560px; margin: auto; }

.details { min-width: 0; min-height: 0; padding: 16px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
.details.collapsed { display: none; }
.details-content { display: grid; gap: 12px; }
.details-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.details-head h2 { margin: 0; font-size: 18px; }
.details-close { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; color: var(--text); background: #ffffff; border-color: var(--line-strong); }
.details-section { margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); }
.details-section h2 { margin: 0 0 10px; color: var(--text); font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.details-subline { color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: minmax(108px, 40%) minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--muted); }
.crm-profile-card { display: grid; gap: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.crm-profile-card .profile-card-head { align-items: center; }
.record-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.record-strip div { min-width: 0; padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.record-strip span { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.record-strip strong { display: block; margin-top: 3px; overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.profile-form-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.profile-form-grid textarea { min-height: 100px; }
.source-agent { margin: 8px 0; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.source-agent code,
.report-preview { overflow-wrap: anywhere; white-space: pre-wrap; }
.report-preview { width: 100%; min-height: 190px; font-size: 12px; }
.background-check-form,
.contact-status-form,
.contact-archive-form { margin-top: 14px; }
.lead-status-card { display: grid; gap: 12px; background: #ffffff; }
.status-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status-card-head h2,
.status-card-head h3 { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.status-action-groups { display: grid; gap: 11px; }
.status-action-group { display: grid; gap: 7px; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); }
.status-action-title { display: grid; gap: 2px; }
.status-action-title strong { color: var(--text); font-size: 13px; font-weight: 600; }
.status-action-title span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.status-action-grid { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.status-action { min-height: 31px; padding: 6px 10px; color: var(--text); background: #ffffff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; box-shadow: none; }
.status-action:hover { color: var(--blue-3); background: var(--blue-soft); border-color: var(--blue-border); }
.status-action.active { color: #ffffff; background: var(--blue); border-color: var(--blue); }
.archive-action-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--danger-soft); border: 1px solid #fecaca; border-radius: var(--radius-md); }
.archive-action-card strong { display: block; color: var(--danger); font-size: 13px; }
.archive-action-card .details-subline { margin: 2px 0 0; }

#pwc-push-container { position: fixed; right: 24px; bottom: 24px; z-index: 75; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.pwc-push { min-width: 290px; max-width: 380px; display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: var(--radius-md); box-shadow: var(--shadow-md); pointer-events: auto; animation: uiReveal 160ms ease both; }
.pwc-push-info { border-left-color: var(--blue); }
.pwc-push-warn { border-left-color: var(--warning); }
.pwc-push-danger { border-left-color: var(--danger); }
.pwc-push-ok { border-left-color: var(--success); }
.pwc-push-icon { flex: 0 0 auto; }
.pwc-push-body { flex: 1; min-width: 0; }
.pwc-push-title { font-weight: 600; }
.pwc-push-msg { color: var(--muted); }
.pwc-push-close { min-width: 26px; width: 26px; height: 26px; min-height: 26px; padding: 0; color: var(--text); background: transparent; border: 0; box-shadow: none; }
.pwc-push-close:hover { color: var(--blue-3); background: var(--blue-soft); box-shadow: none; }

.account-panel { width: min(100%, 900px); margin: 20px auto 0; }
.account-panel .section-title-row { margin-bottom: 16px; }
.auth-layout { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--navy), #062744); }
.auth-card { position: relative; width: min(100%, 430px); padding: 30px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 24px 80px rgba(0, 0, 0, .24); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand .nav-icon { width: 48px; height: 48px; flex-basis: 48px; }
.auth-card h1 { margin: 0 0 3px; font-size: 24px; font-weight: 600; }
.auth-sub { margin: 0; color: var(--muted); font-size: 13px; }
.auth-step { margin: 0 0 16px; color: var(--text-soft); }
.auth-card .form-row { margin-bottom: 14px; }
.auth-card button[type="submit"] { width: 100%; margin-top: 3px; }
.auth-alert { margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; }
.auth-alert.error { color: var(--danger); background: var(--danger-soft); border-color: #fecaca; }
.auth-alert.info { color: var(--blue-3); background: var(--blue-soft); border-color: var(--blue-border); }
.auth-meta { margin-top: 18px; padding-top: 14px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; text-align: center; }
.auth-meta a { color: var(--blue-3); font-weight: 500; text-decoration: underline; }

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .metric-card,
  .setup-card,
  .profile-card,
  .ltr-lead-card,
  .bubble,
  .auth-card { animation: uiReveal 220ms ease both; }
}
@keyframes uiReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1500px) {
  .shell { grid-template-columns: minmax(380px, 460px) minmax(0, 1fr); }
  .details { position: absolute; inset: 14px 14px 14px auto; z-index: 12; width: min(410px, calc(100% - 28px)); border: 1px solid var(--line); box-shadow: var(--shadow-md); border-radius: var(--radius-lg); }
  .details.collapsed { display: none; }
  .details .record-strip { grid-template-columns: 1fr; }
}
@media (max-width: 1320px) {
  .metric-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ops-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  :root { --sidebar-width: 72px; }
  .nav-copy { display: none; }
  .side-nav { align-items: center; padding-inline: 0; overflow: visible; }
  .nav-brand,
  .side-nav a,
  .side-nav .theme-toggle,
  .profile-switcher { width: 100%; justify-content: center; padding-inline: 0; }
  .nav-brand .nav-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .nav-divider { width: 36px; margin-inline: auto; }
  .shell { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
  .details { inset: 12px 12px 12px auto; width: min(380px, calc(100% - 24px)); }
}
@media (max-width: 1080px) {
  .ops-split-grid.contacts-layout-grid,
  .setup-overview-grid,
  .setup-profile-cards,
  .profile-cards { grid-template-columns: 1fr; }
  .contacts-main-column,
  .contacts-detail-column,
  .quick-create-card { margin-left: 0; padding-top: 0; transform: none; }
  .sticky-panel { position: static; }
  .composer-options { flex-wrap: wrap; align-items: stretch; }
  .channel-toggle { flex: 1 1 260px; }
  .wa-template-drawer { flex: 1 1 100%; max-width: none; }
  .wa-template-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body.inbox-view { height: auto; overflow: auto; }
  .app-layout,
  body.inbox-view .app-layout { display: block; min-height: 100dvh; height: auto; padding-bottom: 66px; }
  .side-nav { position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 80; width: 100%; height: 64px; flex-direction: row; align-items: center; justify-content: center; overflow: hidden; padding: 8px 10px; border-top: 1px solid #0e2f4b; border-right: 0; }
  .nav-top,
  .nav-links,
  .nav-bottom { width: auto; display: flex; align-items: center; gap: 4px; }
  .nav-brand,
  .nav-divider,
  .profile-switcher,
  .logout-btn { display: none !important; }
  .nav-icon,
  .side-nav a,
  .side-nav .theme-toggle { width: 46px; height: 46px; min-height: 46px; flex-basis: 46px; }
  .page { min-height: calc(100dvh - 66px); }
  .page-inner { padding: 0 12px 28px; }
  .ops-hero { margin-inline: -12px; padding-inline: 14px; align-items: flex-start; flex-direction: column; }
  .hero-status-card { width: 100%; min-width: 0; }
  .shell,
  .shell.details-collapsed,
  .shell:has(.ltr-details.collapsed) { height: auto; min-height: calc(100dvh - 66px); grid-template-columns: 1fr; overflow: visible; }
  .list { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-pane { min-height: 58vh; }
  .conversation-head { grid-template-columns: 1fr; align-items: stretch; }
  .conversation-actions { justify-content: flex-start; }
  .timeline { min-height: 280px; max-height: 52vh; padding: 18px 12px; }
  .bubble { max-width: 92%; }
  .details { position: fixed; inset: 12px 12px 76px; width: auto; }
  .settings-grid,
  .grid,
  .grid-3 { grid-template-columns: 1fr; }
  .settings-grid .form-row.full { grid-column: 1; }
  .metric-card-grid,
  .ops-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-panel { overflow-x: auto; }
  .tabs { gap: 14px; }
  .quick-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .metric-card-grid,
  .ops-metrics-grid,
  .setup-mini-grid,
  .record-strip { grid-template-columns: 1fr; }
  .filter-panel .filter-row { grid-template-columns: 1fr; }
  .conversation-actions { align-items: stretch; }
  .conversation-actions .stage-form,
  .conversation-actions .stage-form select { width: 100%; }
  .composer { grid-template-columns: 44px minmax(0, 1fr) 88px; padding-inline: 8px; }
  .composer .send-button { width: 88px; min-width: 88px; padding-inline: 8px; }
  .channel-toggle { width: 100%; min-width: 0; }
  .composer-hint { grid-column: 1 / -1; margin-left: 52px; }
  .auth-layout { padding: 14px; }
  .auth-card { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
