:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --surface-strong: #eef3f0;
  --text: #18201c;
  --text-soft: #68736d;
  --text-faint: #929b96;
  --line: #e2e8e4;
  --line-strong: #d3dbd6;
  --accent: #1aa06d;
  --accent-strong: #118257;
  --accent-soft: #e5f6ee;
  --accent-ink: #0b6040;
  --danger: #c74e4e;
  --danger-soft: #fff0ef;
  --warning: #9c6d17;
  --warning-soft: #fff7df;
  --shadow: 0 18px 45px rgba(31, 48, 40, .07);
  --shadow-sm: 0 8px 24px rgba(31, 48, 40, .055);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --sidebar: 244px;
}

html[data-theme="dark"] {
  --bg: #101412;
  --surface: #171c19;
  --surface-soft: #1b211e;
  --surface-strong: #222a26;
  --text: #f3f7f5;
  --text-soft: #9eaaa4;
  --text-faint: #6f7974;
  --line: #29322d;
  --line-strong: #344038;
  --accent: #49cf98;
  --accent-strong: #5dddA6;
  --accent-soft: #17372a;
  --accent-ink: #98ebc8;
  --danger: #ef8581;
  --danger-soft: #3b2221;
  --warning: #ecc56f;
  --warning-soft: #362d1a;
  --shadow: 0 18px 45px rgba(0, 0, 0, .25);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
textarea { resize: vertical; }
[hidden] { display: none !important; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(26,160,109,.08), transparent 32%),
    radial-gradient(circle at 90% 90%, rgba(26,160,109,.05), transparent 28%),
    var(--bg);
}
.auth-brand, .brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 760;
  letter-spacing: -.02em;
}
.auth-brand { font-size: 22px; }
.brand-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: var(--text);
  color: var(--surface);
  font-weight: 850;
  letter-spacing: -.06em;
  box-shadow: var(--shadow-sm);
}
.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -.035em; }
.auth-foot { color: var(--text-faint); font-size: 13px; margin: 0; }

.eyebrow {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.muted { color: var(--text-soft); }
.stack { display: grid; gap: 16px; margin-top: 24px; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; font-weight: 680; color: var(--text); }
.field small { color: var(--text-faint); font-weight: 500; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border .16s ease, box-shadow .16s ease, background .16s ease;
}
input, select { min-height: 44px; padding: 0 13px; }
textarea { padding: 12px 13px; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  border-color: color-mix(in srgb, var(--accent) 75%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 80%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

.button {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 720;
  transition: transform .14s ease, background .14s ease, border .14s ease, opacity .14s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.button-secondary:hover { background: var(--surface-soft); }
.button-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, var(--line)); }
.button-lg { min-height: 48px; }
.full-width { width: 100%; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 30;
}
.brand { padding: 0 10px; min-height: 44px; }
.brand-name { font-size: 18px; }
.nav { display: grid; gap: 5px; margin-top: 34px; }
.nav-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-soft);
  font-weight: 650;
  text-align: left;
}
.nav-item:hover { background: var(--surface-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-icon {
  width: 24px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
}
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.soft-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
}
.user-mini {
  display: grid;
  grid-template-columns: 36px 1fr 32px;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 760;
  flex: none;
}
.user-mini-copy { min-width: 0; display: grid; }
.user-mini-copy strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-copy span { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  display: inline-grid;
  place-items: center;
}
.icon-button:hover { background: var(--surface-soft); }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  height: 84px;
  padding: 0 clamp(24px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h2 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page {
  display: none;
  padding: 10px clamp(24px, 4vw, 54px) 54px;
  animation: fadeIn .18s ease;
}
.page.active { display: block; }
@keyframes fadeIn { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}
.status-neutral { background: var(--surface-strong); color: var(--text-soft); }
.status-connected, .status-ai { background: var(--accent-soft); color: var(--accent-ink); }
.status-human { background: var(--warning-soft); color: var(--warning); }
.status-disconnected { background: var(--danger-soft); color: var(--danger); }

.hero-card {
  min-height: 220px;
  padding: clamp(28px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--accent-soft) 75%, transparent), transparent 30%),
    var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}
.hero-copy { max-width: 680px; }
.hero-copy h1 {
  max-width: 560px;
  margin: 8px 0 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -.055em;
}
.hero-copy p { max-width: 590px; margin: 0; color: var(--text-soft); font-size: 17px; }

.step-grid, .stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}
.step-card, .stat-card, .card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.step-card {
  min-height: 112px;
  padding: 18px;
  text-align: left;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 13px;
}
.step-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.step-number, .number-dot {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 800;
}
.step-card strong { display: block; margin-bottom: 3px; }
.step-card p { margin: 0; color: var(--text-soft); font-size: 13px; }
.step-state {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
}
.step-state-ready { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

.stat-card { padding: 20px; }
.stat-card span, .stat-card small { color: var(--text-soft); }
.stat-card span { font-size: 13px; font-weight: 650; }
.stat-card strong { display: block; margin: 10px 0 3px; font-size: 32px; letter-spacing: -.04em; }
.stat-card small { font-size: 12px; }

.clean-card { margin-top: 18px; padding: 26px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-head h3 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.03em; }
.flow-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
}
.flow-item { display: grid; justify-items: center; text-align: center; gap: 5px; }
.flow-item > span {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800;
}
.flow-item small { color: var(--text-soft); }
.flow-line { width: 56px; height: 1px; background: var(--line-strong); }

.section-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.section-intro h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.04em; }
.section-intro p { margin: 0; color: var(--text-soft); }
.select { background: var(--surface); }
.compact-select { width: min(260px, 100%); }

.empty-state {
  min-height: 370px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 36px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
}
.empty-state h3 { margin: 14px 0 5px; font-size: 21px; }
.empty-state p { max-width: 440px; margin: 0 0 20px; color: var(--text-soft); }
.empty-icon {
  width: 54px; height: 54px; border-radius: 17px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 25px;
}

.instance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 14px;
}
.instance-card { padding: 20px; }
.instance-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.instance-card h3 { margin: 0; font-size: 18px; }
.instance-card p { margin: 5px 0 0; color: var(--text-soft); font-size: 13px; }
.instance-meta { margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.instance-meta .button { flex: 1; }

.agent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, .65fr);
  gap: 18px;
  align-items: start;
}
.agent-form { padding: 26px; }
.form-section { display: grid; gap: 18px; }
.section-label { display: flex; align-items: flex-start; gap: 12px; }
.section-label h3 { margin: 0; font-size: 19px; }
.section-label p { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; max-width: 620px; }
.divider { height: 1px; background: var(--line); margin: 26px 0; }
.context-area { min-height: 230px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.agent-savebar {
  position: sticky;
  bottom: 14px;
  margin: 28px -10px -10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow);
}
.toggle-row { display: flex; align-items: center; gap: 11px; }
.toggle-row strong { display: block; font-size: 13px; }
.toggle-row small { color: var(--text-soft); display: block; }
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { width: 0; height: 0; opacity: 0; position: absolute; }
.switch-ui {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: .18s ease;
}
.switch-ui::after {
  content: "";
  position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.18); transition: .18s ease;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.save-actions { display: flex; align-items: center; gap: 12px; }
.save-status { color: var(--text-soft); font-size: 12px; }

