/* NEXXO · Premium UX · UX-06 · Acabamento das telas internas.
   Projeto (cabeçalho, abas, cartões, tabelas, formulários), Relatórios, Configurações, paginação e modais.
   Só apresentação: nenhum fluxo ou regra depende deste arquivo.
   As regras gerais usam :where() (especificidade baixa) e exclusões explícitas para não alterar o Painel,
   a Carteira, a Central de Alertas e a tela Todos, já homologados. */

/* Cabeçalho do projeto */
.proj-back{margin-bottom:12px}
.proj-back .btn{min-height:44px;display:inline-flex;align-items:center;color:var(--sub);background:transparent;border-color:transparent;padding-inline:6px 12px}
.proj-back .btn:hover{color:var(--text);background:var(--raised);border-color:var(--line)}
.proj-identity .actions{display:flex;flex-wrap:wrap;gap:8px}
.proj-identity .actions .btn{min-height:44px}

/* Cartões, títulos e estados vazios */
.main-shell .c-head:not(.alert-screen .c-head){gap:12px;margin-bottom:14px}
.main-shell .c-head:not(.alert-screen .c-head) h2{font-size:16px;font-weight:650;letter-spacing:-.01em}
.main-shell .c-head:not(.alert-screen .c-head) p{font-size:12.5px;line-height:1.45}
.main-shell .c-head>.btn,.main-shell .c-head>.link{flex:none}
.main-shell .empty:not(.dx-empty):not(.alert-screen .empty){padding:24px 16px;border:1px dashed var(--line2);border-radius:var(--r);font-size:13.5px;line-height:1.5}
.main-shell .empty:not(.dx-empty):not(.alert-screen .empty) strong{font-size:14.5px;font-weight:650;margin-bottom:3px}

/* Formulários */
.main-shell .field input,.main-shell .field select,.modal .field input,.modal .field select{min-height:44px}
.main-shell .field textarea,.modal .field textarea{min-height:96px;line-height:1.45}
.main-shell .field label,.modal .field label{font-size:12.5px;font-weight:600;line-height:1.3}
.report-filter select,.report-filter input{min-height:44px}

/* Botões: altura confortável no computador (no toque, 44 px mais abaixo) */
:where(.main-shell .content .btn:not(.alert-readall)){min-height:40px}
:where(.main-shell .content .btn.sm){min-height:36px;display:inline-flex;align-items:center;justify-content:center}

/* Ligações de cartão ("Ver marcos", "Editar fluxos") e seletores de segmento */
:where(.main-shell .content .link:not(.dx-more)){display:inline-flex;align-items:center;min-height:36px}
:where(.main-shell .content .seg:not(.alert-groups):not(.hub-mode)){max-width:100%;flex-wrap:wrap}
:where(.main-shell .content .seg:not(.alert-groups):not(.hub-mode)) button{flex:1 1 auto;cursor:pointer}

/* Cronograma: em colunas estreitas rola dentro do próprio cartão, sem alargar a página */
.project-grid>*{min-width:0}
.project-grid>.card:has(>.gantt-head){overflow-x:auto}

/* Tabelas */
.main-shell .table td .btn.sm{min-height:36px;display:inline-flex;align-items:center}
.main-shell .table td .btn.sm+.btn.sm{margin-left:6px}
.main-shell .projcell{display:inline-flex;align-items:center;min-height:36px}

/* Paginação: alvos adequados em todas as telas que paginam */
.pagination .pager-controls{gap:6px}
.pagination .pager-controls button{display:inline-grid;place-items:center;min-width:40px;height:40px;cursor:pointer}
.proj-back .btn:focus-visible{outline:2px solid var(--mint);outline-offset:2px}

/* Modais: mesmo cabeçalho das folhas, com fechar */
.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.modal-head h2{margin:4px 0 0;min-width:0;overflow-wrap:anywhere}
.modal .modal-foot .btn{min-height:44px;min-width:104px}
/* As ações do formulário ficam sempre à vista, mesmo em telas baixas */
.modalwrap:not(.sheetwrap) .modal{padding-bottom:0}
.modalwrap:not(.sheetwrap) .modal-foot{position:sticky;bottom:0;z-index:1;padding-bottom:18px;background:var(--card)}

