:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --panel-2: #eef2ee;
  --line: #dce2dc;
  --text: #17211b;
  --muted: #66736b;
  --brand: #16745a;
  --brand-2: #0f5f4a;
  --sidebar-brand: #16745a;
  --sidebar-brand-2: #0f5f4a;
  --blue: #315fba;
  --amber: #ba7d13;
  --red: #bd3d35;
  --shadow: 0 18px 45px rgba(35, 49, 40, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  background: #101915;
}

.login-panel {
  background: var(--panel);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.login-panel .brand-mark,
.login-shell .brand-mark {
  background: var(--sidebar-brand);
}

.login-panel .input:focus,
.login-panel .textarea:focus,
.login-panel .select:focus {
  border-color: var(--sidebar-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sidebar-brand) 16%, transparent);
}

.login-panel .btn.primary {
  background: var(--sidebar-brand);
}

.login-panel .btn.primary:hover {
  background: var(--sidebar-brand-2);
}

.login-visual {
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: end;
  padding: clamp(32px, 7vw, 86px);
  background:
    linear-gradient(120deg, rgba(22, 116, 90, 0.92), rgba(34, 62, 83, 0.86)),
    url("https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.login-visual::after {
  content: none;
}

.login-visual-card {
  max-width: 640px;
  padding: 28px;
  color: white;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

.login-visual-card span {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.login-visual-card h2 {
  max-width: 520px;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.08;
}

.login-visual-metrics {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.login-visual-metrics strong,
.login-visual-metrics small {
  display: block;
}

.login-visual-metrics small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand-logo {
  width: auto;
  max-width: 178px;
  height: 38px;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
}

.brand-has-logo {
  max-width: 190px;
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.form {
  display: grid;
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #344239;
  font-size: 13px;
  font-weight: 650;
}

.hidden {
  display: none !important;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.textarea {
  resize: vertical;
  min-height: 86px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 90, 0.12);
}

.input.input-error,
.textarea.input-error,
.select.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(189, 61, 53, 0.12);
}

.field-error {
  color: var(--red);
  font-size: 12px;
  line-height: 1.35;
}

.select.compact {
  width: auto;
  min-width: 160px;
}

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 13px;
  min-height: 40px;
  background: #e9eee9;
  color: var(--text);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.primary {
  background: var(--brand);
  color: white;
}

.btn.primary:hover {
  background: var(--brand-2);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
}

.btn.ghost.active {
  background: #e1ece5;
  border-color: #b8cabe;
}

.btn.ghost.danger {
  color: var(--red);
}

.btn.danger {
  border-color: #f3c7c3;
  color: var(--red);
}

.btn.icon {
  width: 40px;
  padding: 0;
  font-size: 18px;
}

.error {
  padding: 10px 12px;
  background: #fff0ef;
  color: var(--red);
  border: 1px solid #f3c7c3;
  border-radius: var(--radius);
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.app-shell {
  height: 100dvh;
  min-height: 100%;
  display: grid;
  grid-template-columns: 248px 1fr;
  overflow: hidden;
  transition: grid-template-columns 0.16s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px 1fr;
}

.sidebar {
  position: relative;
  background: var(--sidebar-brand-2);
  color: white;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 14px;
  gap: 18px;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  width: 100%;
  min-width: 0;
}

.sidebar .brand-mark {
  background: #d8fff0;
  color: var(--sidebar-brand-2);
}

.sidebar .brand-has-logo {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.sidebar .brand-has-logo .brand-logo {
  width: 100%;
  max-width: 100%;
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.collapse-btn {
  position: absolute;
  top: 17px;
  right: -14px;
  z-index: 60;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--sidebar-brand-2) 78%, white 22%);
  color: white;
  box-shadow: 0 8px 20px rgba(4, 10, 7, 0.26);
}

.brand-text,
.nav-label,
.profile-copy {
  max-width: 180px;
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.14s ease, max-width 0.16s ease;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .status-pill {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-collapsed .sidebar {
  padding: 14px 10px;
}

.sidebar-collapsed .nav button {
  justify-content: center;
}

.sidebar-collapsed .nav {
  width: 100%;
}

.sidebar-collapsed .sidebar-head {
  justify-content: center;
  gap: 4px;
}

.sidebar-collapsed .brand {
  justify-content: center;
}

.sidebar-collapsed .brand-has-logo {
  width: 34px;
  max-width: 34px;
}

.sidebar-collapsed .brand-mark {
  width: 34px;
  height: 34px;
}

.sidebar-collapsed .brand-logo {
  width: 34px;
  height: 34px;
  object-fit: cover;
}

.sidebar-collapsed .collapse-btn {
  width: 28px;
  height: 28px;
}

.nav {
  display: grid;
  gap: 6px;
  align-content: start;
}

.nav button {
  border: 0;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
}

.nav-icon,
.btn svg,
.icon-link svg,
.emoji-btn svg,
.collapse-btn svg,
.profile-menu-action svg,
.attach-menu svg,
.choice-icon svg,
.builder-palette svg,
.message-error svg,
.scheduled-chip svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.nav-icon {
  display: grid;
  place-items: center;
}

.nav button.active,
.nav button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  position: relative;
}

.sidebar-collapsed .sidebar-footer {
  width: 100%;
}

.sidebar-collapsed .live-pill {
  justify-content: center;
  padding: 8px 4px;
  font-size: 11px;
}

.sidebar-collapsed .sidebar-footer .btn {
  padding: 8px 4px;
  font-size: 12px;
}

.sidebar-footer .btn {
  color: white;
  border-color: rgba(255, 255, 255, 0.45);
}

.sidebar-footer .btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.profile-button {
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  text-align: left;
}

.profile-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.profile-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: var(--sidebar-brand-2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  transform-origin: bottom left;
  animation: menuFadeIn 0.14s ease-out;
}

.sidebar-collapsed .profile-menu {
  left: calc(100% + 10px);
  right: auto;
  bottom: 0;
  width: 220px;
}

.profile-menu-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  padding: 9px 10px;
  font-weight: 700;
  text-align: left;
}

.profile-menu-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

.profile-menu .live-pill,
.profile-menu .status-pill {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
}

.profile-menu-action svg {
  width: 16px;
  height: 16px;
  color: white;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.profile-copy strong,
.profile-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy small {
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.sidebar-collapsed .profile-button {
  justify-content: center;
  padding: 8px 4px;
}

.sidebar-collapsed .profile-copy {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: #d8fff0;
  color: #14201a;
  font-weight: 800;
  object-fit: cover;
}

.avatar.xs {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.avatar.md {
  width: 42px;
  height: 42px;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 10px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
}

.live-pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa69d;
}

.live-pill.on {
  color: #d8fff0;
}

.live-pill.on::before {
  background: #36d399;
  box-shadow: 0 0 0 4px rgba(54, 211, 153, 0.14);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfdfb;
}

.switch-row input {
  margin-top: 3px;
}

.switch-row span {
  display: grid;
  gap: 3px;
}

.switch-row small {
  color: var(--muted);
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.main:has(.notice) {
  grid-template-rows: auto minmax(0, 1fr);
}

.content {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
}

.notice {
  background: #fff8df;
  border-bottom: 1px solid #efdf9a;
  color: #5f4b0b;
  padding: 9px 22px;
  font-size: 13px;
}

.onboarding {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 520px) 1fr;
  gap: 36px;
  align-items: center;
  padding: 42px;
}

.setup-card,
.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setup-card {
  padding: 26px;
  display: grid;
  gap: 20px;
}

.setup-card.compact {
  padding: 14px;
  gap: 10px;
  box-shadow: none;
  background: #f7fbf8;
}

.copy-field {
  display: grid;
  gap: 4px;
}

.copy-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.copy-field code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 9px 10px;
}

.advanced-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfb;
  padding: 12px;
}

.advanced-box summary {
  cursor: pointer;
  font-weight: 800;
}

.advanced-box[open] {
  display: grid;
  gap: 12px;
}

.advanced-box[open] summary {
  margin-bottom: 4px;
}

.whatsapp-connect-layout {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}

.whatsapp-brand-panel {
  background: #f1f5f2;
  border-right: 1px solid var(--line);
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.whatsapp-logo-card {
  min-height: 120px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #0e3a27;
  color: white;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.1;
}

.whatsapp-logo-card span {
  font-weight: 500;
}

.whatsapp-connect-main {
  padding: 30px;
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  overflow-y: auto;
}

.whatsapp-hero {
  max-width: 720px;
  display: grid;
  gap: 16px;
}

.whatsapp-hero .row {
  align-items: stretch;
  flex-wrap: wrap;
}

.whatsapp-hero .btn {
  min-height: 48px;
}

.whatsapp-number-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.whatsapp-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px 14px;
}

.whatsapp-status-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
}

.btn.compact {
  min-height: 40px;
  padding: 0 12px;
  gap: 8px;
}

.whatsapp-status-card p {
  margin-top: 3px;
}

.whatsapp-info-wrap {
  position: relative;
  flex: 0 0 auto;
}

.whatsapp-info-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 65;
  width: min(420px, 82vw);
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 12px;
  animation: menuFadeIn 0.14s ease-out;
}

.whatsapp-meta-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 65;
  width: min(520px, 86vw);
  max-height: min(680px, 76vh);
  overflow: auto;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 14px;
  animation: menuFadeIn 0.14s ease-out;
}

.settings-subsection-head {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.settings-subsection-head h3 {
  margin: 0;
}

.settings-subsection-head p {
  margin-top: 4px;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.integration-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 12px;
  min-height: 260px;
}

.integration-card-head,
.integration-actions,
.integration-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.integration-card-head {
  justify-content: space-between;
}

.integration-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
}

.integration-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
}

.integration-icon.messenger {
  background: #2563eb;
}

.integration-icon.instagram {
  background: #d9468f;
}

.integration-icon.tiktok {
  background: #111827;
}

.integration-meta {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.integration-meta small {
  color: var(--muted);
}

.compact-copy {
  min-width: 0;
}

.compact-copy code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-number-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 10px;
}

.whatsapp-number-row p {
  margin-top: 3px;
}

.whatsapp-orbit {
  width: 112px;
  height: 76px;
  position: relative;
}

.whatsapp-orbit span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #35d06f;
  color: white;
  font-weight: 900;
  font-size: 26px;
  box-shadow: 0 0 0 12px #e8f8ee;
}

