:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #17201c;
  --muted: #62716b;
  --line: #dbe3dc;
  --brand: #128c7e;
  --brand-rgb: 18, 140, 126;
  --brand-dark: #075e54;
  --brand-soft: #eef5f1;
  --sun: #f7bd3b;
  --rose: #ef7f72;
  --shadow: 0 24px 70px rgba(26, 42, 35, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(var(--brand-rgb), 0.12), transparent 34%),
    linear-gradient(315deg, rgba(247, 189, 59, 0.18), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.modal-open {
  overflow: hidden;
}

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

.language-switch {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
}

.language-links {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(200, 216, 207, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 32px rgba(26, 42, 35, 0.12);
  backdrop-filter: blur(12px);
}

.language-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.language-link.active,
.language-link:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.language-select-label {
  display: none;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(200, 216, 207, 0.95);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(26, 42, 35, 0.12);
}

.language-select-label select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 850;
  outline: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 170px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: 32px;
  align-items: center;
  padding: 42px 0;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 34px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  text-align: center;
}

.site-footer p {
  margin: 0 auto 8px;
  max-width: 820px;
}

.footer-logo {
  width: min(180px, 46vw);
  height: auto;
  display: block;
  margin: 0 auto 12px;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.site-footer a {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.footer-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.footer-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c8d8cf;
  border-radius: 8px;
  padding: 9px 13px;
  background: #fff;
  color: var(--brand-dark);
  text-decoration: none;
}

.legal-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.legal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.legal-nav div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legal-nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #c8d8cf;
  border-radius: 8px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-dark);
  font-weight: 850;
  text-decoration: none;
}

.legal-bottom-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.legal-bottom-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c8d8cf;
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--brand-dark);
  font-weight: 850;
  text-decoration: none;
}

.legal-hero {
  margin-bottom: 24px;
}

