/* ==========================================================================
   mobile.css — versão enxuta, pensada para o celular (≈90% do uso).
   Reaproveita o design do sistema principal (cores, tipografia, componentes) e acrescenta:
   navegação de baixo, áreas seguras (notch), alvos de toque de 44 px, e o chat do Jarvis.
   ========================================================================== */

/* ---------- navegação de baixo ---------- */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  :root { --bn-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
  body { padding-bottom: calc(var(--bn-h) + var(--safe-b)); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--bn-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
    background: rgb(255 255 255 / .94); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgb(0 23 55 / .06);
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: var(--bn-h); min-width: 0; color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  }
  .bn-item svg { width: 22px; height: 22px; stroke-width: 1.9; }
  .bn-item.active { color: var(--navy); }
  .bn-item.active svg { color: var(--blue); }
  .bn-item:active { transform: scale(.96); }
  .bn-jarvis .bn-orb {
    display: grid; place-items: center; width: 46px; height: 46px; margin-top: -20px; border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #1a4a8a, var(--navy) 70%); color: #fff;
    box-shadow: 0 6px 16px rgb(0 23 55 / .35), 0 0 0 4px #fff;
  }
  .bn-jarvis .bn-orb svg { width: 22px; height: 22px; color: #fff; }
  .bn-jarvis.active .bn-orb { box-shadow: 0 6px 16px rgb(0 23 55 / .35), 0 0 0 4px #fff, 0 0 0 6px var(--blue); }
  .bn-jarvis > span:last-child { margin-top: -2px; }

  /* topbar com área segura e enxuta */
  .topbar { height: calc(56px + var(--safe-t)); padding: var(--safe-t) 12px 0; }
  .topbar .top-divider, .topbar .top-profile > span:not(.profile-avatar), .topbar .top-profile > i { display: none; }
  .topbar .top-profile { padding: 0; }
  .topbar-actions { gap: 4px; }
  .top-action, #mobileOpen, .topbar .icon-button { width: 42px; height: 42px; }

  .content-wrap { padding: 14px 14px 18px; }
  .page-footer { display: none; }
  .sidebar { padding-top: calc(var(--safe-t) + 14px); padding-bottom: calc(var(--safe-b) + 10px); }

  /* formulários: 16 px evita o zoom automático do iPhone ao focar; alvos de toque confortáveis */
  input, select, textarea, .lm-field input, .lm-field select, .lm-field textarea { font-size: 16px !important; }
  .lm-btn { min-height: 42px; }
  .lm-btn.sm { min-height: 36px; }
  .lm-chip, .lm-filters button { min-height: 36px; }
  .nav-item { min-height: 46px; }
  .lm-toasts { bottom: calc(var(--bn-h) + var(--safe-b) + 12px) !important; left: 12px; right: 12px; }
  .lm-pop { left: 10px !important; right: 10px !important; width: auto !important; max-width: none; }
  .lm-palette { width: calc(100% - 20px); }
}

/* ---------- chat do Jarvis ---------- */
.ch-wrap { display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; height: calc(100dvh - 66px - 29px - 20px - 34px); min-height: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 8px 30px rgb(0 23 55 / .05); }
.ch-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fafcff); }
.ch-head strong { display: block; font-size: 14px; color: var(--navy); }
.ch-pill { display: inline-block; margin-top: 2px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: #eaf2ff; color: var(--blue); }
.ch-pill.warn { background: #fff4e0; color: #9a6a1e; }
.ch-orb { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; color: #fff; background: radial-gradient(circle at 30% 25%, #2a5fa8, var(--navy) 72%); box-shadow: 0 10px 28px rgb(0 23 55 / .28); }
.ch-orb svg { width: 28px; height: 28px; }
.ch-orb.sm { width: 36px; height: 36px; margin: 0; box-shadow: 0 4px 12px rgb(0 23 55 / .25); } .ch-orb.sm svg { width: 18px; height: 18px; }

.ch-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 8px; overscroll-behavior: contain; scroll-behavior: smooth; }
.ch-hello { text-align: center; padding: 22px 6px 10px; }
.ch-hello h2 { margin: 0 0 6px; font-size: 21px; color: var(--navy); font-weight: 750; }
.ch-hello p { margin: 0 auto 18px; max-width: 420px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ch-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.ch-chip svg { width: 15px; height: 15px; color: var(--blue); }
.ch-chip:hover { border-color: #b9cbe3; background: #f5f9ff; } .ch-chip:active { transform: scale(.97); }

.ch-list { display: flex; flex-direction: column; gap: 10px; }
.ch-msg { display: flex; flex-direction: column; max-width: 88%; gap: 8px; animation: rise .25s var(--ease); }
.ch-msg.user { align-self: flex-end; align-items: flex-end; }
.ch-msg.bot { align-self: flex-start; align-items: flex-start; }
.ch-bub { padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.55; word-break: break-word; overflow-wrap: anywhere; }
.ch-msg.user .ch-bub { background: var(--navy); color: #fff; border-bottom-right-radius: 6px; }
.ch-msg.bot .ch-bub { background: #f1f5fa; color: var(--ink); border-bottom-left-radius: 6px; }
.ch-txt p { margin: 0 0 6px; } .ch-txt p:last-child { margin-bottom: 0; }
.ch-txt ul { margin: 4px 0 6px; padding-left: 18px; } .ch-txt li { margin: 2px 0; }
.ch-typing { display: inline-flex; gap: 4px; align-items: center; padding: 14px 16px; }
.ch-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9db0c8; animation: chDot 1s infinite ease-in-out; }
.ch-typing i:nth-child(2) { animation-delay: .15s; } .ch-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chDot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.ch-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-size: 12.5px; font-weight: 650; text-decoration: none; }
.ch-link svg { width: 14px; height: 14px; }

/* documento devolvido no chat */
.ch-doc { width: min(340px, 100%); padding: 12px; border: 1px solid #cfdcee; border-radius: 16px; background: #fff; box-shadow: 0 4px 16px rgb(0 23 55 / .07); }
.ch-doc-head { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.ch-doc-ico { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: #eaf2ff; color: var(--blue); } .ch-doc-ico svg { width: 21px; height: 21px; }
.ch-doc-meta { min-width: 0; } .ch-doc-meta strong { display: block; font-size: 13px; line-height: 1.3; color: var(--navy); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ch-doc-meta small { color: var(--muted); font-size: 11.5px; }
.ch-doc-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .ch-doc-acts .lm-btn { width: 100%; }

.ch-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: #fff; }
.ch-form textarea { flex: 1; min-width: 0; max-height: 140px; resize: none; padding: 11px 14px; border: 1px solid var(--line); border-radius: 22px; background: #f8fafc; font: inherit; font-size: 16px; line-height: 1.4; color: var(--ink); outline: none; }
.ch-form textarea:focus { border-color: #9db8e0; background: #fff; box-shadow: 0 0 0 3px rgb(71 120 189 / .15); }
.ch-send, .ch-clear { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer; }
.ch-send { background: var(--navy); color: #fff; } .ch-send:active { transform: scale(.94); } .ch-send svg { width: 19px; height: 19px; }
.ch-clear { background: transparent; color: var(--muted); } .ch-clear:hover { background: #f1f5fa; } .ch-clear svg { width: 18px; height: 18px; }

/* no celular o chat ocupa a tela toda (sem moldura) */
@media (max-width: 760px) {
  body[data-module="jarvis"] .content-wrap { padding: 0; }
  .ch-wrap { height: calc(100dvh - 56px - var(--safe-t) - var(--bn-h) - var(--safe-b)); border: 0; border-radius: 0; box-shadow: none; max-width: none; }
  .ch-form { padding-bottom: 10px; }
  .ch-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { .ch-msg, .ch-typing i { animation: none; } .ch-scroll { scroll-behavior: auto; } }

/* ---------- convite para instalar (PWA) ---------- */
.pwa-banner { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: calc(var(--bn-h, 62px) + env(safe-area-inset-bottom, 0px) + 12px); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 18px; background: var(--navy); color: #fff; box-shadow: 0 12px 34px rgb(0 23 55 / .35); animation: rise .3s var(--ease); }
.pwa-banner img { border-radius: 11px; flex: none; }
.pwa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; } .pwa-txt strong { font-size: 13.5px; } .pwa-txt span { font-size: 11.5px; color: #b9cbe3; line-height: 1.35; }
.pwa-go { flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: #fff; color: var(--navy); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.pwa-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #b9cbe3; font-size: 22px; line-height: 1; cursor: pointer; }
.pwa-sheet-back { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; background: rgb(0 10 28 / .55); }
.pwa-sheet { width: 100%; padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; background: #fff; animation: rise .25s var(--ease); }
.pwa-sheet h3 { margin: 0 0 12px; font-size: 18px; color: var(--navy); } .pwa-sheet ol { margin: 0 0 18px; padding-left: 20px; font-size: 14.5px; line-height: 1.6; color: var(--ink); } .pwa-sheet li { margin-bottom: 8px; }
.pwa-sheet .pwa-go { width: 100%; background: var(--navy); color: #fff; min-height: 46px; }
@media (min-width: 761px) { .pwa-banner { bottom: 16px; left: auto; width: 380px; } }

/* ---------- convite para ativar avisos (dentro do sino) ---------- */
.nt-convite { display: flex; align-items: center; gap: 10px; margin: 0 14px 8px; padding: 10px 12px; border-radius: 14px; background: #eef4ff; color: var(--navy); font-size: 12.5px; line-height: 1.4; }
.nt-convite span { flex: 1; } .nt-convite .lm-btn { flex: none; }