.success-line,
.notice-inline {
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
}

.success-line {
  background: #e3f7ea;
  color: #146b42;
}

.notice-inline {
  background: #fff8df;
  color: #6c530c;
  border: 1px solid #ead78b;
}

.setup-preview {
  min-height: 420px;
  background: #dfe7e1;
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-end;
}

.phone-demo {
  max-width: 360px;
  background: #f7faf7;
  border: 1px solid #cbd6cd;
  border-radius: 28px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.bubble {
  width: fit-content;
  max-width: 100%;
  border-radius: 14px;
  padding: 10px 12px;
  margin: 8px 0;
  box-sizing: border-box;
  overflow: hidden;
}

.bubble.in {
  background: white;
}

.bubble.out {
  background: #d7f5e7;
  margin-left: auto;
}

.inbox-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(380px, 1fr) 320px;
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
}

.inbox-layout.detail-collapsed {
  grid-template-columns: 340px minmax(380px, 1fr) 0;
}

.conversation-list,
.chat-pane,
.detail-pane {
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.conversation-list {
  display: grid;
  grid-template-rows: auto 1fr;
}

.pane-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 9px 12px;
  min-height: 38px;
  font-weight: 700;
}

.segmented button + button {
  border-left: 1px solid var(--line);
}

.segmented button.active {
  background: #dcebe3;
  color: #0f5f4a;
}