.test-panel { position: sticky; top: 20px; padding: 20px; min-height: 540px; display: flex; flex-direction: column; }
.test-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.test-head h3 { margin: 5px 0 0; font-size: 20px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); margin: 7px; }
.test-messages { flex: 1; margin: 22px 0; display: flex; flex-direction: column; gap: 10px; overflow: auto; min-height: 310px; max-height: 480px; }
.bubble { max-width: 88%; padding: 11px 13px; border-radius: 15px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-ai { align-self: flex-start; background: var(--surface-strong); border-bottom-left-radius: 5px; }
.bubble-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.test-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.test-compose textarea { min-height: 46px; max-height: 100px; }

.conversation-layout {
  height: calc(100vh - 148px);
  min-height: 570px;
  display: grid;
  grid-template-columns: minmax(245px, .72fr) minmax(420px, 1.5fr) minmax(260px, .72fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.conversation-list-pane, .memory-pane { background: var(--surface); min-width: 0; }
.conversation-list-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.conversation-search { padding: 12px; border-bottom: 1px solid var(--line); }
.conversation-search input { background: var(--surface-soft); border-color: transparent; min-height: 40px; }
.conversation-list { overflow: auto; flex: 1; }
.conversation-item {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: 14px; display: grid; grid-template-columns: 38px 1fr; gap: 10px; text-align: left;
}
.conversation-item:hover, .conversation-item.active { background: var(--surface-soft); }
.conversation-copy { min-width: 0; }
.conversation-line { display: flex; justify-content: space-between; gap: 8px; }
.conversation-line strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.conversation-line time { color: var(--text-faint); font-size: 10px; white-space: nowrap; }
.conversation-preview { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--text-soft); font-size: 12px; }
.conversation-preview span:first-child { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-label.ai { color: var(--accent); }
.mode-label.human { color: var(--warning); }

.chat-pane { min-width: 0; background: var(--surface-soft); position: relative; }
.chat-placeholder { height: 100%; display: grid; place-items: center; align-content: center; text-align: center; color: var(--text-soft); }
.chat-placeholder h3 { margin: 13px 0 4px; color: var(--text); }
.chat-placeholder p { margin: 0; }
.active-chat { height: 100%; display: flex; flex-direction: column; }
.chat-head {
  min-height: 68px; padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.chat-person { min-width: 0; display: grid; flex: 1; }
.chat-person strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-person span { color: var(--text-faint); font-size: 11px; }
.chat-actions { display: flex; align-items: center; gap: 8px; }
.chat-actions .button { min-height: 36px; font-size: 12px; }
.message-list {
  flex: 1; overflow: auto; padding: 24px clamp(14px, 3vw, 34px);
  display: flex; flex-direction: column; gap: 7px;
}
.message {
  max-width: min(78%, 600px);
  padding: 9px 11px 6px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.message.inbound { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.message.outbound { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { margin-top: 4px; color: var(--text-faint); font-size: 9px; text-align: right; }
.human-notice {
  padding: 9px 14px; border-top: 1px solid color-mix(in srgb, var(--warning) 25%, var(--line));
  background: var(--warning-soft); color: var(--warning); display: flex; gap: 8px; justify-content: center; font-size: 12px;
}

.human-compose {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}
.human-compose textarea { min-height: 42px; max-height: 120px; resize: none; }
.message-media {
  display: block;
  max-width: min(100%, 360px);
  max-height: 320px;
  border-radius: 10px;
  margin-bottom: 7px;
}
.message-media.audio { width: min(320px, 100%); }
.message-file {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 650;
  margin-bottom: 6px;
}
.message-file:hover { text-decoration: underline; }
.memory-pane { border-left: 1px solid var(--line); padding: 20px; overflow: auto; }
.memory-head h3 { margin: 5px 0 5px; font-size: 18px; }
.memory-head p { color: var(--text-soft); font-size: 12px; margin: 0 0 20px; }
.memory-pane form { display: grid; gap: 14px; }
.memory-meta { display: flex; justify-content: space-between; color: var(--text-faint); font-size: 10px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12,17,14,.58);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(100%, 500px);
  max-height: 90vh;
  overflow: auto;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
  padding: 30px;
  position: relative;
}
.modal h2 { margin: 7px 0 8px; font-size: 26px; letter-spacing: -.035em; }
.modal-close {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font-size: 21px; line-height: 1;
}
.qr-step { text-align: center; }
.qr-visual {
  width: 260px; height: 260px; margin: 24px auto 14px;
  border: 1px solid var(--line); border-radius: 18px; background: #fff;
  display: grid; place-items: center; overflow: hidden; padding: 12px;
}
.qr-visual img { width: 100%; height: 100%; object-fit: contain; }
.pairing-code {
  margin: 12px auto; padding: 12px 16px; border-radius: 12px;
  background: var(--surface-strong); font-size: 22px; letter-spacing: .14em; font-weight: 800;
}
.qr-status { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--text-soft); font-size: 13px; }
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; z-index: 200; right: 20px; bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px; border-radius: 12px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: .2s ease; font-size: 13px;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); color: #fff; }

.mobile-nav { display: none; }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar: 210px; }
  .agent-layout { grid-template-columns: 1fr; }
  .test-panel { position: static; min-height: 460px; }
  .conversation-layout { grid-template-columns: 260px 1fr; }
  .memory-pane { display: none; }
}

@media (max-width: 860px) {
  body { padding-bottom: 68px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { height: 70px; padding: 0 18px; }
  .page { padding: 8px 16px 28px; }
  .mobile-nav {
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    height: 66px; padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(4,1fr);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  }
  .mobile-nav-item {
    border: 0; background: transparent; display: grid; place-items: center; align-content: center; gap: 2px;
    color: var(--text-faint);
  }
  .mobile-nav-item span { font-size: 18px; }
  .mobile-nav-item small { font-size: 10px; font-weight: 650; }
  .mobile-nav-item.active { color: var(--accent); }
  .mobile-only { display: inline-grid; }
  .hero-card { min-height: 280px; display: grid; align-content: end; }
  .hero-copy h1 { font-size: 42px; }
  .step-grid, .stats-grid { grid-template-columns: 1fr; }
  .flow-row { grid-template-columns: 1fr; gap: 9px; }
  .flow-line { width: 1px; height: 26px; }
  .section-intro { align-items: stretch; flex-direction: column; }
  .compact-select { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .agent-savebar { align-items: stretch; flex-direction: column; }
  .save-actions { justify-content: flex-end; }
  .conversation-layout { height: calc(100vh - 162px); min-height: 530px; grid-template-columns: 1fr; }
  .conversation-list-pane { border-right: 0; }
  .chat-pane { display: none; }
  .conversation-layout.chat-open .conversation-list-pane { display: none; }
  .conversation-layout.chat-open .chat-pane { display: block; }
  .chat-actions .status-pill { display: none; }
  .chat-actions .button { padding: 0 10px; }
}

@media (max-width: 560px) {
  .auth-card { padding: 26px 20px; }
  .hero-card { padding: 26px 22px; }
  .hero-copy h1 { font-size: 35px; }
  .hero-copy p { font-size: 15px; }
  .step-card { grid-template-columns: 34px 1fr; }
  .step-state { grid-column: 2; justify-self: start; }
  .agent-form, .test-panel { padding: 18px; }
  .agent-savebar { position: static; margin: 24px 0 0; }
  .toggle-row { align-items: flex-start; }
  .save-actions { flex-direction: column; align-items: stretch; }
  .modal { padding: 25px 18px; }
  .qr-visual { width: 230px; height: 230px; }
  .human-notice { flex-direction: column; text-align: center; }
}

/* Stage 11: compact agent summary, natural messages and topic triggers */
.agent-main-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.agent-summary-card {
  padding: 24px;
}
.summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.summary-top h3 {
  margin: 5px 0 0;
  font-size: 24px;
  letter-spacing: -.035em;
}
.summary-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.summary-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}
.summary-context {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  margin-bottom: 16px;
}
.summary-context strong {
  display: block;
  font-size: 13px;
  color: var(--accent-ink);
  margin-bottom: 5px;
}
.summary-context p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.topics-card {
  padding: 24px;
}
.topics-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.topics-head h3 {
  margin: 5px 0 4px;
  font-size: 20px;
  letter-spacing: -.03em;
}
.topics-head p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}
.topics-empty {
  margin-top: 18px;
  min-height: 110px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  text-align: center;
  color: var(--text-soft);
  padding: 18px;
}
.topics-empty strong {
  color: var(--text);
}
.topics-empty span {
  font-size: 12px;
}
.topics-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.topic-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topic-card-copy {
  min-width: 0;
  flex: 1;
}
.topic-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topic-card-title strong {
  font-size: 14px;
}
.topic-meta {
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  margin-top: 5px;
}
.topic-card p {
  color: var(--text-soft);
  font-size: 12px;
  margin: 7px 0 0;
}
.topic-card-actions {
  display: flex;
  gap: 7px;
  flex: none;
}
.topic-card-actions .button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 11px;
}
.topic-editor {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: grid;
  gap: 16px;
}
.topic-editor-head,
.trigger-head,
.topic-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topic-editor-head h4 {
  margin: 4px 0 0;
  font-size: 18px;
}
.toggle-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 700;
}
.trigger-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-soft);
}
.trigger-head {
  align-items: flex-start;
}
.trigger-head strong {
  display: block;
  font-size: 13px;
}
.trigger-head small {
  display: block;
  max-width: 510px;
  color: var(--text-soft);
  margin-top: 3px;
}
.trigger-head .button {
  min-height: 34px;
  white-space: nowrap;
}
.trigger-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.trigger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px 34px;
  gap: 7px;
  align-items: center;
}
.trigger-row input,
.trigger-row select {
  min-height: 40px;
}
.trigger-remove {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 20px;
  display: grid;
  place-items: center;
}
.trigger-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.topic-actions {
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .topics-head,
  .topic-card,
  .topic-editor-head,
  .trigger-head {
    align-items: stretch;
    flex-direction: column;
  }
  .topic-card-actions {
    width: 100%;
  }
  .topic-card-actions .button {
    flex: 1;
  }
  .trigger-row {
    grid-template-columns: minmax(0, 1fr) 105px 34px;
  }
}

@media (max-width: 520px) {
  .agent-summary-card,
  .topics-card {
    padding: 18px;
  }
  .summary-top {
    flex-direction: column;
  }
  .trigger-row {
    grid-template-columns: 1fr 88px 32px;
  }
  .trigger-row input,
  .trigger-row select {
    padding-left: 9px;
    padding-right: 9px;
    font-size: 12px;
  }
}
.summary-context strong.incomplete {
  color: var(--warning);
}

/* Test chat: mirrors WhatsApp-like typing between AI bubbles */
.typing-bubble {
  min-width: 58px;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-top: 13px;
  padding-bottom: 13px;
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: .35;
  animation: zgTyping 1.05s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) {
  animation-delay: .14s;
}
.typing-bubble span:nth-child(3) {
  animation-delay: .28s;
}
@keyframes zgTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .32; }
  30% { transform: translateY(-3px); opacity: .82; }
}

/* Conversation workspace UX + GENIUSZAP brand polish */
.brand-mark-logo {
  overflow: visible;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.brand-mark-logo .brand-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}
.brand-image-dark {
  display: none !important;
}
html[data-theme="dark"] .brand-image-light {
  display: none !important;
}
html[data-theme="dark"] .brand-image-dark {
  display: block !important;
}
.auth-brand .brand-mark {
  width: 48px;
  height: 48px;
}
.brand .brand-mark {
  width: 46px;
  height: 46px;
}
.brand-mark-logo .brand-image {
  transform: scale(1.12);
  transform-origin: center;
}
.brand-name,
.auth-brand > span:last-child {
  letter-spacing: -.03em;
  font-weight: 800;
}
.nav-icon svg,
.mobile-nav-icon svg,
.icon-button svg,
.compose-send svg,
.conversation-search-box svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-icon {
  width: 26px;
  height: 26px;
}
.nav-icon svg {
  width: 19px;
  height: 19px;
}
.nav-item.active .nav-icon {
  color: var(--accent);
}
.mobile-nav-icon {
  display: inline-grid;
  place-items: center;
}
.mobile-nav-icon svg {
  width: 19px;
  height: 19px;
}

