:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e2a3a;
    --sidebar-text: #c9d4e0;
    --sidebar-active: #4a9eff;
    --topbar-height: 52px;
    --content-bg: #f4f6f9;
}

* { box-sizing: border-box; }

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--content-bg); }

/* ── Auth ───────────────────────────────────────────────────── */
.auth-body { background: linear-gradient(135deg, #1e2a3a 0%, #2d4a7a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.auth-card { background: #fff; border-radius: 12px; padding: 2.5rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo i { font-size: 3rem; color: #f59e0b; }
.auth-logo h4 { margin: .5rem 0 0; color: #1e2a3a; font-weight: 700; }

/* ── App wrapper ────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; transition: transform .25s ease; }
.sidebar-header { padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo { display: flex; align-items: center; gap: .6rem; font-size: 1rem; font-weight: 700; color: #fff; }
.sidebar-logo i { font-size: 1.4rem; }
.sidebar-menu { padding: .75rem 0; flex: 1; }
.sidebar-menu a { display: flex; align-items: center; gap: .6rem; padding: .6rem 1.25rem; color: var(--sidebar-text); text-decoration: none; font-size: .875rem; transition: background .15s, color .15s; }
.sidebar-menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-menu a.active { background: rgba(74,158,255,.15); color: var(--sidebar-active); font-weight: 600; border-right: 3px solid var(--sidebar-active); }
.sidebar-menu a i { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,.08); margin: .5rem 1rem; }
.sidebar-empresa-header { display: flex; align-items: center; gap: .35rem; margin-top: .5rem; color: var(--sidebar-active); font-size: .75rem; font-weight: 600; }
.sidebar-empresa-header i { font-size: .85rem; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.user-info { display: flex; align-items: center; gap: .6rem; }
.user-info > i { font-size: 1.5rem; opacity: .7; }
.user-perfil { color: #f59e0b; font-weight: 600; }


/* ── Main content ───────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--topbar-height); background: #fff; border-bottom: 1px solid #e5e9f0; position: sticky; top: 0; z-index: 50; padding: 0 1.5rem; }
.content-area { padding: 1.5rem; flex: 1; }

/* ── Page header ────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem; }
.page-title { font-size: 1.4rem; font-weight: 700; color: #1e2a3a; margin: 0; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card { background: #fff; border-radius: 10px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); border-left: 4px solid #e5e9f0; }
.stat-icon { font-size: 2rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .8rem; color: #6c757d; margin-top: .1rem; }

/* ── Cards ──────────────────────────────────────────────────── */
.card { border: 1px solid #e5e9f0; box-shadow: 0 1px 4px rgba(0,0,0,.05); border-radius: 10px; }
.card-header { background: #fafbfc; border-bottom: 1px solid #e5e9f0; }

/* ── Flash messages ─────────────────────────────────────────── */
#flash-container { position: fixed; top: 70px; right: 1.5rem; z-index: 1060; max-width: 400px; }
#flash-container .alert { animation: slideIn .3s ease; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Footer copyright ───────────────────────────────────────── */
.content-footer { padding: .75rem 1.5rem; font-size: .75rem; color: #adb5bd; border-top: 1px solid #e5e9f0; text-align: center; }
.auth-copyright { margin-top: 1.5rem; font-size: .72rem; color: rgba(255,255,255,.4); text-align: center; }

/* ── Responsive ─────────────────────────────────────────────── */
/* ── Logo no topo do menu (chip branco para contraste no fundo escuro) ── */
.sidebar-logo-link { display: block; width: 100%; line-height: 0; }
.sidebar-logo-img { display: block; width: 100%; max-width: 190px; height: auto; }

/* ── Título da página na barra superior (no lugar do breadcrumb) ── */
.topbar-title { font-weight: 600; color: #1e2a3a; font-size: .95rem; }

/* ── Menu recolhível no desktop (botão do topo) ── */
.main-content { transition: margin-left .25s ease; }
.app-wrapper.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.app-wrapper.sidebar-collapsed .main-content { margin-left: 0; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}