.search-filter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.filter-menu-wrap {
  position: relative;
}

.filter-trigger {
  position: relative;
}

.filter-trigger.active,
.filter-trigger:hover {
  background: #e5f1e9;
  border-color: #bdd3c4;
}

.filter-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid white;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(280px, 82vw);
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  transform-origin: top right;
  animation: menuFadeIn 0.14s ease-out;
}

.filter-menu-title {
  padding: 4px 10px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.filter-menu-section {
  display: grid;
  gap: 6px;
  padding: 8px 6px 4px;
  border-top: 1px solid var(--line);
}

.filter-menu-section label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filter-menu button {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  text-align: left;
}

.chat-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e5f1e9;
  color: var(--brand-2);
  font-size: 12px;
}

.filter-menu button.active,
.filter-menu button:hover {
  background: #e5f1e9;
  color: var(--brand-2);
}

.check-mark {
  color: var(--brand);
}

.conv-items {
  overflow-y: auto;
  overflow-x: hidden;
}

.conv-item {
  position: relative;
  border: 0;
  width: 100%;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 14px 46px 14px 16px;
  text-align: left;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.channel-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--brand-2);
  background: white;
}

.channel-badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.channel-badge.instagram {
  color: #c13584;
}

.channel-badge.tiktok {
  color: #111827;
}

.channel-badge.messenger {
  color: #0078ff;
}

.conv-item span,
.conv-item div {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item.active,
.conv-item:hover {
  background: #f0f5f0;
}

.conv-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 750;
  min-width: 0;
}

.conv-title span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.unread {
  width: 20px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  flex: 0 0 20px;
  overflow: visible;
}

.unread.dot-only {
  width: 10px;
  min-width: 10px;
  height: 10px;
  flex-basis: 10px;
  font-size: 0;
}

.chat-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #edf3ee;
  overflow: hidden;
}

