/* Consulting Flow — 07-responsivo.css · Responsivo (tablet/celular), app instalado (notch) e impressão
   Carregado na ordem 01→07 (ver CF_CSS em app/lib/core.php). Mexa só no arquivo do bloco. */
/* ================= RESPONSIVO ================= */
@media (max-width:1180px){
  .dash-grid .w-7, .dash-grid .w-5, .dash-grid .w-6{grid-column:span 12;}
  .detail-grid{grid-template-columns:minmax(0,1fr);}
  .kv{grid-template-columns:repeat(2, minmax(0,1fr));}
  .mini-strip.cinco, .mini-strip.seis, .kpi-row.seis, .tv-kpis.seis{grid-template-columns:repeat(3, minmax(0,1fr));}
}
@media (max-width:980px){
  .mini-strip, .kpi-row, .mini-strip.cinco, .mini-strip.seis, .kpi-row.seis, .tv-kpis.seis{grid-template-columns:repeat(2, minmax(0,1fr));}
  .mini-strip.cinco > :last-child{grid-column:span 2;} /* 5º cartão ocupa a linha inteira em vez de ficar sozinho pela metade */
  .action-grid, .action-grid.four{grid-template-columns:1fr 1fr;}
  .home-cols{grid-template-columns:1fr;}
  .kanban{grid-template-columns:1fr;}
  .tb-search{min-width:0;}
  .tb-search span, .tb-search kbd{display:none;}
  .tv-kpis{grid-template-columns:repeat(2,1fr);}
}
@media (max-width:767px){
  :root{--top-h:58px;}
  .sidebar{width:var(--sb-w-open); transform:translateX(-100%);}
  html.sb-open .sidebar{transform:none;}
  .sb-brand, .sb-sec, .sb-link span{opacity:1;}
  .sb-link .sb-badge{left:auto; right:12px; top:14px;}
  .main{margin-left:0 !important;}
  .tb-menu{display:flex;}
  .topbar{padding:0 14px; gap:10px;}
  .tb-title p{display:none;}
  .user-btn{padding:3px;} .user-btn .who{display:none;}
  .content{padding:18px 16px 40px;}
  .page-head h2{font-size:20px;}
  .mini-strip{gap:10px; margin:18px 0 22px;}
  .action-grid, .action-grid.four{grid-template-columns:1fr;}
  .action-card{padding:18px;}
  .action-card .aicn{margin-bottom:10px;}
  .form-grid, .form-grid.three, .kv, .inst-grid, .resumo-grid{grid-template-columns:1fr;}
  .search-box{min-width:0; width:100%; margin-left:0; order:-1;}
  .filters:has(.filter-btn){flex-wrap:nowrap;} .filters:has(.filter-btn) .search-box{width:auto; flex:1;}
  .filters{gap:6px;}
  .filters.scroll-x{flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; margin-right:-16px; padding-right:16px;}
  .filters.scroll-x::-webkit-scrollbar{display:none;}
  .auth-card{padding:30px 22px; border-radius:20px;}
  .kpi .val{font-size:19px;}
  .card{padding:16px;}
  .card.card-flush{padding:0;}
  .card-flush .card-pad{padding:16px 16px 4px;}
  .itens-row{grid-template-columns:minmax(0,1fr) 80px 40px;}
  /* linha de documento: nome + botões em cima, tipo/tamanho/data embaixo */
  .file-row{flex-wrap:wrap; row-gap:0;}
  .file-row > span.muted{order:3; flex-basis:100%; white-space:normal; padding-left:28px;}
  .head-actions{width:100%;} .head-actions > .btn, .head-actions > form{flex:1 1 auto;} .head-actions > form .btn{width:100%;}
  .doc-row{grid-template-columns:minmax(0,1fr) 40px;} .doc-row .doc-slot{grid-column:1;}
  .dash-toolbar .period-label{margin-left:0; width:100%;}
  .modal-box{border-radius:16px;}
  /* tabela → cartões */
  table.tbl.cards thead{display:none;}
  table.tbl.cards, table.tbl.cards tbody, table.tbl.cards tr, table.tbl.cards td{display:block; width:100%;}
  table.tbl.cards tr{padding:12px 14px; border-bottom:1px solid var(--line);}
  table.tbl.cards tr:last-child{border-bottom:none;}
  table.tbl.cards tbody td{border:none; padding:3px 0; display:flex; justify-content:space-between; gap:12px; text-align:right; font-size:12.5px;}
  table.tbl.cards tbody td::before{content:attr(data-l); font-size:11px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.4px; text-align:left; flex-shrink:0;}
  table.tbl.cards tbody td.td-main{display:block; text-align:left; padding-bottom:6px; font-size:13.5px;}
  table.tbl.cards tbody td.td-main::before{display:none;}
  table.tbl.cards tbody td.actions{justify-content:flex-end;}
  table.tbl.cards tbody td.actions::before{display:none;}
  table.tbl.cards tbody td.sel-col{position:absolute; right:14px; top:12px; width:auto !important; padding:0 !important;}
  table.tbl.cards tbody td.sel-col::before{display:none;}
  table.tbl.cards tr{position:relative;}
  table.tbl.cards .st-env{align-items:flex-end;}
  table.tbl.cards td[colspan]{display:block; text-align:center;}
  table.tbl.cards td[colspan]::before{display:none;}
  .tv-top{padding:12px 16px; gap:10px;} .tv-clinic, .tv-brand, .tv-clock small{display:none;} .tv-title{font-size:15px; text-align:left;} .tv-clock{font-size:17px;}
  #tvFull{display:none;} .tv-ctrl{gap:4px;} .tv-ctrl button, .tv-ctrl a{width:32px; height:32px;}
  .tv-bar{padding:14px 16px 0;} .tv-status{margin-left:0; width:100%;} .tv-main{padding:12px 16px 28px;} .tv .card{padding:16px;}
  .tv-kpis{grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px;} .tv-kpi{padding:14px;} .resumo-grid{grid-template-columns:1fr;}
}
/* tablet: tabela de Cadastros (Convênios tem 7 colunas) — botões Editar/Desativar descem um sob o outro em vez de passar do card */
@media (min-width:768px) and (max-width:900px){ .cad-tbl td.actions{white-space:normal;} }
/* tablet/notebook: lista de Processos (10 colunas) — títulos e SLA quebram linha para rolar o mínimo dentro do card (.table-wrap) */
@media (min-width:768px) and (max-width:1279px){ .proc-tbl thead th, .proc-tbl .sla{white-space:normal;} }
/* ================= APP INSTALADO: respeita notch, barra de status e bordas da tela ================= */
:root{--sat:env(safe-area-inset-top, 0px); --sab:env(safe-area-inset-bottom, 0px); --sal:env(safe-area-inset-left, 0px); --sar:env(safe-area-inset-right, 0px);}
html, body{max-width:100%; overflow-x:hidden;}
.sidebar{padding-top:var(--sat); padding-bottom:var(--sab); padding-left:var(--sal); width:calc(var(--sb-w) + var(--sal));}
html.sb-open .sidebar{width:calc(var(--sb-w-open) + var(--sal));}
.main{margin-left:calc(var(--sb-w) + var(--sal)); min-height:100dvh;}
@media (min-width:1280px){ html.sb-open .main{margin-left:calc(var(--sb-w-open) + var(--sal));} }
.topbar{height:calc(var(--top-h) + var(--sat)); padding-top:var(--sat); padding-right:max(28px, var(--sar));}
.content{padding-bottom:calc(56px + var(--sab)); padding-right:max(28px, var(--sar));}
.toast-stack{bottom:calc(20px + var(--sab)); right:max(20px, var(--sar));}
.install-banner{bottom:calc(16px + var(--sab));}
.bulk-bar{bottom:calc(12px + var(--sab));}
.auth-wrap{padding:calc(24px + var(--sat)) max(16px, var(--sar)) calc(24px + var(--sab)) max(16px, var(--sal));}
body.has-install-banner .auth-wrap{padding-bottom:calc(130px + var(--sab));}
.modal{padding:calc(16px + var(--sat)) 16px calc(16px + var(--sab));}
.modal-box{max-height:calc(100dvh - 32px - var(--sat) - var(--sab));}
.tv-top{padding-top:calc(14px + var(--sat)); padding-left:max(32px, var(--sal)); padding-right:max(32px, var(--sar));}
.tv-main{padding-bottom:calc(40px + var(--sab)); padding-left:max(32px, var(--sal)); padding-right:max(32px, var(--sar));}
@media (max-width:767px){
  .sidebar{width:calc(var(--sb-w-open) + var(--sal));}
  .main{margin-left:0 !important;}
  .topbar{padding-left:max(14px, var(--sal)); padding-right:max(14px, var(--sar));}
  .content{padding-left:max(16px, var(--sal)); padding-right:max(16px, var(--sar)); padding-bottom:calc(40px + var(--sab));}
  .tv-top{padding-top:calc(12px + var(--sat)); padding-left:max(16px, var(--sal)); padding-right:max(16px, var(--sar));}
  .tv-main{padding-bottom:calc(28px + var(--sab)); padding-left:max(16px, var(--sal)); padding-right:max(16px, var(--sar));}
  .install-banner{flex-wrap:wrap;} .install-banner .acts{width:100%; justify-content:flex-end;}
}

