:root {
    --primary-color: #1a56db;
    --primary-hover: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-main: #f0f4ff;
    --bg-surface: #ffffff;
    --border-color: #e5e7eb;
    --sidebar-width: 250px;
    --header-height: 60px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Compatibilidade com tokens do design_system.md */
    --primary: var(--primary-color);
    --border: var(--border-color);

    /* Sidebar dark theme */
    --sidebar-bg-top: #0f172a;
    --sidebar-bg-bottom: #1e3a8a;
    --sidebar-text: rgba(255,255,255,0.75);
    --sidebar-text-active: #ffffff;
    --sidebar-item-hover: rgba(255,255,255,0.08);
    --sidebar-item-active: rgba(96,165,250,0.15);
    --sidebar-border: rgba(255,255,255,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ══════════════════════════════════════════════
   SIDEBAR — Dark Premium
══════════════════════════════════════════════ */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg-bottom) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s ease;
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
}

/* Linha decorativa animada no topo da sidebar */
.sidebar::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #34d399, #60a5fa);
    background-size: 200% 100%;
    animation: sidebar-shimmer 3s linear infinite;
    flex-shrink: 0;
}

@keyframes sidebar-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Cabeçalho da sidebar ── */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

.logo {
    height: 28px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.menu-toggle-close {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--sidebar-text);
    transition: color 0.2s;
}

.menu-toggle-close:hover {
    color: #ffffff;
}

/* ── Label de seção ── */
.sidebar-section-label {
    padding: 20px 20px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
}

/* ── Menu ── */
.sidebar-menu {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    border-radius: 0;
    transition: background 0.18s, color 0.18s;
    position: relative;
    margin: 2px 10px;
    border-radius: 8px;
}

.menu-item:hover {
    background: var(--sidebar-item-hover);
    color: #ffffff;
}

.menu-item.active {
    background: var(--sidebar-item-active);
    color: var(--sidebar-text-active);
    border: 1px solid rgba(96,165,250,0.25);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #60a5fa;
    border-radius: 0 2px 2px 0;
}

/* Ícone de menu — substituindo emoji por container SVG-ready */
.menu-item .icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255,255,255,0.07);
    flex-shrink: 0;
    transition: background 0.18s;
}

.menu-item:hover .icon,
.menu-item.active .icon {
    background: rgba(96,165,250,0.2);
}

.menu-icon-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: invert(1);
    mix-blend-mode: screen;
    opacity: 0.85;
    transition: opacity 0.18s;
}

.menu-item:hover .menu-icon-img,
.menu-item.active .menu-icon-img {
    opacity: 1;
}

/* ── Rodapé da sidebar ── */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    background: rgba(0,0,0,0.15);
}

.profile-logo {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: contain;
    border: 1.5px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    padding: 2px;
}

.profile-email {
    flex: 1;
    min-width: 0;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.55);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-logout svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.btn-logout:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
    color: #fca5a5;
}

/* ══════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.mobile-header {
    display: none;
    height: var(--header-height);
    background: linear-gradient(135deg, #1a56db, #1e3a8a);
    border-bottom: none;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 12px rgba(26,86,219,0.3);
}

.mobile-header h2 {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 22px;
    margin-right: 15px;
    cursor: pointer;
    color: #ffffff;
}

.content-wrapper {
    padding: 28px 30px;
    flex: 1;
}

/* ══════════════════════════════════════════════
   BUTTONS (Global)
══════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: 0 2px 8px rgba(26,86,219,0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26,86,219,0.35);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: #f3f4f6;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-icon {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 8px;
    font-size: 16px;
}

.btn-icon:hover {
    background: var(--bg-main);
}

/* ══════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════ */

.w-full { width: 100%; }
.mb-4 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════ */

.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(3px);
}

.modal-backdrop.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    position: relative;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    background: #f3f4f6;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: #e5e7eb;
    color: var(--text-main);
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .menu-toggle-close {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-header {
        display: flex;
    }
    .content-wrapper {
        padding: 16px;
    }
}