#conversationsPage.active {
  min-height: calc(100dvh - 84px);
}
.conversation-layout {
  height: calc(100dvh - 166px);
  max-height: calc(100dvh - 166px);
  min-height: 500px;
}
.conversation-list-pane,
.chat-pane,
.memory-pane,
.active-chat {
  min-height: 0;
}
.chat-pane {
  overflow: hidden;
}
.active-chat {
  overflow: hidden;
}
.message-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}
.conversation-list {
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.memory-pane {
  min-height: 0;
}

.conversation-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
  align-items: center;
}
.conversation-search-box {
  position: relative;
}
.conversation-search-box svg {
  position: absolute;
  width: 16px;
  height: 16px;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.conversation-search-box input {
  padding-left: 36px;
}
.conversation-view-filter {
  min-height: 40px;
  padding: 0 9px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--surface-soft);
  border-color: transparent;
}
.conversation-item {
  position: relative;
}
.conversation-item.pinned::after {
  content: "⌁";
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 12px;
  color: var(--text-faint);
  transform: rotate(45deg);
}
.conversation-item.unread {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
.conversation-item.unread .conversation-line strong {
  font-weight: 820;
}
.conversation-item.unread .conversation-line time {
  color: var(--accent);
  font-weight: 760;
}

.chat-head {
  position: relative;
  z-index: 12;
}
.chat-actions {
  flex-wrap: nowrap;
}
.chat-menu-wrap {
  position: relative;
}
.chat-menu-button {
  width: 38px;
  height: 38px;
}
.chat-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 90;
  width: 220px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.chat-menu button {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 12px;
  font-weight: 620;
}
.chat-menu button:hover {
  background: var(--surface-soft);
}
.chat-menu button.danger {
  color: var(--danger);
}
.chat-menu-separator {
  height: 1px;
  background: var(--line);
  margin: 5px 4px;
}

.message {
  position: relative;
}
.message.deleted {
  opacity: .74;
  font-style: italic;
}
.message.edited .message-meta::before {
  content: "editada · ";
}
.message-actions {
  position: absolute;
  top: -12px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(3px);
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}
.message.inbound .message-actions {
  left: 8px;
  right: auto;
}
.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.message-action {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  display: inline-grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}
.message-action:hover {
  color: var(--text);
  background: var(--surface-strong);
}
.message-action.danger:hover {
  color: var(--danger);
}

.human-notice {
  flex: none;
}
.human-compose {
  flex: none;
  padding: 10px 14px;
  grid-template-columns: 40px 40px minmax(0, 1fr) 44px;
  align-items: end;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
}
.compose-input-wrap {
  display: grid;
  gap: 4px;
}
.compose-input-wrap textarea {
  min-height: 44px;
  max-height: 132px;
  border-radius: 14px;
  background: var(--surface-soft);
  resize: none;
}
.compose-input-wrap small {
  padding-left: 4px;
  color: var(--text-faint);
  font-size: 9px;
}
.compose-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  transition: transform .15s ease, background .15s ease;
}
.compose-send:hover {
  background: var(--accent-strong);
  transform: scale(1.03);
}
.compose-send:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.compose-send svg {
  width: 19px;
  height: 19px;
}

@media (max-width: 1180px) {
  .conversation-layout {
    height: calc(100dvh - 166px);
    max-height: calc(100dvh - 166px);
  }
  .chat-topic-badge {
    display: none;
  }
}

@media (max-width: 860px) {
  #conversationsPage.active {
    min-height: calc(100dvh - 70px);
  }
  .conversation-layout {
    height: calc(100dvh - 176px);
    max-height: calc(100dvh - 176px);
    min-height: 0;
  }
  .conversation-search {
    grid-template-columns: minmax(0, 1fr) 104px;
  }
  .chat-actions {
    gap: 5px;
  }
  .chat-actions .button {
    min-height: 34px;
  }
  .chat-menu {
    width: min(220px, calc(100vw - 30px));
  }
  .message {
    max-width: 86%;
  }
}

@media (max-width: 560px) {
  .conversation-search {
    grid-template-columns: 1fr;
  }
  .conversation-view-filter {
    width: 100%;
  }
  .compose-input-wrap small {
    display: none;
  }
}

.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface-strong);
}
.reply-preview > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.reply-preview strong {
  color: var(--accent-ink);
  font-size: 11px;
}
.reply-preview span {
  color: var(--text-soft);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-preview button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 20px;
  line-height: 1;
  padding: 2px 5px;
}
.mode-label.blocked {
  color: var(--danger);
}

.compose-attach {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  align-self: center;
  background: transparent;
  color: var(--text-soft);
}
.compose-attach:hover {
  background: var(--surface-strong);
  color: var(--text);
}
.compose-attach:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.compose-attach svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Conversations viewport: header/composer fixed, messages own the scroll */
#conversationsPage.active {
  height: calc(100dvh - 84px);
  min-height: 0;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#conversationsPage.active > .section-intro {
  flex: none;
}
#conversationsPage.active > .empty-state {
  flex: 1;
  min-height: 0;
}
#conversationsPage.active > .conversation-layout {
  flex: 1;
  height: auto;
  max-height: none;
  min-height: 0;
}
.conversation-layout,
.conversation-list-pane,
.chat-pane,
.active-chat,
.memory-pane {
  min-height: 0;
}
.conversation-list-pane,
.chat-pane,
.active-chat {
  overflow: hidden;
}
.conversation-list,
.message-list,
.memory-pane {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.chat-head,
.human-notice,
.human-compose {
  flex: none;
}
.message-list {
  flex: 1 1 auto;
}

@media (max-width: 860px) {
  #conversationsPage.active {
    height: calc(100dvh - 70px - 66px);
    padding-bottom: 10px;
  }
  #conversationsPage.active > .conversation-layout {
    height: auto;
    max-height: none;
  }
}


.chat-search-bar {
  flex: none;
  min-height: 52px;
  padding: 7px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px 34px 34px;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chat-search-input {
  position: relative;
}
.chat-search-input svg {
  position: absolute;
  width: 16px;
  height: 16px;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  color: var(--text-faint);
  pointer-events: none;
}
.chat-search-input input {
  min-height: 38px;
  padding-left: 36px;
  background: var(--surface-soft);
  border-color: transparent;
}
.chat-search-count {
  min-width: 44px;
  text-align: center;
  color: var(--text-faint);
  font-size: 10px;
}
.message.search-match {
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.message.search-current {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-soft) 70%, transparent);
}

.compose-tool-wrap {
  position: relative;
  align-self: center;
}
.emoji-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 95;
  width: 220px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0,0,0,.2);
}
.emoji-picker button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 18px;
}
.emoji-picker button:hover {
  background: var(--surface-strong);
}
@media (max-width: 560px) {
  .chat-search-bar {
    grid-template-columns: minmax(0, 1fr) auto 32px 32px 32px;
  }
  .human-compose {
    grid-template-columns: 36px 36px minmax(0, 1fr) 42px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .compose-attach {
    width: 36px;
    height: 36px;
  }
}

/* Product intelligence */
.test-product-field {
  margin: 14px 0 12px;
}
.test-product-field select {
  min-height: 40px;
}
.topic-editor #topicContext {
  min-height: 190px;
  resize: vertical;
}
.topic-editor #topicRules {
  min-height: 108px;
  resize: vertical;
}

/* Instance-centered AI + account-level products/services */
.step-grid { grid-template-columns: repeat(4, 1fr); }
.stats-grid { grid-template-columns: repeat(3, 1fr); }

.instance-ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.instance-ai-summary {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  display: grid;
  gap: 4px;
}
.instance-ai-summary strong {
  font-size: 12px;
  line-height: 1.4;
}
.instance-ai-summary span {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.4;
}
.instance-meta {
  flex-wrap: wrap;
}
.instance-meta .button {
  min-width: 100px;
}

.product-account-list {
  margin-top: 0;
}
.product-account-card {
  margin-bottom: 10px;
}
.product-editor {
  margin-top: 18px;
  padding: 24px;
  border-top: 1px solid var(--line);
}
.product-bindings-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-soft);
}
.product-bindings-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.product-binding-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.product-binding-head {
  min-height: 62px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.product-binding-select {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  cursor: pointer;
}
.product-binding-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
}
.product-binding-select > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.product-binding-select strong {
  font-size: 13px;
}
.product-binding-select small,
.binding-trigger-head small {
  color: var(--text-soft);
  font-size: 11px;
}
.product-binding-body {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}
.binding-trigger-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.binding-trigger-head > div {
  display: grid;
  gap: 3px;
}
.binding-trigger-head strong {
  font-size: 12px;
}
.binding-trigger-head .button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}
.product-editor .topic-actions {
  padding-top: 2px;
}

@media (max-width: 1180px) {
  .step-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .step-grid, .stats-grid { grid-template-columns: 1fr; }
  .instance-ai-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .instance-ai-actions .compact-select { width: 100%; }
  .product-binding-head,
  .binding-trigger-head {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Refined navigation icon family */
.nav-icon,
.mobile-nav-icon {
  flex: none;
  color: currentColor;
}
.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
}
.nav-item:hover .nav-icon {
  background: color-mix(in srgb, currentColor 7%, transparent);
  transform: translateY(-1px);
}
.nav-item.active .nav-icon {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.mobile-nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.mobile-nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
}
.mobile-nav-item.active .mobile-nav-icon {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translateY(-1px);
}
#logoutButton svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.75;
}

