/* Dingous Match — mobile-only responsive layer.
   IMPORTANT: every rule lives behind a mobile media query so desktop remains untouched. */
@media (max-width: 767px) {
  html,
  body[data-dingous-match-shell="true"] {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body[data-dingous-match-shell="true"] {
    min-height: 100dvh;
    overscroll-behavior-x: none;
  }

  body[data-dingous-match-shell="true"] button,
  body[data-dingous-match-shell="true"] a,
  body[data-dingous-match-shell="true"] input,
  body[data-dingous-match-shell="true"] select,
  body[data-dingous-match-shell="true"] textarea {
    -webkit-tap-highlight-color: transparent;
  }

  body[data-dingous-match-shell="true"] button,
  body[data-dingous-match-shell="true"] input,
  body[data-dingous-match-shell="true"] select {
    min-height: 44px;
  }

  /* Discovery /match */
  body[data-dingous-match-shell="true"] .dm-app {
    width: 100% !important;
    min-height: 100dvh !important;
    padding: 0 0 calc(36px + env(safe-area-inset-bottom)) !important;
  }

  body[data-dingous-match-shell="true"] .dm-topbar {
    width: 100% !important;
    min-height: auto !important;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1300 !important;
  }

  body[data-dingous-match-shell="true"] .dm-brand {
    align-self: flex-start;
    min-height: 42px;
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    font-size: 18px !important;
  }

  body[data-dingous-match-shell="true"] .dm-brand-mark {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
    border-radius: 12px !important;
  }

  body[data-dingous-match-shell="true"] .dm-top-actions,
  body[data-dingous-match-shell="true"] .be-nav,
  body[data-dingous-match-shell="true"] .dmc-actions,
  body[data-dingous-match-shell="true"] .top-actions {
    width: 100%;
    max-width: 100%;
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1px 1px 4px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  body[data-dingous-match-shell="true"] .dm-top-actions::-webkit-scrollbar,
  body[data-dingous-match-shell="true"] .be-nav::-webkit-scrollbar,
  body[data-dingous-match-shell="true"] .dmc-actions::-webkit-scrollbar,
  body[data-dingous-match-shell="true"] .top-actions::-webkit-scrollbar {
    display: none;
  }

  body[data-dingous-match-shell="true"] .dm-top-actions > a,
  body[data-dingous-match-shell="true"] .be-nav > a,
  body[data-dingous-match-shell="true"] .dmc-actions > a,
  body[data-dingous-match-shell="true"] .top-actions > a {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  body[data-dingous-match-shell="true"] .dm-layout {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10px 10px 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  body[data-dingous-match-shell="true"] .dm-sidebar {
    position: static !important;
    width: 100% !important;
    padding: 16px !important;
    border-radius: 18px !important;
  }

  body[data-dingous-match-shell="true"] .dm-sidebar h1 {
    margin: 10px 0 12px !important;
    font-size: clamp(1.8rem, 9vw, 2.35rem) !important;
    line-height: 1.02 !important;
    letter-spacing: -.045em !important;
  }

  body[data-dingous-match-shell="true"] .dm-sidebar > p {
    margin: 0;
    font-size: .92rem;
    line-height: 1.5;
  }

  body[data-dingous-match-shell="true"] .dm-search {
    margin-top: 16px !important;
  }

  body[data-dingous-match-shell="true"] .dm-search-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
    padding: 5px !important;
    border-radius: 16px !important;
  }

  body[data-dingous-match-shell="true"] .dm-search input {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    font-size: 16px;
  }

  body[data-dingous-match-shell="true"] .dm-search button {
    min-width: 88px;
    min-height: 46px;
  }

  body[data-dingous-match-shell="true"] .dm-chips {
    width: calc(100% + 10px);
    margin-right: -10px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding: 2px 10px 4px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body[data-dingous-match-shell="true"] .dm-chips::-webkit-scrollbar { display: none; }
  body[data-dingous-match-shell="true"] .dm-chips button { flex: 0 0 auto; white-space: nowrap; }

  body[data-dingous-match-shell="true"] .dm-agent-card,
  body[data-dingous-match-shell="true"] .dm-company-cta {
    margin-top: 12px !important;
  }

  body[data-dingous-match-shell="true"] .dm-stage {
    width: 100%;
    min-height: 0 !important;
    padding: 0 !important;
  }

  body[data-dingous-match-shell="true"] .dm-profile-area {
    width: 100% !important;
    display: block !important;
  }

  body[data-dingous-match-shell="true"] .dm-deck-column,
  body[data-dingous-match-shell="true"] .dm-deck {
    width: 100% !important;
    max-width: none !important;
  }

  body[data-dingous-match-shell="true"] .dm-deck {
    height: clamp(480px, 69dvh, 560px) !important;
    min-height: 0 !important;
  }

  body[data-dingous-match-shell="true"] .dm-card,
  body[data-dingous-match-shell="true"] .dm-deck::before,
  body[data-dingous-match-shell="true"] .dm-deck::after {
    border-radius: 24px !important;
  }

  body[data-dingous-match-shell="true"] .dm-cover { height: 51% !important; }
  body[data-dingous-match-shell="true"] .dm-initial {
    width: 90px !important;
    height: 90px !important;
    border-radius: 24px !important;
    font-size: 2.6rem !important;
  }

  body[data-dingous-match-shell="true"] .dm-body {
    padding: 0 18px 18px !important;
  }

  body[data-dingous-match-shell="true"] .dm-body h2 {
    font-size: 1.45rem !important;
  }

  body[data-dingous-match-shell="true"] .dm-actions {
    width: max-content;
    max-width: calc(100vw - 24px);
    margin: 12px auto 0 !important;
    padding: 8px 12px;
    gap: 18px !important;
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 1250;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 999px;
    background: rgba(7,16,31,.88);
    box-shadow: 0 14px 36px rgba(0,0,0,.34);
    backdrop-filter: blur(16px);
  }

  body[data-dingous-match-shell="true"] .dm-action {
    width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
  }

  body[data-dingous-match-shell="true"] .dm-info {
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
  }

  body[data-dingous-match-shell="true"] .dm-details {
    position: static !important;
    width: 100% !important;
    margin-top: 12px !important;
    padding: 17px !important;
    border-radius: 20px !important;
    min-height: 0 !important;
  }

  body[data-dingous-match-shell="true"] .dm-detail-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  body[data-dingous-match-shell="true"] .dm-empty,
  body[data-dingous-match-shell="true"] .dm-searching-panel {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 20px 16px !important;
    border-radius: 18px !important;
  }

  body[data-dingous-match-shell="true"] .dm-seo-copy {
    width: calc(100% - 20px) !important;
    margin: 14px 10px 28px !important;
    padding: 18px !important;
    border-radius: 18px !important;
  }

  body[data-dingous-match-shell="true"] .dm-map-panel {
    width: 100% !important;
    min-height: 56dvh !important;
    border-radius: 18px !important;
    overflow: hidden;
  }

  body[data-dingous-match-shell="true"] #dmMapCanvas {
    width: 100% !important;
    min-height: 56dvh !important;
    height: 56dvh !important;
  }

  body[data-dingous-match-shell="true"] .dm-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  body[data-dingous-match-shell="true"] .dm-modal-panel {
    width: 100% !important;
    max-width: none !important;
    max-height: 92dvh !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  }

  /* Public company */
  body[data-dingous-match-shell="true"] .dmc-page {
    width: 100% !important;
    max-width: none !important;
    padding: 12px 10px 36px !important;
  }

  body[data-dingous-match-shell="true"] .dmc-top {
    margin-bottom: 12px !important;
    gap: 10px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body[data-dingous-match-shell="true"] .dmc-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  body[data-dingous-match-shell="true"] .dmc-card,
  body[data-dingous-match-shell="true"] .dmc-panel { border-radius: 20px !important; }
  body[data-dingous-match-shell="true"] .dmc-cover { height: 220px !important; }
  body[data-dingous-match-shell="true"] .dmc-body,
  body[data-dingous-match-shell="true"] .dmc-panel { padding: 18px !important; }
  body[data-dingous-match-shell="true"] .dmc-body h1 { font-size: 1.75rem !important; }
  body[data-dingous-match-shell="true"] .dmc-links a,
  body[data-dingous-match-shell="true"] .dmc-primary,
  body[data-dingous-match-shell="true"] .dmc-secondary { min-height: 46px; }

  /* Claim flow */
  body[data-dingous-match-shell="true"] .claim-page {
    width: 100% !important;
    max-width: none !important;
    padding: 16px 10px 36px !important;
  }
  body[data-dingous-match-shell="true"] .claim-card {
    margin-top: 14px !important;
    padding: 18px !important;
    border-radius: 20px !important;
  }
  body[data-dingous-match-shell="true"] .claim-card h1 { font-size: 1.8rem !important; }
  body[data-dingous-match-shell="true"] .benefits { grid-template-columns: 1fr !important; }
  body[data-dingous-match-shell="true"] .claim-card button { min-height: 50px; }

  /* For businesses */
  body[data-dingous-match-shell="true"] .be-page {
    width: 100% !important;
    max-width: none !important;
    padding: 10px 10px 36px !important;
  }
  body[data-dingous-match-shell="true"] .be-hero {
    padding: 30px 18px !important;
    border-radius: 20px !important;
  }
  body[data-dingous-match-shell="true"] .be-hero h1 {
    font-size: clamp(2.35rem, 13vw, 3.6rem) !important;
    line-height: .95 !important;
    margin: 14px 0 20px !important;
  }
  body[data-dingous-match-shell="true"] .be-cta { display: grid !important; grid-template-columns: 1fr !important; }
  body[data-dingous-match-shell="true"] .be-cta a { width: 100% !important; }
  body[data-dingous-match-shell="true"] .be-flow,
  body[data-dingous-match-shell="true"] .be-mock { grid-template-columns: 1fr !important; }
  body[data-dingous-match-shell="true"] .be-proof { margin: 34px 0 !important; gap: 16px !important; }
  body[data-dingous-match-shell="true"] .be-final { padding: 32px 18px !important; border-radius: 20px !important; }

  /* Plans */
  body[data-dingous-match-shell="true"] .plans-page {
    width: 100% !important;
    max-width: none !important;
    padding: 14px 10px 40px !important;
  }
  body[data-dingous-match-shell="true"] .plans-page > header {
    gap: 8px !important;
    align-items: stretch !important;
  }
  body[data-dingous-match-shell="true"] .plans-page > header > a:last-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
  }
  body[data-dingous-match-shell="true"] .plans-page .intro { padding: 38px 4px 24px !important; }
  body[data-dingous-match-shell="true"] .plans-page .intro h1 {
    font-size: clamp(2.15rem, 11vw, 3.25rem) !important;
  }
  body[data-dingous-match-shell="true"] .plans { grid-template-columns: 1fr !important; gap: 12px !important; }
  body[data-dingous-match-shell="true"] .plans article { padding: 22px 18px !important; border-radius: 20px !important; }
  body[data-dingous-match-shell="true"] .plans article.featured { transform: none !important; }

  /* Business dashboard */
  body[data-dingous-match-shell="true"] .mb-page {
    width: 100% !important;
    max-width: none !important;
    padding: 16px 10px 40px !important;
  }
  body[data-dingous-match-shell="true"] .mb-top,
  body[data-dingous-match-shell="true"] .company-head,
  body[data-dingous-match-shell="true"] .growth,
  body[data-dingous-match-shell="true"] .section-head {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  body[data-dingous-match-shell="true"] .mb-top h1 { font-size: 2rem !important; }
  body[data-dingous-match-shell="true"] .company { padding: 18px !important; border-radius: 20px !important; }
  body[data-dingous-match-shell="true"] .metrics,
  body[data-dingous-match-shell="true"] .email-metrics { grid-template-columns: 1fr 1fr !important; }
  body[data-dingous-match-shell="true"] .opp { flex-direction: column !important; gap: 8px !important; }
  body[data-dingous-match-shell="true"] .opp-state { white-space: normal !important; }

  /* My Matches — app-like mobile behavior. The JS asset toggles dm-mobile-chat-open. */
  body[data-dingous-match-shell="true"] > .top {
    width: 100%;
    height: auto !important;
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px !important;
    gap: 10px;
  }
  body[data-dingous-match-shell="true"] > .top .brand { min-width: 0; font-size: 17px !important; }
  body[data-dingous-match-shell="true"] > .top > a:last-child { max-width: 48%; text-align: right; line-height: 1.25; }
  body[data-dingous-match-shell="true"] > .wrap {
    width: 100%;
    max-width: none;
    padding: 12px 10px calc(18px + env(safe-area-inset-bottom)) !important;
  }
  body[data-dingous-match-shell="true"] > .wrap .title { margin-bottom: 12px !important; }
  body[data-dingous-match-shell="true"] > .wrap .title h1 { font-size: 28px !important; }
  body[data-dingous-match-shell="true"] > .wrap .grid {
    display: block !important;
    min-height: 0 !important;
  }
  body[data-dingous-match-shell="true"] > .wrap .list,
  body[data-dingous-match-shell="true"] > .wrap .chat { border-radius: 18px !important; }
  body[data-dingous-match-shell="true"] > .wrap .match-list {
    max-height: calc(var(--dm-mobile-height, 100dvh) - 245px) !important;
    min-height: 280px;
  }
  body[data-dingous-match-shell="true"] > .wrap .match-item { padding: 15px 48px 15px 14px !important; }
  body[data-dingous-match-shell="true"] > .wrap .chat { display: none; }
  body[data-dingous-match-shell="true"].dm-mobile-chat-open > .wrap .list { display: none; }
  body[data-dingous-match-shell="true"].dm-mobile-chat-open > .wrap .chat {
    display: flex !important;
    flex-direction: column;
    min-height: calc(var(--dm-mobile-height, 100dvh) - 94px);
  }
  body[data-dingous-match-shell="true"].dm-mobile-chat-open > .wrap .title { display: none !important; }
  body[data-dingous-match-shell="true"] > .wrap .chat-head {
    min-height: auto !important;
    padding: 12px 14px !important;
  }
  body[data-dingous-match-shell="true"] > .wrap .chat-title-row { gap: 10px !important; }
  body[data-dingous-match-shell="true"] > .wrap .messages {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 320px;
    max-height: calc(var(--dm-mobile-height, 100dvh) - 285px);
    padding: 14px !important;
  }
  body[data-dingous-match-shell="true"] > .wrap .msg { max-width: 88% !important; }
  body[data-dingous-match-shell="true"] > .wrap .composer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: 10px !important;
    gap: 8px !important;
    background: rgba(7,16,31,.97);
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
  body[data-dingous-match-shell="true"] > .wrap .composer textarea {
    min-height: 48px !important;
    max-height: 100px !important;
    resize: none !important;
    font-size: 16px;
  }
  body[data-dingous-match-shell="true"] > .wrap .composer button {
    min-width: 74px;
    min-height: 48px;
    padding: 0 14px !important;
  }
  .dm-mobile-chat-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: max-content;
    min-height: 38px !important;
    margin: 0 0 10px;
    padding: 7px 10px;
    border: 1px solid #31405d;
    border-radius: 11px;
    background: #0a1424;
    color: #dbe7fa;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
  }

  /* Company secure conversation */
  body[data-dingous-match-shell="true"] > .wrap > .brand {
    margin-bottom: 12px !important;
    font-size: 18px !important;
  }
  body[data-dingous-match-shell="true"] > .wrap > .card {
    border-radius: 18px !important;
  }
  body[data-dingous-match-shell="true"] > .wrap > .card .head { padding: 16px !important; }
  body[data-dingous-match-shell="true"] > .wrap > .card .head h1 {
    font-size: 1.45rem !important;
    line-height: 1.2;
  }
  body[data-dingous-match-shell="true"] > .wrap > .card .visitor {
    overflow-wrap: anywhere;
  }
  body[data-dingous-match-shell="true"] > .wrap > .card .messages {
    height: clamp(340px, 54dvh, 520px) !important;
    padding: 14px !important;
  }
  body[data-dingous-match-shell="true"] > .wrap > .card .msg { max-width: 90% !important; }
  body[data-dingous-match-shell="true"] > .wrap > .card .composer {
    position: sticky;
    bottom: 0;
    padding: 10px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    background: rgba(7,16,31,.97);
  }
  body[data-dingous-match-shell="true"] > .wrap > .card .composer textarea {
    min-height: 50px !important;
    max-height: 96px !important;
    resize: none !important;
    font-size: 16px;
  }
  body[data-dingous-match-shell="true"] > .wrap > .card .composer button {
    min-width: 72px;
    min-height: 50px;
    padding: 0 13px !important;
  }

  /* Footer is compact and respects the bottom safe-area. */
  body[data-dingous-match-shell="true"] .dm-dingous-footer { margin-top: 22px !important; }
  body[data-dingous-match-shell="true"] .dm-dingous-footer__inner {
    width: 100% !important;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom)) !important;
    gap: 14px !important;
  }
}

@media (max-width: 420px) {
  body[data-dingous-match-shell="true"] .dm-search-row { grid-template-columns: 1fr !important; }
  body[data-dingous-match-shell="true"] .dm-search button { width: 100%; }
  body[data-dingous-match-shell="true"] .dm-deck { height: clamp(470px, 68dvh, 535px) !important; }
  body[data-dingous-match-shell="true"] .dm-detail-grid { grid-template-columns: 1fr !important; }
  body[data-dingous-match-shell="true"] .metrics,
  body[data-dingous-match-shell="true"] .email-metrics { grid-template-columns: 1fr !important; }
  body[data-dingous-match-shell="true"] .plans-page > header { flex-direction: column !important; }
  body[data-dingous-match-shell="true"] > .top > a:last-child { max-width: 46%; font-size: 11px !important; }
}