.chat-head {
  background: white;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.chat-contact-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-contact-title > div {
  min-width: 0;
}

.chat-contact-title strong,
.chat-contact-title .small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-avatar {
  background: #d8f8e8;
  color: var(--green);
}

.chat-head-actions .btn.active {
  color: var(--amber);
  background: #fff8e9;
  border-color: #efd49c;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
}

.date-separator {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
  position: sticky;
  top: 8px;
  z-index: 2;
  pointer-events: none;
}

.date-separator span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 12px;
  border: 1px solid rgba(184, 202, 190, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #536159;
  box-shadow: 0 6px 18px rgba(35, 49, 40, 0.08);
  font-size: 12px;
  font-weight: 750;
  text-transform: capitalize;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.message:has(.message-info-popover) {
  z-index: 80;
}

.message.out {
  justify-content: flex-end;
}

.message.in .message-sender {
  order: -1;
}

.message-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: min(78%, 560px);
}

.message.out .message-stack {
  justify-items: end;
}

.message-sender {
  display: inline-grid;
  place-items: center;
  align-self: flex-end;
  margin-bottom: 18px;
}

.message .bubble {
  box-shadow: 0 4px 16px rgba(35, 49, 40, 0.06);
}

.message-info-btn {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  align-self: center;
  border: 1px solid rgba(160, 177, 166, 0.72);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: #65736a;
  opacity: 0;
  transform: translateX(3px);
  transition: opacity 0.14s ease, transform 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.message.out:hover .message-info-btn,
.message-info-btn:focus,
.message-info-btn.active,
.message-info-btn:has(+ .message-info-popover) {
  opacity: 1;
  transform: translateX(0);
}

.message-info-btn:hover,
.message-info-btn:focus {
  color: var(--brand);
  border-color: #9fc9b3;
  outline: none;
}

.message-info-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

.message-info-popover {
  position: absolute;
  right: 44px;
  top: calc(100% + 6px);
  z-index: 80;
  width: min(320px, calc(100vw - 48px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  animation: menuFadeIn 0.14s ease-out;
}

.message-info-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
}

.message-info-head svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.message-info-grid {
  display: grid;
  gap: 8px;
}

.message-info-grid div {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.message-info-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.message-info-grid strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.media-image {
  max-width: min(320px, 100%);
  height: auto;
  max-height: 300px;
  border-radius: var(--radius);
  display: block;
  object-fit: cover;
  cursor: zoom-in;
}

.media-video,
.media-preview {
  max-width: min(420px, 100%);
  max-height: 340px;
  border-radius: var(--radius);
  display: block;
  object-fit: contain;
  background: #111;
}

.media-sticker {
  width: 128px;
  max-width: 100%;
  height: 128px;
  display: block;
  object-fit: contain;
  cursor: zoom-in;
}

.media-expired {
  width: min(260px, 100%);
  min-height: 120px;
  border: 1px dashed #b7c7bd;
  border-radius: var(--radius);
  background: #f7faf8;
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  padding: 18px;
}

.media-expired svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-error {
  color: var(--red);
  display: inline-grid;
  place-items: center;
  cursor: help;
}

.checks {
  font-weight: 800;
  color: #6f7d73;
}

.checks.read {
  color: #1b8bd8;
}

.scheduled-chip {
  margin-top: 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.load-more {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 8px 12px;
  margin: 0 auto 14px;
  display: block;
  color: var(--brand);
  font-weight: 750;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 10, 8, 0.86);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: modalFadeIn 0.16s ease-out;
}

.lightbox img,
.lightbox video {
  max-width: min(980px, 94vw);
  max-height: 88vh;
  object-fit: contain;
}

.lightbox audio {
  width: min(620px, 92vw);
}

.lightbox-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.lightbox-file {
  min-width: min(520px, 92vw);
  padding: 28px;
  border-radius: var(--radius);
  background: white;
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
}

.lightbox-file svg {
  width: 42px;
  height: 42px;
}

.media-audio {
  width: min(300px, 68vw);
}

.media-caption {
  margin-top: 8px;
}

.upload-progress {
  display: grid;
  gap: 8px;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.upload-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e2;
}

.upload-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.18s ease;
}

.upload-progress.indeterminate .upload-track span {
  width: 35%;
  animation: uploadSlide 1s ease-in-out infinite;
}

.mini-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.recording-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #f1b9b5;
  border-radius: var(--radius);
  background: #fff1f0;
  color: #8f231c;
}

.recording-bar strong {
  font-size: 13px;
}

.recording-bar #recordingTimer {
  margin-left: auto;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(189, 61, 53, 0.36);
  animation: pulseRecord 1.1s ease-out infinite;
}

@keyframes uploadSlide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(300%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseRecord {
  0% {
    box-shadow: 0 0 0 0 rgba(189, 61, 53, 0.36);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(189, 61, 53, 0);
  }
}

.media-placeholder {
  min-width: 180px;
  padding: 18px;
  border: 1px dashed #b9c7bd;
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.composer-wrap {
  background: white;
  border-top: 1px solid var(--line);
}

.attach-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px 0;
  align-items: center;
}

.customer-window-warning {
  margin: 12px 14px 0;
  padding: 10px 12px;
  border: 1px solid #f1c88b;
  border-radius: var(--radius);
  background: #fff8ea;
  color: #7a4d08;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.customer-window-warning svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex: 0 0 auto;
}

.btn.template-glow {
  border-color: #e6b15d;
  color: #6f480b;
  animation: templatePulse 1.4s ease-in-out infinite;
}

@keyframes templatePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(230, 177, 93, 0.45);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(230, 177, 93, 0.12);
  }
}

.attach-menu-wrap {
  position: relative;
}

.attach-trigger {
  box-shadow: 0 8px 18px rgba(22, 116, 90, 0.18);
}

.attach-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 12;
  width: 224px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  transform-origin: bottom left;
  animation: menuFadeIn 0.14s ease-out;
}

.attach-menu button {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  min-height: 38px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 700;
}

.attach-menu button:hover {
  background: #eef5ef;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 14px;
  background: white;
}

.composer-input-wrap {
  position: relative;
}

.composer-input-wrap .input {
  padding-right: 44px;
}

.emoji-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #edf2ee;
}

.emoji-picker {
  position: absolute;
  right: 0;
  bottom: 44px;
  z-index: 10;
  width: 260px;
  max-height: 170px;
  overflow: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform-origin: bottom right;
  animation: menuFadeIn 0.14s ease-out;
}

.emoji-picker button {
  border: 0;
  background: #f4f6f3;
  border-radius: var(--radius);
  height: 34px;
  font-size: 18px;
}

.template-list {
  display: grid;
  gap: 10px;
}

.template-modal {
  width: min(94vw, 1480px);
  min-width: min(1120px, calc(100vw - 36px));
  overflow-x: hidden;
}

.template-builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 520px);
  gap: 32px;
  align-items: start;
  min-width: 0;
}

.template-form-panel {
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  overflow: visible;
}

.template-builder-layout .field,
.template-builder-layout .input,
.template-builder-layout .textarea,
.template-builder-layout .select {
  min-width: 0;
}

.template-preview-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f8f6;
  min-width: 0;
  max-width: 100%;
  position: sticky;
  top: 18px;
  align-self: start;
  justify-self: stretch;
}

.template-preview-phone {
  min-height: 360px;
  padding: 18px;
}

.template-preview-phone .bubble {
  max-width: 100%;
}

.template-preview-phone button {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #cfe0d5;
  border-radius: 999px;
  background: white;
  color: #128c7e;
  padding: 8px 10px;
  font-weight: 750;
}

