/* Falcon - melhorias visuais somente para celulares/tablets
   Não altera regras de negócio, rotas, permissões ou estrutura PHP. */
@media (max-width: 980px){
  html{font-size:15px;-webkit-text-size-adjust:100%;scroll-behavior:smooth;}
  body{overflow-x:hidden;background:linear-gradient(180deg,#f8fbff 0%,#eef4fb 100%);}

  .mobilebar{
    min-height:58px;
    display:flex!important;
    align-items:center;
    gap:12px;
    position:sticky;
    top:0;
    z-index:70;
    padding:10px 14px;
    background:rgba(255,255,255,.94)!important;
    backdrop-filter:blur(14px);
    border-bottom:1px solid rgba(220,229,241,.9);
    box-shadow:0 10px 28px rgba(8,18,38,.08);
  }
  .mobilebar b{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#0f172a;
    font-size:15px;
    letter-spacing:-.02em;
  }
  .mobilebar button{
    margin-left:auto;
    min-height:38px;
    padding:9px 12px;
    border-radius:12px;
    background:#102247;
    color:#fff;
    border:0;
    box-shadow:0 10px 22px rgba(16,34,71,.18);
  }

  .shell{display:block;min-height:100vh;}
  .sidebar{
    width:min(86vw,320px)!important;
    max-width:320px;
    padding:16px 12px calc(22px + env(safe-area-inset-bottom));
    border-radius:0 24px 24px 0;
    box-shadow:24px 0 70px rgba(2,6,23,.32);
    transform:translateX(-110%);
    transition:transform .22s ease;
  }
  .menu-open .sidebar{transform:translateX(0);}
  .menu-open:after{
    content:"";
    position:fixed;
    inset:0;
    background:rgba(2,6,23,.42);
    z-index:25;
  }
  .menu-open .sidebar{z-index:80;}
  .brand{padding:4px 6px 16px;margin-bottom:12px;}
  .brand .logo,.logo{width:44px;height:44px;border-radius:14px;}
  .brand b{font-size:14px;line-height:1.15;}
  .brand span{font-size:11px;}
  .sidebar nav{gap:5px;}
  .sidebar a{
    min-height:42px;
    padding:11px 12px;
    border-radius:13px;
    font-size:13px;
  }

  .main{
    width:100%!important;
    max-width:100%;
    margin-left:0!important;
    padding:14px 12px 24px!important;
  }
  .topbar{
    display:block!important;
    margin:8px 0 14px;
    padding:0 2px;
  }
  .topbar h1{
    font-size:24px!important;
    line-height:1.12;
    letter-spacing:-.04em;
    margin:0;
  }
  .topbar p{font-size:12px;margin:6px 0 0;color:#64748b;}
  .userpill{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    width:100%;
    margin-top:12px;
    padding:10px 12px;
    border-radius:16px;
  }
  .userpill span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .userpill b{margin-left:0;white-space:nowrap;}

  .panel,.quick,.invoice-paper,.client-hero,.hero-saas,.premium-hero,.pay-hero{
    border-radius:18px!important;
    box-shadow:0 12px 32px rgba(15,23,42,.08)!important;
  }
  .panel,.quick{padding:15px!important;margin-bottom:14px!important;}
  .quick{display:block!important;}
  .quick h2,.panel h2{font-size:20px;line-height:1.15;margin:6px 0;}
  .quick p,.panel p{font-size:13px;line-height:1.45;}
  .eyebrow{font-size:10px;letter-spacing:.12em;}

  .grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;margin-bottom:14px!important;}
  .stat{min-height:108px;padding:15px;border-radius:18px!important;}
  .stat b{font-size:23px;margin:7px 0;word-break:break-word;}
  .stat span,.stat p{font-size:12px;line-height:1.25;}
  .stat i{right:12px;top:12px;padding:7px;border-radius:10px;}

  .formgrid{grid-template-columns:1fr!important;gap:12px!important;}
  .field{gap:6px;}
  .field label{font-size:12px;}
  .field input,.field select,.field textarea{
    width:100%;
    min-height:44px;
    font-size:16px;
    border-radius:12px;
    padding:10px 12px;
  }
  .field textarea{min-height:104px;}
  .field small{font-size:12px;line-height:1.35;}

  .actions,.quicknav{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:8px!important;
    margin-top:10px;
    overflow:visible!important;
    padding-bottom:0!important;
  }
  .btn,button,.quicknav a,.command-list a{
    min-height:40px;
    border-radius:12px;
    padding:9px 12px;
    font-size:13px;
    line-height:1.15;
    white-space:normal;
    text-align:center;
  }
  .actions .btn,.actions button,.quicknav a{flex:1 1 auto;}

  .tablewrap{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    border-radius:16px;
    margin-top:12px;
    background:#fff;
    box-shadow:inset 0 -1px 0 rgba(226,232,240,.8);
  }
  .tablewrap:before{
    content:"Arraste para o lado para ver mais";
    display:block;
    padding:9px 11px;
    color:#64748b;
    font-size:11px;
    font-weight:800;
    background:#f8fafc;
    border-bottom:1px solid #e2e8f0;
  }
  table{min-width:720px;font-size:13px;}
  th,td{padding:10px 11px;vertical-align:middle;}
  th{font-size:10px;}
  td small{font-size:11px;}
  .tablewrap .btn,.tablewrap button{
    min-height:32px;
    padding:6px 9px;
    margin:2px;
    border-radius:10px;
    font-size:11px;
  }

  .invoice-head{
    display:grid!important;
    grid-template-columns:auto 1fr;
    gap:12px;
    align-items:center;
    padding:18px!important;
  }
  .invoice-head img{width:56px!important;height:56px!important;border-radius:14px;}
  .invoice-body{padding:16px!important;}
  .invoice-boxes{grid-template-columns:1fr!important;gap:10px!important;}
  .invoice-box{padding:12px;border-radius:14px;}
  .invoice-box b{font-size:16px;word-break:break-word;}

  .client-hero,.hero-saas,.premium-hero,.pay-hero{padding:18px!important;}
  .client-hero h2,.hero-saas h2,.premium-hero h2,.pay-hero h2{font-size:26px!important;line-height:1.05;}
  .hero-saas,.premium-hero,.pay-hero,.pay-grid,.premium-grid,.insight-grid{grid-template-columns:1fr!important;display:grid;gap:14px;}
  .hero-card,.score-ring{margin-top:4px;}
  .hero-card b{font-size:34px;}
  .score-ring{width:150px!important;height:150px!important;justify-self:center;}
  .score-ring b{font-size:34px!important;}

  .filterbar,.status-grid,.mini-bars{grid-template-columns:1fr!important;gap:10px!important;}
  .command-list{gap:8px;}
  .command-list a{justify-content:center;}
  .alert,.notice{font-size:13px;line-height:1.4;border-radius:13px;padding:11px 12px;}
  .qrbox{padding:14px;border-radius:18px;}
  .qrbox img{max-width:260px!important;width:100%;height:auto;}
  .copybox{font-size:13px;line-height:1.45;}
}

@media (max-width: 620px){
  .main{padding:12px 10px 22px!important;}
  .mobilebar{padding:9px 11px;}
  .mobilebar b{font-size:14px;}
  .grid{grid-template-columns:1fr!important;}
  .stat{min-height:96px;}
  .panel,.quick{padding:14px!important;border-radius:16px!important;}
  .topbar h1{font-size:22px!important;}
  .userpill{display:grid;grid-template-columns:1fr auto;}
  .actions,.quicknav{display:grid!important;grid-template-columns:1fr;}
  .actions .btn,.actions button,.quicknav a,.btn,button{width:100%;}
  .panel-head{display:block!important;}
  .panel-head .btn{margin-top:10px;width:100%;}
  .tablewrap{margin-left:-2px;margin-right:-2px;width:calc(100% + 4px);}
  table{min-width:660px;}
  .invoice-head{grid-template-columns:1fr!important;text-align:left;}
  .invoice-head img{margin-bottom:4px;}
  .invoice-body{padding:14px!important;}
  .client-hero h2,.hero-saas h2,.premium-hero h2,.pay-hero h2{font-size:24px!important;}
  .hero-saas,.premium-hero{padding:17px!important;}
  .auth-page{padding:12px!important;}
  .loginbox.auth-form{width:100%!important;}
}

@media (max-width: 390px){
  .main{padding-left:8px!important;padding-right:8px!important;}
  .panel,.quick{padding:12px!important;}
  .topbar h1{font-size:20px!important;}
  .btn,button,.quicknav a{font-size:12px;padding:8px 10px;}
  table{min-width:620px;}
}