/* Product webhook recovery */
.product-webhook-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 18px;
  display: grid;
  gap: 14px;
}
.product-webhook-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.product-webhook-heading > div {
  display: grid;
  gap: 4px;
}
.product-webhook-heading > div > strong {
  font-size: 16px;
}
.product-webhook-heading small,
.product-webhook-unsaved,
.product-webhook-card-title small,
.product-webhook-settings small,
.product-webhook-event-grid + small {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}
.product-webhook-unsaved,
.product-webhook-empty,
.product-webhook-loading {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
}
.product-webhook-empty {
  display: grid;
  gap: 4px;
}
.product-webhook-empty strong {
  color: var(--text);
  font-size: 13px;
}
.product-webhook-create {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px;
  background: var(--surface);
  margin-bottom: 12px;
}
.webhook-create-grid {
  grid-template-columns: 1.2fr .8fr 1fr;
}
.product-webhook-create-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.product-webhook-list {
  display: grid;
  gap: 12px;
}
.product-webhook-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.product-webhook-card-head {
  padding: 15px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.product-webhook-card-title {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 9px;
  min-width: 0;
}
.product-webhook-card-title strong {
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-webhook-card-title small {
  grid-column: 2;
}
.webhook-platform-badge {
  grid-row: 1 / span 2;
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  height: 30px;
  padding: 0 9px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.product-webhook-url {
  padding: 14px 16px;
  display: grid;
  gap: 7px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.product-webhook-url > span {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}
.product-webhook-url > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.product-webhook-url input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.product-webhook-settings {
  padding: 16px;
  display: grid;
  gap: 14px;
}
.product-webhook-events {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  background: var(--surface-soft);
  display: grid;
  gap: 10px;
}
.product-webhook-events > div:first-child {
  display: grid;
  gap: 3px;
}
.product-webhook-events > div:first-child strong {
  font-size: 12px;
}
.product-webhook-event-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.product-webhook-event-check {
  margin: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.product-webhook-event-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: none;
}
.product-webhook-event-check span {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}
.product-webhook-active {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.product-webhook-active input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.product-webhook-active > span {
  margin: 0;
  display: grid;
  gap: 2px;
}
.product-webhook-active strong {
  font-size: 12px;
}
.product-webhook-active small {
  display: block;
}
.product-webhook-platform-note {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10px;
  line-height: 1.5;
}
.product-webhook-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.product-webhook-history {
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
}
.product-webhook-history-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 9px;
}
.product-webhook-history-head strong {
  font-size: 12px;
}
.product-webhook-history-head span {
  color: var(--text-soft);
  font-size: 10px;
}
.product-webhook-history-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.product-webhook-history-row:first-child {
  border-top: 0;
}
.product-webhook-history-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.product-webhook-history-row strong {
  font-size: 11px;
}
.product-webhook-history-row small {
  color: var(--text-soft);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-webhook-history-row time {
  color: var(--text-faint);
  font-size: 9px;
  white-space: nowrap;
}
.webhook-history-status {
  border-radius: 999px;
  padding: 4px 7px;
  text-align: center;
  font-size: 9px;
  font-weight: 750;
  background: var(--surface-strong);
  color: var(--text-soft);
}
.webhook-history-status.succeeded {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.webhook-history-status.failed {
  background: var(--danger-soft);
  color: var(--danger);
}
.webhook-history-status.ignored {
  background: var(--warning-soft);
  color: var(--warning);
}
.product-webhook-history-empty {
  padding: 8px 0 2px;
  color: var(--text-faint);
  font-size: 10px;
}

@media (max-width: 860px) {
  .product-webhook-heading,
  .product-webhook-card-head {
    flex-direction: column;
    align-items: stretch;
  }
  .product-webhook-heading .button {
    width: 100%;
  }
  .webhook-create-grid,
  .product-webhook-event-grid {
    grid-template-columns: 1fr;
  }
  .product-webhook-url > div {
    grid-template-columns: 1fr;
  }
  .product-webhook-url .button {
    width: 100%;
  }
  .product-webhook-history-row {
    grid-template-columns: 70px minmax(0, 1fr);
  }
  .product-webhook-history-row time {
    grid-column: 2;
  }
  .product-webhook-settings-actions {
    flex-direction: column-reverse;
  }
  .product-webhook-settings-actions .button {
    width: 100%;
  }
}

/* SUPER ADMIN */
.status-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.password-change-logout {
  width: 100%;
  margin-top: 10px;
}
.super-admin-nav {
  margin-top: 10px;
}
.super-admin-intro {
  margin-bottom: 18px;
}
.super-admin-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.super-admin-stats .stat-card {
  min-width: 0;
}
.super-admin-stats .stat-card strong {
  font-size: 25px;
}
.token-stat {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.super-admin-create {
  padding: 20px;
  margin-bottom: 18px;
}
.super-admin-create-grid {
  grid-template-columns: 1.15fr 1.15fr 1fr .7fr;
}
.super-admin-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.super-admin-clients {
  display: grid;
  gap: 12px;
}
.super-admin-client {
  padding: 0;
  overflow: hidden;
}
.super-admin-client-head {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}
.super-admin-client-identity {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.super-admin-client-identity > strong {
  font-size: 16px;
}
.super-admin-client-identity > span {
  color: var(--text-soft);
  font-size: 12px;
}
.super-admin-client-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
}
.super-admin-validity {
  display: grid;
  gap: 2px;
  text-align: right;
  flex: none;
}
.super-admin-validity span,
.super-admin-validity small {
  color: var(--text-soft);
  font-size: 10px;
}
.super-admin-validity strong {
  font-size: 14px;
}
.super-admin-resource-grid {
  padding: 14px 20px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.super-admin-metric {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.super-admin-metric span {
  color: var(--text-soft);
  font-size: 10px;
}
.super-admin-metric strong {
  font-size: 16px;
}
.super-admin-metric small {
  color: var(--text-faint);
  font-size: 9px;
}
.super-admin-token-panel {
  padding: 16px 20px;
  display: grid;
  gap: 12px;
}
.super-admin-token-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.super-admin-token-head > div {
  display: grid;
  gap: 3px;
}
.super-admin-token-head > div strong {
  font-size: 13px;
}
.super-admin-token-head small {
  color: var(--text-soft);
  font-size: 10px;
}
.super-admin-token-total {
  color: var(--accent);
  font-size: 15px;
  white-space: nowrap;
}
.super-admin-token-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.super-admin-client-actions {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.super-admin-last-login {
  color: var(--text-faint);
  font-size: 10px;
}
.super-admin-client-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-renew-cycle {
  width: 110px;
  min-height: 38px;
}

@media (max-width: 1280px) {
  .super-admin-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .super-admin-create-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .super-admin-user .mobile-nav {
    grid-template-columns: repeat(5, 1fr);
  }
  .super-admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .super-admin-create-grid,
  .super-admin-resource-grid,
  .super-admin-token-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .super-admin-client-head,
  .super-admin-client-actions,
  .super-admin-token-head {
    flex-direction: column;
    align-items: stretch;
  }
  .super-admin-validity {
    text-align: left;
  }
  .super-admin-client-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .admin-renew-cycle {
    width: 100%;
    grid-column: 1 / -1;
  }
}
@media (max-width: 560px) {
  .super-admin-stats,
  .super-admin-create-grid,
  .super-admin-resource-grid,
  .super-admin-token-grid {
    grid-template-columns: 1fr 1fr;
  }
  .super-admin-client-controls {
    grid-template-columns: 1fr;
  }
  .admin-renew-cycle {
    grid-column: auto;
  }
  .super-admin-client-controls .button {
    width: 100%;
  }
}

/* Ready Funnels + per-conversation AI control */
.conversation-ai-note {
  display: grid;
  gap: 3px;
  color: var(--text);
}
.conversation-ai-note strong { font-size: 12px; }
.conversation-ai-note small { color: var(--text-soft); font-size: 10px; }

.ready-funnel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}
.ready-funnel-toolbar .compact-field { width: min(360px, 100%); }
.ready-funnel-help {
  display: grid;
  gap: 2px;
  max-width: 460px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.ready-funnel-help strong { font-size: 11px; }
.ready-funnel-help span { color: var(--text-soft); font-size: 10px; line-height: 1.45; }

.ready-funnel-list { display: grid; gap: 10px; }
.ready-funnel-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
}
.ready-funnel-card-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.ready-funnel-card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.ready-funnel-card-title > strong { font-size: 14px; }
.ready-funnel-product {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.ready-funnel-card-copy > small {
  color: var(--text-soft);
  font-size: 10px;
}
.ready-funnel-card-actions { display: flex; gap: 8px; flex: none; }

.ready-funnel-editor {
  margin-top: 18px;
  padding: 22px;
  display: grid;
  gap: 16px;
}
.ready-funnel-variables {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-size: 10px;
}
.ready-funnel-variables code {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 10px;
}
.ready-funnel-steps-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 15px;
}
.ready-funnel-steps-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.ready-funnel-steps-head > div:first-child { display: grid; gap: 3px; }
.ready-funnel-steps-head strong { font-size: 12px; }
.ready-funnel-steps-head small { color: var(--text-soft); font-size: 10px; }
.ready-funnel-add-control { display: flex; gap: 7px; }
.ready-funnel-add-control select {
  min-height: 36px;
  min-width: 120px;
  padding: 0 9px;
}
.ready-funnel-add-control .button { min-height: 36px; padding: 0 11px; }

.ready-funnel-steps { display: grid; gap: 9px; }
.ready-funnel-step {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  overflow: hidden;
}
.ready-funnel-step-head {
  min-height: 45px;
  padding: 8px 10px 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.ready-funnel-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ready-funnel-step-number {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
}
.ready-funnel-step-title strong { font-size: 11px; }
.ready-funnel-step-controls { display: flex; gap: 4px; }
.ready-funnel-step-controls .icon-button { width: 29px; height: 29px; }
.ready-funnel-step-body { padding: 12px; }
.ready-funnel-step-body textarea { width: 100%; resize: vertical; }
.funnel-delay-field { max-width: 280px; }
.ready-funnel-file {
  display: block;
  cursor: pointer;
}
.ready-funnel-file input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ready-funnel-file-picker {
  min-height: 54px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  display: grid;
  gap: 2px;
}
.ready-funnel-file-picker strong { font-size: 11px; }
.ready-funnel-file-picker small { color: var(--text-soft); font-size: 9px; }

.conversation-funnels-panel {
  flex: none;
  max-height: min(52%, 430px);
  overflow: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -10px 32px rgba(0,0,0,.06);
}
.conversation-funnels-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.conversation-funnels-head > div { display: grid; gap: 2px; }
.conversation-funnels-head strong { font-size: 13px; }
.conversation-funnels-head small { color: var(--text-soft); font-size: 10px; }
.conversation-funnels-notice,
.conversation-funnel-running {
  margin: 10px 12px 0;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.45;
}
.conversation-funnels-notice {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text-soft);
}
.conversation-funnel-running {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}
.conversation-funnels-list {
  display: grid;
  gap: 7px;
  padding: 10px 12px 13px;
}
.conversation-funnel-card {
  width: 100%;
  min-height: 54px;
  padding: 10px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}
.conversation-funnel-card:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.conversation-funnel-card:disabled { opacity: .55; cursor: not-allowed; }
.conversation-funnel-card > span:first-child { display: grid; gap: 2px; min-width: 0; }
.conversation-funnel-card strong { font-size: 11px; }
.conversation-funnel-card small { color: var(--text-soft); font-size: 9px; }
.conversation-funnel-send {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  flex: none;
}
.conversation-funnels-empty {
  padding: 12px;
  color: var(--text-soft);
  font-size: 10px;
  text-align: center;
}
.funnel-compose-button { color: var(--accent); }
.human-compose {
  grid-template-columns: 40px 40px 40px minmax(0, 1fr) 44px;
}

@media (max-width: 860px) {
  .mobile-nav { grid-template-columns: repeat(5, 1fr); }
  .super-admin-user .mobile-nav { grid-template-columns: repeat(6, 1fr); }
  .ready-funnel-toolbar,
  .ready-funnel-card,
  .ready-funnel-steps-head {
    flex-direction: column;
    align-items: stretch;
  }
  .ready-funnel-card-actions,
  .ready-funnel-add-control { width: 100%; }
  .ready-funnel-card-actions .button,
  .ready-funnel-add-control .button,
  .ready-funnel-add-control select { flex: 1; }
  .conversation-funnels-panel { max-height: 58%; }
}

/* Conversation product selector + WhatsApp delivery states */
.chat-product-control {
  min-width: 190px;
  display: grid;
  gap: 3px;
}
.chat-product-control > span {
  color: var(--text-faint);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.chat-product-control select {
  width: 100%;
  min-height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}
.chat-product-control select.has-product {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 52%, var(--surface));
}
.chat-product-control select:disabled {
  opacity: .68;
  cursor: wait;
}

.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}
.message-status {
  display: inline-block;
  min-width: 11px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -1.6px;
  color: var(--text-faint);
  user-select: none;
}
.message-status.read {
  color: #53bdeb;
}
.message-status.pending {
  letter-spacing: 0;
  font-size: 10px;
}

@media (max-width: 860px) {
  .chat-product-control {
    min-width: 132px;
    max-width: 150px;
  }
  .chat-product-control > span {
    display: none;
  }
  .chat-product-control select {
    min-height: 34px;
    font-size: 10px;
    padding-left: 8px;
  }
}

/* Composer alignment refinement */
.human-compose {
  align-items: center;
  padding: 12px 14px 20px;
  column-gap: 8px;
}
.compose-input-wrap {
  position: relative;
  align-self: center;
}
.compose-input-wrap textarea {
  min-height: 46px;
  height: 46px;
  padding: 12px 14px;
  line-height: 20px;
  border-radius: 15px;
}
.compose-input-wrap small {
  position: absolute;
  left: 4px;
  top: calc(100% + 4px);
  margin: 0;
  line-height: 1;
}
.compose-attach,
.compose-tool-wrap,
.compose-send {
  align-self: center;
}
.compose-attach {
  width: 40px;
  height: 40px;
}
.compose-send {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 22%, transparent);
}
.compose-send:hover {
  transform: translateY(-1px);
}
.compose-send:active {
  transform: translateY(0) scale(.97);
}
.compose-send svg {
  width: 18px;
  height: 18px;
  transform: translateX(1px);
}

/* Product knowledge base */
.product-knowledge-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  display: grid;
  gap: 16px;
}
.product-knowledge-heading > div {
  display: grid;
  gap: 4px;
}
.product-knowledge-heading strong {
  font-size: 16px;
}
.product-knowledge-heading small,
.knowledge-add-card small,
.knowledge-processing-note span {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
}
.knowledge-manual-field {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.product-knowledge-unsaved,
.knowledge-sources-empty,
.knowledge-loading {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 11px;
  text-align: center;
}
.product-knowledge-content {
  display: grid;
  gap: 14px;
}
.knowledge-add-grid {
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 10px;
}
.knowledge-add-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  display: grid;
  gap: 10px;
}
.knowledge-add-card > div:first-child {
  display: grid;
  gap: 3px;
}
.knowledge-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.knowledge-url-row input {
  min-width: 0;
}
.knowledge-processing-note {
  display: flex;
  gap: 5px;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 44%, var(--surface));
  font-size: 10px;
}
.knowledge-sources-list {
  display: grid;
  gap: 9px;
}
.knowledge-source-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  display: grid;
  gap: 10px;
}
.knowledge-source-card.is-disabled {
  opacity: .68;
}
.knowledge-source-head,
.knowledge-source-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.knowledge-source-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.knowledge-source-identity strong {
  overflow-wrap: anywhere;
}
.knowledge-source-identity span,
.knowledge-source-footer > span {
  color: var(--text-faint);
  font-size: 9px;
}
.knowledge-source-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.55;
}
.knowledge-topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.knowledge-topic-list span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 9px;
  background: var(--surface-soft);
}
.knowledge-conflict,
.knowledge-source-error {
  padding: 9px 10px;
  border-radius: 9px;
  display: grid;
  gap: 3px;
  font-size: 10px;
}
.knowledge-conflict {
  border: 1px solid color-mix(in srgb, var(--warning) 36%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}
.knowledge-source-error {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  color: var(--danger);
}
.knowledge-coverage {
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent-soft) 28%, var(--surface));
  display: grid;
  gap: 3px;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
}
.knowledge-coverage strong {
  color: var(--text);
  font-size: 9px;
  letter-spacing: .02em;
}
.knowledge-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.danger-soft {
  color: var(--danger);
}

@media (max-width: 860px) {
  .knowledge-add-grid {
    grid-template-columns: 1fr;
  }
  .knowledge-url-row {
    grid-template-columns: 1fr;
  }
  .knowledge-source-head,
  .knowledge-source-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .knowledge-source-actions {
    justify-content: flex-start;
  }
}

/* CRM Kanban */
#crmPage.active {
  max-width: none;
}
.crm-intro {
  margin-bottom: 12px;
}
.crm-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.crm-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 11px;
}
.crm-summary strong {
  color: var(--text);
  font-size: 11px;
}
.crm-board {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 520px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 14px;
  scrollbar-width: thin;
}
.crm-column {
  flex: 0 0 294px;
  width: 294px;
  max-height: calc(100dvh - 210px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
  overflow: hidden;
}
.crm-column-head {
  min-height: 52px;
  padding: 10px 10px 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.crm-column-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
.crm-column-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.crm-column-identity span {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 750;
}
.crm-column-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.crm-column-tool {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.crm-column-tool:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--text);
}
.crm-column-tool:disabled {
  opacity: .28;
  cursor: default;
}
.crm-column-cards {
  flex: 1;
  min-height: 130px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.crm-column-cards.is-drag-over {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
.crm-card {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 5%, transparent);
  cursor: grab;
  outline: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.crm-card:hover,
.crm-card:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 7px 18px color-mix(in srgb, var(--text) 8%, transparent);
}
.crm-card.is-dragging {
  opacity: .42;
  transform: rotate(1deg) scale(.98);
  cursor: grabbing;
}
.crm-card > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.crm-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--text-faint);
  font-size: 9px;
}
.crm-card-value {
  color: var(--accent);
  font-weight: 750;
}
.crm-card p {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.crm-add-card-inline {
  width: calc(100% - 18px);
  margin: 0 9px 9px;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
}
.crm-add-card-inline:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.crm-card-modal {
  width: min(620px, calc(100vw - 28px));
  max-height: min(88dvh, 760px);
  overflow-y: auto;
}
.crm-history-wrap {
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.crm-history-wrap > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
}
.crm-history {
  max-height: 190px;
  display: grid;
  gap: 6px;
  overflow-y: auto;
}
.crm-history-row {
  padding: 8px 9px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-radius: 9px;
  background: var(--surface-soft);
}
.crm-history-row strong {
  font-size: 10px;
  font-weight: 650;
}
.crm-history-row span {
  flex: none;
  color: var(--text-faint);
  font-size: 9px;
}
.crm-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crm-modal-spacer {
  flex: 1;
}

@media (max-width: 860px) {
  .mobile-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .super-admin-user .mobile-nav {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .mobile-nav-item small {
    font-size: 8.5px;
  }
  .crm-top-actions {
    width: 100%;
  }
  .crm-top-actions .button {
    flex: 1;
  }
  .crm-board {
    min-height: calc(100dvh - 230px);
    margin-right: -16px;
    width: calc(100% + 16px);
    padding-right: 16px;
  }
  .crm-column {
    flex-basis: 276px;
    width: 276px;
    max-height: calc(100dvh - 228px);
  }
  .crm-modal-actions {
    flex-wrap: wrap;
  }
  .crm-modal-spacer {
    display: none;
  }
  .crm-modal-actions .button {
    flex: 1;
  }
}

/* CRM stage 2 */
.crm-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(160px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.crm-filters label {
  display: grid;
  gap: 5px;
}
.crm-filters label > span {
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
}
.crm-filters input,
.crm-filters select {
  width: 100%;
  min-height: 38px;
}
.crm-clear-filters {
  min-height: 38px;
  white-space: nowrap;
}
.crm-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 7px;
}
.crm-card-tag {
  max-width: 100%;
  padding: 3px 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 8.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-card-tag-source {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
}
.crm-card-last-message {
  color: var(--text-soft);
}
.crm-card-activity {
  display: block;
  margin-top: 7px;
  color: var(--text-faint);
  font-size: 8.5px;
}
.crm-conversation-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.crm-conversation-link > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.crm-conversation-link strong {
  font-size: 11px;
}
.crm-conversation-link span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-conversation-link .button {
  flex: none;
}
@media (max-width: 1180px) {
  .crm-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .crm-filter-search {
    grid-column: 1 / -1;
  }
  .crm-clear-filters {
    width: 100%;
  }
}
@media (max-width: 860px) {
  .crm-filters {
    grid-template-columns: 1fr 1fr;
  }
  .crm-filter-search {
    grid-column: 1 / -1;
  }
  .crm-conversation-link {
    align-items: stretch;
    flex-direction: column;
  }
  .crm-conversation-link .button {
    width: 100%;
  }
}
@media (max-width: 560px) {
  .crm-filters {
    grid-template-columns: 1fr;
  }
  .crm-filter-search {
    grid-column: auto;
  }
}

/* CRM product-first simplification */
.crm-product-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.crm-product-toolbar label {
  display: grid;
  gap: 5px;
}
.crm-product-toolbar label > span,
.crm-card-product-context > span {
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
}
.crm-product-toolbar select {
  min-height: 42px;
  font-weight: 700;
}
.crm-product-toolbar > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.crm-product-toolbar > div strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-product-toolbar > div span {
  color: var(--text-soft);
  font-size: 10px;
}
.crm-filters {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 280px) auto;
}
.crm-card-product-context {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}
.crm-card-product-context strong {
  font-size: 11px;
}
@media (max-width: 860px) {
  .crm-product-toolbar {
    grid-template-columns: 1fr;
  }
  .crm-filters {
    grid-template-columns: 1fr 1fr;
  }
  .crm-filter-search {
    grid-column: 1 / -1;
  }
}
@media (max-width: 560px) {
  .crm-filters {
    grid-template-columns: 1fr;
  }
  .crm-filter-search {
    grid-column: auto;
  }
}

/* CRM card readability refinement */
.crm-column {
  flex: 0 0 336px;
  width: 336px;
}

.crm-column-cards {
  padding: 12px;
  gap: 12px;
}

.crm-card {
  padding: 15px 15px 13px;
  border-radius: 15px;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--text) 6%, transparent);
}