.legal-date {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.legal-card {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid rgba(219, 227, 220, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 52px rgba(26, 42, 35, 0.1);
}

.legal-card h2 {
  margin-bottom: 18px;
  font-size: 1.8rem;
}

.legal-card h3 {
  margin: 24px 0 8px;
  font-size: 1.08rem;
}

.legal-card p {
  margin-bottom: 0;
  color: #40504a;
  line-height: 1.65;
}

.workspace {
  display: grid;
  gap: 28px;
}

.intro {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 790px;
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.lede {
  max-width: 650px;
  margin-top: 18px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.builder {
  display: grid;
  gap: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(219, 227, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

label {
  font-weight: 800;
}

input,
textarea,
.link-output,
.code-output {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input,
textarea {
  padding: 13px 14px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.18);
}

.phone-row {
  display: grid;
  grid-template-columns: 96px 44px 1fr;
}

.phone-row input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.country-code {
  min-width: 0;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 850;
  outline: none;
}

.prefix {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 0;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.meta-row,
.actions,
.quick-messages {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-row {
  justify-content: space-between;
}

.counter {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

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

.emoji-picker-field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
}

.emoji-picker-trigger {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(26, 42, 35, 0.12);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

.emoji-picker-trigger:hover,
.emoji-picker-trigger:focus {
  border-color: #b75cff;
  box-shadow: 0 0 0 4px rgba(183, 92, 255, 0.14);
  outline: none;
}

.emoji-dialog {
  width: min(430px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 28px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
}

.emoji-dialog::backdrop {
  background: rgba(16, 29, 24, 0.26);
}

.emoji-dialog-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: min(620px, calc(100vh - 28px));
  overflow: hidden;
  border: 1px solid #ccd6d0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 32, 26, 0.24);
}

.emoji-category-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--line);
}

.emoji-category-tab {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  color: #6f7b76;
  font-size: 1.05rem;
}

.emoji-category-tab.active,
.emoji-category-tab:hover,
.emoji-category-tab:focus {
  border-bottom-color: #b75cff;
  color: #6f22d2;
  outline: none;
}

.emoji-search-row {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.emoji-search-row input {
  min-height: 34px;
  padding: 7px 10px;
}

.emoji-dialog-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.emoji-dialog-body {
  overflow-y: auto;
  padding: 0 10px 14px;
  scroll-padding-top: 8px;
}

.emoji-picker-title {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 1.15rem;
}

.emoji-category {
  margin-top: 8px;
}

.emoji-category h3 {
  margin: 0 0 8px;
  color: #26332e;
  font-size: 1rem;
  font-weight: 700;
}

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

.emoji-option {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1.18rem;
  line-height: 1;
}

.emoji-option:hover,
.emoji-option:focus {
  background: #f0f4f2;
  outline: none;
}

.quick-messages button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #33433d;
  padding: 9px 13px;
  cursor: pointer;
}

.quick-messages button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.quick-messages .more-templates-button {
  border-color: #25d366;
  background: #25d366;
  color: #fff;
  font-weight: 400 !important;
}

.quick-messages .more-templates-button:hover {
  border-color: #1fb85a;
  background: #1fb85a;
  color: #fff;
}

.template-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.template-dialog::backdrop {
  background: rgba(16, 29, 24, 0.58);
}

.template-dialog-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(820px, calc(100vh - 28px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #f7faf8;
  box-shadow: 0 24px 70px rgba(20, 32, 26, 0.28);
}

.template-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.template-dialog-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.dialog-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.dialog-close:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.template-dialog-body {
  display: grid;
  gap: 18px;
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding: 18px 20px 20px;
}

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

.template-category h3 {
  margin: 0;
  font-size: 1rem;
}

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

.template-card {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.template-card strong {
  font-size: 0.95rem;
}

.template-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.template-card:hover {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.13);
}

.result {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #c8d8cf;
  border-radius: 8px;
  background: #f4fbf7;
}

.embed,
.qr-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #d8ded6;
  border-radius: 8px;
  background: #ffffff;
}

.qr-panel {
  background: #fbfcfb;
}

.embed-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

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

.color-control {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
}

.color-control input {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.qr-content {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.qr-frame {
  width: 220px;
  height: 220px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-frame img {
  width: 200px;
  height: 200px;
  display: block;
}

.qr-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.button-preview {
  padding: 16px;
  border: 1px dashed #b9cac1;
  border-radius: 8px;
  background: #f8faf8;
}

.whatsapp-embed-preview {
  width: fit-content;
  max-width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 8px;
  background: #25d366;
  color: #ffffff;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(37, 211, 102, 0.22);
}

.whatsapp-embed-preview span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.link-output {
  min-height: 52px;
  padding: 14px;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.code-output {
  min-height: 128px;
  padding: 14px;
  color: #26352f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.5;
  resize: vertical;
}

.code-output.compact {
  min-height: 0;
  height: 100%;
}

.icon-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.icon-button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.icon-button svg,
.chat-input svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status {
  min-height: 20px;
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.preview {
  display: grid;
  justify-items: center;
}

.phone-frame {
  width: min(100%, 390px);
  aspect-ratio: 9 / 16;
  max-height: 720px;
  display: grid;
  grid-template-rows: 34px auto 1fr auto;
  overflow: hidden;
  border: 10px solid #1d2925;
  border-radius: 34px;
  background: #ecf2ed;
  box-shadow: 0 34px 90px rgba(20, 40, 34, 0.26);
}

.phone-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #1d2925;
}

.phone-top span:first-child {
  width: 52px;
  height: 5px;
  border-radius: 999px;
  background: #52605b;
}

.phone-top span:last-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #52605b;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--brand-dark);
  color: #fff;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sun);
  color: #1d2925;
  font-weight: 900;
}

.chat-header small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.68)),
    repeating-linear-gradient(45deg, #dfe9e3 0 10px, #d5e2dc 10px 20px);
}

.bubble {
  max-width: 82%;
  padding: 11px 12px;
  border-radius: 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bubble.received {
  align-self: flex-start;
  background: #fff;
}

.bubble.sent {
  align-self: flex-end;
  background: #dcf8c6;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #f2f2f2;
}

.chat-input span {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-input svg {
  width: 44px;
  height: 44px;
  padding: 12px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

@media (max-width: 900px) {
  .language-switch {
    position: sticky;
    top: 0;
    width: min(100% - 22px, 1180px);
    margin: 10px auto 0;
    display: flex;
    justify-content: flex-end;
  }

  .language-links {
    display: none;
  }

  .language-select-label {
    display: inline-flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 28px;
  }

  .preview {
    order: -1;
  }

  .phone-frame {
    width: min(100%, 330px);
  }

  .qr-content {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    gap: 22px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .builder {
    padding: 16px;
  }

  .phone-row {
    grid-template-columns: 88px 38px 1fr;
  }

  .template-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .template-dialog-panel {
    max-height: calc(100vh - 18px);
  }

  .emoji-dialog {
    width: calc(100vw - 18px);
  }

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

  .template-dialog-header,
  .template-dialog-body {
    padding-inline: 14px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .qr-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .embed-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .embed-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .color-control {
    width: 100%;
    justify-content: flex-start;
  }

  .icon-button {
    padding-inline: 10px;
  }
}