.template-preview-header {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.template-preview-phone small {
  display: block;
  margin-top: 8px;
  color: #667781;
}

.template-preview-media {
  margin: -4px -4px 10px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #e8efea;
}

.template-preview-media img,
.template-preview-media video {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.template-media-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.template-buttons-editor {
  display: grid;
  gap: 10px;
}

.template-button-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(170px, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.template-button-row [data-template-button-url],
.template-button-row [data-template-button-phone] {
  grid-column: 1 / -2;
}

.template-card {
  position: relative;
}

.template-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.template-title-block {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.template-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1;
  font-weight: 850;
  border: 1px solid transparent;
}

.status-chip.approved {
  color: #075e42;
  background: #daf5e7;
  border-color: #b6e6cc;
}

.status-chip.pending {
  color: #8a5a00;
  background: #fff1c9;
  border-color: #f2d58b;
}

.status-chip.rejected {
  color: #a12822;
  background: #ffe2df;
  border-color: #f1bab5;
}

.status-chip.draft {
  color: #4d5a52;
  background: #edf2ee;
  border-color: #dde5df;
}

.template-metrics-modal {
  width: min(820px, calc(100vw - 36px));
}

.metrics-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
}

.compact-field {
  min-width: 160px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #f8faf8;
  display: grid;
  gap: 4px;
}

.metric-card strong {
  font-size: 24px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metrics-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  min-width: min(720px, 100%);
}

.metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.metric-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
  min-height: 260px;
}

.metric-panel.wide {
  grid-column: span 2;
}

.metric-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.metric-bars {
  display: grid;
  gap: 12px;
}

.metric-bar-row {
  display: grid;
  gap: 6px;
}

.metric-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.metric-bar-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3ebe6;
}

.metric-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--blue));
}

.metric-donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: center;
}

.metric-donut {
  width: 148px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}

.metric-donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: white;
}

.metric-donut span {
  position: relative;
  z-index: 1;
  font-weight: 850;
  font-size: 24px;
}

.metric-legend {
  display: grid;
  gap: 8px;
}

.metric-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.metric-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.metric-timeline {
  min-height: 180px;
  display: flex;
  align-items: end;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 4px 0;
}

.metric-day {
  min-width: 54px;
  display: grid;
  justify-items: center;
  align-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.metric-day-bar {
  width: 28px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--brand), #8ed0b8);
}

.metric-day strong {
  color: var(--text);
}

.metric-user-list {
  display: grid;
  gap: 10px;
}

.metric-user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.metric-user-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.template-button-metrics {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.template-button-metrics div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: white;
}

.template-option {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 5px;
}

.template-option span,
.template-option small {
  color: var(--muted);
}

.detail-pane {
  border-right: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  transform: translateX(0);
  opacity: 1;
  transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.detail-pane.collapsed {
  border: 0;
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
}

.detail-head {
  min-height: 57px;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.detail-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
}

.contact-sheet-toggle {
  display: none;
  background: #e4fff1;
  color: #0b6b4d;
  border-color: #a8d9c1;
  box-shadow: 0 8px 18px rgba(15, 111, 78, 0.16);
}

.inbox-layout.detail-collapsed .contact-sheet-toggle {
  display: inline-grid;
}

.contact-sheet-toggle:hover {
  background: #c9f7df;
}

.detail-body {
  overflow: auto;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.inline-notes {
  display: grid;
  gap: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
  background: #edf2ee;
  border: 1px solid transparent;
}

button.tag {
  cursor: pointer;
}

.toggle-tag {
  color: var(--muted);
  background: white;
  border-color: var(--line);
}

.toggle-tag.active {
  color: var(--text);
  background: #edf7f1;
  border-color: #b8dac7;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.grid-page {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 22px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-content: start;
  grid-auto-rows: max-content;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: 0 -22px;
  padding: 18px 22px 14px;
  background: color-mix(in srgb, var(--bg) 94%, white);
  border-bottom: 1px solid rgba(203, 214, 205, 0.72);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.toolbar > * {
  min-width: 0;
}

.library-filters {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 12px;
  align-items: center;
}

.library-picker-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.library-picker-grid {
  max-height: min(520px, 58vh);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.library-picker-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 10px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.library-picker-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 90, 0.14);
}

.library-picker-card strong,
.library-picker-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-picker-card span {
  color: var(--muted);
  font-size: 12px;
}

.settings-tabs {
  max-width: min(100%, 760px);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 6px;
  scrollbar-width: thin;
}

.settings-tabs .btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 13px;
}

.contact-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.record-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.library-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
}

.library-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 90, 0.12);
}

.library-thumb {
  height: 150px;
  background: #edf3ee;
  display: grid;
  place-items: center;
  color: var(--brand);
}

.library-thumb img,
.library-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-thumb span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--line);
}

.library-thumb svg {
  width: 24px;
  height: 24px;
}

.library-card-body {
  padding: 14px;
  display: grid;
  gap: 10px;
  background: white;
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 1;
}

.library-thumb-action {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--brand);
  display: grid;
  place-items: center;
}