.crm-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.crm-card-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.crm-card-title {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.crm-card-phone {
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.3;
}

.crm-card-source {
  flex: none;
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 750;
  line-height: 1;
}

.crm-card-instance {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.crm-card-instance span,
.crm-card-message > span,
.crm-card-footer-item > span {
  color: var(--text-faint);
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.crm-card-instance strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-card-message {
  margin-top: 11px;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.crm-card-message > span {
  display: block;
  margin-bottom: 5px;
}

.crm-card-message p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  line-height: 1.5;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.crm-card-footer {
  margin-top: 12px;
  padding-top: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.crm-card-footer-item {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.crm-card-footer-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-card-footer-value {
  min-width: 78px;
  text-align: right;
}

.crm-card-footer-value strong {
  color: var(--accent);
  font-size: 11px;
}

.crm-card-activity {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--text-faint);
  font-size: 8.5px;
}

@media (max-width: 860px) {
  .crm-column {
    flex-basis: 308px;
    width: 308px;
  }

  .crm-card {
    padding: 14px;
  }

  .crm-card-title {
    font-size: 13.5px;
  }
}

/* Sidebar collapse - minimal, preserves original layout */
.sidebar {
  transition: width .18s ease, padding .18s ease;
}
.main {
  transition: margin-left .18s ease;
}
.sidebar-collapse-button {
  position: absolute;
  top: 31px;
  right: 18px;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text-faint);
  cursor: pointer;
}
.sidebar-collapse-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-strong);
}
.sidebar-collapse-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-shell.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 24px 14px 18px;
}
.app-shell.sidebar-collapsed .main {
  margin-left: 72px;
}
.app-shell.sidebar-collapsed .brand {
  width: 44px;
  min-height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 12px;
}
.app-shell.sidebar-collapsed .brand:hover {
  background: var(--surface-soft);
}
.app-shell.sidebar-collapsed .brand-name,
.app-shell.sidebar-collapsed .sidebar-collapse-button,
.app-shell.sidebar-collapsed .nav,
.app-shell.sidebar-collapsed .sidebar-bottom {
  display: none;
}
@media (max-width: 860px) {
  .sidebar-collapse-button {
    display: none;
  }
  .app-shell.sidebar-collapsed .main {
    margin-left: 0;
  }
}

/* Signup and trial access */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: -8px 0 26px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 6%, transparent);
}
.password-input-wrap {
  position: relative;
}
.password-input-wrap input {
  padding-right: 48px;
}
.password-eye {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}
.password-eye:hover,
.password-eye.is-visible {
  background: var(--surface-soft);
  color: var(--text);
}
.password-eye svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}
.password-mismatch {
  color: var(--danger);
  font-size: 11px;
  font-weight: 650;
}
input.input-error {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--line));
}
.trial-note {
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}
.upgrade-modal {
  width: min(460px, calc(100vw - 28px));
}
.upgrade-modal h2 {
  margin: 6px 0 8px;
}
.upgrade-modal > p {
  margin: 0 0 18px;
  line-height: 1.55;
}
.upgrade-limit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
}
.upgrade-limit-summary span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
}
.conversation-item.trial-locked {
  opacity: .68;
}
.conversation-item.trial-locked:hover {
  opacity: .86;
}

