.whatsapp-example {
  --wa-paper-bright: var(--paper-bright, #ffffff);
  --wa-frame: var(--paper, #f7f5ef);
  --wa-ink: var(--ink, #171913);
  --wa-ink-soft: var(--ink-soft, #65655f);
  --wa-line: var(--line-strong, #bcbab2);
  --wa-accent: var(--accent, #ff6847);
  --wa-accent-ink: var(--accent-ink, #b44730);
  --wa-font-body: "Heebo", "Arial Hebrew", Arial, sans-serif;
  --wa-font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wa-border: 1px solid var(--wa-line);
  width: min(100%, 680px);
  margin-inline: auto;
  color: var(--wa-ink);
  font-family: var(--wa-font-body);

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  .workbench {
    position: relative;
    background: var(--wa-paper-bright);
    border: 1px solid var(--wa-line);
    border-radius: 20px;
    overflow: hidden;
  }

  .workbench__bar {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--wa-frame);
    border-bottom: var(--wa-border);
  }

  .workbench__bar > div {
    display: grid;
    min-width: 0;
    gap: 0.25rem;
  }

  .workbench__bar .mono {
    color: var(--wa-ink-soft);
    font-family: var(--wa-font-mono);
    font-size: 0.65rem;
    font-weight: 600;
  }

  .workbench__bar strong {
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
  }

  .status {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--wa-line);
    border-radius: 3px;
    font-family: var(--wa-font-mono);
    font-size: 0.66rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .status__dot {
    width: 0.55rem;
    height: 0.55rem;
    background: #25a55f;
    border: 1px solid var(--wa-ink);
    border-radius: 50%;
    animation: whatsapp-example-pulse 1.8s ease-in-out infinite;
  }

  .chat {
    display: grid;
    grid-template-rows: auto minmax(230px, 1fr) auto;
    min-height: 342px;
    overflow: hidden;
    color: #0a0a0a;
    background: #f5f1eb;
    font-family: "Roboto Variable", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  }

  .whatsapp-header {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 58px;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    color: #0a0a0a;
    background: #f7f5f3;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .whatsapp-avatar {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: var(--wa-paper-bright);
    background: var(--wa-ink);
    border-radius: 50%;
    font-family: "Arial Black", Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: -0.08em;
  }

  .whatsapp-avatar::after {
    content: "";
    position: absolute;
    inset-inline-end: 2px;
    inset-block-end: 2px;
    width: 7px;
    height: 7px;
    background: #25d366;
    border: 2px solid #f7f5f3;
    border-radius: 50%;
  }

  .whatsapp-header__contact {
    display: grid;
    min-width: 0;
    gap: 0.05rem;
    text-align: start;
  }

  .whatsapp-header__contact strong {
    overflow: hidden;
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .whatsapp-header__contact small {
    overflow: hidden;
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .whatsapp-header__actions {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    color: rgba(0, 0, 0, 0.6);
  }

  .whatsapp-ui-icon {
    position: relative;
    display: block;
    width: 18px;
    height: 18px;
    font-style: normal;
  }

  .whatsapp-ui-icon--search::before {
    content: "";
    position: absolute;
    inset: 1px 4px 4px 1px;
    border: 2px solid currentColor;
    border-radius: 50%;
  }

  .whatsapp-ui-icon--search::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 2px;
    inset-inline-end: 0;
    inset-block-end: 2px;
    background: currentColor;
    border-radius: 2px;
    transform: rotate(45deg);
  }

  .whatsapp-ui-icon--menu::before {
    content: "";
    position: absolute;
    inset: 7px;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
  }

  .whatsapp-thread {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: start;
    min-width: 0;
    min-height: 230px;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    background-color: #f5f1eb;
  }

  .whatsapp-thread::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background-image: url("/assets/whatsapp-chat-wallpaper.webp");
    background-position: center top;
    background-repeat: repeat;
    background-size: 540px 960px;
    opacity: 0.1;
  }

  .message {
    position: relative;
    width: fit-content;
    max-width: 88%;
    padding: 0.62rem 0.7rem 0.35rem;
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.07), 0 0 3px rgba(0, 0, 0, 0.04);
  }

  .message p {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 400;
    line-height: 1.42;
  }

  .message--user {
    justify-self: start;
    background: #d9fdd3;
  }

  .message--gimmi {
    justify-self: end;
    background: #fff;
  }

  .message::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    width: 10px;
    height: 12px;
    background: inherit;
    clip-path: polygon(0 0, 100% 0, 0 100%);
  }

  .message--user::before {
    right: -7px;
  }

  .message--gimmi::before {
    left: -7px;
    transform: scaleX(-1);
  }

  .message__label {
    display: block;
    margin-bottom: 0.2rem;
    color: #128c7e;
    font-family: "Arial Black", Arial, sans-serif;
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    text-align: start;
  }

  .whatsapp-message__meta {
    display: flex;
    min-height: 0.8rem;
    align-items: center;
    justify-content: flex-end;
    gap: 0.22rem;
    margin-top: 0.18rem;
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.58rem;
    line-height: 1;
  }

  .whatsapp-checks {
    padding-inline-end: 0.22em;
    color: #007bfc;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: -0.28em;
  }

  .whatsapp-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    min-height: 52px;
    gap: 0.6rem;
    padding: 0.45rem 0.7rem;
    color: rgba(0, 0, 0, 0.6);
    background: #f7f5f3;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .whatsapp-composer__emoji,
  .whatsapp-composer__attach {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    font-size: 1.18rem;
    line-height: 1;
  }

  .whatsapp-composer__field {
    min-width: 0;
    padding: 0.55rem 0.8rem;
    overflow: hidden;
    color: rgba(0, 0, 0, 0.6);
    background: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .whatsapp-composer__mic {
    display: block;
    width: 22px;
    height: 22px;
    flex: none;
    margin-inline: 0.15rem;
    fill: currentColor;
  }

  .task-log {
    min-height: 160px;
    margin: 0;
    border: 0;
    border-top: var(--wa-border);
  }

  .task-log__head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.48rem 0.85rem;
    color: var(--wa-paper-bright);
    background: var(--wa-ink);
    font-size: 0.75rem;
  }

  .task-log__head .mono {
    color: inherit;
    font-family: var(--wa-font-mono);
    font-size: inherit;
  }

  .task-log ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .task-log li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--wa-line);
    font-size: 0.82rem;
    font-weight: 600;
  }

  .task-log li:last-child {
    border-bottom: 0;
  }

  .task-log li span {
    color: var(--wa-ink-soft);
    font-family: var(--wa-font-mono);
    font-size: 0.65rem;
  }

  .task-log li b {
    color: #13783e;
    font-size: 0.72rem;
  }

  .demo-switcher {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: var(--wa-border);
  }

  .demo-switcher__indicator {
    position: absolute;
    z-index: -1;
    inset-block: 0;
    left: 0;
    width: 25%;
    pointer-events: none;
    background: var(--wa-accent);
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), width 240ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .demo-switcher button {
    min-width: 0;
    min-height: 47px;
    padding-inline: 0.35rem;
    color: var(--wa-ink);
    background: var(--wa-paper-bright);
    border: 0;
    border-inline-end: 1px solid var(--wa-line);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
  }

  .demo-switcher button:last-of-type {
    border-inline-end: 0;
  }

  .demo-switcher button:hover {
    color: var(--wa-accent-ink);
    background: var(--accent-soft);
  }

  .demo-switcher button:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid var(--focus-ring);
    outline-offset: -3px;
  }

  .demo-switcher button.is-active {
    color: var(--wa-ink);
    background: var(--wa-accent);
  }

  .demo-switcher.has-active-indicator button {
    position: relative;
    z-index: 1;
    background: transparent;
  }

  .demo-switcher.has-active-indicator button:hover {
    background: transparent;
  }

  @media (max-width: 540px) {
    .workbench::before {
      inset-inline-end: 0.5rem;
      font-size: 0.74rem;
    }

    .workbench__bar {
      min-height: 64px;
      align-items: flex-start;
      padding: 0.65rem 0.75rem;
    }

    .workbench__bar strong {
      display: -webkit-box;
      font-size: 0.9rem;
      line-height: 1.35;
      white-space: normal;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    .status {
      padding-inline: 0.4rem;
      font-size: 0.58rem;
    }

    .chat {
      grid-template-rows: auto minmax(0, 1fr) auto;
      height: 336px;
      min-height: 336px;
    }

    .whatsapp-header {
      grid-template-columns: 40px minmax(0, 1fr) auto;
      gap: 0.55rem;
      padding-inline: 0.65rem;
    }

    .whatsapp-avatar {
      width: 38px;
      height: 38px;
    }

    .whatsapp-header__actions {
      gap: 0.85rem;
    }

    .whatsapp-thread {
      min-height: 0;
      padding: 0.8rem;
      overflow: hidden;
    }

    .message {
      max-width: 94%;
    }

    .message p {
      font-size: 0.78rem;
    }

    .task-log {
      height: 154px;
      min-height: 154px;
      margin: 0;
      overflow: hidden;
    }

    .task-log li {
      gap: 0.45rem;
      padding: 0.45rem 0.65rem;
      font-size: 0.72rem;
    }

    .demo-switcher button {
      min-height: 44px;
      font-size: 0.72rem;
    }
  }

  @media (max-width: 380px) {
    .workbench__bar {
      gap: 0.5rem;
      padding-inline: 0.7rem;
    }

    .status {
      max-width: 92px;
      white-space: normal;
    }

    .task-log li b {
      font-size: 0.65rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .status__dot {
      animation: none;
    }

    .demo-switcher__indicator {
      transition: none;
    }
  }
}

@keyframes whatsapp-example-pulse {
  50% {
    opacity: 0.45;
  }
}

.whatsapp-example[data-locale="he"] .workbench__bar .mono,
.whatsapp-example[data-locale="he"] .status,
.whatsapp-example[data-locale="he"] .task-log .mono { font-family: "Heebo", "Arial Hebrew", Arial, sans-serif; font-size: 12px; letter-spacing: 0; }

/* A static handwritten cue points to the actual example controls. */
.whatsapp-example .demo-invitation { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 42px; padding: 5px 18px 0; background: var(--wa-paper-bright); color: var(--wa-accent-ink); font-family: var(--font-body); font-size: 13px; font-weight: 500; }
.whatsapp-example .demo-invitation span { transform: rotate(-2deg); }
[dir="rtl"] .whatsapp-example .demo-invitation span { transform: rotate(2deg); }
[dir="rtl"] .whatsapp-example .demo-invitation svg { transform: scaleX(-1); }
@media (max-width: 540px) { .whatsapp-example .demo-invitation { padding-inline: 12px; font-size: 12px; } .whatsapp-example .demo-invitation svg { width: 52px; height: 28px; } }