.library-thumb-action svg {
  width: 26px;
  height: 26px;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.automation-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.contact-detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.contact-detail-title h3 {
  margin: 0;
}

.owner-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.owner-line span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-avatar {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e7f4ed;
  color: var(--brand);
}

.owner-avatar svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.owner-avatar.unassigned {
  border: 1px dashed #b7c7bd;
  background: #f7faf8;
  color: #7a897f;
}

.owner-select-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.contact-card {
  cursor: grab;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.contact-card:active {
  cursor: grabbing;
}

.contact-card.selected,
.contact-row.selected,
.template-row.selected {
  background: #f1faf5;
  border-color: #9dccb2;
  box-shadow: inset 3px 0 0 var(--brand);
}

.contact-table {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 2px 0;
  flex-wrap: wrap;
}

.page-pill {
  min-width: 64px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px 10px;
  font-weight: 750;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.contact-table-head,
.contact-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(170px, 1.1fr) minmax(150px, 0.85fr) minmax(170px, 1fr) minmax(100px, 0.65fr) minmax(160px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.template-table-head,
.template-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(190px, 1.1fr) minmax(280px, 1.8fr) minmax(110px, 0.6fr) minmax(120px, 0.6fr) auto;
  gap: 14px;
  align-items: center;
}

.template-row > *,
.template-table-head > * {
  min-width: 0;
}

.record-primary {
  display: grid;
  gap: 3px;
}

.record-primary strong,
.template-text-sample {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-text-sample {
  margin: 0;
}

.record-actions {
  justify-content: flex-end;
}

.template-table-head span:last-child {
  text-align: right;
}

.compact-input {
  width: 220px;
}

.bulk-bar {
  background: #f2f7f4;
  border: 1px solid #cfe0d5;
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-bar strong {
  margin-right: 4px;
  font-size: 14px;
}

.bulk-action {
  min-height: 32px;
  border: 1px solid #cbdcd1;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
}

.bulk-action:hover {
  background: rgba(255, 255, 255, 0.56);
  border-color: #a9c7b5;
}

.bulk-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bulk-action.danger {
  color: var(--red);
  border-color: #efc5c2;
}

.bulk-action.clear {
  margin-left: auto;
}

.contact-filter-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(390px, calc(100vw - 24px));
  height: 100dvh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-right: 0;
  border-top: 0;
  border-bottom: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 14px;
  align-content: start;
  animation: slideInRight 0.16s ease-out;
}

.contact-filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(9, 17, 13, 0.22);
  animation: menuFadeIn 0.14s ease-out;
}

.filter-section {
  display: grid;
  gap: 8px;
}

.filter-section > label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.filter-info {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.filter-info svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
}

.date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.filter-save-box {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.contact-list-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.contact-list-tabs button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 9px 12px;
  font-weight: 800;
}

.contact-list-tab-wrap {
  display: inline-flex;
  align-items: stretch;
}

.contact-list-tab-wrap > button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.contact-list-tab-wrap .tab-export {
  width: 38px;
  padding: 0;
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  display: grid;
  place-items: center;
}

.contact-list-tab-wrap .tab-export svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.contact-list-tab-wrap.active button {
  background: #e4f2ea;
  border-color: #b9d6c5;
  color: var(--brand-2);
}

.import-guidelines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.smart-list-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}

.smart-list-head,
.smart-list-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.smart-list-head {
  background: #eef3ee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.smart-list-row:last-child {
  border-bottom: 0;
}

.smart-list-row.locked {
  background: #fbfdfb;
}

.import-guidelines > div,
.success-box,
.inline-warning {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8fbf9;
  display: grid;
  gap: 4px;
}

.inline-warning {
  border-color: #ead69b;
  background: #fff8df;
  color: #765a00;
  font-size: 13px;
  font-weight: 750;
}

.success-box {
  border-color: #bfe2ce;
  background: #e8f6ee;
  color: var(--brand-2);
  font-weight: 800;
}

.import-success {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding: 18px 8px 8px;
}

.success-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d8fff0;
  color: var(--brand);
}

.success-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.success-detail-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.success-detail-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbf9;
  padding: 14px;
  display: grid;
  gap: 4px;
}

.success-detail-grid strong {
  font-size: 24px;
  color: var(--brand-2);
}

.wizard-steps {
  display: flex;
  gap: 8px;
  margin: 12px 0 18px;
}

.wizard-steps span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: white;
  font-weight: 900;
}

.wizard-steps span.active,
.wizard-steps span.done {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.import-preview-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 260px;
}

.import-preview-head,
.import-preview-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 1fr);
}

.import-preview-head span,
.import-preview-row span {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview-head span {
  background: #eef3ee;
  font-weight: 850;
}

.radio-stack {
  display: grid;
  gap: 10px;
}

.radio-stack label {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: white;
  display: flex;
  gap: 10px;
}

.select-all-contacts {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.select-contact {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.select-contact input {
  margin: 0;
}

.contact-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.contact-card-head h3 {
  overflow-wrap: anywhere;
}

.contact-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.btn.icon.action-icon {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: var(--radius);
}

.btn.icon.action-icon svg {
  width: 15px;
  height: 15px;
}

.snippet-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.snippet-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.snippet-copy {
  min-width: 0;
  display: contents;
}

.snippet-copy p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.snippet-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.contact-table-head,
.template-table-head {
  padding: 10px 14px;
  background: #eef3ee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  border-bottom: 1px solid var(--line);
}

.contact-row,
.template-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.contact-row:last-child,
.template-row:last-child {
  border-bottom: 0;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.pipeline-column {
  height: min(62vh, 620px);
  min-height: 360px;
  background: #e9efea;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-rows: auto 1fr;
}

.pipeline-column.drag-over {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 90, 0.12);
}

.pipeline-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icon-link {
  border: 0;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-weight: 800;
}

.icon-link.danger {
  color: var(--red);
}

.icon-link.danger:hover {
  background: #fff1f1;
}

.icon-link.locked,
.icon-link:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.pipeline-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.settings-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 14px;
  background: white;
  min-width: 0;
}

.data-settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr));
  align-items: start;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.backup-card {
  min-height: 100%;
  overflow: hidden;
}