/* Account settings, training and sidebar utilities */
.sidebar-utility-nav {
  display: grid;
  gap: 5px;
  padding-bottom: 2px;
}

.sidebar-utility-item,
.super-admin-nav {
  margin-top: 0;
}

.user-mini {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.user-mini-main {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
}

.user-mini-main:hover .user-mini-copy strong {
  color: var(--accent);
}

.app-version {
  padding: 0 8px 2px;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  gap: 14px;
}

.training-card {
  min-height: 180px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.training-card h3 {
  margin: 5px 0 7px;
}

.training-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.training-icon {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}

.training-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.account-settings-card {
  min-width: 0;
}

.account-settings-card .card-head {
  margin-bottom: 18px;
}

.account-settings-card input[readonly] {
  cursor: not-allowed;
  background: var(--surface-soft);
  color: var(--text-soft);
}

.account-password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.account-plan-name {
  display: grid;
  gap: 3px;
  margin-bottom: 18px;
}

.account-plan-name strong {
  font-size: 23px;
  letter-spacing: -.025em;
}

.account-plan-name span {
  color: var(--text-soft);
  font-size: 11px;
}

.account-plan-dates {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.account-plan-dates > div {
  padding: 11px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.account-plan-dates span {
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.account-plan-dates strong {
  font-size: 12px;
}

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

.theme-choice {
  min-height: 82px;
  padding: 11px 8px;
  display: grid;
  place-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
}

.theme-choice span {
  font-size: 20px;
}

.theme-choice strong {
  font-size: 11px;
}

.theme-choice:hover,
.theme-choice.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.admin-account-modal {
  width: min(500px, calc(100vw - 28px));
}

.admin-account-modal > p {
  margin-bottom: 18px;
}

@media (max-width: 860px) {
  .account-settings-grid {
    grid-template-columns: 1fr;
  }

  .account-plan-dates {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-nav {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .super-admin-user .mobile-nav {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .account-plan-dates,
  .theme-choice-grid {
    grid-template-columns: 1fr;
  }

  .account-password-actions .button {
    width: 100%;
  }
}
.super-admin-client-controls { flex-wrap: wrap; }

/* Global card visual refinement */
.step-card,
.stat-card,
.card {
  border-color: color-mix(in srgb, var(--line) 88%, var(--text) 12%);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text) 4%, transparent),
    0 8px 24px color-mix(in srgb, var(--text) 3.5%, transparent);
}

.step-card {
  min-height: 96px;
  padding: 15px 16px;
  border-radius: 15px;
  gap: 12px;
}

.step-card:hover {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--text) 5%, transparent);
}

.step-card strong {
  font-size: 13px;
}

.step-card p {
  font-size: 11.5px;
  line-height: 1.45;
}

.stat-card {
  padding: 16px 18px;
  border-radius: 15px;
}

.stat-card strong {
  margin: 7px 0 2px;
  font-size: 28px;
}

.clean-card {
  padding: 22px;
}

/* Account settings */
.account-settings-grid {
  gap: 16px;
  align-items: start;
}

.account-settings-card {
  min-height: 0;
  padding: 19px 20px 20px;
  border-radius: 16px;
}

.account-settings-card .card-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.account-settings-card .card-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.account-settings-card .card-head p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.5;
}

.account-settings-card .field > span {
  margin-bottom: 2px;
}

.account-plan-name {
  margin-bottom: 14px;
}

.account-plan-name strong {
  font-size: 20px;
}

.account-plan-dates {
  gap: 10px;
  margin-bottom: 14px;
}

.account-plan-dates > div {
  padding: 11px 12px;
  border-radius: 10px;
}

.theme-choice-grid {
  gap: 10px;
}

.theme-choice {
  min-height: 74px;
  border-radius: 11px;
}

/* Instances */
.instance-card {
  padding: 18px;
  border-radius: 16px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.instance-card:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--text) 5%, transparent);
}

.instance-card h3 {
  font-size: 16px;
}

.instance-card p {
  font-size: 11.5px;
  line-height: 1.45;
}

.instance-ai-summary {
  margin-top: 15px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.instance-ai-summary strong {
  font-size: 11.5px;
}

.instance-ai-summary span {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
}

.instance-meta {
  margin-top: 15px;
  padding-top: 13px;
  gap: 7px;
}

/* Products / services */
.topic-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text) 3%, transparent),
    0 7px 20px color-mix(in srgb, var(--text) 3%, transparent);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.topic-card:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--text) 5%, transparent);
}

