:root {
  --sidebar-width: 248px;
  --ink: #18211b;
  --muted: #68756d;
  --line: #dfe7dd;
  --surface: #ffffff;
  --canvas: #f4f6f2;
  --green: #147a49;
  --green-soft: #e7f5ec;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid #d8e1d8;
  background: #fbfcfa;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 78px;
  padding: 0 1.15rem;
  border-bottom: 1px solid #e4eae2;
  color: var(--ink);
  text-decoration: none;
}

.sidebar-brand:hover {
  color: var(--ink);
}

.sidebar-brand > span:last-child,
.sidebar-footer > span:last-child {
  display: grid;
}

.sidebar-brand strong {
  font-size: 1rem;
  line-height: 1.2;
}

.sidebar-brand small,
.sidebar-footer small {
  color: var(--muted);
  font-size: .74rem;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 8px;
  background: #1d9b5d;
  color: #fff;
  font-weight: 850;
}

.sidebar-nav {
  display: grid;
  gap: .25rem;
  padding: 1.35rem .75rem;
  overflow-y: auto;
}

.nav-label {
  margin: 0 0 .35rem;
  padding: 0 .65rem;
  color: #8a958e;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-label-secondary {
  margin-top: 1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 42px;
  padding: .55rem .65rem;
  border-radius: 7px;
  color: #435048;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}

.sidebar-link:hover {
  background: #f0f3ef;
  color: var(--ink);
}

.sidebar-link.active {
  background: var(--green-soft);
  color: #0d663c;
}

.nav-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border: 1px solid #98a49c;
  border-radius: 50%;
}

.sidebar-link.active .nav-indicator {
  border-color: var(--green);
  background: var(--green);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: auto .75rem .85rem;
  padding: .8rem;
  border: 1px solid #e0e7de;
  border-radius: 8px;
  background: #fff;
}

.sidebar-footer strong {
  font-size: .82rem;
}

.sidebar-account {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  min-width: 0;
}

.account-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #e7f5ec;
  color: #0d663c;
  font-size: .78rem;
  font-weight: 850;
}

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

.account-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account form {
  min-width: 0;
}

.logout-button {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: .3rem .4rem;
  border: 0;
  background: transparent;
  color: #7a4038;
  font-size: .74rem;
  font-weight: 750;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button:hover {
  color: #a5291e;
  text-decoration: underline;
}

.status-dot {
  width: .6rem;
  height: .6rem;
  flex: 0 0 .6rem;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 0 4px rgba(37, 211, 102, .14);
}

.app-workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.app-main {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 2rem;
}

.mobile-header,
.sidebar-backdrop {
  display: none;
}

.dashboard-shell {
  display: grid;
  gap: 1.25rem;
  padding: 1rem 0 2.5rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 86px;
  border-bottom: 1px solid #dde4dc;
}

.dashboard-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 780;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 .2rem;
  color: var(--green);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 38px;
  padding: .55rem .75rem;
  border: 1px solid #dce5dc;
  border-radius: 7px;
  background: #fff;
  color: #516257;
  font-size: .84rem;
}

.dashboard-section[hidden] {
  display: none;
}

.dashboard-section.active {
  animation: section-in 160ms ease-out;
}

@keyframes section-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 760;
}

.section-heading p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.metric-grid,
.workspace-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  align-items: start;
}

.secondary-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
}

.form-page {
  display: grid;
  grid-template-columns: minmax(0, 760px);
}

.metric-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(33, 47, 37, .045);
}

.metric-panel {
  min-height: 108px;
  padding: 1rem;
}

.metric-panel span {
  display: block;
  color: var(--muted);
  font-size: .83rem;
}

.metric-panel strong {
  display: block;
  margin-top: .35rem;
  font-size: 2rem;
  line-height: 1;
}

.overview-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-left: 3px solid #d69b2d;
  background: #fffaf0;
}

.overview-note strong {
  font-size: .92rem;
}

.overview-note p {
  margin: .15rem 0 0;
  color: #6f6249;
  font-size: .86rem;
}

.overview-note a {
  flex: 0 0 auto;
  color: #72510f;
  font-size: .85rem;
  font-weight: 750;
}

.whatsapp-health-section {
  margin-top: 2rem;
}

