:root {
    --primary: #FF6B00;
    --primary-dark: #E85D00;
    --secondary: #E8088B;
    --accent: #00A859;
    --bg-dark: #0A0E1A;
    --bg-card: #141824;
    --bg-elevated: #1C2131;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A8B8;
    --text-muted: #6B7280;
    --border: #252B3B;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --gradient-primary: linear-gradient(135deg, #FF6B00 0%, #E8088B 100%);
    --gradient-card: linear-gradient(135deg, rgba(255, 107, 0, 0.1) 0%, rgba(232, 8, 139, 0.1) 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* ⭐ Largura do sidebar */
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    
    /* ⭐ CSS Grid para layout sidebar + main */
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas: "sidebar main";
    min-height: 100vh;
}

/* ⭐ Body sem sidebar (landing page) */
body:not(:has(.sidebar)) {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Clash Display', sans-serif;
    font-weight: 600;
    line-height: 1.2;
}

/* ==================== SIDEBAR ==================== */

.sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow: hidden; /* Não overflow no container principal */
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; /* Não encolhe */
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    opacity: 0.8;
}

.nav-menu {
    flex: 1;
    padding: 24px 16px;
    list-style: none;
    overflow-y: auto;
    min-height: 0; /* Importante para flex + overflow funcionar */
}

