:root {
  --forest: #103f35;
  --ink: #17332c;
  --muted: #55675e;
  --paper: #f7f7f0;
  --mint: #dceedd;
  --border: #ccd4cb;
  --coral: #ff8a70;
  --serif: Georgia, "Times New Roman", serif;
  color: var(--ink);
  font: 16px/1.48 system-ui, -apple-system, sans-serif;
}
* {box-sizing: border-box}
body {margin: 0; background: var(--paper)}
a {color: var(--forest)}
button, input, select, textarea {font: inherit}
button, .button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 40px;
  padding: .52rem 1rem; border: 1px solid var(--forest); border-radius: 7px;
  background: var(--forest); color: white; font-weight: 600; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover {filter: brightness(1.13)}
.secondary, .plain {color: var(--forest); background: white}
.plain {min-height: 30px; border: 0; background: transparent; text-decoration: underline; padding: .2rem .4rem}
.small {font-size: .83rem; min-height: 34px; padding: .38rem .7rem}
input:not([type=checkbox]), select, textarea {
  width: 100%; min-width: 0; padding: .65rem .75rem; border: 1px solid #a7b5aa;
  background: white; color: var(--ink); border-radius: 6px;
}
textarea {display: block; resize: vertical}
label {display: block; font-size: .91rem; font-weight: 600}
label :is(input:not([type=checkbox]), textarea, select), label + input {margin-top: .3rem}
:focus-visible {outline: 3px solid #bc5b2e; outline-offset: 3px}
h1, h2, p {margin: 0}
h1, h2 {font-family: var(--serif); color: #102f27; line-height: 1.08; overflow-wrap: anywhere}
h1 {font-size: clamp(2.5rem, 4vw, 4.1rem); letter-spacing: -.055em}
h2 {font-size: clamp(1.55rem, 2.3vw, 2.35rem); letter-spacing: -.04em}
small, .muted, .preview, .access {color: var(--muted)}
small {font-size: .81rem}
[hidden] {display: none !important}
.skip {position: fixed; top: -100px; left: 1rem; background: white; padding: .7rem; z-index: 9}
.skip:focus {top: 1rem}
.workspace {display: grid; grid-template-columns: clamp(190px, 18vw, 275px) minmax(0, 1fr)}
.sidebar {position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 1.1rem; background: var(--forest); color: #fbfaee; padding: 2rem 1.15rem 1.2rem}
.brand {display: inline-flex; align-items: center; gap: .65rem; font: bold clamp(1.7rem, 2.5vw, 2.65rem)/1 var(--serif); letter-spacing: -.045em; white-space: nowrap; color: #fff9ea}
.brand-link {display: block; text-decoration: none; padding: 0 .4rem 1.4rem; border-bottom: 1px solid #678679}
.thread-mark {position: relative; display: inline-block; height: .9em; width: 1.38em; color: var(--coral); flex: none}
.thread-mark::before, .thread-mark::after {content: ""; position: absolute; top: 0; width: .69em; height: .85em; border: .09em solid; border-radius: 55%; transform: rotate(35deg)}
.thread-mark::before {left: .08em}
.thread-mark::after {left: .57em}
.tenant {padding-inline: .45rem; font: bold 1.55rem var(--serif); overflow-wrap: anywhere}
.sidebar nav {display: grid; gap: .35rem}
.sidebar nav a {display: flex; align-items: center; gap: .75rem; padding: .72rem .8rem; color: #f6f7ed; border-radius: 7px; text-decoration: none}
.sidebar nav a:hover, .sidebar nav [aria-current] {background: #376452}
.sidebar nav [aria-current] {font-weight: 650}
.nav-icon {width: 1.2rem; font-size: 1.3rem; text-align: center; line-height: 1}
.profile {margin-top: auto; border-top: 1px solid #648677; display: flex; gap: .65rem; align-items: center; padding-top: 1rem; overflow-wrap: anywhere}
.profile strong {font-size: .93rem}
.logout {display: block; min-height: 24px; font-size: .8rem; color: #d6e6d7; border: 0; padding: 0; background: transparent; text-decoration: underline}
.avatar {display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; background: #e6eddf; border-radius: 50%; color: var(--forest); font-weight: 650}
.workspace main {min-width: 0; padding: clamp(1.15rem, 2.4vw, 3rem); width: 100%; max-width: 1760px; margin-inline: auto}
.page-head {display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; margin: 0 0 1.3rem}
.page-head p {margin-top: .45rem}
.access {font-size: .84rem}
.panel {background: white; border: 1px solid var(--border); border-radius: 12px; min-width: 0}
.card {padding: clamp(1.1rem, 2vw, 2.1rem)}
.card > * + * {margin-top: 1rem}
.line, .tools, .meta, .attention {display: flex; flex-wrap: wrap; align-items: center; gap: .65rem}
.line, .attention {justify-content: space-between}
.pill {display: inline-block; border-radius: 20px; padding: .23rem .68rem; font-size: .8rem; font-weight: 650; background: var(--mint); color: var(--forest)}
.pill.warm, .attention span {background: #ffebd4; color: #814210}
.notice {margin: 0 0 .8rem; border-radius: 7px; padding: .55rem .85rem; background: var(--mint); color: var(--forest)}
.stack {display: grid; gap: 1rem}
.inbox-grid {display: grid; grid-template-columns: minmax(235px, .84fr) minmax(0, 1.45fr); gap: .8rem; height: calc(100dvh - 8.7rem); min-height: 480px}
.queue, .conversation {display: flex; flex-direction: column; overflow: hidden}
.queue-scroll, .history {min-height: 0; overflow-y: auto; scrollbar-width: thin}
.segments {display: flex; margin: .9rem .7rem; padding: .2rem; border: 1px solid var(--border); border-radius: 8px}
.segments a {display: grid; flex: 1 auto; place-items: center; border-radius: 5px; min-height: 36px; color: var(--ink); text-align: center; text-decoration: none; font-size: .84rem; padding: .2rem}
.segments [aria-current], .contact-row[aria-current] {background: var(--mint)}
.contact-row {display: flex; gap: .55rem; align-items: flex-start; color: var(--ink); text-decoration: none; padding: 1rem .8rem; border-top: 1px solid #e2e7df}
.contact-row:hover {background: #f0f6ed}
.row-body {min-width: 0; flex: 1; display: grid; gap: .23rem}
.row-body > * {overflow: hidden; white-space: nowrap; text-overflow: ellipsis}
.source, .preview {font-size: .82rem}
.dot {display: inline-block; width: .58rem; height: .58rem; border-radius: 50%; background: #6f7972; margin-right: .3rem}
.dot.whatsapp {background: #208752}
.dot.instagram {background: #b64075}
.dot.messenger {background: #3677cc}
.row-meta {display: grid; justify-items: end; gap: .5rem; white-space: nowrap; color: var(--muted); font-size: .72rem}
.pending-dot {width: 8px; height: 8px; background: #bd630f; border-radius: 50%}
.empty, .more {display: block; padding: 1rem; color: var(--muted)}
.choose {margin: auto; padding: 2rem; text-align: center}
.choose .thread-mark {font-size: 2.3rem; margin-bottom: .8rem}
.choose p {color: var(--muted); margin-top: .65rem}
.conversation-head {padding: 1rem 1.15rem; border-bottom: 1px solid var(--border)}
.conversation-head .meta {margin-top: .65rem; font-size: .85rem}
.mobile-back {display: none}
.history {flex: 1; background: #fcfcf7; padding: 1rem; display: flex; flex-direction: column; align-items: flex-start; gap: .75rem}
.bubble {max-width: 85%; border: 1px solid #e0e4d8; border-radius: 12px 12px 12px 3px; background: #f1f2ea; padding: .65rem .9rem}
.bubble p {white-space: pre-wrap; overflow-wrap: anywhere}
.bubble small {display: block; margin-top: .32rem; font-size: .72rem; text-align: right}
.outgoing {align-self: flex-end; background: #e2f1df; border-radius: 12px 12px 3px 12px}
.attention {padding: .35rem .9rem; border-top: 1px solid var(--border); font-size: .8rem}
.attention span {border-radius: 12px; padding: .15rem .5rem}
.composer {border-top: 1px solid var(--border); padding: .8rem}
.tools {margin-top: .6rem}
.tools select {width: auto; max-width: 100%; font-size: .82rem; padding: .47rem}
.send {margin-left: auto}
dialog {border: 1px solid var(--border); color: var(--ink); width: min(430px, 100%); max-width: 100%; max-height: 100dvh; margin: 0 0 0 auto; height: 100dvh; padding: 2rem 1.5rem; background: white}
dialog::backdrop {background: #122f265c}
dialog form {align-content: start}
.account-grid {display: grid; grid-template-columns: 1.15fr 1fr; gap: 1rem}
.channels {grid-row: span 2}
.channel {border-top: 1px solid var(--border); margin: 0}
.channel:first-of-type {margin-top: 1.15rem}
summary {cursor: pointer; font-weight: 600}
.channel summary {padding: 1rem .15rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap}
.channel summary::after {content: "⌄"; margin-left: auto}
.channel[open] summary::after {content: "⌃"}
.channel-title {font-weight: 700}
.tinted {background: #eff5ec; padding: 1rem; border-radius: 7px; margin-bottom: 1rem}
.connection-info {overflow-wrap: anywhere; font-size: .84rem; padding-bottom: .7rem}
.disclosure {font-size: .85rem; padding-top: .7rem; border-top: 1px solid var(--border)}
.disclosure[open] > :not(summary) {margin-top: .65rem}
.price {font-size: 1.75rem; font-weight: 700}
.wide {width: 100%}
.public-form {grid-column: 1/-1; display: flex; align-items: center; flex-wrap: wrap; gap: 1rem}
.public-form > * {margin: 0}
.public-form > div {margin-right: auto}
.public-form p {margin-top: .4rem}
.embed[open] {flex-basis: 100%}
.embed code {display: block; white-space: normal; overflow-wrap: anywhere; background: var(--paper); padding: 1rem; margin-top: .6rem}
.kpis {display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: .9rem}
.kpis h2 {font: 650 1rem/1.3 system-ui, sans-serif; letter-spacing: 0}
.kpis strong {display: block; font: bold clamp(2rem, 4vw, 4rem)/1.05 var(--serif); letter-spacing: -.055em; overflow-wrap: anywhere}
.kpis small {display: block}
.chart {margin: 1rem 0}
.bar-row {display: grid; grid-template-columns: minmax(100px, 1fr) 2fr 8rem; gap: .8rem; align-items: center; overflow-wrap: anywhere}
.bar {height: 1.05rem; background: var(--mint); border-radius: 3px; overflow: hidden}
.bar > div {height: 100%; background: #25704c}
.legend {display: flex; gap: 1rem; font-size: .8rem}
.legend i {display: inline-block; height: .7rem; width: .7rem; margin-right: .3rem; background: #25704c}
.legend span + span i {background: var(--mint)}
.table-scroll {max-width: 100%; overflow-x: auto}
table {border-collapse: collapse; font-size: .9rem; width: 100%}
th, td {text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border); overflow-wrap: anywhere}
thead {background: #eaf2e7}
.ad-row {font-size: .82rem; color: var(--muted)}
.standalone {background: #e6efe2}
.standalone main {min-height: 100dvh; display: grid; place-items: center; padding: 1rem}
.entry {width: min(100%, 29rem); background: white; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; box-shadow: 0 12px 42px #103f350c}
.entry header {display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; background: var(--forest); padding: 1.1rem 1.5rem}
.entry-tenant {color: white; border-left: 1px solid #8aa496; padding-left: .75rem; font: 1.25rem var(--serif); overflow-wrap: anywhere}
.entry-body {padding: clamp(1.25rem, 3vw, 2rem)}
.entry-body h1 {font-size: clamp(2rem, 3vw, 2.7rem); margin-bottom: 1.25rem}
.helptext, .helptext ul {color: var(--muted); font-size: .8rem; margin: .3rem 0}
.errorlist {color: #8c381f; padding-left: 1.2rem; margin: 0}
@media (max-width: 920px) {
  .workspace {grid-template-columns: 165px minmax(0, 1fr)}
  .sidebar {padding-inline: .75rem}
  .inbox-grid {grid-template-columns: minmax(200px, .75fr) minmax(0, 1.25fr)}
  .contact-row .avatar {display: none}
  .tools {gap: .4rem}
}
@media (max-width: 740px) {
  .workspace {display: block}
  .sidebar {height: auto; position: static; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .45rem .7rem; padding: .8rem 1rem .55rem}
  .brand-link {border: 0; padding: 0}
  .tenant {font-size: .95rem; font-weight: normal; flex: 1}
  .profile {border: 0; padding: 0; margin: 0}
  .profile .avatar, .profile strong {display: none}
  .sidebar nav {order: 2; display: flex; width: 100%; gap: .2rem}
  .sidebar nav a {padding: .42rem .7rem; font-size: .87rem}
  .nav-icon {display: none}
  .workspace main {padding: 1rem .75rem}
  .page-head {margin-bottom: 1rem}
  .inbox-grid {display: block; height: auto; min-height: 0}
  .queue {min-height: 45vh}
  .inbox:not(.has-detail) .conversation, .has-detail .queue, .has-detail .page-head {display: none}
  .contact-row .avatar {display: grid}
  .contact-row {min-height: 78px}
  .conversation {min-height: 540px; height: calc(100dvh - 125px)}
  .mobile-back {display: inline-block; margin-bottom: .6rem; font-size: .85rem}
  .conversation-head {padding: .8rem}
  .tools select {max-width: 47%}
  .account-grid {grid-template-columns: 1fr}
  .channels {grid-row: auto}
  .kpis {grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem}
  .kpis .card:last-child {grid-column: 1/-1}
  .bar-row {grid-template-columns: 1fr auto; gap: .25rem}
  .bar-space {order: 3; grid-column: 1/-1}
  .table-scroll table {min-width: 540px}
}
.brand small{color:inherit;font:600 .68rem/1 system-ui;letter-spacing:.12em;vertical-align:middle}
.starter-guide {padding:clamp(1rem,3vw,2.5rem);overflow:auto}
.starter-guide h2 {margin:.4rem 0}
.starter-guide h3 {font-size:1rem;margin:1.25rem 0 .4rem}
.starter-guide details {padding:.55rem 0;border-bottom:1px solid var(--border)}
.starter-guide summary {cursor:pointer;font-weight:600}
.starter-guide p {color:var(--muted);margin:.4rem 0}
.starter-guide a {display:inline-block;margin-top:1.25rem}
@media(max-width:740px){
  .inbox.has-starters .conversation {display:block;height:auto;min-height:0;margin-top:.75rem}
  .has-starters .queue {min-height:0}
}
.guide-links {display:flex;gap:1rem;flex-wrap:wrap}
.starter-guide .guide-links a {margin-top:.35rem}
.guide-form {margin-block:.85rem;padding:.9rem;background:var(--paper);border-radius:10px}
.guide-form button {justify-self:start}
.guide-preview {border-left:3px solid var(--forest);padding:.5rem .8rem;background:white}
.guide-preview [data-message] {white-space:pre-wrap;overflow-wrap:anywhere}
.guide-progress {margin:1rem 0;padding:.85rem 1rem;background:var(--paper);border-radius:10px}
.guide-progress progress {display:block;width:100%;height:.5rem;margin:.5rem 0;accent-color:var(--forest)}
.guide-state {display:inline-block;font-weight:500;background:var(--paper);border-radius:1rem;padding:.15rem .55rem}
.starter-guide .finished-guide {margin-top:1.5rem;border-top:1px solid var(--border)}
.finished-guide > details {margin-inline-start:.75rem}
