:root {
    --brand: #0d9488;          /* teal — identidade clínica/saúde */
    --brand-dark: #0f766e;
    --bg: #f1f5f9;
    /* Paleta única do menu (horizontal e vertical usam as MESMAS cores) */
    --nav-bg: #0f172a;
    --nav-hover: #1e293b;
    --nav-border: #1e293b;
}

body { background: var(--bg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ── Navbar superior (topnav) ─────────────────────────────── */
.topnav {
    min-height: 52px; background: var(--nav-bg);
    position: fixed; top: 0; left: 0; right: 0; z-index: 1030; padding: 0 .5rem;
}
/* Bootstrap cria .dropdown-backdrop p/ nav fixa — esconde p/ não escurecer a página */
.dropdown-backdrop { display: none !important; }
.topnav-inner { min-height: 52px; gap: .5rem; }
.topnav-brand { padding: 0 .5rem 0 0; flex-shrink: 0; text-decoration: none; }
.topnav-brand:hover { opacity: .85; }
.topnav-logo { height: 36px; width: auto; object-fit: contain; }

.topnav .navbar-collapse { flex-grow: 1; align-items: center; }
.topnav .nav-link {
    color: #94a3b8; padding: .35rem .6rem; border-radius: 6px; font-size: .85rem;
    white-space: nowrap; display: flex; align-items: center; gap: .4rem;
    transition: all .18s; line-height: 1.3;
}
.topnav .nav-link:hover, .topnav .nav-link.active, .topnav .nav-link.show {
    background: var(--nav-hover); color: #f1f5f9;
}
.topnav .nav-link.active { box-shadow: inset 2px 0 0 var(--brand); }
.topnav .nav-link i { font-size: .95rem; flex-shrink: 0; }
.topnav .dropdown-toggle::after { margin-left: .2rem; }

/* Dropdowns dos grupos (Cadastros / Administração) */
.topnav-dropdown-menu {
    background: var(--nav-bg); border: 1px solid var(--nav-hover); border-radius: 8px;
    min-width: 190px; margin-top: 4px !important; padding: 4px;
}
.topnav-dropdown-menu .dropdown-item {
    color: #94a3b8; font-size: .85rem; padding: .45rem .75rem; border-radius: 5px;
    display: flex; align-items: center; gap: .5rem;
}
.topnav-dropdown-menu .dropdown-item:hover,
.topnav-dropdown-menu .dropdown-item.active,
.topnav-dropdown-menu .dropdown-item:focus { background: var(--nav-hover); color: #f1f5f9; }
.topnav-dropdown-menu .dropdown-item i { width: 16px; text-align: center; flex-shrink: 0; }

/* Ações fixas à direita (usuário/sair) — sempre visíveis */
.topnav-actions { flex-shrink: 0; }
.topnav-user-icon { color: #94a3b8; font-size: 1.35rem; flex-shrink: 0; }
.topnav-user-name { font-size: .78rem; color: #e2e8f0; white-space: nowrap; line-height: 1.2; }
.topnav-user-role { font-size: .67rem; color: #64748b; line-height: 1.2; }
.topnav-logout-btn {
    color: #94a3b8; padding: .35rem .5rem; border-radius: 6px; text-decoration: none;
    font-size: 1.1rem; display: flex; align-items: center; transition: color .15s, background .15s;
}
.topnav-logout-btn:hover { color: #ef4444; background: rgba(239,68,68,.08); }
.topnav-toggler { border: none; color: #94a3b8; background: none; font-size: 1.4rem;
    line-height: 1; padding: .2rem .4rem; }
.topnav-toggler:focus { box-shadow: none; }

.main-content { margin-top: 52px; padding: 1.5rem 2rem; min-height: calc(100vh - 52px); }

@media (max-width: 991.98px) {
    .topnav .navbar-collapse {
        background: var(--nav-bg); padding: .5rem; border-top: 1px solid var(--nav-hover);
        margin: 0 -.5rem; max-height: 80vh; overflow-y: auto;
    }
    .topnav .navbar-nav .nav-link { padding: .55rem .75rem; }
    .topnav-dropdown-menu { background: var(--nav-bg); border-color: var(--nav-hover); }
    .main-content { padding: 1rem; }
}

/* ── Sidebar (layout vertical opcional) ───────────────────── */
.sidebar {
    width: 240px; height: 100vh; background: var(--nav-bg);
    position: fixed; top: 0; left: 0; z-index: 1030;
    display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-brand {
    padding: .85rem 1rem; border-bottom: 1px solid var(--nav-hover); text-decoration: none;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-brand:hover { opacity: .85; }
.sidebar-logo { max-width: 180px; max-height: 46px; height: auto; object-fit: contain; }
.sidebar > ul.nav {
    flex: 1 1 0; overflow-y: auto; overflow-x: hidden; min-height: 0; flex-wrap: nowrap;
    scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.sidebar > ul.nav::-webkit-scrollbar { width: 4px; }
.sidebar > ul.nav::-webkit-scrollbar-track { background: transparent; }
.sidebar > ul.nav::-webkit-scrollbar-thumb { background-color: #334155; border-radius: 4px; }
.sidebar .nav-link {
    color: #94a3b8; padding: .6rem 1rem; border-radius: 6px; margin: 2px 8px;
    font-size: .88rem; transition: all .18s; display: flex; align-items: center; gap: .5rem;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active { background: var(--nav-hover); color: #f1f5f9; }
.sidebar .nav-link.active { box-shadow: inset 3px 0 0 var(--brand); }
.sidebar .nav-link i { width: 18px; text-align: center; font-size: 1rem; }
.sidebar .collapse .nav-link {
    font-size: .84rem; padding: .45rem .75rem; margin: 1px 8px 1px 16px; gap: .4rem;
}
.sidebar .nav-link-collapse::after {
    content: ''; display: inline-block; width: .5rem; height: .5rem; margin-left: auto;
    border-right: 2px solid #94a3b8; border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg); transition: transform .2s;
}
.sidebar .nav-link-collapse[aria-expanded="true"]::after { transform: rotate(-135deg); }
.sidebar-footer { flex-shrink: 0; border-top: 1px solid var(--nav-hover); padding: .75rem 1rem; }
.sidebar-footer-inner { display: flex; align-items: center; gap: .6rem; }
.sidebar-user-icon { color: #94a3b8; font-size: 1.5rem; flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .8rem; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .7rem; color: #64748b; }
.sidebar-logout-btn {
    color: #94a3b8; font-size: 1.1rem; padding: .35rem .5rem; border-radius: 6px;
    text-decoration: none; display: flex; align-items: center; transition: color .15s, background .15s;
}
.sidebar-logout-btn:hover { color: #ef4444; background: rgba(239,68,68,.08); }
.sidebar-mobile-toggle { position: fixed; top: .5rem; left: .5rem; z-index: 1040; }

/* main-content quando o layout é sidebar */
.main-content.layout-sidebar { margin-top: 0; margin-left: 240px; min-height: 100vh; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.show { transform: translateX(0); }
    .main-content.layout-sidebar { margin-left: 0; padding: 1rem; }
}

/* Itens de menu ainda não construídos (fase de adaptação) */
.nav-soon { opacity: .55; }
.nav-soon:hover { opacity: .8; }

/* ── Conteúdo / cards ─────────────────────────────────────── */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.topbar h5 { margin: 0; font-weight: 600; }

.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: .65rem; }
.stat-card { padding: 1.1rem 1.25rem; }
.stat-card .num { font-size: 1.8rem; font-weight: 700; }
.stat-card .lbl { color: #64748b; font-size: .85rem; }
.stat-card .ico { font-size: 1.6rem; opacity: .85; }

.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.flash-overlay { position: fixed; top: 1rem; right: 1rem; z-index: 2000; width: 320px; }
.alert-trial-banner, .alert-vencimento-banner {
    background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
    padding: .6rem 1rem; border-radius: .5rem; margin-bottom: 1rem; font-size: .9rem;
}
.alert-vencimento-banner { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ── Login ────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; }
.login-logo { max-width: 200px; max-height: 80px; object-fit: contain; }

/* ── Suspenso ─────────────────────────────────────────────── */
.suspended-wrap { min-height: 100vh; }
.suspended-card { max-width: 440px; }

/* ── Utilidades ───────────────────────────────────────────── */
.icon-3xl { font-size: 3rem; }
