/* =====================================================================
   Arkon Saúde - Design System
   Tokens + componentes reutilizáveis. Use estas classes nas telas novas;
   o Tailwind (CDN) continua disponível para layout e ajustes pontuais.
   ===================================================================== */

:root {
    --ark-primary: #2A4B5D;
    --ark-primary-700: #1F3946;
    --ark-primary-50: #E8EDEF;
    --ark-accent: #8DA399;
    --ark-accent-50: #EEF2EF;
    --ark-ink: #2A4B5D;
    --ark-text: #2D3436;
    --ark-muted: #636E72;
    --ark-line: #DFE1D8;
    --ark-bg: #FAFAF8;
    --ark-surface: #ffffff;
    --ark-success: #059669;
    --ark-success-50: #ecfdf5;
    --ark-warning: #d97706;
    --ark-warning-50: #fffbeb;
    --ark-danger: #dc2626;
    --ark-danger-50: #fef2f2;
    --ark-radius: 1rem;
    --ark-radius-sm: .625rem;
    --ark-shadow: 0 1px 2px rgba(42, 75, 93, .04), 0 4px 16px rgba(42, 75, 93, .06);
    --ark-shadow-lg: 0 10px 40px rgba(42, 75, 93, .14);
    --ark-ouro-texto: #556B2F; /* dourado escurecido: texto sobre claro (identidade: docs/IDENTIDADE_VISUAL.md) */
    --ark-bege: #E9EAE0;
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--ark-bg);
    color: var(--ark-text);
    -webkit-tap-highlight-color: transparent;
}
/* O sistema usava itálico em tudo; o padrão agora é texto reto */
.italic { font-style: normal; }
:focus-visible { outline: 2px solid var(--ark-accent); outline-offset: 2px; }

/* ---------- Tipografia ---------- */
.ark-h1 { font-family: 'Lora', Georgia, serif; font-size: 1.95rem; line-height: 1.15; font-weight: 500; color: var(--ark-ink); letter-spacing: -.02em; }
.ark-h2 { font-size: 1.125rem; font-weight: 700; color: var(--ark-ink); }
.ark-sub { color: var(--ark-muted); font-size: .9375rem; margin-top: .25rem; }
.ark-label { display: block; font-size: .75rem; font-weight: 600; color: var(--ark-muted); margin-bottom: .375rem; }
.ark-eyebrow { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ark-ouro-texto); }
@media (min-width: 768px) { .ark-h1 { font-size: 2.3rem; } }

/* ---------- Superfícies ---------- */
.ark-card { background: var(--ark-surface); border: 1px solid var(--ark-line); border-radius: var(--ark-radius); box-shadow: var(--ark-shadow); }
.ark-card-pad { padding: 1.25rem; }
@media (min-width: 768px) { .ark-card-pad { padding: 1.75rem; } }
.ark-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }

/* ---------- Botões ---------- */
.ark-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1.15rem; border-radius: var(--ark-radius-sm);
           font-weight: 600; font-size: .875rem; line-height: 1; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.ark-btn:active { transform: translateY(1px); }