@media(max-width:900px){
  /* Toque: botões, ligações e controles com pelo menos 44 px */
  :where(.main-shell .content) .btn,:where(.main-shell .content) .btn.sm{min-height:44px}
  :where(.main-shell .content) .btn.sm{padding-inline:12px}
  .main-shell .table td .btn.sm{min-height:44px}
  :where(.main-shell .content) .link{min-height:44px;padding-inline:4px}
  :where(.main-shell .content) .seg button{min-height:44px;min-width:44px}
  .main-shell .projcell{min-height:44px}
  .main-shell .c-head{align-items:center}
  .pagination .pager-controls button{min-width:44px;height:44px}
}
@media(max-width:620px){
  /* Cabeçalho do projeto: relatório em destaque, as duas ações de registro lado a lado */
  .proj-identity .actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  .proj-identity .actions .btn{min-width:0;justify-content:center;white-space:normal;line-height:1.25;padding-inline:8px}
  .proj-identity .actions .exec-cta{grid-column:1/-1}
  .main-shell .c-head{flex-wrap:wrap}
  /* Modal como folha: ocupa a largura, sobe de baixo e mantém as ações à vista */
  .modalwrap:not(.sheetwrap){align-items:flex-end;padding:0}
  .modalwrap:not(.sheetwrap) .modal{width:100%;max-height:92dvh;border-radius:18px 18px 0 0;border-bottom:0;padding:18px 18px 0}
  .modalwrap:not(.sheetwrap) .modal-foot{margin:18px -18px 0;padding:12px 18px max(12px,env(safe-area-inset-bottom))}
  .modalwrap:not(.sheetwrap) .modal-foot .btn{flex:1 1 0}
}
@media(max-width:620px){
  /* Tabelas no celular: cada linha vira uma ficha com rótulo e valor; nada fica cortado na horizontal */
  .table-scroll:has(>.table-stack){overflow:visible;background:none}
  .table-stack,.table-stack tbody{display:block;width:100%;min-width:0}
  .table-stack thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .table-stack tr{display:grid;grid-template-columns:minmax(0,1fr);row-gap:7px;padding:14px 2px;border-bottom:1px solid var(--line)}
  .table-stack tr:last-child{border-bottom:0}
  .table.table-stack td,.table.table-stack td:has(>.projcell),.table.table-stack td:has(>.projcell)+td,.table.table-stack td:has(>.meta){width:auto;min-width:0;max-width:none}
  .table-stack td{display:flex;align-items:baseline;justify-content:space-between;gap:16px;min-width:0;padding:0;border:0;background:transparent;text-align:right;overflow-wrap:anywhere}
  .table-stack td[data-label]::before{content:attr(data-label);flex:none;max-width:45%;text-align:left;font-size:11px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--sub)}
  .table-stack td:first-child{display:block;text-align:left;font-size:14.5px;font-weight:650;line-height:1.35}
  .table-stack td:first-child[data-label]::before{display:block;max-width:none;margin-bottom:3px}
  .table-stack td:first-child>.projcell{text-align:left;justify-content:flex-start}
  .table-stack td>.projcell{text-align:right;justify-content:flex-end}
  .table-stack td:not([data-label]){justify-content:flex-start;flex-wrap:wrap;gap:8px;margin-top:3px}
  .table-stack td:not([data-label]):empty{display:none}
  .table-stack td:not([data-label]) .btn.sm{flex:0 1 auto;margin-left:0}
  .table-stack tr.alert-target{background:var(--blue-soft);border-radius:10px;padding-inline:10px}
  .table-stack tr.alert-target>td{background:transparent}
}
@media(max-width:400px){
  /* Paginação estreita: a indicação da página sobe e os quatro botões ficam em uma linha */
  .pagination .pager-controls{flex-wrap:wrap;justify-content:center;margin-inline:auto}
  .pagination .page-count{order:-1;flex-basis:100%;text-align:center;margin-bottom:4px}
}
@media print{.proj-back,.modal-head .sheet-close{display:none}}