.backup-card .spread {
  align-items: flex-start;
  flex-wrap: wrap;
}

.backup-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.backup-option {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfdfb;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
}

.backup-option input {
  grid-row: span 2;
}

.backup-option > span {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef6f1;
  color: var(--brand);
}

.backup-option > span svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.backup-option strong,
.backup-option small {
  grid-column: 3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.backup-option small {
  color: var(--muted);
}

.backup-size {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  background: #f8faf8;
  min-width: 0;
}

.backup-size strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.backup-card .input,
.backup-card input[type="file"] {
  width: 100%;
  min-width: 0;
}

.backup-result {
  border: 1px solid #cfe4d8;
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #eef8f2;
}

.backup-result div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backup-result span {
  border-radius: 999px;
  padding: 5px 8px;
  background: white;
  font-size: 12px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e2;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.18s ease;
}

.user-manager {
  display: grid;
  gap: 10px;
}

.business-manager {
  display: grid;
  gap: 10px;
}

.user-row,
.business-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: white;
}

.business-row {
  align-items: flex-start;
}

.business-row > div:first-child {
  min-width: 0;
}

.user-main,
.profile-edit-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.role-chip {
  border: 1px solid #cfe4d8;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  color: var(--brand);
  background: #eef8f2;
  font-size: 12px;
  font-weight: 700;
}

.role-chip.off {
  color: #9a3412;
  border-color: #fed7aa;
  background: #fff7ed;
}

.role-chip svg,
.permission-tile svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.permission-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fbfdfb;
}

.permission-tile.compact {
  min-width: 0;
  padding: 8px;
  font-size: 12px;
}

.permission-tile.compact strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-tile input {
  margin: 0;
}

.permission-tile span {
  color: var(--brand);
  display: grid;
  place-items: center;
}

.row.tight {
  gap: 8px;
  flex-wrap: wrap;
}

.soft-line {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.label-manager {
  display: grid;
  gap: 10px;
}

.label-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) 72px auto auto;
  align-items: center;
  gap: 10px;
}

.color-input {
  padding: 5px;
  min-height: 40px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spread {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.spread > * {
  min-width: 0;
}

.switch {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  background: #cbd4cd;
  padding: 3px;
}

.switch::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.18s ease;
}

.switch.on {
  background: var(--brand);
}

.switch.on::before {
  transform: translateX(20px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 17, 13, 0.42);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 200;
}

.modal-backdrop:has(.automation-builder-modal) {
  padding: 0;
  background: rgba(9, 17, 13, 0.2);
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 20px;
  display: grid;
  gap: 16px;
  animation: modalFadeIn 0.16s ease-out;
}

.whatsapp-connect-modal {
  width: min(90vw, 1080px);
  max-height: min(90dvh, 760px);
  padding: 18px;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

.modal > .spread:first-child {
  position: sticky;
  top: -20px;
  z-index: 2;
  background: white;
  padding: 4px 0 10px;
}

.whatsapp-connect-modal > .spread:first-child {
  top: -18px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.automation-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbf8;
  padding: 16px;
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 10px;
  text-align: left;
  color: var(--text);
}

.choice-card:hover {
  border-color: #a9cab8;
  background: #eef7f2;
}

.choice-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #e3f2ea;
  color: var(--brand);
}

.choice-card small {
  color: var(--muted);
  line-height: 1.35;
}

.automation-builder-modal {
  width: 100vw;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  animation: none;
}

.automation-builder {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.builder-topbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.builder-title-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.builder-title-controls .input {
  width: 260px;
}

.builder-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 190px minmax(420px, 1fr) 300px;
  transition: grid-template-columns 0.18s ease;
}

.builder-layout.inspector-collapsed {
  grid-template-columns: 190px minmax(420px, 1fr) 42px;
}

.builder-palette,
.builder-inspector {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #f8faf8;
}

.builder-palette {
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 10px;
}

.builder-palette button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
  text-align: left;
}

.builder-palette button:hover {
  background: #eef7f2;
  border-color: #b7d3c3;
}

.builder-inspector {
  position: relative;
  border-left: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 12px;
}

.inspector-collapsed .builder-inspector {
  overflow: visible;
  padding: 8px;
}

.inspector-collapsed .builder-inspector > :not(.inspector-toggle) {
  display: none;
}

.inspector-toggle {
  position: absolute;
  left: -15px;
  top: 14px;
  z-index: 40;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--brand);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(35, 49, 40, 0.14);
}