.health-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .35rem .8rem;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  border: 1px solid #ead18d;
  border-radius: 8px;
  background: #fff8e5;
  color: #72550a;
  font-size: .84rem;
}

.health-warning-critical {
  border-color: #efc5c0;
  background: #fff0ee;
  color: #8e2d24;
}

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

.health-card {
  min-width: 0;
  min-height: 190px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(33, 47, 37, .045);
}

.health-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .025em;
}

.health-card > strong:not(.health-number) {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.health-card p {
  margin: .45rem 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.health-card > a {
  display: inline-block;
  margin-top: .8rem;
  color: var(--green);
  font-size: .8rem;
  font-weight: 750;
}

.health-card small {
  display: block;
  margin-top: .65rem;
  color: #8b958e;
  font-size: .72rem;
}

.health-state {
  padding: .22rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  letter-spacing: 0;
}

.health-state-good {
  background: #dcf7e8;
  color: #0e6d3d;
}

.health-state-bad {
  background: #fde2df;
  color: #a5291e;
}

.health-number {
  display: block;
  color: #123f29;
  font-size: 2rem;
  line-height: 1;
}

.quality-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .35rem .5rem;
  border-radius: 6px;
  font-size: .72rem;
}

.quality-good { background: #dcf7e8; color: #0e6d3d; }
.quality-medium { background: #fff2cc; color: #826100; }
.quality-low { background: #fde2df; color: #a5291e; }

.health-rate-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .7rem;
  color: #4d5c52;
  font-size: .78rem;
}

.health-progress {
  height: 6px;
  margin-top: .3rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece6;
}

.health-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #27a86a;
}

.health-progress-read span {
  background: #4f8fd9;
}

.health-disclaimer {
  margin: .8rem 0 0;
  color: var(--muted);
  font-size: .76rem;
}

.panel {
  padding: 1.15rem;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-title h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 760;
}

.panel-title p,
.form-hint {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .83rem;
}

.modal-content {
  border: 1px solid #dbe4da;
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(24, 33, 27, .18);
}

.modal-header,
.modal-footer {
  border-color: #e1e7df;
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 760;
}

.modal-header p {
  margin: .2rem 1rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}

.form-stack {
  display: grid;
  gap: .9rem;
}

.form-control,
.form-select {
  min-height: 42px;
  border-color: #d9e2d9;
  border-radius: 7px;
}

.form-control:focus,
.form-select:focus {
  border-color: #63a981;
  box-shadow: 0 0 0 .2rem rgba(20, 122, 73, .12);
}

.message-box {
  min-height: 156px;
  resize: vertical;
}

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

.btn {
  min-height: 42px;
  border-radius: 7px;
  font-weight: 700;
}

.btn-success {
  border-color: var(--green);
  background: var(--green);
}

.template-list {
  display: grid;
  gap: .75rem;
}

.template-item {
  padding: .85rem;
  border: 1px solid #e3e9e1;
  border-radius: 8px;
  background: #fbfcfa;
}

.template-item div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .45rem;
}

.section-actions,
.template-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.template-identity {
  display: grid !important;
  justify-items: start;
  gap: .15rem !important;
  margin: 0 !important;
}

.template-actions {
  flex: 0 0 auto;
  margin: 0 !important;
}

.template-actions form,
.section-actions form {
  margin: 0;
}

.template-meta-error {
  display: block;
  margin-top: .6rem;
  color: #a5291e;
  overflow-wrap: anywhere;
}

.status-localdraft { background: #e6edf7; color: #315c8f; }
.status-pending { background: #fff2cc; color: #826100; }
.status-approved { background: #dcf7e8; color: #0e6d3d; }
.status-rejected,
.status-disabled,
.status-submissionfailed { background: #fde2df; color: #a5291e; }
.status-paused,
.status-unknown { background: #ecebea; color: #5f625f; }

.template-item span {
  color: var(--muted);
  font-size: .78rem;
  text-align: right;
}

.template-item p {
  margin: 0;
  color: #314238;
  font-size: .9rem;
}

.history-panel {
  overflow: hidden;
}

.table {
  margin: 0;
}

.table thead th {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message-preview {
  max-width: 520px;
  color: #243229;
}

.template-preview-panel {
  position: sticky;
  top: 1rem;
}

.template-preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
  color: var(--muted);
  font-size: .82rem;
}

.template-live-preview {
  min-height: 132px;
  margin: 0;
  padding: 1rem;
  border-radius: 12px 12px 2px 12px;
  background: #dcf8c6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.webhook-table {
  min-width: 980px;
}

.webhook-message-id {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.webhook-summary {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.help-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.help-index {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: .35rem;
}

.help-index strong {
  margin-bottom: .35rem;
  color: var(--ink);
}

.help-index a {
  padding: .45rem .55rem;
  border-radius: 8px;
  color: #415247;
  font-size: .86rem;
  text-decoration: none;
}

.help-index a:hover {
  background: #eef6f0;
  color: var(--green);
}

.help-content {
  display: grid;
  gap: 1rem;
}

.help-section {
  scroll-margin-top: 1rem;
}

.help-section p,
.help-section li {
  color: #4f5d54;
  line-height: 1.65;
}

.help-section code,
.help-code {
  border-radius: 6px;
  background: #f2f7f3;
  color: #1f5f3b;
}

.help-section code {
  padding: .1rem .28rem;
  font-size: .86em;
}

.help-table-wrapper {
  overflow-x: auto;
}

.help-table {
  margin-bottom: 0;
  border-color: #e1e8df;
  font-size: .88rem;
}

.help-table th {
  background: #f3f7f2;
  color: #34463a;
  font-size: .74rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.help-note {
  margin-top: .85rem;
  padding: .75rem .9rem;
  border: 1px solid #d7e7d9;
  border-radius: 10px;
  background: #f5fbf6;
}

.help-code {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid #dce7dd;
  white-space: pre;
}

.contacts-panel {
  display: grid;
  gap: 1rem;
}

.contacts-search {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: .75rem;
  align-items: end;
}

.contacts-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  color: var(--muted);
  font-size: .82rem;
}

.contacts-summary span {
  padding: .25rem .55rem;
  border-radius: 999px;
  background: #f0f5f1;
}

.contacts-table td {
  vertical-align: middle;
}

.contact-row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}

.contacts-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
  padding-top: .25rem;
}

.contacts-pagination span {
  color: var(--muted);
  font-size: .82rem;
}

.contact-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.status-contact {
  background: #edf5ef;
  color: #24653f;
}

.contact-autocomplete {
  position: relative;
}

.contact-autocomplete-results {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  left: 0;
  z-index: 1060;
  overflow: hidden;
  border: 1px solid #dce5dc;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(31, 45, 36, .16);
}

.contact-autocomplete-item {
  display: grid;
  width: 100%;
  gap: .15rem;
  padding: .7rem .85rem;
  border: 0;
  border-bottom: 1px solid #edf2ee;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.contact-autocomplete-item:last-child {
  border-bottom: 0;
}

.contact-autocomplete-item:hover,
.contact-autocomplete-item:focus {
  background: #f2f8f4;
  outline: none;
}

.contact-autocomplete-item strong {
  font-size: .88rem;
}

.contact-autocomplete-item small,
.contact-autocomplete-empty {
  color: var(--muted);
  font-size: .75rem;
}

.contact-autocomplete-empty {
  padding: .8rem .9rem;
}

.received-chat-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  height: min(720px, calc(100vh - 190px));
  min-height: 560px;
  padding: 0;
  overflow: hidden;
}

.received-chat-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid #d8dfda;
  background: #fff;
}

.received-chat-sidebar-header,
.received-chat-header {
  min-height: 68px;
  padding: .75rem 1rem;
  background: #f0f2f1;
}

.received-chat-sidebar-header {
  display: flex;
  align-items: center;
}

.received-chat-sidebar-header > div,
.received-chat-header > div {
  display: grid;
}

.received-chat-sidebar-header small,
.received-chat-header small {
  color: var(--muted);
  font-size: .76rem;
}

.received-conversation-list {
  min-height: 0;
  overflow-y: auto;
}

.received-conversation {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: .75rem;
  min-height: 78px;
  padding: .75rem 1rem;
  border-bottom: 1px solid #edf0ed;
  color: var(--ink);
  text-decoration: none;
}

.received-conversation:hover {
  background: #f5f7f5;
  color: var(--ink);
}

.received-conversation.active {
  background: #e9edef;
}

.received-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 50%;
  background: #d5e8dc;
  color: #147a49;
  font-size: .78rem;
  font-weight: 850;
}

.received-conversation-copy {
  display: grid;
  min-width: 0;
  align-content: center;
}

.received-conversation-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.received-conversation-heading strong {
  overflow: hidden;
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.received-conversation-heading time,
.received-conversation-copy small {
  color: #76827a;
  font-size: .7rem;
}

.received-conversation-preview {
  overflow: hidden;
  color: #657168;
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.received-message-count {
  position: absolute;
  right: 1rem;
  bottom: .55rem;
  min-width: 20px;
  padding: .1rem .35rem;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-size: .67rem;
  font-weight: 800;
  text-align: center;
}

.received-chat-list-empty {
  display: grid;
  min-height: 180px;
  padding: 1rem;
  place-items: center;
  color: var(--muted);
  font-size: .84rem;
  text-align: center;
}

.received-chat-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: #efeae2;
}

.received-chat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid #d9dedb;
}

.received-chat-timeline {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: .55rem;
  padding: 1.5rem 5%;
  overflow-y: auto;
  background-color: #efeae2;
  background-image:
    radial-gradient(circle at 12px 12px, rgba(88, 104, 94, .055) 1px, transparent 1.5px),
    radial-gradient(circle at 34px 34px, rgba(88, 104, 94, .04) 1px, transparent 1.5px);
  background-size: 46px 46px;
}

.received-chat-bubble {
  position: relative;
  align-self: flex-start;
  width: fit-content;
  max-width: min(72%, 640px);
  padding: .55rem .7rem .35rem;
  border-radius: 2px 9px 9px 9px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(41, 54, 45, .14);
}

.received-chat-bubble::before {
  position: absolute;
  top: 0;
  left: -7px;
  border-top: 8px solid #fff;
  border-left: 8px solid transparent;
  content: "";
}

.received-chat-bubble.outbound {
  align-self: flex-end;
  border-radius: 9px 2px 9px 9px;
  background: #dcf8c6;
}

.received-chat-bubble.outbound::before {
  right: -7px;
  left: auto;
  border-top-color: #dcf8c6;
  border-right: 8px solid transparent;
  border-left: 0;
}

.received-chat-bubble.failed {
  background: #ffe2df;
}

.received-chat-bubble.failed::before {
  border-top-color: #ffe2df;
}

.received-chat-bubble p {
  margin: 0;
  padding-right: 2.7rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .88rem;
}

.received-chat-meta {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  margin-top: .18rem;
  color: #7b857e;
  font-size: .64rem;
}

.received-chat-error {
  display: block;
  max-width: 420px;
  margin-top: .3rem;
  color: #a64235;
  font-size: .7rem;
}

.received-chat-reply {
  display: flex;
  min-height: 68px;
  flex-direction: column;
  justify-content: center;
  gap: .35rem;
  padding: .65rem .85rem;
  border-top: 1px solid #dde1de;
  background: #f0f2f1;
  color: #758079;
  font-size: .78rem;
}

.received-reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: end;
}

.received-reply-form textarea {
  width: 100%;
  min-height: 46px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid #d7ded9;
  border-radius: 18px;
  padding: .68rem .9rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.received-reply-form textarea:focus {
  border-color: #9ac9ac;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, .16);
}

.received-reply-form .btn {
  min-height: 44px;
  border-radius: 999px;
}

.received-reply-closed {
  padding: .75rem 1rem;
  border: 1px solid #ead7a6;
  border-radius: 12px;
  background: #fff8df;
  color: #7a5a13;
}

.received-chat-placeholder {
  display: grid;
  flex: 1;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.received-placeholder-mark {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 50%;
  background: #d9e8de;
  color: #16804d;
  font-size: 1.6rem;
  font-weight: 850;
}

.received-chat-placeholder h3 {
  margin: 0;
  font-size: 1.1rem;
}

.received-chat-placeholder p {
  margin: .35rem 0 0;
  font-size: .84rem;
}

.mobile-chat-body {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #efeae2;
}

.mobile-chat-main {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.mobile-chat-screen {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background: #efeae2;
}

.mobile-chat-list-header,
.mobile-chat-header {
  display: flex;
  min-height: calc(58px + env(safe-area-inset-top));
  align-items: center;
  gap: .75rem;
  padding: calc(.55rem + env(safe-area-inset-top)) .85rem .55rem;
  background: #075e54;
  color: #fff;
}

.mobile-chat-list-header {
  justify-content: space-between;
}

.mobile-chat-list-header > div,
.mobile-chat-header > div {
  display: grid;
  min-width: 0;
}

.mobile-chat-list-header strong,
.mobile-chat-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-chat-list-header small,
.mobile-chat-header small {
  color: rgba(255, 255, 255, .74);
  font-size: .72rem;
}

.mobile-chat-list-header a {
  color: rgba(255, 255, 255, .86);
  font-size: .76rem;
  font-weight: 750;
  text-decoration: none;
}

.mobile-chat-header .received-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  background: #cfe7dc;
}

.mobile-chat-back {
  display: grid;
  width: 30px;
  height: 38px;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
}

.mobile-chat-conversations {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
}

.mobile-chat-conversation {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: .75rem;
  min-height: 74px;
  padding: .7rem .9rem;
  border-bottom: 1px solid #edf0ed;
  color: var(--ink);
  text-decoration: none;
}

.mobile-chat-conversation:active,
.mobile-chat-conversation:hover {
  background: #f5f7f5;
  color: var(--ink);
}

.mobile-chat-timeline {
  flex: 1;
  min-height: 0;
  padding: .8rem .65rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-chat-timeline .received-chat-bubble {
  max-width: 86%;
}

.mobile-chat-reply {
  padding: .45rem .55rem calc(.45rem + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0, 0, 0, .08);
  background: #f0f2f1;
}

.mobile-chat-reply-form {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: end;
}

.mobile-chat-reply-form textarea {
  min-height: 42px;
  max-height: 110px;
  border: 0;
  border-radius: 22px;
  padding: .62rem .9rem;
  resize: none;
}

.mobile-chat-reply-form .btn {
  min-width: 58px;
  min-height: 42px;
  padding-inline: .8rem;
  border: 0;
  background: #128c7e;
  font-size: .82rem;
}

.mobile-chat-validation {
  display: block;
  margin: .35rem .55rem 0;
  font-size: .75rem;
}

.mobile-chat-closed {
  border-radius: 18px;
  font-size: .78rem;
}

.mobile-chat-empty {
  display: grid;
  flex: 1;
  place-content: center;
  justify-items: center;
  padding: 2rem;
  color: #55625b;
  text-align: center;
}

.mobile-chat-empty h1 {
  margin: 0;
  font-size: 1.1rem;
}

.mobile-chat-empty p {
  margin: .35rem 0 0;
  font-size: .84rem;
}

.chat-notification-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1080;
  display: grid;
  width: min(330px, calc(100vw - 2rem));
  gap: .65rem;
}

.chat-notification-toast {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .7rem;
  align-items: center;
  padding: .75rem .85rem;
  border: 1px solid rgba(9, 86, 68, .18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(20, 38, 30, .2);
  color: var(--ink);
  text-decoration: none;
  transition: opacity .18s ease, transform .18s ease;
}

.chat-notification-toast:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.chat-notification-toast.leaving {
  opacity: 0;
  transform: translateY(8px);
}

.chat-notification-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  font-weight: 850;
}

.chat-notification-toast span:last-child {
  display: grid;
  min-width: 0;
}

.chat-notification-toast strong,
.chat-notification-toast small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-notification-toast small {
  color: var(--muted);
  font-size: .78rem;
}

.payload-details summary {
  color: var(--green);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 750;
  white-space: nowrap;
}

.payload-details pre {
  width: min(680px, 70vw);
  max-height: 360px;
  margin: .65rem 0 0;
  padding: .75rem;
  overflow: auto;
  border: 1px solid #dce5dc;
  border-radius: 7px;
  background: #f7f9f6;
  color: #243229;
  font-size: .75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 800;
}

.status-accepted,
.status-sent,
.status-delivered,
.status-read {
  background: #dcf7e8;
  color: #0e6d3d;
}

.status-failed { background: #fde2df; color: #a5291e; }
.status-simulated { background: #fff2cc; color: #826100; }
.status-pending { background: #e6edf7; color: #315c8f; }
.status-connected { background: #dcf7e8; color: #0e6d3d; }
.status-pendingvalidation { background: #fff2cc; color: #826100; }
.status-disconnected,
.status-tokeninvalid { background: #fde2df; color: #a5291e; }

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

.billing-total {
  padding: .55rem .75rem;
  border: 1px solid #dce5dc;
  border-radius: 7px;
  background: #fff;
  font-size: .9rem;
}

.connection-actions {
  display: flex;
  gap: .55rem;
}

.connection-details {
  display: grid;
  gap: 0;
  margin: 0;
}

.connection-details > div {
  display: grid;
  grid-template-columns: minmax(120px, .55fr) minmax(0, 1fr);
  gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid #e5ebe3;
}

.connection-details dt {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
}

.connection-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: .88rem;
}

.connection-error {
  margin-top: 1rem;
  padding: .8rem;
  border-left: 3px solid #b83a2e;
  background: #fff3f1;
  color: #8f291f;
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.campaign-table,
.campaign-recipient-table {
  min-width: 1040px;
}

.campaign-row-actions,
.campaign-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
}

.campaign-row-actions form,
.campaign-detail-actions form {
  margin: 0;
}

.tenant-table {
  min-width: 1050px;
}

.sample-link,
.back-link {
  color: var(--green);
  font-size: .84rem;
  font-weight: 750;
}

.campaign-detail-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: .4rem 0 1.1rem;
  border-bottom: 1px solid #dde4dc;
}

.campaign-detail-header h2 {
  margin: .35rem 0 0;
  font-size: 1.55rem;
  font-weight: 780;
}

.campaign-detail-header p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .86rem;
}

.campaign-metrics .metric-panel {
  min-height: 96px;
}

.campaign-template-preview {
  display: grid;
  grid-template-columns: minmax(140px, .25fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.campaign-template-preview > div {
  display: grid;
}

.campaign-template-preview small,
.campaign-template-preview span {
  color: var(--muted);
  font-size: .8rem;
}

.campaign-template-preview p {
  margin: 0;
  overflow-wrap: anywhere;
}

.campaign-message-preview {
  max-width: 420px;
  overflow-wrap: anywhere;
}

.campaign-parameter-section {
  padding: 1rem;
  border: 1px solid #dfe7dd;
  border-radius: 8px;
  background: #f9fbf8;
}

.campaign-parameter-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.campaign-parameter-heading p {
  margin: -.2rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}

.campaign-csv-status {
  flex: 0 0 auto;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: #ecefed;
  color: #667168;
  font-size: .7rem;
  font-weight: 750;
}

.campaign-csv-status.ready {
  background: #dcf7e8;
  color: #0e6d3d;
}

.campaign-selected-template {
  margin-top: .85rem;
  padding: .75rem;
  border-left: 3px solid #25a45f;
  background: #fff;
}

.campaign-selected-template small {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}

.campaign-selected-template p {
  margin: .3rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .82rem;
}

.campaign-parameter-mappings {
  display: grid;
  gap: .65rem;
  margin-top: .85rem;
}

.campaign-parameter-row {
  display: grid;
  grid-template-columns: minmax(130px, .35fr) minmax(0, 1fr);
  align-items: center;
  gap: .75rem;
}

.campaign-parameter-row .form-label {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .8rem;
}

.campaign-mapping-empty {
  padding: .75rem;
  border: 1px dashed #ccd8cc;
  border-radius: 7px;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

.campaign-mapping-ready {
  border-color: #abd7bd;
  background: #f0faf4;
  color: #176b42;
}

.template-send-parameter-section {
  margin-top: .15rem;
}

.template-parameter-hint {
  margin: -.2rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}

.campaign-error {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.status-draft { background: #e6edf7; color: #315c8f; }
.status-queued,
.status-processing { background: #fff2cc; color: #826100; }
.status-completed { background: #dcf7e8; color: #0e6d3d; }
.status-completedwitherrors { background: #fde2df; color: #a5291e; }
.status-cancelled { background: #ecebea; color: #5f625f; }

.auth-body {
  background: #edf1ec;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 1.25rem;
  place-items: center;
}

.auth-card {
  width: min(100%, 430px);
  padding: 1.5rem;
  border: 1px solid #dbe4da;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 46, 35, .09);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  text-decoration: none;
}

.auth-brand > span:last-child {
  display: grid;
}

.auth-brand small {
  color: var(--muted);
  font-size: .72rem;
}

.auth-heading {
  margin: 1.75rem 0 1.2rem;
}

.auth-heading h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 780;
}

.auth-heading p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .87rem;
}

.auth-footer {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #e2e8e0;
  color: var(--muted);
  font-size: .84rem;
  text-align: center;
}

.auth-footer a {
  color: var(--green);
  font-weight: 750;
}

.auth-legal-footer {
  position: fixed;
  right: 1rem;
  bottom: .75rem;
  left: 1rem;
  text-align: center;
}

.auth-legal-footer a,
.sidebar-legal-link {
  color: var(--muted);
  font-size: .78rem;
}

.sidebar-legal-link {
  margin: auto 1.4rem .65rem;
  text-decoration: none;
}

.sidebar-legal-link:hover,
.auth-legal-footer a:hover {
  color: var(--green);
}

.sidebar-legal-link + .sidebar-footer {
  margin-top: 0;
}

.public-body {
  background:
    radial-gradient(circle at 15% 5%, rgba(29, 155, 93, .09), transparent 28rem),
    #f5f7f3;
}

.public-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: .8rem max(1.25rem, calc((100vw - 1080px) / 2));
  border-bottom: 1px solid rgba(216, 225, 216, .9);
  background: rgba(251, 252, 250, .94);
  backdrop-filter: blur(12px);
}

.public-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  text-decoration: none;
}

.public-brand > span:last-child {
  display: grid;
}

.public-brand small {
  color: var(--muted);
  font-size: .7rem;
}

.public-main {
  width: min(100% - 2rem, 1080px);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.public-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2rem, 1080px);
  margin: 0 auto;
  padding: 1.35rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
}

.public-footer a {
  color: var(--green);
}

.privacy-page {
  display: grid;
  gap: 1.25rem;
}

.privacy-hero {
  padding: clamp(1.5rem, 4vw, 3.25rem);
  border: 1px solid #d9e5d9;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff 0%, #eef8f1 100%);
  box-shadow: 0 20px 55px rgba(31, 46, 35, .07);
}

.privacy-kicker {
  color: var(--green);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.privacy-hero h1 {
  margin: .65rem 0 .8rem;
  font-size: clamp(2rem, 5vw, 3.35rem);
  font-weight: 820;
  letter-spacing: -.045em;
}

.privacy-hero > p {
  max-width: 760px;
  margin: 0;
  color: #4e5b53;
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.7;
}

.privacy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.25rem;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: .8rem;
}

.privacy-draft-warning {
  padding: 1rem 1.15rem;
  border: 1px solid #e8cb80;
  border-radius: 10px;
  background: #fff8e5;
  color: #72550a;
  font-size: .88rem;
  line-height: 1.55;
}

.privacy-draft-warning strong {
  display: block;
  margin-bottom: .2rem;
}

.privacy-index,
.privacy-section,
.privacy-contact {
  padding: clamp(1.25rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.privacy-index ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem 2rem;
  margin: .8rem 0 0;
  padding-left: 1.25rem;
}

.privacy-index a {
  color: #2f5e45;
  text-decoration: none;
}

.privacy-index a:hover {
  color: var(--green);
  text-decoration: underline;
}

.privacy-section {
  scroll-margin-top: 90px;
}

.privacy-section h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 790;
  letter-spacing: -.02em;
}

.privacy-section h3 {
  margin: 0 0 .45rem;
  font-size: 1rem;
  font-weight: 760;
}

.privacy-section p,
.privacy-section li {
  color: #4e5b53;
  line-height: 1.7;
}

.privacy-section p:last-child,
.privacy-section ul:last-child {
  margin-bottom: 0;
}

.privacy-section a {
  color: var(--green);
}

.privacy-placeholder-grid,
.privacy-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.privacy-placeholder-grid > div,
.privacy-cards > div {
  padding: 1rem;
  border: 1px solid #e1e8df;
  border-radius: 9px;
  background: #f9fbf8;
}

.privacy-placeholder-grid span {
  display: block;
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.privacy-placeholder-grid strong {
  color: var(--ink);
  font-size: .88rem;
}

.privacy-cards p {
  margin: 0;
  font-size: .88rem;
}

.privacy-table {
  margin: 0 0 1.2rem;
  border-color: #e2e8e0;
  font-size: .88rem;
}

.privacy-table th {
  background: #f3f7f2;
  color: #34463a;
  font-size: .74rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.privacy-table td {
  color: #4e5b53;
  line-height: 1.55;
}

.privacy-contact {
  border-color: #cfe4d4;
  background: #eaf6ed;
}

.privacy-contact span,
.privacy-contact strong {
  display: block;
}

.privacy-contact span {
  color: var(--green);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.privacy-contact strong {
  margin: .35rem 0;
  color: #8a5f00;
}

.privacy-contact p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}

@media (max-width: 1050px) {
  .app-main { padding: 0 1.25rem; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid,
  .secondary-grid { grid-template-columns: 1fr; }
  .template-preview-panel { position: static; }
}

@media (max-width: 760px) {
  .public-header { min-height: 64px; }
  .public-main { padding: 1.25rem 0 2.5rem; }
  .public-footer { flex-direction: column; }
  .privacy-index ol,
  .privacy-placeholder-grid,
  .privacy-cards { grid-template-columns: 1fr; }

  .app-sidebar {
    width: min(82vw, 280px);
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    transform: translateX(-102%);
    transition: transform 180ms ease-out;
  }

  .app-sidebar.open { transform: translateX(0); }
  .app-workspace { margin-left: 0; }
  .sidebar-nav {
    flex: 1;
    min-height: 0;
    padding-bottom: .75rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-legal-link {
    margin-top: .35rem;
  }

  .sidebar-footer {
    flex: 0 0 auto;
    margin-bottom: calc(.85rem + env(safe-area-inset-bottom));
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 58px;
    padding: 0 1rem;
    border-bottom: 1px solid #dfe6dd;
    background: rgba(255, 255, 255, .96);
  }

  .mobile-header strong { font-size: .92rem; }

  .received-chat-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .received-chat-sidebar {
    max-height: 300px;
    border-right: 0;
    border-bottom: 1px solid #d8dfda;
  }

  .received-chat-pane { min-height: 520px; }
  .received-chat-bubble { max-width: 88%; }
  .help-layout { grid-template-columns: 1fr; }
  .help-index { position: static; }
  .contacts-search { grid-template-columns: 1fr; }
  .contact-row-actions { justify-content: flex-start; }
  .contacts-pagination { justify-content: flex-start; }

  .menu-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #dce4da;
    border-radius: 7px;
    background: #fff;
  }

  .menu-icon,
  .menu-icon::before,
  .menu-icon::after {
    display: block;
    width: 17px;
    height: 2px;
    background: #314238;
    content: "";
  }

  .menu-icon { position: relative; }
  .menu-icon::before { position: absolute; top: -5px; }
  .menu-icon::after { position: absolute; top: 5px; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: none;
    border: 0;
    background: rgba(17, 25, 20, .38);
  }

  .sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-open { overflow: hidden; }
  .app-main { padding: 0 1rem; }

  .dashboard-header {
    min-height: 78px;
  }

  .dashboard-header h1 { font-size: 1.6rem; }
  .header-actions { display: none; }
  .overview-note { align-items: flex-start; flex-direction: column; gap: .7rem; }
  .campaign-detail-header { align-items: flex-start; flex-direction: column; }
  .campaign-template-preview { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .campaign-parameter-heading,
  .campaign-parameter-row {
    grid-template-columns: 1fr;
  }

  .campaign-parameter-heading { display: grid; }
  .campaign-csv-status { width: fit-content; }
  .metric-grid,
  .health-grid,
  .two-columns,
  .contact-form-grid { grid-template-columns: 1fr; }

  .health-warning { grid-template-columns: 1fr; }

  .template-item div {
    align-items: flex-start;
    flex-direction: column;
  }

  .template-item span { text-align: left; }
}
