/* ============================================================
   EXPRESSO — Mobile · PWA · Kanban responsivo
   ============================================================ */

/* ===== App mobile shell (admin) ===== */
@media (max-width: 980px) {
  body.app .app-shell { grid-template-columns: 1fr; }
  body.app .app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; z-index: 80;
    transform: translateX(-105%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1);
    box-shadow: 20px 0 60px -20px rgba(0,0,0,0.4);
  }
  body.app .app-sidebar.open { transform: translateX(0); }
  body.app .app-topbar { padding: 12px 16px; }
  body.app .app-topbar .search { max-width: none; flex: 1; }
  body.app .app-topbar .search input { padding: 8px 12px 8px 36px; font-size: 13px; }
  body.app .app-topbar .right .btn.btn-primary { display: none; }

  /* Botão hambúrguer mobile */
  .mobile-hamb {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--paper);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
  }
  body.app .app-body { padding: 16px; }
  body.app .page-h { flex-direction: column; align-items: flex-start; gap: 12px; }
  body.app .page-h h1 { font-size: 24px; }
  body.app .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  body.app .kpi { padding: 14px; }
  body.app .kpi .val { font-size: 22px; }

  /* Overlay mobile do sidebar */
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(14,15,31,0.5);
    backdrop-filter: blur(4px); z-index: 70;
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
}
@media (min-width: 981px) {
  .mobile-hamb, .sidebar-backdrop { display: none !important; }
}

/* ===== Kanban carrossel mobile ===== */
@media (max-width: 820px) {
  .kanban {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px !important;
    padding: 6px 16px 16px;
    margin: 0 -16px;
    grid-template-columns: none !important;
  }
  .kanban::-webkit-scrollbar { height: 0; }
  .kanban-col {
    flex: 0 0 86%;
    scroll-snap-align: center;
    min-width: 86%;
    max-width: 86%;
  }
  .kanban-col:first-child { margin-left: 0; }
  .kanban-col:last-child { margin-right: 8px; }

  /* Indicador de página */
  .kanban-pages {
    display: flex; justify-content: center; gap: 6px;
    padding: 14px 0;
  }
  .kanban-pages .dot-p {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--line);
    transition: all .2s;
  }
  .kanban-pages .dot-p.active {
    width: 28px;
    background: var(--purple);
    border-radius: 999px;
  }

  /* Swipe hint primeira vez */
  .kanban-hint {
    position: fixed; bottom: 80px; left: 50%;
    transform: translateX(-50%);
    background: var(--ink); color: #fff;
    padding: 10px 18px; border-radius: 999px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
    z-index: 30;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.3);
    animation: hintBounce 2s ease-in-out infinite;
  }
  @keyframes hintBounce {
    0%, 100% { transform: translateX(-50%) translateX(0); }
    50% { transform: translateX(-50%) translateX(8px); }
  }
}
@media (min-width: 821px) {
  .kanban-pages, .kanban-hint { display: none !important; }
}

/* ===== Bottom Tab Bar (PWA standalone) ===== */
.mobile-tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  justify-content: space-around;
  align-items: center;
}
.mobile-tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 10px; text-decoration: none;
  color: var(--mute); flex: 1; max-width: 80px;
  position: relative;
}
.mobile-tabbar a.active { color: var(--purple); }
.mobile-tabbar a.active::before {
  content: ""; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%); width: 24px; height: 2px;
  background: var(--grad-marca); border-radius: 0 0 2px 2px;
}
.mobile-tabbar a svg { width: 20px; height: 20px; }
.mobile-tabbar a span {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.04em; font-weight: 600;
}
.mobile-tabbar a .badge {
  position: absolute; top: 4px; right: 50%; margin-right: -18px;
  background: var(--purple); color: #fff;
  font-size: 9px; font-weight: 700;
  width: 14px; height: 14px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 720px) {
  body.app .mobile-tabbar { display: flex; }
  body.app .app-body { padding-bottom: 76px; }
  .wa-float { bottom: 80px; }
}

/* ===== Install PWA prompt ===== */
.pwa-install {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  max-width: 420px; margin: 0 auto;
  background: linear-gradient(135deg, #1A1B36, #0E0F1F);
  color: #fff; border-radius: 14px;
  padding: 14px 16px; z-index: 60;
  display: flex; gap: 12px; align-items: center;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
  transform: translateY(120px); opacity: 0;
  transition: transform .3s, opacity .3s;
}
.pwa-install.show { transform: translateY(0); opacity: 1; }
.pwa-install .ic {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--grad-marca);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pwa-install .info { flex: 1; min-width: 0; }
.pwa-install .info b { display: block; font-size: 13px; }
.pwa-install .info p { font-size: 11px; color: #B6B9D6; margin-top: 2px; }
.pwa-install button {
  background: #fff; color: var(--ink); border: 0;
  padding: 8px 14px; border-radius: 999px;
  font-weight: 600; font-size: 12px; cursor: pointer;
  font-family: var(--font-body);
}
.pwa-install .dismiss {
  background: transparent; color: #9FA3CC;
  padding: 4px 8px; font-size: 18px;
}

/* ===== Modal de notificações WhatsApp config ===== */
.wa-notif-modal {
  position: fixed; bottom: 24px; right: 24px;
  background: #1A1B36; color: #fff;
  border-radius: 16px; padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  max-width: 360px; z-index: 55;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  animation: notifSlide .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes notifSlide { from { transform: translateY(40px); opacity: 0; } }
.wa-notif-modal .ic {
  width: 36px; height: 36px; border-radius: 10px; background: #25D366;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
}
.wa-notif-modal .info { flex: 1; min-width: 0; }
.wa-notif-modal .info b { display: block; font-size: 13px; }
.wa-notif-modal .info p { font-size: 11px; color: #B6B9D6; margin-top: 4px; line-height: 1.4; }
.wa-notif-modal .actions { display: flex; gap: 6px; margin-top: 10px; }
.wa-notif-modal .actions button {
  background: rgba(255,255,255,0.10); color: #fff; border: 0;
  padding: 6px 10px; border-radius: 8px; font-size: 11px; cursor: pointer;
  font-family: var(--font-body); font-weight: 500;
}
.wa-notif-modal .actions .ack { background: #25D366; }
.wa-notif-modal .close {
  background: transparent; color: #9FA3CC; border: 0;
  cursor: pointer; padding: 2px;
}