.topic-card-title {
  gap: 7px;
}

.topic-card-title strong {
  font-size: 14px;
}

.topic-meta {
  margin-top: 7px;
  font-size: 10px;
}

.topic-card-copy > p {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.45;
}

/* Ready funnels */
.ready-funnel-list {
  gap: 12px;
}

.ready-funnel-card {
  padding: 15px 17px;
  border-radius: 16px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.ready-funnel-card:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--text) 5%, transparent);
}

.ready-funnel-card-copy {
  gap: 4px;
}

/* Training */
.training-grid {
  gap: 16px;
}

.training-card {
  min-height: 145px;
  padding: 18px 20px;
  border-radius: 16px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.training-card:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--text) 5%, transparent);
}

.training-card h3 {
  margin: 4px 0 6px;
  font-size: 17px;
}

.training-card p {
  font-size: 11.5px;
}

/* SUPER ADMIN */
.super-admin-stats {
  gap: 12px;
}

.super-admin-client {
  border-radius: 16px;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text) 3%, transparent),
    0 9px 26px color-mix(in srgb, var(--text) 3.5%, transparent);
}

.super-admin-client-head {
  padding: 17px 19px;
}

.super-admin-resource-grid,
.super-admin-token-grid {
  gap: 9px;
}

.super-admin-token-panel {
  border-radius: 13px;
}

.super-admin-client-actions {
  padding: 12px 19px;
}

/* CRM keeps its richer hierarchy, only harmonize surface */
.crm-card {
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--text) 12%);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--text) 3%, transparent),
    0 8px 20px color-mix(in srgb, var(--text) 4%, transparent);
}

@media (max-width: 860px) {
  .account-settings-card,
  .training-card,
  .instance-card,
  .topic-card,
  .ready-funnel-card {
    padding: 15px;
  }

  .step-card {
    min-height: 88px;
  }
}

/* Conversation scope filters */
.conversation-scope-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(190px, 260px));
  gap: 10px;
  align-items: end;
}

.conversation-scope-filters label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.conversation-scope-filters label > span {
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.conversation-scope-filters .compact-select {
  width: 100%;
  min-height: 40px;
}

@media (max-width: 860px) {
  .conversation-scope-filters {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .conversation-scope-filters {
    grid-template-columns: 1fr;
  }
}

/* Slight content card and label scale-up - sidebar intentionally excluded */
.main .eyebrow {
  font-size: 13px;
}

.main .field > span {
  font-size: 14px;
}

.main .field small {
  font-size: 11.5px;
}

.main .status-pill,
.main .step-state {
  font-size: 10.5px;
  padding: 5px 9px;
}

.main .step-card {
  min-height: 104px;
  padding: 17px 18px;
}

.main .stat-card {
  padding: 18px 20px;
}

.main .clean-card {
  padding: 24px;
}

.main .account-settings-card {
  padding: 21px 22px 22px;
}

.main .account-settings-card .card-head h3 {
  font-size: 19px;
}

.main .account-settings-card .card-head p {
  font-size: 12px;
}

.main .instance-card {
  padding: 20px;
}

.main .instance-card h3 {
  font-size: 17px;
}

.main .instance-card p,
.main .instance-ai-summary strong {
  font-size: 12px;
}

.main .instance-ai-summary span {
  font-size: 10.5px;
}

.main .topic-card {
  padding: 18px 20px;
}

.main .topic-card-title strong {
  font-size: 15px;
}

.main .topic-meta,
.main .topic-card-copy > p {
  font-size: 11.5px;
}

.main .ready-funnel-card {
  padding: 17px 19px;
}

.main .training-card {
  min-height: 154px;
  padding: 20px 22px;
}

.main .training-card h3 {
  font-size: 18px;
}

.main .training-card p {
  font-size: 12px;
}

.main .super-admin-client-head {
  padding: 19px 21px;
}

.main .super-admin-client-actions {
  padding: 14px 21px;
}

.main .conversation-item {
  padding: 15px 16px;
  grid-template-columns: 40px 1fr;
  gap: 11px;
}

.main .conversation-line strong {
  font-size: 13.5px;
}

.main .conversation-line time {
  font-size: 10.5px;
}

.main .conversation-preview {
  font-size: 11.5px;
}

.main .conversation-scope-filters label > span,
.main .crm-product-toolbar label > span,
.main .crm-card-product-context > span,
.main .crm-filters label > span,
.main .crm-card-instance span,
.main .crm-card-message > span,
.main .crm-card-footer-item > span {
  font-size: 9.5px;
}

.main .crm-card {
  padding: 16px 16px 14px;
}

.main .crm-card-title {
  font-size: 14.5px;
}

.main .crm-card-phone,
.main .crm-card-footer-item strong {
  font-size: 11px;
}

.main .crm-card-message p {
  font-size: 11.5px;
}

@media (max-width: 860px) {
  .main .account-settings-card,
  .main .training-card,
  .main .instance-card,
  .main .topic-card,
  .main .ready-funnel-card {
    padding: 17px;
  }

  .main .conversation-item {
    padding: 14px 15px;
  }

  .main .crm-card {
    padding: 15px;
  }
}

/* Readability pass for descriptive copy inside main-content cards */
.main .card p,
.main .step-card p,
.main .account-settings-card .card-head p,
.main .training-card p,
.main .instance-card p,
.main .topic-card-copy > p,
.main .ready-funnel-card p,
.main .super-admin-client p {
  font-size: 13.5px;
  line-height: 1.55;
}

.main .card .muted,
.main .step-card .muted,
.main .account-settings-card .muted,
.main .training-card .muted,
.main .instance-card .muted,
.main .topic-card .muted,
.main .ready-funnel-card .muted,
.main .super-admin-client .muted {
  font-size: 13px;
  line-height: 1.55;
}

.main .instance-ai-summary span,
.main .ready-funnel-help span,
.main .topic-meta,
.main .conversation-preview,
.main .crm-card-message p,
.main .crm-card-phone,
.main .crm-card-footer-item strong {
  font-size: 12.5px;
  line-height: 1.5;
}

.main .stat-card span,
.main .stat-card small,
.main .account-plan-name span,
.main .account-plan-dates strong {
  font-size: 12px;
  line-height: 1.45;
}

.main .field small {
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .main .card p,
  .main .step-card p,
  .main .account-settings-card .card-head p,
  .main .training-card p,
  .main .instance-card p,
  .main .topic-card-copy > p,
  .main .ready-funnel-card p,
  .main .super-admin-client p {
    font-size: 13px;
  }
}

/* Google OAuth on authentication only */
.oauth-auth-block {
  margin-top: 20px;
}

.google-auth-button {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}

.google-auth-button:hover {
  background: var(--surface-soft);
  border-color: color-mix(in srgb, var(--text) 24%, var(--line));
  transform: translateY(-1px);
}

.google-auth-button:active {
  transform: translateY(0);
}

.google-auth-button svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.oauth-auth-block + .stack {
  margin-top: 14px;
}

/* Pending conversations + browser notifications */
.notification-setting {
  display: grid;
  gap: 12px;
}

.notification-toggle-row {
  align-items: center;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  cursor: pointer;
}

.notification-toggle-row > span:last-child {
  min-width: 0;
}

.notification-setting-status {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
}

.conversation-item.awaiting-response {
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 75%, transparent);
}

.conversation-item.awaiting-response:hover {
  background: color-mix(in srgb, var(--accent-soft) 88%, var(--surface));
}

.conversation-item.awaiting-response .conversation-line strong {
  color: var(--text);
  font-weight: 820;
}

.conversation-item.awaiting-response .conversation-preview > span:first-child {
  color: color-mix(in srgb, var(--text) 82%, var(--text-soft));
  font-weight: 620;
}

.conversation-item.awaiting-response .avatar {
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--surface-strong));
  color: var(--accent-strong);
}

