
/* Betoni TKD UI enhancements - V9
   Camada leve acima do Tailwind compilado. Foca em consistência, desktop/mobile e estados vazios. */
:root{
  --bt-brand-navy:#0B2C4D;
  --bt-brand-red:#C81E2A;
  --bt-brand-blue:#123D68;
  --bt-brand-gold:#F59E0B;
  --bt-surface:#ffffff;
  --bt-surface-soft:#f8fafc;
  --bt-border:#e2e8f0;
  --bt-text:#0f172a;
  --bt-muted:#64748b;
  --bt-radius:1rem;
  --bt-radius-lg:1.35rem;
  --bt-shadow:0 18px 45px -32px rgba(15,23,42,.65);
}

/* Botões padronizados para novas telas e para páginas que não usam classes consistentes. */
.btn-primary,.bt-btn-primary{
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  min-height:2.55rem;padding:.62rem 1rem;border-radius:.85rem;
  background:linear-gradient(135deg,var(--bt-brand-navy),var(--bt-brand-blue));
  color:#fff;font-weight:800;border:1px solid rgba(11,44,77,.28);
  box-shadow:0 12px 24px -18px rgba(11,44,77,.72);
  text-decoration:none;transition:transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn-primary:hover,.bt-btn-primary:hover{transform:translateY(-1px);box-shadow:0 16px 28px -20px rgba(11,44,77,.86);}
.btn-secondary,.bt-btn-secondary{
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  min-height:2.55rem;padding:.62rem 1rem;border-radius:.85rem;
  background:#fff;color:var(--bt-text);font-weight:800;border:1px solid var(--bt-border);
  box-shadow:0 10px 22px -20px rgba(15,23,42,.55);text-decoration:none;
}
.btn-danger,.bt-btn-danger{
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  min-height:2.55rem;padding:.62rem 1rem;border-radius:.85rem;
  background:linear-gradient(135deg,var(--bt-brand-red),#991b1b);
  color:#fff;font-weight:800;border:1px solid rgba(200,30,42,.35);text-decoration:none;
}
.btn-muted,.bt-btn-muted{
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  min-height:2.55rem;padding:.62rem 1rem;border-radius:.85rem;
  background:#f8fafc;color:#334155;font-weight:800;border:1px solid var(--bt-border);text-decoration:none;
}
.bt-btn-icon{width:2.65rem;min-width:2.65rem;padding:0;}

/* Cards, títulos e empty states reutilizáveis. */
.bt-empty-state{
  display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;
  gap:.55rem;padding:2rem 1rem;border:1px dashed #cbd5e1;border-radius:1.25rem;
  background:rgba(248,250,252,.88);color:#475569;
}
.bt-empty-state__icon{width:3rem;height:3rem;display:grid;place-items:center;border-radius:999px;background:#fff;border:1px solid var(--bt-border);font-size:1.35rem;}
.bt-empty-state__title{font-weight:900;color:var(--bt-text);font-size:1rem;}
.bt-empty-state__text{font-size:.9rem;max-width:42rem;line-height:1.55;}

/* Tabelas grandes: leitura melhor no desktop, rolagem segura no mobile. */
.bt-table-wrap,.overflow-x-auto{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}
table.bt-enhanced-table, main#main-content table{border-collapse:separate;border-spacing:0;}
@media (min-width:768px){
  main#main-content thead th{position:sticky;top:0;z-index:1;background:#f8fafc;}
}
main#main-content tbody tr{transition:background .12s ease;}
main#main-content tbody tr:hover td{background:rgba(248,250,252,.82);}

/* Flash/toast: mais claro e sem ocupar muito espaço. */
.flash-card{position:relative;}
.flash-card[data-auto-dismiss="true"]{padding-right:2.55rem;}
.bt-toast-close{
  position:absolute;right:.65rem;top:.55rem;width:1.75rem;height:1.75rem;
  display:grid;place-items:center;border-radius:.65rem;border:1px solid rgba(15,23,42,.08);
  background:rgba(255,255,255,.62);font-weight:900;line-height:1;color:inherit;
}
.bt-toast-close:hover{background:#fff;}

/* Acessibilidade e alvos de toque. */
@media (max-width:640px){
  a[href],button,[role="button"],input[type="submit"],input[type="button"],summary,label[for]{min-height:44px;}
  main#main-content .bt-btn-primary,
  main#main-content .bt-btn-secondary,
  main#main-content .bt-btn-danger,
  main#main-content .bt-btn-muted{width:100%;}
}

/* Corrige layouts que ficam muito largos em telas intermediárias. */
main#main-content .max-w-\[1600px\],
main#main-content .max-w-\[1500px\],
main#main-content .max-w-\[1400px\]{width:100%;}

/* Skeleton leve opcional para áreas que carregam dados por JS. */
.bt-skeleton{position:relative;overflow:hidden;background:#e2e8f0;border-radius:.9rem;min-height:2.75rem;}
.bt-skeleton::after{content:"";position:absolute;inset:0;transform:translateX(-100%);background:linear-gradient(90deg,transparent,rgba(255,255,255,.7),transparent);animation:btSkeleton 1.2s infinite;}
@keyframes btSkeleton{100%{transform:translateX(100%);}}

/* Página Saúde do Sistema */
.system-status-ok{background:#ecfdf5;color:#047857;border-color:#a7f3d0;}
.system-status-warn{background:#fffbeb;color:#b45309;border-color:#fde68a;}
.system-status-error{background:#fef2f2;color:#b91c1c;border-color:#fecaca;}


/* =====================================================================
   Betoni TKD V10 - Padronização completa de UI
   Botões, feedback, acessibilidade, tabelas, formulários e logs.
   ===================================================================== */
:root{
  --bt-success:#047857;
  --bt-success-soft:#ecfdf5;
  --bt-warning:#b45309;
  --bt-warning-soft:#fffbeb;
  --bt-danger:#b91c1c;
  --bt-danger-soft:#fef2f2;
  --bt-focus:rgba(200,30,42,.58);
}

.btn-primary,.bt-btn-primary,
[data-bt-button].bt-action-primary{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:.5rem!important;
  min-height:2.7rem!important;padding:.68rem 1rem!important;border-radius:.9rem!important;
  background:linear-gradient(135deg,var(--bt-brand-navy),var(--bt-brand-blue))!important;
  color:#fff!important;font-weight:850!important;border:1px solid rgba(11,44,77,.32)!important;
  box-shadow:0 14px 28px -20px rgba(11,44,77,.88)!important;text-decoration:none!important;
  transition:transform .15s ease,box-shadow .15s ease,opacity .15s ease,filter .15s ease!important;
}
.btn-secondary,.bt-btn-secondary,
[data-bt-button].bt-action-secondary{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:.5rem!important;
  min-height:2.7rem!important;padding:.68rem 1rem!important;border-radius:.9rem!important;
  background:#fff!important;color:var(--bt-text)!important;font-weight:800!important;border:1px solid var(--bt-border)!important;
  box-shadow:0 12px 24px -22px rgba(15,23,42,.65)!important;text-decoration:none!important;
  transition:transform .15s ease,box-shadow .15s ease,background .15s ease!important;
}
.btn-danger,.bt-btn-danger,
[data-bt-button].bt-action-danger{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:.5rem!important;
  min-height:2.7rem!important;padding:.68rem 1rem!important;border-radius:.9rem!important;
  background:linear-gradient(135deg,var(--bt-brand-red),#991b1b)!important;
  color:#fff!important;font-weight:850!important;border:1px solid rgba(200,30,42,.38)!important;
  box-shadow:0 14px 28px -20px rgba(153,27,27,.88)!important;text-decoration:none!important;
}
.btn-success,.bt-btn-success,
[data-bt-button].bt-action-success{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:.5rem!important;
  min-height:2.7rem!important;padding:.68rem 1rem!important;border-radius:.9rem!important;
  background:linear-gradient(135deg,#059669,#047857)!important;
  color:#fff!important;font-weight:850!important;border:1px solid rgba(4,120,87,.35)!important;
  box-shadow:0 14px 28px -20px rgba(4,120,87,.85)!important;text-decoration:none!important;
}
.btn-warning,.bt-btn-warning,
[data-bt-button].bt-action-warning{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:.5rem!important;
  min-height:2.7rem!important;padding:.68rem 1rem!important;border-radius:.9rem!important;
  background:linear-gradient(135deg,#f59e0b,#b45309)!important;
  color:#fff!important;font-weight:850!important;border:1px solid rgba(180,83,9,.35)!important;
  box-shadow:0 14px 28px -20px rgba(180,83,9,.85)!important;text-decoration:none!important;
}
.btn-muted,.bt-btn-muted,
[data-bt-button].bt-action-muted{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:.5rem!important;
  min-height:2.7rem!important;padding:.68rem 1rem!important;border-radius:.9rem!important;
  background:#f8fafc!important;color:#334155!important;font-weight:800!important;border:1px solid var(--bt-border)!important;
  box-shadow:none!important;text-decoration:none!important;
}
.btn-icon,.bt-btn-icon,[data-bt-button].bt-action-icon{
  width:2.75rem!important;min-width:2.75rem!important;max-width:2.75rem!important;padding:0!important;
}
.btn-full-mobile,.bt-btn-full-mobile{width:auto!important;}
[data-bt-button]:hover:not(:disabled):not([aria-disabled="true"]){transform:translateY(-1px)!important;filter:saturate(1.03)!important;}
[data-bt-button]:active:not(:disabled):not([aria-disabled="true"]){transform:translateY(0)!important;}
[data-bt-button]:disabled,[data-bt-button][aria-disabled="true"],button:disabled,input[type="submit"]:disabled{
  opacity:.58!important;cursor:not-allowed!important;filter:grayscale(.18)!important;transform:none!important;
}

/* Campos e labels mais claros. */
main#main-content :where(input:not([type='checkbox']):not([type='radio']):not([type='file']),select,textarea){
  background:#fff!important;color:#0f172a!important;border-color:#cbd5e1!important;
}
main#main-content :where(input,select,textarea)[aria-invalid="true"]{
  border-color:#ef4444!important;box-shadow:0 0 0 4px rgba(239,68,68,.12)!important;
}
.bt-field-error{margin-top:.35rem;color:#b91c1c;font-size:.82rem;font-weight:700;}
.bt-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;}

/* Toasts globais criados pelo JS. */
#bt-toast-region{position:fixed;z-index:99990;top:1rem;right:1rem;display:flex;flex-direction:column;gap:.6rem;width:min(92vw,25rem);pointer-events:none;}
.bt-toast{pointer-events:auto;display:flex;gap:.75rem;align-items:flex-start;padding:.85rem .95rem;border-radius:1rem;border:1px solid #e2e8f0;background:#fff;color:#0f172a;box-shadow:0 18px 44px -30px rgba(15,23,42,.85);animation:btToastIn .18s ease-out both;}
.bt-toast__icon{width:1.8rem;height:1.8rem;display:grid;place-items:center;border-radius:999px;flex:0 0 auto;background:#f1f5f9;}
.bt-toast__body{min-width:0;flex:1;}
.bt-toast__title{font-weight:900;font-size:.92rem;line-height:1.2;color:#0f172a;}
.bt-toast__msg{margin-top:.15rem;font-size:.84rem;line-height:1.35;color:#475569;}
.bt-toast__close{width:1.9rem;height:1.9rem;display:grid;place-items:center;border-radius:.7rem;border:1px solid #e2e8f0;background:#fff;font-weight:900;color:#334155;}
.bt-toast--success{border-color:#a7f3d0;background:#f0fdf4;}.bt-toast--success .bt-toast__icon{background:#dcfce7;color:#047857;}
.bt-toast--error,.bt-toast--danger{border-color:#fecaca;background:#fef2f2;}.bt-toast--error .bt-toast__icon,.bt-toast--danger .bt-toast__icon{background:#fee2e2;color:#b91c1c;}
.bt-toast--warning{border-color:#fde68a;background:#fffbeb;}.bt-toast--warning .bt-toast__icon{background:#fef3c7;color:#b45309;}
.bt-toast--info{border-color:#bfdbfe;background:#eff6ff;}.bt-toast--info .bt-toast__icon{background:#dbeafe;color:#1d4ed8;}
@keyframes btToastIn{from{opacity:0;transform:translateY(-8px) scale(.98);}to{opacity:1;transform:translateY(0) scale(1);}}

/* Modais e dialogs com foco/contraste melhores. */
[role="dialog"]{outline:none;}
body.bt-modal-open{overflow:hidden;}

/* Cursores clicáveis e alvos de toque consistentes. */
a[href],button,input[type="submit"],input[type="button"],input[type="checkbox"],input[type="radio"],select,summary,label[for],[role="button"],[data-open-modal],[data-close-modal]{cursor:pointer;}
input:disabled,select:disabled,textarea:disabled,button:disabled{cursor:not-allowed;}

/* Estados vazios e tabela: evita tela parecer quebrada quando não há registros. */
.bt-empty-state{min-height:9rem;}
main#main-content table{width:100%;}
main#main-content :where(.bt-table-wrap,.overflow-x-auto,.overflow-auto){scrollbar-gutter:stable;}
main#main-content :where(thead th){white-space:nowrap;}
main#main-content :where(td,th){vertical-align:middle;}

/* Logs da tela de Saúde do Sistema: garante leitura mesmo com regras globais. */
.bt-system-log-card{background:rgba(255,255,255,.96)!important;}
.bt-system-log-shell{border:1px solid #1e293b!important;background:#020617!important;box-shadow:inset 0 0 0 1px rgba(255,255,255,.04)!important;}
.bt-system-log-viewer{display:block;max-height:420px;overflow:auto;white-space:pre-wrap;word-break:break-word;margin:0;padding:1rem 1.1rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace!important;font-size:13px!important;line-height:1.6!important;color:#f8fafc!important;background:#020617!important;text-shadow:none!important;}
.bt-system-log-viewer *{color:inherit!important;background:transparent!important;}
.bt-system-log-viewer::-webkit-scrollbar{width:10px;height:10px;}.bt-system-log-viewer::-webkit-scrollbar-track{background:#020617;}.bt-system-log-viewer::-webkit-scrollbar-thumb{background:#475569;border-radius:999px;border:2px solid #020617;}.bt-system-log-viewer::-webkit-scrollbar-thumb:hover{background:#64748b;}

/* Ajustes mobile finais. */
@media (max-width:640px){
  #bt-toast-region{top:.75rem;right:.75rem;left:.75rem;width:auto;}
  .btn-full-mobile,.bt-btn-full-mobile,
  main#main-content [data-bt-button]:not(.bt-no-full-mobile),
  main#main-content .btn-primary:not(.bt-no-full-mobile),
  main#main-content .btn-secondary:not(.bt-no-full-mobile),
  main#main-content .btn-danger:not(.bt-no-full-mobile),
  main#main-content .btn-success:not(.bt-no-full-mobile),
  main#main-content .btn-warning:not(.bt-no-full-mobile),
  main#main-content .btn-muted:not(.bt-no-full-mobile){width:100%!important;}
  main#main-content :where(.flex.flex-wrap){gap:.55rem!important;}
  .bt-toast{border-radius:.9rem;}
}
