/* The mobile search shares the list surface; only the rounded field is raised.
   Keep these rules scoped to the chat toolbar so desktop forms are unaffected. */
@media (max-width: 767px) {
  html:root {
    --mobile-chat-list-surface: #fff;
    --mobile-chat-search-fill: #f1f3f5;
    --mobile-chat-search-ink: #26333b;
    --mobile-chat-search-muted: #6b7780;
    --mobile-chat-search-focus: #129b76;
  }

  html.dark:root,
  html.crm-glass:root {
    --mobile-chat-list-surface: var(--dk-surface, #18252e);
    --mobile-chat-search-fill: rgb(223 240 248 / 8%);
    --mobile-chat-search-ink: var(--slate-ink, #edf5fa);
    --mobile-chat-search-muted: var(--slate-muted, #afc1cc);
    --mobile-chat-search-focus: var(--slate-positive, #9debd0);
  }

  html.crm-glass.crm-violet:root {
    --mobile-chat-list-surface: var(--slate-card-solid);
    --mobile-chat-search-fill: var(--slate-field);
  }

  html:root body .crm-route-content .whatsapp-header,
  html.crm-glass:root body .crm-route-content .whatsapp-header,
  html:root body .crm-route-content aside:has(.chat-filters-toolbar) {
    background: var(--mobile-chat-list-surface) !important;
    border: 0;
    box-shadow: none;
  }

  html:root body .crm-route-content aside > div:has(> .chat-filters-toolbar) {
    background: transparent !important;
    border: 0;
    box-shadow: none;
  }

  .crm-route-content .chat-filters-toolbar {
    gap: 6px;
    padding: 8px 12px 14px;
  }

  html:root body .chat-filters-toolbar > div:has(> input[type='search']) {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--mobile-chat-search-fill) !important;
    transition: box-shadow 150ms ease;
  }

  html:root body .chat-filters-toolbar > div > .lucide-search {
    width: 20px;
    height: 20px;
    color: var(--mobile-chat-search-muted) !important;
    stroke-width: 1.75;
  }

  html:root body .chat-filters-toolbar input[type='search'],
  html.crm-glass:root body .chat-filters-toolbar input[type='search'] {
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: var(--mobile-chat-search-ink) !important;
    font-size: 16px;
    line-height: 24px;
    text-overflow: ellipsis;
    outline: none !important;
    box-shadow: none !important;
  }

  html:root body .chat-filters-toolbar input[type='search']::placeholder {
    color: var(--mobile-chat-search-muted) !important;
    opacity: 1;
  }

  html:root body .chat-filters-toolbar > div:has(> input[type='search']):focus-within {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mobile-chat-search-focus) 45%, transparent);
  }

  .crm-route-content .chat-filters-toolbar .chat-filters-toggle {
    border-radius: 999px;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .chat-filters-toolbar > div:has(> input[type='search']) { transition: none; }
}