/* Conversation memory modal + permanent Ready Funnels sidebar */
.chat-memory-trigger {
  min-width: 0;
  flex: 1;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: background .14s ease;
}

.chat-memory-trigger:hover {
  background: var(--surface-soft);
}

.chat-memory-trigger:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

.chat-memory-trigger .chat-person {
  flex: 1;
}

.chat-memory-hint {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 760;
  letter-spacing: .02em;
}

.memory-modal {
  width: min(100%, 680px);
  padding: 30px;
}

.memory-modal .memory-head h2 {
  margin: 6px 0 7px;
  font-size: 27px;
  letter-spacing: -.035em;
}

.memory-modal .memory-head p {
  margin: 0 0 22px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.memory-modal-form {
  display: grid;
  gap: 16px;
}

.memory-modal-form textarea {
  min-height: 132px;
}

.memory-modal-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-soft);
}

.conversation-layout {
  height: calc(100dvh - 154px);
  max-height: calc(100dvh - 154px);
  min-height: 520px;
  grid-template-columns:
    minmax(235px, .70fr)
    minmax(410px, 1.48fr)
    minmax(285px, .84fr);
}

.conversation-funnels-sidebar {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: hidden;
  border-top: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.conversation-funnels-sidebar .conversation-funnels-head {
  flex: none;
  padding: 18px 18px 15px;
}

.conversation-funnels-sidebar .conversation-funnels-head strong {
  font-size: 16px;
}

.conversation-funnels-sidebar .conversation-funnels-head small {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.45;
}

.conversation-funnels-sidebar .conversation-funnels-notice,
.conversation-funnels-sidebar .conversation-funnel-running {
  flex: none;
  margin: 14px 16px 0;
  padding: 11px 12px;
  font-size: 11.5px;
  line-height: 1.5;
}

.conversation-funnels-sidebar .conversation-funnels-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  align-content: start;
  gap: 10px;
  padding: 14px 16px 18px;
}

.conversation-funnels-sidebar .conversation-funnel-card {
  min-height: 68px;
  padding: 13px 14px;
  border-radius: 13px;
}

.conversation-funnels-sidebar .conversation-funnel-card strong {
  font-size: 13px;
}

.conversation-funnels-sidebar .conversation-funnel-card small {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.4;
}

.conversation-funnels-sidebar .conversation-funnel-send {
  font-size: 11px;
}

.conversation-funnels-sidebar .conversation-funnels-empty {
  padding: 18px 14px;
  font-size: 11.5px;
  line-height: 1.5;
}

.conversation-funnels-focus {
  animation: zgFunnelFocus .7s ease;
}

@keyframes zgFunnelFocus {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
}

/* A little more breathing room across main content; sidebar intentionally excluded */
.main .section-intro h1 {
  font-size: 32px;
}

.main .section-intro p {
  font-size: 15px;
  line-height: 1.6;
}

.main .step-card {
  min-height: 110px;
  padding: 19px 20px;
}

.main .stat-card {
  padding: 20px 22px;
}

.main .clean-card {
  padding: 26px;
}

.main .account-settings-card {
  padding: 23px 24px 24px;
}

.main .instance-card {
  padding: 22px;
}

.main .topic-card {
  padding: 20px 22px;
}

.main .ready-funnel-card {
  padding: 19px 21px;
}

.main .training-card {
  min-height: 160px;
  padding: 22px 24px;
}

.main .super-admin-client-head {
  padding: 21px 23px;
}

.main .super-admin-client-actions {
  padding: 16px 23px;
}

.main .crm-card {
  padding: 17px 17px 15px;
}

.main .conversation-item {
  padding: 17px;
  grid-template-columns: 42px 1fr;
  gap: 12px;
}

.main .conversation-item .avatar {
  width: 40px;
  height: 40px;
}

.main .conversation-line strong {
  font-size: 14px;
}

.main .conversation-preview {
  font-size: 13px;
}

.main .chat-head {
  min-height: 76px;
  padding: 12px 16px;
}

.main .message {
  padding: 10px 12px 7px;
  font-size: 14.5px;
  line-height: 1.5;
}

.main .message-list {
  padding-top: 27px;
  padding-bottom: 27px;
}

@media (max-width: 1280px) {
  .conversation-layout {
    grid-template-columns: 245px minmax(0, 1fr);
  }

  .conversation-funnels-sidebar {
    display: none;
    position: fixed;
    z-index: 98;
    top: 96px;
    right: 22px;
    bottom: 22px;
    width: min(360px, calc(100vw - 44px));
    height: auto;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0,0,0,.22);
  }

  .conversation-funnels-sidebar.mobile-open {
    display: flex;
  }
}

@media (max-width: 860px) {
  .conversation-layout {
    height: calc(100vh - 154px);
    max-height: calc(100vh - 154px);
    grid-template-columns: 1fr;
  }

  .chat-memory-hint {
    display: none;
  }

  .conversation-funnels-sidebar {
    top: 82px;
    right: 14px;
    bottom: 80px;
    width: min(380px, calc(100vw - 28px));
  }

  .memory-modal {
    width: min(100%, 620px);
  }
}

@media (max-width: 560px) {
  .memory-modal {
    padding: 24px 18px;
  }

  .memory-modal .memory-head h2 {
    font-size: 24px;
  }

  .main .section-intro h1 {
    font-size: 28px;
  }
}

/* Conversations workspace breathing pass - visual only, no behavior changes */
#conversationsPage.active {
  padding-left: clamp(20px, 2vw, 30px);
  padding-right: clamp(20px, 2vw, 30px);
}

#conversationsPage .conversation-layout {
  grid-template-columns:
    minmax(230px, .70fr)
    minmax(420px, 2.20fr)
    minmax(260px, .80fr);
}

#conversationsPage .conversation-search {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px;
}

#conversationsPage .conversation-view-filter {
  width: 100%;
}

#conversationsPage .conversation-item {
  padding: 15px 14px;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 11px;
}

#conversationsPage .chat-head {
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

#conversationsPage .chat-memory-trigger {
  width: 100%;
  min-height: 64px;
  flex: none;
  padding: 11px 16px;
  border-radius: 0;
}

#conversationsPage .chat-memory-trigger:hover {
  background: var(--surface-soft);
}

#conversationsPage .chat-memory-trigger .avatar {
  width: 40px;
  height: 40px;
}

#conversationsPage .chat-person strong {
  font-size: 15px;
}

#conversationsPage .chat-person span {
  margin-top: 1px;
  font-size: 11.5px;
}

#conversationsPage .chat-memory-hint {
  padding: 5px 9px;
  font-size: 10px;
}

#conversationsPage .chat-actions {
  width: 100%;
  min-width: 0;
  padding: 10px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, var(--surface-soft));
}

#conversationsPage .chat-product-control {
  min-width: 220px;
  flex: 1 1 260px;
}

#conversationsPage .chat-product-control select {
  min-height: 38px;
  font-size: 11.5px;
}

#conversationsPage .chat-actions .status-pill {
  min-height: 38px;
  padding: 0 12px;
}

#conversationsPage .chat-actions .button {
  min-height: 38px;
  padding-left: 14px;
  padding-right: 14px;
  white-space: nowrap;
}

#conversationsPage .chat-menu-button {
  width: 38px;
  height: 38px;
  flex: none;
}

#conversationsPage .message-list {
  padding: 30px clamp(22px, 3vw, 46px);
  gap: 10px;
}

#conversationsPage .message {
  max-width: min(82%, 720px);
  padding: 11px 13px 7px;
  font-size: 14.5px;
  line-height: 1.5;
}

#conversationsPage .conversation-funnels-sidebar .conversation-funnels-head {
  padding: 19px 18px 16px;
}

#conversationsPage .conversation-funnels-sidebar .conversation-funnels-list {
  padding: 15px 16px 20px;
  gap: 11px;
}

#conversationsPage .conversation-funnels-sidebar .conversation-funnel-card {
  min-height: 72px;
  padding: 14px;
}

#conversationsPage .conversation-funnels-sidebar .conversation-funnel-card strong {
  font-size: 13.5px;
}

#conversationsPage .conversation-funnels-sidebar .conversation-funnel-card small {
  font-size: 11px;
}

@media (max-width: 1280px) {
  #conversationsPage .conversation-layout {
    grid-template-columns: 245px minmax(0, 1fr);
  }

  #conversationsPage .conversation-search {
    padding: 12px;
  }

  #conversationsPage .chat-actions {
    padding: 9px 12px 11px;
  }
}

@media (max-width: 860px) {
  #conversationsPage.active {
    padding-left: 16px;
    padding-right: 16px;
  }

  #conversationsPage .conversation-layout {
    grid-template-columns: 1fr;
  }

  #conversationsPage .conversation-search {
    grid-template-columns: minmax(0, 1fr) 108px;
  }

  #conversationsPage .chat-memory-trigger {
    min-height: 58px;
    padding: 9px 11px;
  }

  #conversationsPage .chat-actions {
    align-items: center;
  }

  #conversationsPage .chat-product-control {
    min-width: 150px;
    flex: 1 1 180px;
  }

  #conversationsPage .message-list {
    padding: 22px 14px;
  }

  #conversationsPage .message {
    max-width: 88%;
  }
}
