/* =====================================================================
   InfraMap — versão para celular (movel.html)
   Em cima: visualização (informações / arquivo / mapa / relatórios);
   embaixo: navegador de pastas em níveis; divisória arrastável no meio.
   ===================================================================== */
body.movel-page{ font-size:14.5px; overscroll-behavior:none; }
.mv{ --mv-cima:55%; position:fixed; inset:0; display:grid; grid-template-rows:auto minmax(0, var(--mv-cima)) auto minmax(0, 1fr); grid-template-columns:minmax(0, 1fr); background:var(--bg); overflow:hidden;
  padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); }
.mv[hidden]{ display:none; }

/* ---------- Barra de cima ---------- */
.mv-top{ display:flex; align-items:center; gap:6px; padding:8px 10px; border-bottom:1px solid var(--border); background:var(--surface); position:relative; z-index:20; }
.mv-org{ display:flex; align-items:center; gap:8px; min-width:0; border:0; background:none; color:inherit; font:inherit; font-weight:600; font-size:15px; padding:4px 6px; border-radius:8px; }
.mv-org .org-avatar{ width:26px; height:26px; font-size:12px; }
.mv-org-nome{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mv-org svg:last-child{ width:14px; height:14px; color:var(--text-muted); flex-shrink:0; }
.mv-org.so-uma svg:last-child{ display:none; }
.mv-espaco{ flex:1; }
.mv-top .icon-btn{ width:38px; height:38px; }
.mv-top .icon-btn.is-spinning svg{ animation:spin .8s linear infinite; }
.mv-user{ border:0; background:none; padding:2px; border-radius:50%; }
.mv-user .user-avatar{ width:32px; height:32px; border-radius:50%; background:var(--accent); color:var(--accent-contrast, #fff); display:inline-flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; overflow:hidden; }
.mv-user .user-avatar img, .mv-org-avatar img{ width:100%; height:100%; object-fit:cover; }
.mv-menu{ position:absolute; right:8px; top:calc(100% + 4px); min-width:230px; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; display:flex; flex-direction:column; z-index:60; }
.mv-menu[hidden]{ display:none; }
.mv-menu-quem{ display:flex; flex-direction:column; padding:8px 10px 10px; border-bottom:1px solid var(--border); margin-bottom:4px; }
.mv-menu-quem small{ color:var(--text-muted); }
.mv-menu button, .mv-menu a{ display:flex; align-items:center; gap:10px; padding:11px 10px; border:0; background:none; color:inherit; font:inherit; text-decoration:none; border-radius:8px; text-align:left; }
.mv-menu button:active, .mv-menu a:active{ background:var(--surface-alt); }
.mv-menu svg{ width:17px; height:17px; color:var(--text-muted); }
.mv-menu button[hidden]{ display:none; }
.mv-menu-dica{ font-size:12px; color:var(--text-muted); margin:6px 10px 4px; }

/* ---------- Espaço de visualização ---------- */
.mv-vista{ position:relative; display:flex; flex-direction:column; min-height:0; background:var(--surface); }
.mv-abas{ display:flex; gap:4px; padding:6px 8px; border-bottom:1px solid var(--border); flex-shrink:0; overflow-x:auto; }
.mv-aba{ flex:1; padding:8px 6px; border:0; border-radius:8px; background:none; color:var(--text-muted); font:inherit; font-weight:600; font-size:13.5px; white-space:nowrap; }
.mv-aba.is-ativa{ background:color-mix(in srgb, var(--accent) 13%, transparent); color:var(--accent); }
.mv-painel{ flex:1; min-height:0; overflow:auto; -webkit-overflow-scrolling:touch; padding:12px 14px 20px; }
.mv-painel[hidden]{ display:none; }
#mv-rel{ padding:0; }
#mv-rel .inspector-body{ padding:12px 14px 24px; }
.mv-mapa{ flex:1; min-height:0; }
.mv-mapa[hidden]{ display:none; }
.mv-mapa-tools{ top:8px; left:8px; flex-wrap:wrap; }
.mv-mapa-tools .map-tool{ padding:7px 10px; }
.mv-mapa-tools .map-tool.is-loading{ opacity:.6; }

.mv-cab{ display:flex; align-items:flex-start; gap:12px; margin-bottom:8px; }
.mv-cab > svg{ width:34px; height:34px; flex-shrink:0; color:var(--accent); }
.mv-cab h1{ margin:0; font-size:18px; line-height:1.25; word-break:break-word; }
.mv-cab p{ margin:2px 0 0; font-size:12.5px; }
.mv-linha{ margin:4px 0 8px; color:var(--text-muted); font-size:13px; }
.mv-desc{ margin:6px 0 10px; white-space:pre-wrap; }
.mv-dica{ color:var(--text-muted); font-size:13px; }
.mv-acoes{ display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 6px; }
.mv-acoes .btn{ margin:0; min-height:40px; }
.mv-acoes .btn svg{ width:16px; height:16px; }
.mv-previa{ margin:8px 0; border-radius:10px; overflow:hidden; background:var(--surface-alt); min-height:120px; display:flex; align-items:center; justify-content:center; }
.mv-previa img{ display:block; width:100%; max-height:60vh; object-fit:contain; }
.mv-props .insp-section{ padding:12px 0 0; }
.mv-props [data-meta^="gerenciar"]{ display:none; }

/* ---------- Divisória ---------- */
.mv-divisor{ height:22px; display:flex; align-items:center; justify-content:center; background:var(--surface-alt); border-top:1px solid var(--border); border-bottom:1px solid var(--border); touch-action:none; cursor:row-resize; z-index:5; }
.mv-divisor i{ width:44px; height:5px; border-radius:3px; background:var(--border-strong, #94a3b8); }
body.is-resizing .mv-mapa{ pointer-events:none; }

/* ---------- Navegador de pastas ---------- */
.mv-nav{ position:relative; display:flex; flex-direction:column; min-height:0; background:var(--bg); }
.mv-nav-head{ display:flex; align-items:center; gap:4px; padding:6px 6px 6px 10px; border-bottom:1px solid var(--border); background:var(--surface); }
.mv-nav-head .icon-btn{ width:38px; height:38px; flex-shrink:0; }
.mv-nav-head .icon-btn[hidden]{ display:none; }
.mv-trilha{ flex:1; min-width:0; display:flex; align-items:center; gap:2px; overflow-x:auto; scrollbar-width:none; white-space:nowrap; }
.mv-trilha::-webkit-scrollbar{ display:none; }
.mv-crumb{ display:inline-flex; align-items:center; gap:5px; border:0; background:none; color:var(--text-muted); font:inherit; font-size:13px; padding:6px 6px; border-radius:6px; max-width:180px; }
.mv-crumb span{ overflow:hidden; text-overflow:ellipsis; }
.mv-crumb svg{ width:15px; height:15px; flex-shrink:0; }
.mv-crumb.is-atual{ color:var(--text); font-weight:600; }
.mv-sep{ color:var(--text-muted); }
.mv-lista{ list-style:none; margin:0; padding:4px 0 90px; overflow:auto; -webkit-overflow-scrolling:touch; flex:1; min-height:0; }
.mv-orgs{ list-style:none; margin:0; padding:0; }
.mv-item{ display:flex; align-items:center; gap:12px; width:100%; min-height:52px; padding:8px 14px; border:0; border-bottom:1px solid var(--border); background:none; color:inherit; font:inherit; text-align:left; }
.mv-item:active{ background:var(--surface-alt); }
.mv-item.is-sel{ background:color-mix(in srgb, var(--accent) 10%, transparent); }
.mv-item > svg:first-child{ width:24px; height:24px; flex-shrink:0; }
.mv-item > svg:last-child:not(:first-child){ width:16px; height:16px; color:var(--text-muted); flex-shrink:0; }
.mv-item-nome{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; }
.mv-item small{ color:var(--text-muted); font-size:12px; flex-shrink:0; }
.mv-voltar{ color:var(--accent); }
.mv-voltar > svg:first-child{ width:20px; height:20px; }
.mv-vazio{ padding:24px 16px; color:var(--text-muted); text-align:center; }

/* Botão flutuante do assistente: canto inferior direito do navegador */
.movel-page .ast-fab{ right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); width:56px; height:56px; }

/* ---------- Assistente em tela cheia ---------- */
.movel-page .mv-chat{ position:fixed; inset:0; width:auto; box-shadow:none; z-index:80; display:flex; flex-direction:column; background:var(--surface); border:0;
  padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); }
.movel-page .mv-chat[hidden]{ display:none; }
.mv-chat .ast-head{ padding:8px 8px; }
.mv-chat .ast-head .icon-btn{ width:40px; height:40px; }
.mv-chat .mv-voltar-chat{ margin-right:2px; }
.mv-chat .ast-form textarea{ font-size:16px; }          /* evita o zoom automático do iPhone */
body.mv-chat-on .ast-fab{ display:none; }

/* ---------- Envios ---------- */
.mv-uploads{ position:fixed; left:8px; right:8px; bottom:calc(84px + env(safe-area-inset-bottom)); width:auto; max-width:none; z-index:70; }

/* ---------- Relatórios no celular ---------- */
.movel-page .field-2{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.movel-page .mv-painel *{ max-width:100%; box-sizing:border-box; }
.movel-page .range-row{ display:flex; gap:8px; align-items:center; min-width:0; }
.movel-page .range-row input[type=range]{ flex:1; min-width:0; }
.movel-page .rel-form-actions{ position:sticky; bottom:0; background:var(--surface); padding:10px 0; }
.movel-page input, .movel-page select, .movel-page textarea{ font-size:16px; }

/* ---------- Sem organização ---------- */
.mv-sem-org{ position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:24px; text-align:center; }
.mv-sem-org[hidden]{ display:none; }
.mv-sem-org h1{ margin:0; font-size:20px; }
.mv-sem-org p{ color:var(--text-muted); max-width:320px; }

/* Janelas (relatório, tabelas, organização) ocupam a tela toda */
@media (max-width: 640px){
  .movel-page .modal-overlay{ padding:0; align-items:stretch; }
  .movel-page .modal.panel{ max-width:none !important; width:100%; height:100%; max-height:none; border-radius:0; }
}
