﻿/**
 * Design System Global - ERP GinecoLab
 * Paleta unificada slate profissional + teal clinico GinecoLab
 *
 * SaaS branding: brand-tokens.css define --brand-* / --odo-* / --accent / --success
 * tenant-aware. Importado aqui para cobrir 100% das paginas (todas incluem
 * global.css). Tokens --tenant-* injetados via <style id="tenant-brand">.
 */
@import url("base/brand-tokens.css");

/* ===========================
   CSS VARIABLES
   =========================== */
:root {
    /* Primary - cromo da marca (tenant-aware, fallback teal GinecoLab).
       2026-05-22: repontado de slate para a marca para que headers, botoes
       primarios e focus rings sigam a mesma paleta do sidebar (pedido Jayme).
       --brand-primary* vem de base/brand-tokens.css e respeita a cor que cada
       clinica define em /configuracoes_branding (white-label). Os tons -light
       /-lighter ficam neutros de proposito (sao superficies claras). */
    --primary: var(--brand-primary, #FA8072);
    --primary-dark: var(--brand-primary-dark, #E26A5E);
    --primary-darker: var(--brand-primary-darker, #C9544A);
    --primary-light: #f1f5f9;
    --primary-lighter: #f8fafc;
    --primary-hover: var(--brand-primary-dark, #E26A5E);
    --primary-rgb: 250, 128, 114;

    /* Grayscale */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;

    /* Semantic Colors — escala verde unificada (Tailwind green).
       Uso canônico:
         --success         botão/badge principal de sucesso, accent de links
         --success-dark    hover/pressed, detalhes em headers de PDF
         --success-darker  tom mais forte (brand claim), bordas
         --success-emerald shade alternativa (emerald-500) — uso tático quando
                           o design pede um verde mais vibrante (ex.: CTA call).
                           Deve ser usado COM MODERAÇÃO para não criar 2 verdes.
         --success-light   fundos (badge-success), hover suave
         --success-rgb     usado em rgba() para shadows/overlays           */
    /* SALMAO OFICIAL GinecoLab
       Tom de marca unico. Mudar APENAS aqui propaga para todo o ERP. */
    --success:          #FBB5AC; /* salmao pastel GinecoLab: principal */
    --success-dark:     #FA8072; /* salmao: texto sobre fundo claro */
    --success-darker:   #E26A5E; /* variante mais escura para alta legibilidade */
    --success-emerald:  #FBB5AC; /* alias: sem 2 tons diferentes */
    --success-light:    #FDEDEB; /* salmao clarinho: fundos suaves, zebra */
    --success-lighter:  #FEF6F4; /* salmao quase branco para hover muito sutil */
    --success-rgb:      251, 181, 172;
    /* Aliases canonicos para o salmao oficial: use estes em codigo novo
       para deixar a intencao explicita ("e o salmao do sistema") em vez de
       --success que pode soar generico. */
    --green-accent:     #FBB5AC;
    --green-dark:       #FA8072;
    --green-darker:     #E26A5E;
    --green-light:      #FDEDEB;
    --green-lighter:    #FEF6F4;
    --green-rgb:        251, 181, 172;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-dark: #b91c1c;
    --warning: #ca8a04;
    --warning-light: #fef3c7;
    --warning-dark: #a16207;
    --info: #1e293b;
    --info-light: #f1f5f9;
    --purple: #1E6FB5;
    --purple-light: #f1f5f9;
    --pink: #db2777;
    --pink-light: #fce7f3;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* IMPL-18 — Card padding tokens (uso opcional, garantem consistencia entre cards). */
    --card-header-padding: 14px 16px;
    --card-header-padding-sm: 10px 12px;
    --card-body-padding: 16px;
    --card-body-padding-sm: 12px;

    /* ==========================================================
       DESIGN SYSTEM 2026 — paleta clássica e leve
       Tokens adicionais usados em pacientepg e que devem
       gradualmente substituir os aliases legacy acima.
       Filosofia: neutros slate, accent teal-700, semânticos 700.
       ========================================================== */

    /* Neutros (aliases didáticos para os grays já definidos) */
    --ink:         #0f172a;
    --ink-soft:    #1e293b;
    --text:        #334155;
    --text-muted:  #64748b;
    --text-faint:  #94a3b8;
    --border:      #e2e8f0;
    --border-soft: #f1f5f9;
    --bg:          #f8fafc;
    --bg-soft:     #f1f5f9;
    --surface:     #ffffff;

    /* Accent (salmao GinecoLab — sofisticado) */
    --accent:        #E26A5E;
    --accent-strong: #C9544A;
    --accent-soft:   #FEF6F4;
    --accent-hair:   #FDEDEB;

    /* Semânticos escurecidos (clássicos) */
    --success-text: #8a2f24;
    --success-soft: #FEF6F4;
    --success-hair: #FDEDEB;
    --danger-text:  #7f1d1d;
    --danger-soft:  #fef2f2;
    --danger-hair:  #fecaca;
    --warning-text: #78350f;
    --warning-soft: #fffbeb;
    --warning-hair: #fde68a;

    /* Info em azul naval sóbrio (distinto de --text) */
    --info-2:      #0f172a;
    --info-2-soft: #f8fafc;
    --info-2-hair: #f1f5f9;
    --info-2-text: #0a0f1a;

    /* Cores de marca externa — não devem virar var() genérica */
    --brand-whatsapp: #25D366;
    --brand-whatsapp-dark: #128C7E;
    --brand-google-blue: #4285F4;
    --brand-google-red:  #EA4335;

    /* Focus ring acessível — usar em :focus-visible global */
    --focus-ring: rgba(250, 128, 114, 0.30);
}

/* FOCUS VISIBLE GLOBAL: definicao canonica em :focus-visible no final
   do arquivo (bloco WCAG 2026-04-26). Removido bloco duplicado aqui. */

/* ===========================
   RESET / BASE
   =========================== */
/* Reset universal: box-sizing + zero margin/padding em todos os elementos.
   Consolidado 2026-05-10: removidos 12 duplicatas de pages/*.css. */
*, *::before, *::after {
    box-sizing: border-box;
}
* {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   TYPOGRAPHY
   =========================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

label, .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}

small {
    font-size: 0.75rem;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    line-height: 1.4;
    /* 40px alinha com inputs (mesma altura). Antes: 38px desalinhava 2px em forms. */
    min-height: 40px;
}

/* Hover-lift: NAO aplicar em botoes icon-only/table/mini.
   O translate causa "jump" visual em listas densas (financeiro, pacientes). */
.btn:hover:not(.btn-icon):not(.btn-table):not(.btn-mini):not(.btn-compact) {
    transform: translateY(-1px);
}

.btn:active:not(.btn-icon):not(.btn-table):not(.btn-mini):not(.btn-compact) {
    transform: translateY(0);
}

/* Botoes icon-only: feedback de hover via shadow (sem deslocamento). */
.btn-icon:hover,
.btn-table:hover,
.btn-mini:hover,
.btn-compact:hover {
    box-shadow: 0 0 0 2px var(--lb-card-border); /* tokenizado 2026-05-11 */
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--success-dark);
    box-shadow: 0 4px 12px rgba(134, 201, 140, 0.25);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* Variantes novas — design system 2026 unificado.
   Até então agenda.php, leads.php, financeiro.php definiam inline. */
.btn-info {
    background: var(--info-2);
    color: var(--white);
    border-color: var(--info-2);
}
.btn-info:hover {
    background: var(--info-2-text);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
}

.btn-warning {
    background: #b45309;
    color: var(--white);
    border-color: #b45309;
}
.btn-warning:hover {
    background: var(--warning-text);
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.22);
}

/* .btn-ghost: definicao canonica abaixo (linha ~720). Bloco duplicado removido. */

.btn-light {
    background: var(--white);
    color: var(--text);
    border-color: var(--border);
}
.btn-light:hover {
    background: var(--bg-soft);
}

.btn-whatsapp {
    background: var(--brand-whatsapp-dark);
    color: var(--white);
    border-color: var(--brand-whatsapp-dark);
}
.btn-whatsapp:hover {
    background: var(--brand-whatsapp);
    color: var(--white);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    min-height: 32px;
}

.btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    min-height: 44px;
}

/* ===========================
   CARDS
   =========================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: var(--card-header-padding);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: var(--card-body-padding);
}

/* ===========================
   FORM INPUTS
   =========================== */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
    /* 40px alinha com .btn em forms inline. Antes: 42px causava 2px de desalinhamento. */
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

.form-control:hover,
input:hover,
select:hover,
textarea:hover {
    border-color: var(--gray-300);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

/* ===========================
   TABLES
   =========================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===========================
   BADGES
   =========================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}

.animate-slideIn {
    animation: slideIn 0.3s ease forwards;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    min-width: 280px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.toast-success,
.toast.success {
    border-left-color: var(--success);
}

.toast.toast-error,
.toast.error {
    border-left-color: var(--danger);
}

.toast.toast-warning,
.toast.warning {
    border-left-color: var(--warning);
}

/* Modal active state: consolidado 2026-05-10 (era duplicado em 4-8 pages). */
.modal.active,
.modal-overlay.active {
    display: flex;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.w-full { width: 100%; }
.hidden { display: none; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===========================
   MEDIA QUERIES
   =========================== */
@media (max-width: 1024px) {
    /* Override universal: zera o margin-left:280px que muitas paginas
       definem inline em <style>. body prefix eleva especificidade pra
       (0,1,1) e !important garante prioridade sobre regras locais. */
    body .main-content,
    html .main-content,
    body .main-content.sidebar-collapsed,
    html .adm-page-main {
        margin-left: 0 !important;
        padding-top: 3.5rem !important;
        max-width: 100% !important;
    }
    /* Algumas paginas usam height:100vh + overflow:hidden no html/body
       o que bloqueia scroll quando a sidebar pseudo-fixed empurra o
       conteudo. Forca scroll vertical em mobile. */
    body, html {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh;
    }
}

/* Defesa em camadas: grids inline com 4+ colunas que escapam ao breakpoint
   da pagina sao reduzidos automaticamente. Cobre <div style="grid-template
   -columns:repeat(6,1fr)"> em paginas que esquecem media queries. */
@media (max-width: 768px) {
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: repeat(5"],
    [style*="grid-template-columns:repeat(5"],
    [style*="grid-template-columns: repeat(6"],
    [style*="grid-template-columns:repeat(6"],
    [style*="grid-template-columns: repeat(7"],
    [style*="grid-template-columns:repeat(7"],
    [style*="grid-template-columns: repeat(8"],
    [style*="grid-template-columns:repeat(8"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 480px) {
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 0.75rem;
    }

    .toast-container {
        right: 0.5rem;
        left: 0.5rem;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.875rem;
    }

    .btn {
        min-height: 44px;
        font-size: 0.875rem;
    }

    input, select, textarea {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .toast-container {
        top: 0.5rem;
        right: 0.375rem;
        left: 0.375rem;
    }
}

/* ===========================
   BREADCRUMB (Perfil do Paciente / Prontuário / ...)
   Componente promovido para uso em planoalimentar, prescricoes, agenda, etc.
   =========================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: var(--gray-600);
    flex-wrap: wrap;
}
.breadcrumb .bc-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
    transition: all var(--transition-fast);
}
.breadcrumb .bc-back:hover { background: var(--gray-200); color: var(--gray-900); }
.breadcrumb .bc-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.breadcrumb .bc-link {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}
.breadcrumb .bc-link:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb .bc-sep { color: var(--gray-300); font-weight: 400; }
.breadcrumb .bc-current { color: var(--gray-900); font-weight: 600; }

/* ===========================
   BOTÕES AUXILIARES — .btn-ghost e .btn-icon padronizam variantes espalhadas.
   Substitui gradualmente: .btn-back, .btn-voltar, .btn-outline-light, .bc-back, .tb-back.
   =========================== */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-300); }
.btn-ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
}
.btn-icon:hover { background: var(--gray-200); color: var(--gray-900); }
.btn-icon:active { box-shadow: inset 0 2px 4px var(--lb-divider-strong); transform: translateY(1px); }
.btn-icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 640px) {
    .btn-icon { width: 40px; height: 40px; font-size: 14px; }
}

/* :focus-visible: bloco WCAG 2026-04-26 abaixo cobre todos os seletores
   com !important. Patch intermediario removido para evitar cascata dupla. */


/* ==========================================================
   DESIGN SYSTEM 2026 — Botões canônicos (8 variantes)
   Uso padrão: <button class="btn btn-primary">
   Tamanhos:   .btn-sm | (default) | .btn-lg
   Variantes:  .btn-primary | .btn-secondary | .btn-success
               .btn-danger  | .btn-warning   | .btn-info
               .btn-ghost   | .btn-light
   Classes legacy (btn-compact, btn-mini, btn-pdf, btn-guia,
   btn-wpp, btn-table) permanecem funcionais mas deveriam
   migrar para a composição canônica ao longo do tempo.
   ========================================================== */
.btn-2026 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-normal);
    text-decoration: none;
    user-select: none;
    min-height: 36px;
    white-space: nowrap;
}
.btn-2026:disabled { opacity: 0.55; cursor: not-allowed; }

/* IMPL-19: Disabled state global — fallback consistente para qualquer
   button/input/select/textarea desabilitado sem override proprio. */
button[disabled],
button:disabled,
[role="button"][aria-disabled="true"],
input[disabled],
select[disabled],
textarea[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}
.btn-2026.btn-sm { padding: 6px 10px; font-size: 12px; min-height: 30px; }
.btn-2026.btn-lg { padding: 10px 18px; font-size: 14px; min-height: 44px; }

/* Variantes usando tokens do design 2026 */
.btn-2026.btn-primary   { background: var(--ink); color: #fff; }
.btn-2026.btn-primary:hover:not(:disabled)   { background: var(--ink-soft); }

.btn-2026.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-2026.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--text-muted); }

