/* TelaFlux 1.4.3: camada mobile-first sem alterar as regras de desktop.
   Este arquivo carrega DEPOIS de app.css. Todas as alterações ficam <= 767.98px. */
.room-mobile-switcher{display:none}

@media (max-width:767.98px) {
  :root { scroll-padding-top:76px; }
  html,body { width:100%;max-width:100%;overflow-x:clip; }
  body { min-width:0; }
  main,section,aside,article { min-width:0; }
  button,a,input,textarea,select { touch-action:manipulation; }
  button, .btn { -webkit-tap-highlight-color:transparent; }
  .form-control,.form-select,input[type="text"],input[type="password"],input[type="search"],textarea {font-size:16px;}
  .modal-dialog { max-width:calc(100% - 20px);margin:10px auto; }
  .modal-content { max-height:calc(100dvh - 20px);overflow-y:auto;overscroll-behavior:contain; }
  .modal-body { min-width:0; }
  .page-content { padding:16px 12px 24px; }
  .app-footer { padding:12px 10px!important; line-height:1.45; }

  /* Navbar compartilhada: desktop continua usando a definição de app.css. */
  .topbar--unified .tf-navigation {min-height:62px;padding:6px 0;}
  .topbar--unified .tf-nav-shell {padding:0 12px;gap:8px;}
  .topbar--unified .tf-nav-brand .brand-logo-img {width:clamp(108px,28vw,152px);}
  .topbar--unified .tf-nav-brand .brand-beta {padding:3px 5px;font-size:.46rem;}
  .topbar--unified .tf-nav-actions {gap:6px;}
  .topbar--unified .tf-nav-account {max-width:42vw;padding:4px;gap:5px!important;}
  .topbar--unified .tf-nav-avatar {width:32px;height:32px;min-width:32px;}
  .topbar--unified .tf-nav-logout {min-height:42px;padding:8px 10px;}
  .topbar--unified .tf-nav-menu {min-width:205px;max-width:calc(100vw - 20px);}

  /* Login, registro e convites. */
  .auth-shell {min-height:100dvh;display:block;}
  .auth-main {min-height:100dvh;width:100%;padding:clamp(18px,5vw,30px)!important;}
  .auth-panel {max-width:420px;margin-inline:auto;}
  .auth-title {font-size:clamp(1.7rem,6vw,2rem);}
  .auth-panel .form-control {min-height:48px;}
  .invite-panel {width:100%;max-width:540px;padding:24px 16px;margin-top:12px;}
  .invite-panel .room-invite-code {max-width:100%;flex-wrap:wrap;overflow-wrap:anywhere;justify-content:center;}

  /* Painel inicial: conteúdo central, depois salas recentes e amigos. */
  .dashboard-shell {min-height:auto;display:block;padding:14px 12px 25px;}
  .dashboard-columns {width:100%;margin:0;display:grid;grid-template-columns:minmax(0,1fr);gap:12px;}
  .dashboard-center {grid-column:1;grid-row:1;padding:17px 15px;}
  .dashboard-recent {grid-column:1;grid-row:2;min-height:0;}
  .dashboard-social,.dashboard-social-friends-only {grid-column:1;grid-row:3;min-height:0;display:flex;flex-direction:column;}
  .dashboard-center-intro h1 {font-size:clamp(1.5rem,6vw,2.05rem);line-height:1.16;overflow-wrap:anywhere;}
  .dashboard-center-intro>p {font-size:.88rem;line-height:1.55;}
  .dashboard-intro-symbol {width:42px;height:42px;margin-bottom:12px;}
  .dashboard-panel {border-radius:17px;}
  .dashboard-panel-heading {padding:17px 15px 12px;}
  .dashboard-recent-list {max-height:225px;padding:8px;}
  .dashboard-panel-bottom-link {padding:13px 15px;}
  .dashboard-room-actions {padding-top:15px;}
  .dashboard-tabs {grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;}
  .dashboard-tabs .nav-link {padding:8px 5px;min-height:48px;font-size:.73rem;white-space:normal;line-height:1.25;gap:5px;}
  .dashboard-tabs .nav-link .lucide-icon {width:14px;height:14px;}
  .dashboard-tab-content {padding:12px;}
  .dashboard-tab-panel {gap:8px;}
  .dashboard-action-form .form-control {min-height:46px;height:46px;font-size:16px;}
  .dashboard-join-fields {grid-template-columns:1fr;gap:8px;}
  .dashboard-join-fields .btn {min-height:44px;width:100%;}
  .dashboard-room-list {max-height:285px;}
  .dashboard-social-section {padding:15px;}
  .dashboard-social-friends-only .dashboard-friends-footer {margin-top:12px;}
  .dashboard-social-friends-only .dashboard-friends-stack {max-height:330px;}
  .dashboard-friend-card {padding:11px;}
  .dashboard-friend-message {min-height:42px;}
  .dashboard-friends-footer {padding-top:10px;}
  .dashboard-add-friend-footer {min-height:46px;}
  .dashboard-footer {flex-wrap:wrap;justify-content:center;text-align:center;gap:6px;padding:14px 12px;}

  /* Sala: chamada sempre visível e abas móveis para os dois painéis secundários. */
  body:has(#roomApp) {height:auto;min-height:100dvh;overflow-x:clip;overflow-y:auto;}
  #roomApp.room-page {width:100%;max-width:100%;min-width:0;min-height:0;height:auto;
    padding:9px 10px max(17px,env(safe-area-inset-bottom))!important;display:flex;flex-direction:column;gap:9px;}
  #roomApp .room-overview {min-width:0;width:100%;flex:0 0 auto;}
  #roomApp .room-overview-top {display:grid;grid-template-columns:minmax(0,1fr);gap:9px;padding:12px;}
  #roomApp .room-identity {grid-column:1;grid-row:1;min-width:0;}
  #roomApp .room-identity-main {gap:9px;align-items:center;}
  #roomApp .room-identity-symbol {width:36px;height:36px;flex-basis:36px;}
  #roomApp .room-identity-heading {gap:6px;}
  #roomApp .room-title {font-size:1.18rem;overflow-wrap:anywhere;}
  #roomApp .room-subtitle {font-size:.73rem;gap:5px;flex-wrap:wrap;}
  #roomApp .room-meta-divider {display:none;}
  #roomApp .room-overview-brand {grid-column:1;grid-row:2;justify-self:center;display:flex;align-items:flex-start;justify-content:center;gap:7px;max-width:calc(100% - 8px);margin:0;}
  #roomApp .room-brand-logo {width:clamp(148px,42vw,190px);max-width:100%;}
  #roomApp .room-brand-beta {position:static;flex:0 0 auto;margin-top:0;font-size:.51rem;padding:3px 5px;}
  #roomApp .room-overview-actions {grid-column:1;grid-row:3;width:100%;min-width:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:stretch;justify-content:stretch;margin:0;}
  #roomApp .room-overview-actions .room-connection-wrap {width:100%;max-width:none;min-width:0;flex:initial;}
  #roomApp .room-invite-button {width:100%;min-width:0;min-height:44px;padding:8px 5px;font-size:.76rem;white-space:nowrap;}
  #roomApp .room-invite-button .lucide-icon {width:15px;height:15px;}
  #roomApp .room-connection-wrap {width:100%;max-width:none;min-width:0;}
  #roomApp .room-connection-status {width:100%;min-width:0;min-height:44px;padding:5px 6px;}
  #roomApp .room-connection-icon {flex-basis:25px;width:25px;height:25px;}
  #roomApp .room-connection-text {min-width:0;}
  #roomApp .room-connection-text strong {font-size:.71rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  #roomApp .room-connection-text small {font-size:.66rem;}
  #roomApp .room-connection-arrow {display:none;}
  #roomApp .call-notice {padding:8px 10px;font-size:.75rem;line-height:1.4;}
  #roomApp .call-workspace {display:grid;grid-template-columns:minmax(0,1fr);
    grid-template-areas:"stage" "switcher" "panel";grid-template-rows:auto auto auto;
    height:auto;min-height:0;gap:8px;align-items:stretch;overflow:visible;}
  #roomApp .call-primary {grid-area:stage;width:100%;min-height:0;min-width:0;display:flex;flex-direction:column;}
  #roomApp .call-primary .call-stage {height:clamp(250px,42dvh,430px);min-height:0;flex:0 0 auto;max-width:100%;}
  #roomApp .stage-viewport {min-width:0;}
  #roomApp .participant-grid {min-width:0;}
  #roomApp .participant-card video {object-fit:contain;}
  #roomApp .call-primary .call-toolbar {min-height:58px;margin-top:8px!important;padding:7px 5px;gap:6px!important;flex-wrap:nowrap!important;}
  #roomApp .call-toolbar .btn.btn-call-icon {flex:0 0 clamp(41px,12vw,50px);width:clamp(41px,12vw,50px);
    min-width:0;height:48px;min-height:48px;padding:7px;}
  #roomApp .call-toolbar #deleteRoomForm {flex:0 0 auto;}
  #roomApp .call-toolbar .lucide-icon {width:20px;height:20px;}
  #roomApp .room-mobile-switcher {display:grid;grid-area:switcher;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;
    padding:5px;border:1px solid #273954;border-radius:13px;background:#0f1725;}
  #roomApp .room-mobile-switcher button {display:flex;align-items:center;justify-content:center;gap:9px;
    min-height:44px;padding:9px 10px;border:1px solid transparent;border-radius:10px;
    background:transparent;color:#aabddd;font-weight:740;font-size:.85rem;}
  #roomApp .room-mobile-switcher button[aria-pressed="true"] {background:#20385c;border-color:#426ca7;color:#eef4ff;}
  #roomApp .room-mobile-switcher button:focus-visible {outline:2px solid #9ab8ff;outline-offset:2px;}
  #roomApp .room-members-column,#roomApp .room-chat-column {grid-area:panel;min-width:0;min-height:0;
    height:clamp(315px,44dvh,440px);overflow:hidden;}
  #roomApp .room-members-column {display:none;}
  #roomApp .room-chat-column {display:flex;}
  #roomApp[data-mobile-panel="members"] .room-members-column {display:flex;}
  #roomApp[data-mobile-panel="members"] .room-chat-column {display:none;}
  #roomApp[data-mobile-panel="chat"] .room-members-column {display:none;}
  #roomApp[data-mobile-panel="chat"] .room-chat-column {display:flex;}
  #roomApp .room-members-column .members-panel,#roomApp .room-chat-column .chat-panel {display:flex;flex-direction:column;min-height:0;height:100%;}
  #roomApp .room-members-column .member-list {flex:1;min-height:0;overflow:auto;}
  #roomApp .room-chat-column .chat-messages {flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;}
  #roomApp .room-chat-column .chat-compose-form {flex:0 0 auto;padding:9px 9px 3px;}
  #roomApp .room-chat-column .chat-compose-box .chat-input {font-size:16px;min-height:38px;max-height:115px;}
  #roomApp .room-chat-column .chat-compose-box {min-width:0;}
  #roomApp .room-chat-column .chat-tip {font-size:.7rem;line-height:1.4;}
  .chat-emoji-picker {max-width:calc(100vw - 18px);max-height:min(65dvh,470px);}
  .stream-menu {max-width:calc(100vw - 20px);max-height:calc(100dvh - 24px);}
  .profile-floating-menu {max-width:calc(100vw - 20px);}
  .profile-modal .modal-dialog {max-width:calc(100vw - 20px);}
  .profile-photo-area {flex-wrap:wrap;}
  .profile-crop-viewport {max-width:100%;}
  .stream-setup-grid {grid-template-columns:minmax(0,1fr);}

  /* Mensagens privadas: corrigir inversão da sidebar e da conversa no CSS antigo. */
  #dmPage.dm-shell {display:grid;grid-template-columns:minmax(0,1fr);width:calc(100% - 16px);
    height:calc(100dvh - 80px);min-height:360px;max-height:none;margin:8px auto;
    overflow:hidden;border-radius:14px;}
  #dmPage .dm-sidebar {display:flex;min-height:0;border-right:0;}
  #dmPage .dm-conversation {display:none;min-height:0;}
  #dmPage[data-friend-id]:not([data-friend-id=""]) .dm-sidebar {display:none;}
  #dmPage[data-friend-id]:not([data-friend-id=""]) .dm-conversation {display:flex;}
  #dmPage .dm-sidebar-head {padding:14px 12px 11px;}
  #dmPage .dm-friend {min-height:60px;padding:11px;}
  #dmPage .dm-conversation-head {min-height:63px;padding:10px 12px;gap:9px;}
  #dmPage .dm-conversation-person strong {font-size:.93rem;}
  #dmPage .dm-mobile-back {display:inline-flex;padding:8px;margin-left:-7px;min-width:40px;min-height:40px;align-items:center;justify-content:center;}
  #dmPage .dm-message-feed {padding:14px 10px 16px;gap:12px;}
  #dmPage .dm-message-bubble {max-width:min(88%,590px);padding:10px 12px;}
  #dmPage .dm-message-by {flex-wrap:wrap;gap:5px;}
  #dmPage .dm-avatar-small {width:29px;height:29px;}
  #dmPage .dm-composer {padding:9px 10px max(8px,env(safe-area-inset-bottom));}
  #dmPage .dm-composer-box {padding:6px 8px;align-items:flex-end;gap:6px;}
  #dmPage .dm-composer-box textarea {font-size:16px;min-height:44px;max-height:125px;}
  #dmPage .dm-composer-meta {flex-wrap:wrap;font-size:.68rem;}
  #dmPage .dm-send {min-width:44px;min-height:44px;}

  /* Painel administrativo: estatísticas, moderação e Nodes confortáveis ao toque. */
  #adminPage.admin-shell {width:calc(100% - 20px);margin:16px auto 25px;}
  #adminPage .admin-head {flex-direction:column;align-items:stretch;gap:12px;}
  #adminPage .admin-head h1 {font-size:clamp(1.55rem,6vw,2rem);line-height:1.18;}
  #adminPage .admin-back {min-height:43px;justify-content:center;align-self:flex-start;}
  #adminPage .admin-stats {grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;}
  #adminPage .admin-stat {min-width:0;padding:13px;gap:11px;}
  #adminPage .admin-stat strong {font-size:1.65rem;}
  #adminPage .admin-stat span {font-size:.77rem;line-height:1.4;}
  #adminPage .admin-panel-tabs {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
  #adminPage .admin-tab {min-width:0;min-height:46px;display:flex;justify-content:center;flex-wrap:wrap;
    padding:8px 5px;gap:5px;font-size:.74rem;line-height:1.2;text-align:center;}
  #adminPage .admin-future {font-size:.55rem;}
  #adminPage .admin-section-head {flex-wrap:wrap;align-items:flex-start;gap:11px;}
  #adminPage .admin-section-head .btn {min-height:43px;}
  #adminPage .admin-room-heading {padding:12px;flex-wrap:wrap;}
  #adminPage .admin-member-list {padding:8px;}
  #adminPage .admin-member-card {display:flex;flex-direction:column;align-items:stretch;gap:11px;padding:11px;}
  #adminPage .admin-member-main {width:100%;}
  #adminPage .admin-media-controls {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;}
  #adminPage .admin-media-controls .btn {min-width:0;min-height:44px;white-space:normal;}
  #adminPage .admin-node-placeholder {padding:28px 14px;}
  #adminPage .admin-node-points {gap:7px;}
  #adminPage .admin-node-points span {flex:1 1 100%;justify-content:center;text-align:center;}
  #adminPage .admin-audit-item {flex-wrap:wrap;overflow-wrap:anywhere;}
}

@media (max-width:390px) {
  .topbar--unified .tf-nav-username {display:none;}
  .topbar--unified .tf-nav-brand .brand-logo-img {width:106px;}
  .topbar--unified .tf-nav-logout {padding:8px;}
  #roomApp .room-invite-button {font-size:.71rem;}
  #roomApp .room-connection-arrow {display:none;}
  #roomApp .call-toolbar .btn.btn-call-icon {flex-basis:42px;width:42px;height:46px;min-height:46px;}
  #adminPage .admin-tab .admin-future {display:none;}
  .dashboard-tabs .nav-link .lucide-icon {display:none;}
}

@media (max-width:767.98px) and (prefers-reduced-motion:reduce) {
  .btn,.dashboard-panel,.dashboard-friend-card {transition:none;}
}
