/* IYESCHAT R20-MOBILE-R1: correcoes de camada de menu, marcadores e viewport iOS.
 * Apenas dispositivos moveis; nao altera estado do atendimento nem dados recebidos da API.
 */
@media (max-width: 820px) {
  /* Menu administrativo como gaveta unica, acima do backdrop, com superficies coerentes. */
  body.iyes-ux-nav-open .shell.iyes-r2a-drawer-expanded > .sidebar,
  body.iyes-ux-nav-open .shell > .sidebar {
    position: fixed !important;
    top: 0 !important; bottom: auto !important; left: 0 !important;
    width: min(332px, 88vw) !important; min-width: 0 !important; max-width: 88vw !important;
    height: var(--iyes-mobile-r1-vh, 100dvh) !important;
    max-height: var(--iyes-mobile-r1-vh, 100dvh) !important;
    display: flex !important; flex-direction: column !important;
    overflow: hidden !important; box-sizing: border-box !important;
    z-index: 9601 !important;
    border-radius: 0 16px 16px 0 !important;
    padding: 12px 10px !important;
    background: #10213b !important; color: #eef5ff !important;
    box-shadow: 8px 0 35px rgba(4,14,29,.28) !important;
  }
  body.theme-light.iyes-ux-nav-open .shell > .sidebar,
  body.theme-light.iyes-ux-nav-open .shell.iyes-r2a-drawer-expanded > .sidebar {
    background: #f8fbff !important; color: #213c64 !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar > .brand,
  body.iyes-ux-nav-open .shell > .sidebar > nav,
  body.iyes-ux-nav-open .shell > .sidebar > .profile {
    position: relative !important; z-index: 1 !important;
    background: transparent !important; color: inherit !important;
    box-shadow: none !important; opacity: 1 !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar > .brand {
    flex: 0 0 auto !important; min-height: 60px !important;
    padding: 6px 46px 10px 8px !important;
    border-bottom: 1px solid rgba(127,156,193,.22) !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar > nav,
  body.iyes-ux-nav-open .shell > .sidebar > nav.isp-nav-grouped {
    display: flex !important; flex: 1 1 auto !important;
    flex-direction: column !important; min-height: 0 !important;
    width: 100% !important; overflow-y: auto !important;
    overflow-x: hidden !important; padding: 12px 2px 12px !important;
    -webkit-overflow-scrolling: touch !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar > .profile {
    flex: 0 0 auto !important; max-height: 112px !important;
    overflow: auto !important; padding: 8px !important;
    border-top: 1px solid rgba(127,156,193,.22) !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar nav .nav-group,
  body.iyes-ux-nav-open .shell > .sidebar nav .nav-group-body {
    background: transparent !important; color: inherit !important;
    opacity: 1 !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar nav .nav-group-head {
    background: transparent !important; color: #a9bed9 !important;
    opacity: 1 !important; font-weight: 800 !important;
  }
  body.theme-light.iyes-ux-nav-open .shell > .sidebar nav .nav-group-head {color: #657b98 !important}
  body.iyes-ux-nav-open .shell > .sidebar nav button[data-page],
  body.iyes-ux-nav-open .shell > .sidebar nav #iyes-v347-receipts-nav,
  body.iyes-ux-nav-open .shell > .sidebar nav #iyes-iptv-nav {
    display: flex !important; align-items: center !important;
    min-height: 43px !important; width: 100% !important;
    gap: 10px !important; padding: 7px 9px !important;
    color: #e6edf7 !important; background: transparent !important;
    border: 0 !important; border-radius: 10px !important;
    font-size: 14px !important; line-height: 1.2 !important;
    text-align: left !important; white-space: nowrap !important;
    position: relative !important; opacity: 1 !important;
  }
  body.theme-light.iyes-ux-nav-open .shell > .sidebar nav button[data-page],
  body.theme-light.iyes-ux-nav-open .shell > .sidebar nav #iyes-v347-receipts-nav,
  body.theme-light.iyes-ux-nav-open .shell > .sidebar nav #iyes-iptv-nav {color: #2a4569 !important}
  body.iyes-ux-nav-open .shell > .sidebar nav button[data-page].active {
    background: #24466f !important; color: #fff !important;
  }
  body.theme-light.iyes-ux-nav-open .shell > .sidebar nav button[data-page].active {
    background: #e5effe !important; color: #174476 !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar nav button[data-page] > span:not([class*='badge']),
  body.iyes-ux-nav-open .shell > .sidebar nav #iyes-iptv-nav > span:not([class*='badge']) {
    min-width: 0 !important; flex: 1 1 auto !important;
    overflow: hidden !important; text-overflow: ellipsis !important;
    white-space: nowrap !important; color: inherit !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar nav [class*='badge'],
  body.iyes-ux-nav-open .shell > .sidebar nav [class*='nav-count'],
  body.iyes-ux-nav-open .shell > .sidebar nav #iyes-human-queue-count-r18r1,
  body.iyes-ux-nav-open .shell > .sidebar nav #iyes-iptv-badge {
    position: static !important; inset: auto !important;
    margin: 0 0 0 auto !important; transform: none !important;
    flex: 0 0 auto !important; min-width: 24px !important;
    height: 24px !important; display: inline-flex !important;
    align-items: center !important; justify-content: center !important;
    padding: 0 7px !important; border-radius: 999px !important;
    font-size: 12px !important; box-sizing: border-box !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar nav [hidden],
  #iyes-iptv-badge[hidden] {display: none !important}
  /* A linha IPTV e clonada da linha Comprovantes: o contador copiado nao pertence a IPTV. */
  #iyes-iptv-nav .iyes-v347-nav-count {display: none !important}
  body.iyes-ux-nav-open .iyes-ux-backdrop {
    display: block !important; z-index: 9600 !important;
    background: rgba(7,18,35,.43) !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar .iyes-r2a-close-menu {
    display: inline-flex !important; position: absolute !important;
    top: 16px !important; right: 15px !important;
    left: auto !important; bottom: auto !important;
    z-index: 3 !important; align-items: center !important;
    justify-content: center !important;
    width: 40px !important; height: 40px !important;
    color: inherit !important; border: 1px solid rgba(127,156,193,.3) !important;
    border-radius: 12px !important; background: rgba(127,156,193,.09) !important;
    font-size: 22px !important;
  }
  body.iyes-ux-nav-open .shell > .sidebar .iyes-r2a-close-menu[hidden] {display: none !important}

  /* O chat acompanha a viewport visivel no Safari iOS ao abrir teclado. */
  body.mobile-inbox-chat {
    overflow: hidden !important; height: var(--iyes-mobile-r1-vh,100dvh) !important;
    overscroll-behavior: none !important;
  }
  body.mobile-inbox-chat #app {
    position: fixed !important; inset: 0 0 auto 0 !important;
    height: var(--iyes-mobile-r1-vh,100dvh) !important;
    min-height: 0 !important; max-height: var(--iyes-mobile-r1-vh,100dvh) !important;
    overflow: hidden !important;
  }
  body.mobile-inbox-chat .shell,
  body.mobile-inbox-chat .shell > .content,
  body.mobile-inbox-chat .operator-shell,
  body.mobile-inbox-chat .operator-content,
  body.mobile-inbox-chat .operator-inbox.inbox-pro,
  body.mobile-inbox-chat .inbox.inbox-pro {
    height: var(--iyes-mobile-r1-vh,100dvh) !important;
    min-height: 0 !important; max-height: var(--iyes-mobile-r1-vh,100dvh) !important;
    box-sizing: border-box !important; overflow: hidden !important;
  }
  body.mobile-inbox-chat .inbox.inbox-pro.mobile-chat-open .chat,
  body.mobile-inbox-chat .operator-inbox.inbox-pro.mobile-chat-open .chat {
    height: 100% !important; min-height: 0 !important;
    grid-template-rows: auto minmax(0,1fr) auto !important;
    overflow: hidden !important;
  }
  body.mobile-inbox-chat .chat .messages {min-height:0 !important;overflow-y:auto !important;overscroll-behavior:contain !important}
  body.mobile-inbox-chat .chat .composer-pro,
  body.mobile-inbox-chat .chat .iyes-r2-composer {
    min-height: 0 !important; flex-shrink: 0 !important;
    max-height: min(168px, 35vh) !important; overflow-y: auto !important;
  }
  body.mobile-inbox-chat #msg-text,
  body.mobile-inbox-chat #saas-reply {font-size:16px !important;scroll-margin:0 !important}
}