.btn-2026.btn-success   { background: var(--accent); color: #fff; }
.btn-2026.btn-success:hover:not(:disabled)   { background: var(--accent-strong); }

.btn-2026.btn-danger    { background: #b91c1c; color: #fff; }
.btn-2026.btn-danger:hover:not(:disabled)    { background: var(--danger-text); }

.btn-2026.btn-warning   { background: #b45309; color: #fff; }
.btn-2026.btn-warning:hover:not(:disabled)   { background: var(--warning-text); }

.btn-2026.btn-info      { background: var(--info-2); color: #fff; }
.btn-2026.btn-info:hover:not(:disabled)      { background: var(--info-2-text); }

.btn-2026.btn-ghost     { background: transparent; color: var(--text); border-color: var(--border); }
.btn-2026.btn-ghost:hover:not(:disabled)     { background: var(--bg-soft); color: var(--ink); }

.btn-2026.btn-light     { background: #fff; color: var(--text); border-color: var(--border); }
.btn-2026.btn-light:hover:not(:disabled)     { background: var(--bg-soft); }

/* Padrão de modal acessível: atributo role="dialog" ganha estilização automática */
[role="dialog"][aria-modal="true"] { isolation: isolate; }
[role="dialog"][aria-modal="true"]:not(.active):not(.show):not(.open) { display: none; }

/* Redução de motion para usuários com preferência do sistema */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================
   WCAG 2.1 AA — guard rails globais (2026-04-26)
   ----------------------------------------------------------
   - focus-visible sempre presente, mesmo em quem zerou outline.
   - Texto verde de marca usa --green-darker (var(--brand-primary-darker), 7.2:1)
     em vez de --green-accent (var(--brand-pastel), 1.7:1).
   - skip-link opcional via .skip-to-content (ver auth_layout).
   ========================================================== */
:focus-visible {
    outline: 2px solid var(--accent, #0f766e) !important;
    outline-offset: 2px !important;
    border-radius: 3px;
}
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent, #0f766e) !important;
    outline-offset: 2px !important;
}

/* Texto pequeno em verde acidentalmente "fraco" — força tom acessível */
.text-success,
.text-green,
.badge-success,
small.success,
.txt-verde {
    color: var(--green-darker, var(--brand-primary-darker)) !important;
}
/* Sobre fundo verde claro, força ink escuro para contraste suficiente */
.bg-success-light,
.badge-success,
.tag-success {
    color: var(--ink, #0f172a);
}

/* Skip link acessível (oculto até receber foco do teclado) */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 8px 12px;
    background: var(--ink);
    color: #fff;
    text-decoration: none;
    border-radius: 0 0 6px 0;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
    left: 0;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==========================================================
   PRINT — Ctrl+P limpo (esconde chrome do app)
   2026-04-27: aplicado globalmente. Páginas que precisam
   imprimir conteúdo específico (PDFs gerados) já tem CSS
   próprio em api/gerar_*.php; este bloco só limpa o ERP web.
   ========================================================== */
@media print {
    .sidebar,
    .sidebar-backdrop,
    .mobile-menu-toggle,
    .patient-header,
    .header-actions,
    .chat-widget,
    #sn-chat-wrap,
    .toast-container,
    .toast,
    .skip-to-content,
    .modal-overlay,
    .floating-action,
    .fab,
    .tabs-container .tab-actions {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .main-content,
    .content-wrap {
        margin-left: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card, .card-body {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
    a[href]::after {
        content: "";
    }
    /* Tabelas sem background colorido */
    table, th, td {
        background: #fff !important;
        color: #000 !important;
    }
}


/* ============================================================
   Dashboard clínico (melhoria 50): cartões de gráfico
   Paleta salmao GinecoLab. Responsivo, contraste AA.
   ============================================================ */
.dashclin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px}
.dashclin-card{background:#fff;border:1px solid var(--border,#e2e8f0);border-radius:14px;padding:16px}
.dashclin-card h3{font-size:.9rem;font-weight:700;color:#8A3830;margin:0 0 12px}
.dashclin-canvas{position:relative;height:200px}
.dashclin-foot{margin-top:10px;font-size:.8rem;color:#64748b;text-align:center}
.dashclin-empty{display:flex;align-items:center;justify-content:center;height:100%;color:#94a3b8;font-size:.85rem;text-align:center;padding:12px}
@media(max-width:768px){.dashclin-grid{grid-template-columns:1fr}}

/* ============================================================
   CABECALHO DE PAGINA CANONICO (2026-05-22)
   ------------------------------------------------------------
   Fonte unica do "page-header-dark" + chips de KPI + card de
   filtros, na paleta da marca (tenant-aware via --primary*,
   fallback teal GinecoLab). Espelha o padrao da pagina de
   referencia activity_report.php, porem em tokens.

   Convencao: rotulos de KPI e titulos de filtro terminam em ":".
   KPIs vazios mostram "0", nunca "-".

   Paginas com <style> inline proprio ainda sobrescrevem estas
   regras (cascata) ate o sweep remover o gradiente slate inline.
   ============================================================ */
.page-header {
    background: linear-gradient(135deg, var(--primary-darker, #8A3830) 0%, var(--primary-dark, #B0473E) 100%);
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb, 201,84,74), .22);
    color: #ffffff;
}
.page-header .header-title h1,
.page-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}
/* 2026-05-24 (sweep visual): subtitle 72% -> 92% (contraste WCAG AA no salmao). */
.page-header .header-subtitle {
    color: rgba(255,255,255,.92);
    font-size: .85rem;
    margin-top: .25rem;
}
/* Chips de KPI compactos no cabecalho */
.header-stats-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: .9rem;
    padding-top: .8rem;
    border-top: 1px solid rgba(255,255,255,.12);
}
.hs-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    padding: 8px 13px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    transition: background .15s, border-color .15s, transform .12s;
}
a.hs-chip:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.28); }
a.hs-chip:active { transform: scale(.97); }
.hs-chip-num {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.hs-chip-num.accent-ok   { color: var(--green-accent, #5FB6C4); }
.hs-chip-num.accent-warn { color: #fbbf24; }
.hs-chip-num.accent-err  { color: #f87171; }
/* 2026-05-24 (sweep visual): chip-label 78% -> 92%, fundo do chip 7% -> 14%
   e borda 14% -> 24% para legibilidade no gradient salmao. */
.hs-chip-label {
    font-size: .65rem;
    font-weight: 600;
    color: rgba(255,255,255,.92);
    text-transform: uppercase;
    letter-spacing: .05em;
}
/* Card de filtros padronizado */
.filters-card {
    background: var(--white, #fff);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.08));
    border: 1px solid var(--border, #e2e8f0);
}
.filters-title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--gray-900, #0f172a);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.filters-title i { color: var(--primary, #FA8072); }
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .875rem;
    margin-bottom: 1rem;
}
.filter-group { display: flex; flex-direction: column; gap: .375rem; }
.filter-label {
    font-weight: 600;
    font-size: .75rem;
    color: var(--gray-700, #334155);
    text-transform: uppercase;
    letter-spacing: .025em;
}
.filters-actions { display: flex; gap: .625rem; flex-wrap: wrap; }
@media (max-width: 768px) {
    .filters-grid { grid-template-columns: 1fr; }
    .page-header { padding: 1rem 1.1rem; }
    .page-header .header-title h1, .page-header h1 { font-size: 1.2rem; }
}
