@media (max-width: 720px) {
  html, body { width: 100%; height: 100%; }
  body { overflow: hidden; }
  .app-shell, .app-shell.room-active {
    position: fixed;
    top: var(--app-viewport-top, 0px);
    left: var(--app-viewport-left, 0px);
    width: var(--app-viewport-width, 100%);
    height: var(--app-viewport-height, 100vh);
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .topbar { min-height: 50px; padding: .3rem .42rem; }
  .brand-line img { width: 30px; height: 30px; }
  .account-menu-label { display: none; }
  .account-trigger { min-width: 42px; padding-right: .38rem; }
  .auth-shell { padding: max(2.4rem, calc(env(safe-area-inset-top) + 1.4rem)) .95rem 1.5rem; }
  .auth-card.login-card { width: min(100%, 360px); }
  .view { padding: .65rem .58rem max(.55rem, env(safe-area-inset-bottom)); }
  .room-grid { gap: 0; }
  .room-card { border-radius: 0; }
  .room-view { --room-inline-pad: .58rem; --room-inline-offset: -.58rem; --room-footer-extra: 1.16rem; padding: .12rem var(--room-inline-pad) 0; }
  .message-list { scroll-padding-bottom: .75rem; }
  .message { width: 86%; }
  .message-menu summary { opacity: 1; transform: none; pointer-events: auto; }
  .message-menu-panel,
  .media-tile .message-menu-panel { position: fixed; left: 50%; right: auto; top: auto; bottom: calc(var(--room-footer-height, 55px) + .5rem); width: min(288px, calc(100vw - 1rem)); max-height: min(48dvh, calc(var(--app-viewport-height, 100vh) - var(--room-footer-height, 55px) - 70px)); overflow-y: auto; transform: translateX(-50%); }
  .message.mine .message-bubble > .message-menu .message-menu-panel { left: 50%; right: auto; }
  .reaction-picker { gap: .18rem; }
  .reaction-choice { min-height: 36px; font-size: 1.12rem; }
  .admin-modal { width: 100%; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .admin-content { padding: .7rem; }
  .admin-toolbar { align-items: stretch; }
  .admin-toolbar .button { white-space: nowrap; }
  .direct-pair-fields { grid-template-columns: 1fr; }
  .selection-check, .message.mine .selection-check { left: .3rem; right: auto; }
  .media-gallery { --media-thumb-size: clamp(82px, 24vw, 96px); }
  .ttl-modal, .confirm-modal { margin: auto; }
}

@media (min-width: 721px) {
  .message-menu.opens-up .message-menu-panel,
  .media-tile .message-menu.opens-up .message-menu-panel {
    top: auto;
    bottom: 30px;
  }
  .message-menu.align-start .message-menu-panel,
  .media-tile .message-menu.align-start .message-menu-panel {
    left: 0;
    right: auto;
  }
}

@media (max-width: 430px) {
  .app-shell.room-active .topbar { gap: .3rem; }
  .app-shell.room-active .brand-line { gap: .3rem; }
  .app-shell.room-active .brand-line img { display: none; }
  .app-shell.room-active .brand-line strong { max-width: 88px; }
  .app-shell.room-active .brand-line span { max-width: 105px; }
  .app-shell.room-active .topbar-actions { gap: .14rem; }
  .app-shell.room-active .room-quick-actions { gap: .08rem; }
  .app-shell.room-active .topbar-quick-action,
  .app-shell.room-active #roomMenuButton { width: 36px; min-width: 36px; min-height: 38px; }
  .brand-line strong { max-width: 150px; }
  .brand-line span { max-width: 140px; }
  .topbar-back, .topbar-actions .icon-button { width: 38px; min-width: 38px; min-height: 38px; }
  .account-avatar { width: 29px; height: 29px; }
  .view-heading { align-items: center; }
  .dashboard-actions { gap: .25rem; }
  .admin-direct-actions { gap: .2rem; }
  .admin-direct-actions .button { min-height: 32px; padding: .32rem .48rem; font-size: .72rem; }
  .dashboard-actions .version-chip { display: none; }
  .room-card { min-height: 70px; padding: .48rem .3rem; }
  .room-avatar { width: 47px; height: 47px; border-radius: 50%; }
  .message { width: 88%; }
  .message-body { font-size: .875rem; }
  .message-body.emoji-one { font-size: 2.65rem; }
  .message-body.emoji-few { font-size: 1.9rem; }
  .composer { gap: .25rem; padding-top: .36rem; padding-bottom: max(.36rem, env(safe-area-inset-bottom)); }
  .room-footer { flex: 0 0 auto; }
  .composer textarea { font-size: 16px; }
  .emoji-picker { left: 0; bottom: calc(100% + .35rem); }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .admin-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
  .admin-item { padding: .68rem; }
  .admin-item .button { min-height: 38px; padding: .45rem .62rem; }
  .selection-topbar-action { width: 40px; min-width: 40px; height: 40px; }
  .ttl-choice-grid { gap: .34rem; padding: .5rem; }
  .ttl-choice { min-height: 42px; padding: .42rem .45rem; }
}

@media (max-width: 380px) {
  .app-shell.room-active .topbar { padding-inline: .28rem; }
  .app-shell.room-active .topbar-leading { gap: .18rem; }
  .app-shell.room-active .brand-line { gap: .22rem; }
  .app-shell.room-active .contact-avatar { width: 34px; height: 34px; }
  .app-shell.room-active .brand-line strong { max-width: 74px; }
  .app-shell.room-active .brand-line span { display: none; }
  .app-shell.room-active .topbar-back,
  .app-shell.room-active .topbar-quick-action { width: 34px; min-width: 34px; min-height: 36px; }
  .selection-topbar-action { width: 38px; min-width: 38px; height: 38px; }
}

@media (min-width: 900px) {
  .message-list,
  .message-list.selection-active {
    padding-left: max(1rem, calc((100% - 860px) / 2));
    padding-right: max(1rem, calc((100% - 860px) / 2));
  }
  .composer,
  .reply-strip {
    padding-left: max(1rem, calc((100% - 860px) / 2));
    padding-right: max(1rem, calc((100% - 860px) / 2));
  }
  .typing-status {
    padding-left: max(1.2rem, calc((100% - 860px) / 2 + .2rem));
    padding-right: max(1.2rem, calc((100% - 860px) / 2 + .2rem));
  }
}

@media print {
  body > * { display: none; }
  body::after { content: "Conteúdo protegido."; display: block; padding: 2rem; }
}
