:root {
  --ink: #18211d;
  --muted: #6b746f;
  --line: #dfe5df;
  --paper: #faf9f4;
  --surface: #ffffff;
  --surface-2: #f2f6f1;
  --green: #0f766e;
  --green-dark: #115e59;
  --amber: #b7791f;
  --red: #b42318;
  --violet: #5b3b82;
  --shadow: 0 18px 50px rgba(24, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

body.auth-pending .app-shell,
body.unauthenticated .app-shell,
body.authenticated .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 32px;
  align-items: center;
  padding: 48px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.08), rgba(217, 159, 50, 0.11)),
    var(--paper);
}

.login-hero {
  min-height: min(720px, calc(100vh - 96px));
  display: grid;
  align-content: space-between;
  gap: 36px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 35, 29, 0.94), rgba(15, 118, 110, 0.9)),
    #16231d;
  color: #eef6ef;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand strong {
  display: block;
  font-size: 18px;
}

.login-brand span,
.login-copy p,
.login-proof span {
  color: #c7d8cc;
}

.login-copy {
  max-width: 740px;
}

.login-copy h1 {
  margin: 12px 0 16px;
  max-width: 780px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
}

.login-copy p {
  max-width: 640px;
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
}

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

.login-proof div {
  min-height: 116px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.login-proof strong,
.login-proof span {
  display: block;
}

.login-proof strong {
  margin-bottom: 8px;
}

.login-proof span {
  font-size: 13px;
  line-height: 1.45;
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 4px 0 6px;
  font-size: 28px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.login-card input {
  width: 100%;
  border: 1px solid #ccd8ce;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px 13px;
}

.login-card input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--green);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.login-demo {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #d8e6da;
  border-radius: 8px;
  background: var(--surface-2);
}

.login-demo span {
  color: var(--muted);
  font-size: 12px;
}

.login-demo strong {
  font-size: 13px;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: #16231d;
  color: #eef6ef;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f766e, #d99f32);
  color: white;
  font-weight: 800;
}

.brand strong,
.sidebar-footer strong {
  display: block;
  font-size: 15px;
}

.brand span,
.small-label {
  display: block;
  color: #abc1b2;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  border: 0;
  color: #dce9df;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #87a190;
}

.nav-item.active .nav-dot {
  background: #f2b544;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 92px;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 244, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 28px;
  line-height: 1.1;
}

.eyebrow {
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

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

.session-chip {
  display: grid;
  gap: 1px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.session-chip span {
  color: var(--muted);
  font-size: 11px;
}

.session-chip strong {
  font-size: 13px;
}

.content-view {
  padding: 28px 32px 40px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.panel,
.metric,
.table-wrap,
.builder-pane,
.phone-preview,
.kanban-column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel h2 {
  font-size: 20px;
}

.panel h3 {
  font-size: 16px;
}

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

.metric {
  padding: 18px;
  min-height: 116px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.metric small {
  display: block;
  color: var(--green);
  margin-top: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: var(--green);
  color: white;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  background: #fff7e8;
  color: #6f4b12;
  border-color: #f3d7a8;
}

.ghost-button,
.icon-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  background: #fff1ef;
  color: var(--red);
  border-color: #f8c5c0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.badge.green {
  color: var(--green-dark);
  background: #e6f5f2;
  border-color: #bce4dd;
}

.badge.amber {
  color: #6f4b12;
  background: #fff6e4;
  border-color: #f2d49a;
}

.badge.red {
  color: var(--red);
  background: #fff0ef;
  border-color: #f8c5c0;
}

.badge.violet {
  color: var(--violet);
  background: #f2eef7;
  border-color: #d8cbe8;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  overflow: hidden;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f7faf6;
}

tr:last-child td {
  border-bottom: 0;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

.builder-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.builder-pane {
  padding: 14px;
}

.step-list {
  display: grid;
  gap: 8px;
}

.step-item {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 11px;
  text-align: left;
}

.step-item.active {
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green);
}

.step-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

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

.block-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.flow-builder-layout {
  min-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: 172px minmax(420px, 1fr) 350px;
  grid-template-rows: auto minmax(640px, calc(100vh - 232px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.flow-toolbar {
  grid-column: 1 / -1;
  min-height: 64px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #151b18;
  color: #eef6ef;
}

.flow-title {
  display: grid;
  gap: 3px;
  min-width: 210px;
  flex: 1 1 240px;
}

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

.flow-title span,
.palette-brand span,
.flow-node-header small {
  color: #8c9a92;
  font-size: 12px;
}

.segmented-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.segmented-tabs button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #aebbb3;
  font-weight: 800;
}

.segmented-tabs button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.flow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 360px;
}

.flow-actions button,
.flow-actions .link-button {
  flex: 0 0 auto;
}

.flow-palette {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  background: #16231d;
  color: #eef6ef;
  overflow-y: auto;
}

.palette-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 10px;
  text-align: left;
}

.palette-brand .brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.palette-brand strong {
  display: block;
  font-size: 13px;
}

.palette-brand span {
  max-width: none;
  line-height: 1.25;
}

.palette-item,
.palette-add-step {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #eef6ef;
  min-height: 46px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
  text-align: left;
  overflow: visible;
}

.palette-item:hover,
.palette-add-step:hover {
  background: rgba(255, 255, 255, 0.1);
}

.palette-item span {
  width: 40px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #f2b544;
  color: #422b04;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.palette-item strong,
.palette-add-step strong {
  display: block;
  min-width: 0;
  color: inherit;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.palette-add-step {
  margin-top: 8px;
  min-height: 48px;
  padding: 8px;
  color: #16231d;
  background: #f2b544;
  justify-content: center;
  text-align: center;
}

.flow-canvas {
  position: relative;
  min-width: 0;
  overflow: auto;
  background-color: #f7faf8;
  background-image: radial-gradient(#d6e1da 1px, transparent 1px);
  background-size: 18px 18px;
}

.connection-hint {
  position: sticky;
  top: 12px;
  left: 12px;
  z-index: 4;
  width: fit-content;
  max-width: min(520px, calc(100% - 24px));
  margin: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #9bd28f;
  border-radius: 8px;
  background: rgba(246, 255, 244, 0.96);
  color: #1e4b20;
  box-shadow: 0 10px 28px rgba(24, 33, 29, 0.12);
}

.connection-hint span {
  color: #47674a;
  font-size: 13px;
}

.canvas-context-menu {
  position: fixed;
  z-index: 40;
  width: 260px;
  max-height: min(520px, calc(100vh - 36px));
  overflow: auto;
  padding: 10px;
  border: 1px solid #dfe6e2;
  border-radius: 8px;
  background: white;
  box-shadow: 0 20px 45px rgba(24, 33, 29, 0.18);
}

.context-menu-section {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid #edf1ee;
}

.context-menu-section:first-child {
  padding-top: 0;
}

.context-menu-section:last-child,
.context-menu-section.compact {
  border-bottom: 0;
  padding-bottom: 0;
}

.context-menu-section strong {
  display: block;
  padding: 0 4px 4px;
  color: #81908a;
  font-size: 10px;
  text-transform: uppercase;
}

.context-menu-section button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #2c3933;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  text-align: left;
}

.context-menu-section button:hover {
  background: #f4f8f5;
}

.context-menu-section button:disabled {
  cursor: not-allowed;
  color: #9ba7a1;
  background: transparent;
}

.context-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #e9f5e4;
  color: #3c7a20;
  font-size: 9px;
  font-weight: 900;
  flex: 0 0 auto;
}

.context-icon.multiple_choice {
  background: #f0e7ff;
  color: #6a35c4;
}

.context-icon.open_question {
  background: #e8f0ff;
  color: #2454b4;
}

.context-icon.image {
  background: #ffe2ef;
  color: #9d2559;
}

.context-icon.delay {
  background: #fff1cc;
  color: #875707;
}

.context-icon.whatsapp {
  background: #daf8ea;
  color: #087443;
}

.context-icon.condition {
  background: #e9eef6;
  color: #42607f;
}

.context-icon.danger {
  background: #fde8e6;
  color: var(--red);
}

.context-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.canvas-map {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.flow-connections {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.flow-connector-path {
  fill: none;
  stroke: #0f766e;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 5px rgba(15, 118, 110, 0.13));
}

.flow-node {
  width: 308px;
  position: absolute;
  z-index: 1;
  border: 1px solid #d5e0d9;
  border-radius: 10px;
  background: white;
  box-shadow: 0 14px 30px rgba(24, 33, 29, 0.09);
}

.flow-node.active {
  border-color: #76c935;
  box-shadow: 0 0 0 3px rgba(118, 201, 53, 0.18), 0 18px 36px rgba(24, 33, 29, 0.1);
}

.flow-node.dragging {
  cursor: grabbing;
  z-index: 3;
  box-shadow: 0 26px 52px rgba(24, 33, 29, 0.18);
}

.flow-node.connect-target {
  cursor: crosshair;
}

.flow-node.connect-target:hover {
  border-color: #0f766e;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.15), 0 18px 36px rgba(24, 33, 29, 0.1);
}

.node-floating-tools {
  position: absolute;
  left: 12px;
  right: 12px;
  top: -35px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.node-tool {
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #dce6df;
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(24, 33, 29, 0.08);
}

.flow-node-header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid #dbe6f8;
  background: #eef5ff;
  border-radius: 10px 10px 0 0;
  cursor: grab;
}

.message-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1f5bd8;
}

.message-heading strong {
  font-size: 13px;
}

.message-icon {
  width: 25px;
  height: 25px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #2f6fed;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.node-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.node-header-actions span {
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f7fbff;
  color: #7b8da8;
  font-size: 9px;
  font-weight: 900;
}

.node-step-meta {
  display: grid;
  gap: 2px;
  padding: 10px 12px 0;
  cursor: grab;
}

.node-step-meta strong {
  color: #213029;
  font-size: 14px;
}

.node-step-meta span {
  color: var(--muted);
  font-size: 12px;
}

.start-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  margin-bottom: 5px;
  border-radius: 999px;
  background: #76c935;
  color: #15210f;
  font-size: 10px;
  font-weight: 900;
}

.node-count {
  min-width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e9f1ec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-node-body {
  display: grid;
  gap: 9px;
  padding: 11px 12px 14px;
}

.flow-block {
  width: 100%;
  display: grid;
  gap: 7px;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #25342c;
  text-align: left;
  line-height: 1.35;
  word-break: break-word;
}

.flow-block.selected {
  border-color: #2f6fed;
  background: #f7fbff;
  padding: 5px;
}

.flow-block.delay {
  min-height: 54px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-color: #f4c35f;
  background: #fff8e8;
  color: #7a4d08;
}

.flow-block.media {
  padding: 10px;
  border-color: #f3bfd5;
  background: #fff0f6;
  color: #7d214a;
}

.conversation-bubble {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f4f6f7;
  color: #38453f;
  line-height: 1.42;
}

.conversation-bubble.question {
  font-weight: 700;
}

.choice-block,
.open-block {
  gap: 8px;
}

.delay-clock {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid #efb54a;
  color: #b35d09;
  font-size: 9px;
  font-weight: 900;
  flex: 0 0 auto;
}

.block-chip {
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e7f1ee;
  color: #26453b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.block-chip.blue {
  background: #e8f0ff;
  color: #2454b4;
}

.block-chip.purple {
  background: #f0e7ff;
  color: #6a35c4;
}

.block-chip.amber {
  background: #fff1cc;
  color: #875707;
}

.block-chip.pink {
  background: #ffe2ef;
  color: #9d2559;
}

.route-pill {
  position: relative;
  min-height: 34px;
  padding: 7px 18px 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #d8e0dc;
  border-radius: 999px;
  background: white;
  font-size: 12px;
  box-shadow: 0 1px 0 rgba(24, 33, 29, 0.04);
}

.route-pill.warning {
  border-color: #f2bf7f;
  background: #fff8e8;
}

.route-pill.pending {
  border-color: #0f766e;
  background: #eefbf6;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.route-pill span {
  min-width: 0;
}

.route-pill small {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
}

.route-pill i,
.connector-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #65c72d;
  flex: 0 0 auto;
}

.route-pill i {
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 0 3px white;
  cursor: crosshair;
}

.route-pill.warning i,
.connector-dot.warning {
  background: #d97706;
}

.flow-node-footer {
  min-height: 38px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #dbe5df;
  color: var(--muted);
  font-size: 12px;
}

.flow-inspector {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 14px;
  border-left: 1px solid var(--line);
  background: #fbfcfa;
  overflow: auto;
}

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

.inspector-header h2 {
  margin: 4px 0;
  font-size: 20px;
}

.inspector-stack {
  display: grid;
  align-content: start;
  gap: 10px;
}

.inspector-block {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.inspector-block.selected {
  border-color: #9fc2ff;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.11);
}

.inspector-block-title {
  min-height: 34px;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.block-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ghost-button.danger {
  color: var(--red);
  border-color: #f0c5c0;
}

.media-drop {
  min-height: 126px;
  border: 1px dashed #c5cfd0;
  border-radius: 8px;
  background: #f9fbfb;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.route-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d7e1d9;
  border-radius: 8px;
  background: #f7faf8;
}

.route-editor strong {
  font-size: 13px;
}

.route-editor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.route-editor label {
  display: grid;
  gap: 5px;
  align-items: start;
  font-size: 12px;
}

.option-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d7e1d9;
  border-radius: 8px;
  background: white;
}

.option-editor.warning {
  border-color: #f2bf7f;
  background: #fffaf0;
}

.option-editor label {
  grid-template-columns: 1fr;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
}

.route-editor label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-editor select {
  min-height: 34px;
  padding: 6px 8px;
}

.publish-alert {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #f0c36f;
  border-radius: 8px;
  background: #fff8e8;
  color: #775006;
  font-size: 13px;
}

.issue-list {
  margin: 12px 0;
  padding-left: 20px;
  color: var(--muted);
}

.phone-preview {
  padding: 14px;
  position: sticky;
  top: 118px;
}

.phone-shell {
  width: 100%;
  min-height: 560px;
  border: 1px solid #cbd6ce;
  border-radius: 24px;
  overflow: hidden;
  background: #edf4ed;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.phone-header {
  background: #214236;
  color: white;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.phone-header > div:last-child {
  min-width: 0;
}

.phone-header strong,
.phone-header div {
  overflow-wrap: anywhere;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f2b544;
  color: #422b04;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.chat-area {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.bubble {
  max-width: 86%;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 8px;
  background: white;
  border: 1px solid #d7e1d9;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: normal;
}

.bubble.user {
  margin-left: auto;
  background: #d8f4e7;
}

.typing-bubble {
  width: 70px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #7f8c86;
  animation: typingPulse 1s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-reply {
  min-height: 44px;
  border: 1px solid #c1d7cc;
  border-radius: 999px;
  background: white;
  padding: 10px 13px;
  color: #234438;
  font-size: 16px;
  line-height: 1.2;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.phone-input {
  border-top: 1px solid #cbd6ce;
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #f8fbf8;
  color: var(--muted);
}

.phone-input.composer,
.phone-input.contact-composer {
  display: grid;
  gap: 8px;
  color: var(--ink);
}

.phone-input.composer {
  grid-template-columns: 1fr auto;
}

.phone-input.contact-composer {
  grid-template-columns: 1fr 1fr auto;
}

.phone-input input {
  min-height: 44px;
  border-radius: 999px;
  border-color: #cbd6ce;
  background: white;
  font-size: 16px;
  min-width: 0;
  padding: 0 14px;
}

.phone-input button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  color: white;
  background: var(--green);
  font-weight: 700;
  font-size: 16px;
}

.phone-input.muted-input,
.phone-input.done {
  color: var(--muted);
}

.phone-input.action-input {
  display: grid;
  place-items: center;
}

.phone-input.action-input .primary-button {
  width: 100%;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  min-height: 300px;
  padding: 12px;
}

.kanban-column h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.lead-ticket {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #ffffff;
  margin-bottom: 10px;
}

.progress-bar {
  height: 10px;
  background: #e7ece7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 52px;
  align-items: center;
  gap: 12px;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

.modal-card {
  width: min(620px, calc(100vw - 28px));
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0 0 14px;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cbd6ce;
  border-radius: 8px;
  background: #fbfcfa;
}

.public-body,
.public-funnel-body {
  background: #f6f4ed;
}

.public-funnel-body {
  min-height: 100svh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

.site-header {
  min-height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 244, 0.94);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
}

.site-brand,
.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand .brand-mark {
  width: 36px;
  height: 36px;
}

.site-nav {
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
}

.primary-link {
  color: var(--green-dark);
}

.hero-band {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  align-items: center;
  gap: 44px;
  padding: 58px 7vw 72px;
}

.hero-copy h1 {
  margin: 8px 0 14px;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.92;
}

.hero-copy p {
  max-width: 680px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.hero-product {
  display: grid;
  place-items: center;
}

.mini-window {
  width: min(100%, 560px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mini-window-bar {
  height: 42px;
  background: #16231d;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
}

.mini-window-bar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f2b544;
}

.mini-dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 18px;
}

.mini-dashboard div,
.mini-chat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.mini-dashboard small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.mini-dashboard strong {
  font-size: 28px;
}

.mini-chat {
  margin: 0 18px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.mini-chat p {
  width: 100%;
  margin: 0 0 4px;
}

.mini-chat button {
  border: 1px solid #c1d7cc;
  border-radius: 999px;
  padding: 8px 10px;
  background: white;
}

.site-section {
  padding: 68px 7vw;
  border-top: 1px solid var(--line);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: 34px;
}

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

.feature-grid article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.feature-grid p {
  color: var(--muted);
  line-height: 1.5;
}

.public-funnel-shell {
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.public-phone {
  width: min(430px, 100%);
  min-width: 0;
}

.public-phone-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.public-phone .phone-shell {
  height: min(720px, calc(100svh - 92px));
  height: min(720px, calc(100dvh - 92px));
  min-height: 540px;
  box-shadow: var(--shadow);
}

.public-form,
.public-summary {
  display: grid;
  gap: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #d7e1d9;
  border-radius: 8px;
  padding: 12px;
}

.public-summary p {
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.public-error {
  max-width: 520px;
}

.public-trust-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  color: #7e8982;
  font-size: 12px;
}

.public-trust-footer a:hover {
  color: var(--green-dark);
  text-decoration: underline;
}

.legal-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 58px 24px 72px;
}

.legal-page h1 {
  font-size: 46px;
  margin: 8px 0 18px;
}

.legal-page h2 {
  margin-top: 28px;
  font-size: 22px;
}

.legal-page p {
  color: var(--muted);
  line-height: 1.65;
}

.legal-note {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 32px;
}

@media (max-width: 1180px) {
  .login-screen {
    grid-template-columns: 1fr;
    padding: 26px;
  }

  .login-hero {
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 92px 1fr;
  }

  .brand div:last-child,
  .nav-item span:last-child,
  .sidebar-footer {
    display: none;
  }

  .brand {
    justify-content: center;
  }

  .nav-item {
    justify-content: center;
  }

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

  .phone-preview {
    position: static;
  }

  .flow-builder-layout {
    grid-template-columns: 156px minmax(0, 1fr);
    grid-template-rows: auto minmax(520px, auto) auto;
  }

  .flow-inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .canvas-map {
    min-width: 1040px;
  }
}

@media (max-width: 1340px) and (min-width: 1181px) {
  .builder-layout {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .phone-preview {
    grid-column: 1 / -1;
    position: static;
  }

  .phone-shell {
    max-width: 420px;
  }
}

@media (max-width: 820px) {
  .login-screen {
    padding: 14px;
  }

  .login-hero {
    padding: 22px;
  }

  .login-copy h1 {
    font-size: 36px;
  }

  .login-proof {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 20px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .nav-item {
    min-width: 120px;
  }

  .nav-item span:last-child {
    display: inline;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .content-view {
    padding: 18px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .hero-band {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 42px 18px;
  }

  .feature-grid,
  .mini-dashboard {
    grid-template-columns: 1fr;
  }

  .flow-builder-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(500px, 65vh) auto;
  }

  .flow-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-tabs,
  .flow-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .flow-palette {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .palette-item,
  .palette-add-step {
    min-height: 48px;
  }

  .palette-brand {
    display: none;
  }

  .flow-canvas {
    min-height: 500px;
  }

  .flow-inspector {
    grid-column: auto;
  }

  .canvas-map {
    min-width: 960px;
  }
}

@media (max-width: 520px) {
  .public-funnel-shell {
    min-height: 100svh;
    min-height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    place-items: start center;
  }

  .public-phone,
  .public-phone-stack {
    width: 100%;
  }

  .public-phone .phone-shell {
    height: calc(100svh - 30px);
    height: calc(100dvh - 30px);
    min-height: 0;
    border-radius: 18px;
  }

  .phone-header {
    padding: 12px;
  }

  .phone-header strong {
    font-size: 16px;
    line-height: 1.18;
  }

  .chat-area {
    padding: 12px;
    gap: 9px;
  }

  .bubble {
    max-width: 92%;
    padding: 10px 11px;
    font-size: 16px;
    line-height: 1.38;
  }

  .quick-replies {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .quick-reply {
    width: 100%;
  }

  .phone-input.composer {
    grid-template-columns: 1fr;
  }

  .phone-input.contact-composer {
    grid-template-columns: 1fr;
  }

  .phone-input button {
    width: 100%;
  }

  .public-trust-footer {
    padding-bottom: 2px;
  }
}