.ark-btn:disabled { opacity: .5; cursor: not-allowed; }
.ark-btn-primary { background: var(--ark-primary); color: #fff; }
.ark-btn-primary:hover { background: var(--ark-primary-700); }
.ark-btn-accent { background: var(--ark-accent); color: #2D3436; }
.ark-btn-ghost { background: var(--ark-surface); color: var(--ark-text); border-color: var(--ark-line); }
.ark-btn-ghost:hover { border-color: var(--ark-primary); color: var(--ark-primary); }
.ark-btn-danger { background: var(--ark-danger-50); color: var(--ark-danger); border-color: #fecaca; }
.ark-btn-danger:hover { background: var(--ark-danger); color: #fff; }
.ark-btn-block { width: 100%; }
.ark-btn-sm { padding: .45rem .75rem; font-size: .8125rem; }

/* ---------- Formulários ---------- */
.ark-input, .ark-select, .ark-textarea {
    width: 100%; background: #fff; border: 1px solid var(--ark-line); border-radius: var(--ark-radius-sm);
    padding: .7rem .9rem; font-size: .9375rem; color: var(--ark-ink); transition: border-color .15s, box-shadow .15s;
}
.ark-input:focus, .ark-select:focus, .ark-textarea:focus { outline: none; border-color: var(--ark-primary); box-shadow: 0 0 0 3px var(--ark-primary-50); }
.ark-textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }
@media (max-width: 768px) { .ark-input, .ark-select, .ark-textarea, input, select, textarea { font-size: 16px; } } /* evita zoom no iPhone */

/* ---------- Badges ---------- */
.ark-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .6875rem; font-weight: 700; white-space: nowrap; }
.ark-badge-primary { background: var(--ark-primary-50); color: var(--ark-primary); }
.ark-badge-success { background: var(--ark-success-50); color: var(--ark-success); }
.ark-badge-warning { background: var(--ark-warning-50); color: var(--ark-warning); }
.ark-badge-danger  { background: var(--ark-danger-50); color: var(--ark-danger); }
.ark-badge-muted   { background: #EFEAE1; color: var(--ark-muted); }

/* ---------- Tabelas ---------- */
.ark-table-wrap { overflow-x: auto; }
.ark-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ark-table th { text-align: left; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ark-muted); padding: .75rem 1rem; background: #FAF8F5; border-bottom: 1px solid var(--ark-line); }
.ark-table td { padding: .9rem 1rem; border-bottom: 1px solid #EFEAE1; vertical-align: middle; }
.ark-table tr:hover td { background: #FBF9F6; }

/* ---------- KPIs ---------- */
.ark-kpi { padding: 1.25rem 1.5rem; }
.ark-kpi-value { font-size: 1.75rem; font-weight: 800; color: var(--ark-ink); letter-spacing: -.02em; margin-top: .25rem; }

/* ---------- Estados: vazio / carregando ---------- */
.ark-empty { text-align: center; padding: 2.5rem 1rem; color: var(--ark-muted); }
.ark-empty i { font-size: 2rem; color: #D9CBB0; margin-bottom: .75rem; display: block; }
.ark-empty-title { font-weight: 700; color: var(--ark-text); }
.ark-skeleton { background: linear-gradient(90deg, #EFEAE1 25%, #FAFAF8 37%, #EFEAE1 63%); background-size: 400% 100%; animation: ark-shimmer 1.2s ease infinite; border-radius: var(--ark-radius-sm); }
@keyframes ark-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Layout (sidebar / topo / navegação mobile) ---------- */
.ark-sidebar { width: 16.5rem; background: var(--ark-ink); color: rgba(247, 245, 242, .82); }
.ark-nav-group { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(233, 223, 201, .62); padding: 1.25rem .9rem .5rem; }
.ark-nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; border-radius: .6rem; font-size: .875rem; font-weight: 500; color: rgba(247, 245, 242, .82); transition: background .15s, color .15s; }
.ark-nav-link i { width: 1.1rem; text-align: center; opacity: .8; }
.ark-nav-link:hover { background: rgba(247, 245, 242, .08); color: #FAFAF8; }
.ark-nav-link.ativo { background: rgba(141, 163, 153, .18); color: #FAFAF8; }
.ark-nav-link.ativo i { color: var(--ark-accent); opacity: 1; }
.ark-topbar { height: 4rem; background: rgba(247, 245, 242, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--ark-line); }
.ark-avatar { width: 2.25rem; height: 2.25rem; border-radius: 999px; background: var(--ark-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8125rem; flex-shrink: 0; }
.ark-bottomnav { height: calc(4rem + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: #FFFFFF; border-top: 1px solid var(--ark-line); }
.ark-bottomnav a, .ark-bottomnav button { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .625rem; font-weight: 600; color: var(--ark-muted); flex: 1; }
.ark-bottomnav i { font-size: 1.15rem; }
.ark-bottomnav .ativo { color: var(--ark-primary); }

/* ---------- Toast ---------- */
.ark-toast-box { position: fixed; z-index: 9999; right: 1rem; top: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: calc(100vw - 2rem); }
.ark-toast { background: var(--ark-ink); color: #fff; padding: .8rem 1rem; border-radius: .75rem; box-shadow: var(--ark-shadow-lg); font-size: .875rem; display: flex; gap: .6rem; align-items: center; animation: ark-in .2s ease; }
.ark-toast.sucesso i { color: #34d399; } .ark-toast.erro i { color: #f87171; } .ark-toast.aviso i { color: #fbbf24; }
@keyframes ark-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- SweetAlert alinhado ao tema ---------- */
.swal2-popup { border-radius: 1.25rem !important; font-family: 'Inter', sans-serif !important; }
.swal2-styled.swal2-confirm { background: var(--ark-primary) !important; border-radius: .625rem !important; }
.swal2-styled { border-radius: .625rem !important; }
/* Formulário longo no SweetAlert: o conteúdo rola e os botões ficam sempre visíveis */
.swal2-html-container { max-height: 60vh; max-height: 60dvh; overflow-y: auto !important; }

/* ---------- Modais das telas (fundo fixed inset-0 z-[100]) ----------
   Nunca maiores que a tela: o cabeçalho (título e X) fica fixo e o corpo rola até o botão de salvar. */
.fixed.inset-0.z-\[100\] { overflow-y: auto; }
.fixed.inset-0.z-\[100\] > div { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); }
.fixed.inset-0.z-\[100\] > div > :first-child { flex-shrink: 0; }
.fixed.inset-0.z-\[100\] > div > :not(:first-child) { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(100,116,139,.3); border-radius: 10px; }