.builder-label-results {
  display: grid;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.builder-label-results button {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  font-weight: 700;
}

.builder-label-results button:hover {
  background: #edf7f1;
}

.builder-selected-tags {
  margin-top: 8px;
}

.selected-builder-label {
  border-color: #b8dac7;
  background: #edf7f1;
}

.builder-condition-list {
  display: grid;
  gap: 10px;
}

.builder-condition-row {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.builder-canvas {
  position: relative;
  min-height: 0;
  overflow: hidden;
  outline: none;
  cursor: default;
  background:
    linear-gradient(#e6eee8 1px, transparent 1px),
    linear-gradient(90deg, #e6eee8 1px, transparent 1px),
    #f4f8f5;
  background-size: 24px 24px;
}

.builder-canvas.space-panning,
.builder-canvas.is-panning {
  cursor: grab;
}

.builder-canvas.is-panning {
  cursor: grabbing;
}

.builder-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 2200px;
  height: 1600px;
  transform-origin: 0 0;
}

.builder-edges {
  position: absolute;
  left: 0;
  top: 0;
  width: 2200px;
  height: 1600px;
  pointer-events: none;
}

.builder-edge {
  fill: none;
  stroke: #6c8a78;
  stroke-width: 3;
}

.builder-edge.true {
  stroke: var(--brand);
}

.builder-edge.false {
  stroke: var(--red);
}

.builder-edge.live {
  stroke: var(--amber);
  stroke-dasharray: 10 8;
  filter: drop-shadow(0 0 3px rgba(186, 125, 19, 0.35));
}

.builder-edges text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.builder-node {
  position: absolute;
  width: 250px;
  min-height: 126px;
  padding: 12px 14px;
  border: 1px solid #cddbd1;
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 12px 28px rgba(35, 49, 40, 0.1);
  display: grid;
  gap: 8px;
}

.builder-node.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 90, 0.14), 0 14px 32px rgba(35, 49, 40, 0.12);
}

.builder-node.trigger {
  background: #eff8f4;
  border-color: #98d4b4;
}

.builder-node.finish {
  background: #fff1f0;
  border-color: #efb4ae;
}

.builder-node.condition,
.builder-node.action,
.builder-node.webhook {
  background: white;
}

.builder-node.action.finish {
  background: #fff1f0;
  border-color: #efb4ae;
}

.builder-inspector .permission-grid {
  grid-template-columns: 1fr;
}

.builder-inspector .permission-tile.compact strong {
  white-space: normal;
  overflow-wrap: anywhere;
}

.builder-node-head {
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.node-type {
  text-transform: uppercase;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.builder-port {
  border: 2px solid white;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  box-shadow: 0 0 0 1px #98b8a5;
}

.builder-port.in {
  position: absolute;
  left: -8px;
  top: 66px;
  width: 16px;
  height: 16px;
  padding: 0;
}

.builder-ports-out {
  position: absolute;
  right: -14px;
  top: 56px;
  display: grid;
  gap: 18px;
}

.builder-port.out {
  width: auto;
  min-width: 28px;
  max-width: 112px;
  height: 28px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-port.out.active {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(186, 125, 19, 0.18);
}

.connect-hint {
  position: sticky;
  top: 12px;
  left: 50%;
  z-index: 4;
  width: fit-content;
  margin: 12px auto 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #fff8df;
  border: 1px solid #ecd88b;
  color: #5f4b0b;
  font-weight: 750;
}

.builder-hud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(35, 49, 40, 0.12);
}

.builder-hud span {
  min-width: 46px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.builder-minimap {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 6;
  width: 180px;
  height: 128px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(35, 49, 40, 0.12);
}

.minimap-world {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: #edf3ef;
}

.minimap-node {
  position: absolute;
  border: 0;
  border-radius: 3px;
  background: var(--brand);
  opacity: 0.78;
  padding: 0;
}

.minimap-node.condition {
  background: var(--amber);
}

.minimap-node.webhook {
  background: var(--blue);
}

.minimap-view {
  position: absolute;
  border: 2px solid #203329;
  border-radius: 4px;
  background: rgba(22, 116, 90, 0.08);
  pointer-events: none;
}

.empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

@media (max-width: 1100px) {
  .metrics-summary-grid,
  .metrics-dashboard,
  .data-settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-panel.wide {
    grid-column: span 2;
  }

  .template-builder-layout {
    grid-template-columns: 1fr;
  }

  .template-button-row {
    grid-template-columns: 1fr;
  }

  .template-preview-panel {
    order: 2;
  }

  .integration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inbox-layout {
    grid-template-columns: 310px 1fr;
  }

  .detail-pane {
    display: none;
  }
}

@media (max-width: 900px) {
  .whatsapp-connect-modal {
    width: min(94vw, 760px);
    max-height: 92dvh;
  }

  .whatsapp-connect-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .whatsapp-brand-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    padding: 16px;
  }

  .whatsapp-logo-card {
    min-height: 82px;
    font-size: 18px;
  }

  .whatsapp-connect-main {
    overflow: visible;
    padding: 22px;
  }
}

@media (max-width: 760px) {
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .login-shell,
  .app-shell,
  .onboarding,
  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .login-visual,
  .sidebar {
    display: none;
  }

  .main {
    height: 100vh;
  }

  .conversation-list {
    max-height: 34vh;
  }

  .inbox-layout {
    grid-template-rows: auto 1fr;
  }

  .toolbar,
  .contact-toolbar-actions,
  .record-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-filters,
  .metrics-summary-grid,
  .metrics-dashboard,
  .data-settings-grid,
  .backup-options,
  .backup-size,
  .metric-donut-wrap {
    grid-template-columns: 1fr;
  }

  .metric-panel.wide {
    grid-column: auto;
  }

  .template-builder-layout,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-table {
    overflow-x: auto;
  }

  .contact-table-head,
  .contact-row,
  .template-table-head,
  .template-row {
    min-width: 1040px;
  }
}
