/* =========================================================
   Responsividade (mobile first nos componentes críticos)
   ========================================================= */

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .kpi-grid, .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-cards { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  /* Menu lateral vira gaveta */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 272px; height: 100%;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-3);
  }
  .shell.menu-open .sidebar { transform: none; }
  .side-overlay { position: fixed; inset: 0; background: rgba(20, 12, 22, .45); z-index: 35; }
  .shell.menu-open .side-overlay { display: block; }
  .topbar { padding: .6rem 1rem; }
  .topbar .menu-btn { display: inline-grid; }
  .view { padding: 1rem; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: .25rem; padding: .4rem; scrollbar-width: none; }
  .settings-nav a { white-space: nowrap; flex-shrink: 0; }
  .cal { max-height: none; }
}

/* ---------- Celular ---------- */
@media (max-width: 720px) {
  h1 { font-size: 1.45rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .new-client-box { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { gap: .6rem; }
  .kpi { padding: .85rem; }
  .kpi-value { font-size: 1.35rem; }
  .mini-stats { gap: .5rem; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .user-chip > span:last-child { display: none; }
  .user-chip { padding: .15rem; }
  .card { padding: 1rem; }

  /* Tabelas viram cartões */
  .table-wrap { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .6rem; padding: .5rem .8rem; }
  .table td { border: 0 !important; padding: .3rem 0 !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table td::before { content: attr(data-label); font-size: .78rem; color: var(--muted); font-weight: 600; text-align: left; flex-shrink: 0; }
  .table td:first-child { text-align: left; }
  .table td:first-child::before { display: none; }
  .table td.t-actions { justify-content: flex-end; border-top: 1px solid var(--line) !important; margin-top: .3rem; padding-top: .5rem !important; }
  .table td.t-actions::before { display: none; }

  .toolbar .search { flex: 1 1 100%; }
  .toolbar .select-sm { flex: 1; }
  .agenda-bar { gap: .45rem; }
  .agenda-date { order: -1; width: 100%; }
  .cal-col { min-width: 150px; }
  .up-item { grid-template-columns: 52px minmax(0, 1fr); }
  .up-price { grid-column: 2; justify-items: start; text-align: left; display: flex; gap: .5rem; align-items: center; }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-height: 92vh; border-radius: 20px 20px 0 0; width: 100%; max-width: 100% !important; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
  .toasts { left: .75rem; right: .75rem; bottom: .75rem; }
  .toast { max-width: none; }
  .hours-table th:nth-child(4), .hours-table td:nth-child(4) { display: none; }
  .hours-table input[type=time] { min-width: 0; width: 100%; }

  /* Landing / auth / onboarding */
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .onb { grid-template-columns: minmax(0, 1fr); }
  .onb-side { display: none; }
  .quick-add { grid-template-columns: minmax(0, 1fr) !important; }
  .split, .pricing, .feature-grid, .steps { grid-template-columns: minmax(0, 1fr) !important; }

  /* Página pública: botão fixo de agendar */
  .sticky-book { display: flex; }
  .pub-foot { padding-bottom: 5.5rem; }
}


/* ---------- Landing e página pública ---------- */
@media (max-width: 960px) {
  .lp-links { display: none; }
  .lp-hero { padding-top: 2.5rem; }
  .lp-hero .lp-wrap { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .hero-stage { min-height: 520px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); gap: 1.8rem; }
  .split > .demo-panel, .split > .stack, .split > div:first-child:has(.whats-bubble) { order: 2; }
  .pricing { grid-template-columns: minmax(0, 1fr); max-width: 460px; }
  .about { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .lp-wrap { padding: 0 1.1rem; }
  .lp-nav .lp-wrap { gap: .6rem; }
  .lp-nav .lp-cta .btn-ghost { display: none; }
  .lp-section { padding: 3.5rem 0; }
  .lp-hero h1 { font-size: 2.45rem; }
  .lp-hero .row .btn { flex: 1 1 100%; }
  .hero-ring { width: 340px; height: 340px; }
  .hero-ring.r2 { width: 260px; height: 260px; }
  .hero-float.f1 { left: 0; top: 30px; }
  .hero-float.f2 { right: 0; bottom: 40px; }
  .hide-sm { display: none; }
  .pub-cover { height: 190px; }
  .pub-logo { width: 92px; height: 92px; border-radius: 24px; }
  .pub-id { margin-top: -50px; }
  .pub-cta .btn-lg { min-width: 0; flex: 1 1 100%; }
  .pub-sec > .pub-wrap > h2 { font-size: 1.65rem; }
  .svc { padding: .9rem 1rem; }
  .pub-top .btn { display: none; }
  .bk h1 { font-size: 1.7rem; }
  .bk-bar .btn-lg { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 380px) {
  .kpi-grid, .mini-stats { grid-template-columns: minmax(0, 1fr); }
  .stat-row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