@media print{
  .sidebar, .topbar, .no-print, .toast-stack, .install-banner{display:none !important;}
  .main{margin:0 !important;} .content{padding:0; max-width:none;}
  .card{border:none; padding:0;} body{background:#fff;}
}

/* ---------- v1.3.0 · Leitor ótico da guia ---------- */
.leitor-fonte{display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap;}
.leitor-fonte .btn{height:40px;}
.leitor-status{margin-top:10px; font-size:12.5px; font-weight:600; color:var(--ink-soft); display:flex; gap:8px; align-items:center; min-height:0;}
.leitor-status:empty{display:none;}
.leitor-status.ok{color:var(--ok);} .leitor-status.warn{color:var(--warn);} .leitor-status.busy{color:var(--navy-700);}
.leitor-status .spin{width:14px; height:14px; border:2px solid var(--slate-200); border-top-color:var(--navy-700); border-radius:50%; animation:cfspin .8s linear infinite; flex:none;}
@keyframes cfspin{to{transform:rotate(360deg);}}
.leitor-texto{margin-top:12px; border:1px solid var(--line); border-radius:var(--radius-sm); padding:10px 12px; background:var(--bg);}
.leitor-texto summary{cursor:pointer; font-size:12.5px; font-weight:700; color:var(--navy-800);}
.leitor-texto textarea{font-family:ui-monospace, Consolas, monospace; font-size:11.5px; white-space:pre; overflow:auto;}
.lido{border-color:var(--gold) !important; background:var(--gold-bg) !important;}
@media (prefers-reduced-motion:reduce){ .leitor-status .spin{animation:none;} }
.check small{display:block; color:var(--ink-soft); font-size:12px; font-weight:400;}
.check:has(small){align-items:flex-start;} .check:has(small) input{margin-top:2px;}
@media (max-width:640px){ .leitor-fonte .btn{flex:1 1 100%;} }

/* Avisos do Painel Admin no celular: pop-up vira folha de baixo; faixa sem margem lateral */
@media (max-width:640px){
  .aviso-pop{align-items:flex-end; padding:0;}
  .aviso-pop .modal-box{max-width:none; border-radius:18px 18px 0 0; padding-bottom:env(safe-area-inset-bottom);}
  .aviso-acoes{justify-content:stretch;}
  .aviso-acoes .btn{flex:1; justify-content:center;}
  .aviso-faixa{margin:10px 12px 0;}
}
@media print{.aviso-faixa, .aviso-pop{display:none !important;}}