.nav-menu li {
    margin-bottom: 4px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-menu a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu a.active {
    color: var(--text-primary);
    background: var(--gradient-card);
    box-shadow: var(--shadow-sm);
}

.nav-menu a svg {
    opacity: 0.8;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto; /* Empurra para o final */
    background: var(--bg-card);
    flex-shrink: 0; /* Não encolhe */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.btn-logout {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* ==================== MAIN CONTENT ==================== */

.main-content {
    grid-area: main;  /* ⭐ Define área do grid */
    min-height: 100vh;
    padding: 40px;
    width: 100%;  /* ⭐ Ocupa toda a área do grid */
    max-width: 100%;  /* ⭐ Não ultrapassa */
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ==================== FLASH MESSAGES ==================== */

.flash-messages {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.flash-message {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.flash-danger, .flash-error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.flash-warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.flash-info {
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.1);
}

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.flash-close:hover {
    color: var(--text-primary);
}

/* ==================== HEADER ==================== */

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 36px;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ==================== STATS GRID ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--gradient-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-change {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--error);
}

/* ==================== CARDS ==================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* ==================== FORMS ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.form-label small,
.form-group small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 6px;
    line-height: 1.4;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:hover {
    border-color: rgba(255, 107, 0, 0.3);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.15);
    background: var(--bg-card);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Select */
select.form-control {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FF6B00' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

/* Input number sem setas no Firefox */
input[type="number"].form-control {
    -moz-appearance: textfield;
}

input[type="number"].form-control::-webkit-inner-spin-button,
input[type="number"].form-control::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Input date styling */
input[type="date"].form-control {
    cursor: pointer;
}

/* Checkbox e Radio customizados */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Required indicator */
.form-label.required::after {
    content: " *";
    color: var(--error);
}

/* ==================== TABLE ==================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-elevated);
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px;
    border-top: 1px solid var(--border);
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ==================== BADGES ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.badge-primary {
    background: var(--gradient-card);
    color: var(--primary);
}

/* ==================== MODAL ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    padding: 40px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    padding: 32px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* ==================== LANDING PAGE ==================== */

.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
}

.landing::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.15) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

.landing-content {
    max-width: 1200px;
    width: 100%;
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.landing-hero h1 {
    font-size: 64px;
    margin-bottom: 24px;
    line-height: 1.1;
}

.landing-hero h1 span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero p {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.landing-buttons {
    display: flex;
    gap: 16px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 28px;
    margin-bottom: 32px;
    text-align: center;
}

/* ==================== RESPONSIVE ==================== */

/* Botão Menu Mobile */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #FF6B00, #E8088B);
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.mobile-menu-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 12px 32px rgba(255, 107, 0, 0.4);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Ícone Hamburger Animado */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animação ao abrir */
.mobile-menu-btn.active .hamburger-icon span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.mobile-menu-btn.active .hamburger-icon span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

@media (max-width: 1024px) {
    /* ⭐ Desativa grid no mobile */
    body {
        display: block;
        grid-template-columns: none;
        grid-template-areas: none;
    }
    
    /* Mostra botão mobile */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Mostra overlay */
    .sidebar-overlay {
        display: block;
    }

    /* Sidebar volta para position fixed */
    .sidebar {
        position: fixed;  /* ⭐ Fixed no mobile */
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
        z-index: 200 !important;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Remove margem do conteúdo principal */
    .main-content {
        margin-left: 0;
        padding-top: 80px; /* Espaço para o botão hamburger */
    }
    
    /* Previne scroll do body quando sidebar aberta */
    body.sidebar-open {
        overflow: hidden;
    }
    
    .landing-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .landing-hero h1 {
        font-size: 48px;
    }

    /* Cards de stats em 2 colunas no tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
    .main-content {
        margin-left: 0;
    }
    
    .landing-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .landing-hero h1 {
        font-size: 48px;
    }
}

/* Footer fixo no mobile - sempre visível */
@media (max-width: 768px) {
    .sidebar-footer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: var(--bg-card) !important;
        border-top: 1px solid var(--border) !important;
        padding: 12px 16px !important;
        z-index: 1000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        gap: 12px;
    }
    
    .sidebar-footer .user-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
    
    .sidebar-footer .user-name {
        font-size: 13px !important;
        font-weight: 600 !important;
    }
    
    .sidebar-footer .user-role {
        font-size: 10px !important;
        opacity: 0.7;
    }
    
    .sidebar-footer .btn-logout {
        width: 36px !important;
        height: 36px !important;
        padding: 8px !important;
    }
    
    /* Espaço no main-content para não sobrepor o footer */
    .main-content {
        padding-bottom: 80px !important;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 20px 16px;
        padding-top: 80px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .page-header p {
        font-size: 14px;
    }

    /* Cards menores */
    .card {
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Botões em cards full width */
    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tabelas com scroll horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Formulários em coluna única */
    .form-row {
        flex-direction: column;
    }

    /* Modals ocupam tela toda */
    .modal-content {
        max-width: 100% !important;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        padding: 0 !important; /* ⭐ Remove padding geral */
        display: flex;
        flex-direction: column;
    }
    
    /* Header fixo no topo */
    .modal-content .modal-header {
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
        padding: 24px 20px;
        border-bottom: 1px solid var(--border);
        margin: 0 !important;
    }
    
    /* Formulário com padding */
    .modal-content form {
        padding: 20px;
        flex: 1;
        overflow-y: auto;
    }
    
    /* Garante título visível */
    .modal-content .modal-title,
    .modal-content h2,
    .modal-content h3 {
        margin-top: 0 !important;
        font-size: 20px !important;
    }

    /* Grids de 2 colunas viram 1 coluna */
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    .landing-hero h1 {
        font-size: 32px;
    }

    .landing-hero p {
        font-size: 16px;
    }

    .landing-buttons {
        flex-direction: column;
    }

    .landing-buttons .btn {
        width: 100%;
    }
    
    .flash-messages {
        left: 16px;
        right: 16px;
        top: 80px;
        max-width: none;
    }

    /* Sidebar em tela cheia no mobile */
    .sidebar {
        width: 100%;
        max-width: 320px;
    }

    /* Stat cards menores */
    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 32px;
    }
}

/* ==================== UTILITIES ==================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* ==================== FORM GRID ==================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row > * {
    flex: 1;
    min-width: 200px;
}

/* ==================== BADGES ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.badge-secondary {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
}

.badge-primary {
    background: rgba(255, 107, 0, 0.15);
    color: var(--primary);
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
}

/* ==================== BTN VARIANTS ==================== */

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #DC2626;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-warning:hover {
    background: #D97706;
}

.btn-info {
    background: #3B82F6;
    color: white;
}

.btn-info:hover {
    background: #2563EB;
}

/* ==================== RESPONSIVE EXTRAS ==================== */

@media (max-width: 640px) {
    /* Form grids em coluna única */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row > * {
        min-width: 100%;
    }

    /* Badges menores */
    .badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Botões full width em mobile quando necessário */
    .btn-block-mobile {
        width: 100%;
        justify-content: center;
    }

    /* Esconde em mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Tables - células menores */
    table td, table th {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Inputs maiores para touch */
    .form-control {
        padding: 14px 16px;
        font-size: 16px; /* Previne zoom no iOS */
    }

    select.form-control {
        padding: 14px 16px;
    }
}

/* Mostra apenas em mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 640px) {
    .show-mobile {
        display: block !important;
    }

    .hide-desktop {
        display: none !important;
    }
}

/* ==================== LOADING STATES ==================== */

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== SMOOTH TRANSITIONS ==================== */

* {
    -webkit-tap-highlight-color: transparent;
}

a, button, .btn, .form-control, .card {
    transition: all 0.2s ease;
}

/* Focus states acessíveis */
.form-control:focus,
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.3);
}

/* ==================== SCROLLBAR CUSTOM ==================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== CONTENT GRIDS ==================== */

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.profile-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
}

/* ==================== RESPONSIVE GRID LAYOUTS ==================== */

/* Tablet - 768px */
@media (max-width: 768px) {
    /* Content grids específicos */
    .content-grid,
    .profile-grid,
    .admin-layout {
        grid-template-columns: 1fr !important;
    }

    /* Layouts de grid com valores específicos */
    div[style*="grid-template-columns: 350px"],
    div[style*="grid-template-columns: 300px"],
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Stats grid em 2 colunas */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Page header flex em coluna */
    .page-header[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }

    /* Cards de programa */
    div[style*="minmax(350px, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile - 480px */
@media (max-width: 480px) {
    /* Stats grid em 1 coluna */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Botões de ação em flex wrap */
    div[style*="display: flex"][style*="gap: 12px"] {
        flex-wrap: wrap;
    }

    /* Cartões menores em mobile */
    div[style*="minmax(350px"] {
        grid-template-columns: 1fr !important;
    }

    /* Header da página mais compacto */
    .page-header {
        margin-bottom: 16px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    /* Avatar menor em mobile */
    div[style*="width: 64px"][style*="height: 64px"] {
        width: 48px !important;
        height: 48px !important;
        font-size: 20px !important;
    }

    /* Stat values menores */
    .stat-value {
        font-size: 28px !important;
    }

    /* Cards de estatísticas mais compactos */
    .stat-card {
        padding: 12px;
    }
}

/* ==================== TABLET LANDSCAPE ==================== */

@media (min-width: 769px) and (max-width: 1024px) {
    /* Ajustes para tablet landscape */
    div[style*="grid-template-columns: 350px 1fr"] {
        grid-template-columns: 280px 1fr !important;
    }

    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1.5fr 1fr !important;
    }
}

/* ==================== PRINT STYLES ==================== */

@media print {
    .sidebar,
    .btn,
    .modal {
        display: none !important;
    }

    body {
        display: block;
        background: white;
        color: black;
    }

    .main-content {
        padding: 0;
        margin: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
