:root {
    --primary: #6330BF;
    --primary-light: #7a45d4;
    --secondary: #555;
    --accent: #6330BF;
    --danger: #d32f2f;
    --warning: #E8A020;
    --success: #2e7d32;
    --background: #f0f2f7;
    --card-bg: #ffffff;
    --text-main: #2c2c2c;
    --text-muted: #777;
    --divider: #dde1ef;
    --header-bg: #6330BF;
}

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

body {
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

/* ── LAYOUT STRUCTURE ── */
.app-wrapper {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 64px - 44px);
}

/* ── SIDEBAR ── */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1.5rem;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link svg {
    color: #888;
    transition: color 0.2s;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: var(--primary);
}

.sidebar-link:hover svg {
    color: var(--primary);
}

.sidebar-link.active {
    background: #f0f3ff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-link.active svg {
    color: var(--primary);
}

.sidebar-header {
    padding: 0.5rem 1.5rem 1rem;
    font-size: 10px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── MAIN CONTENT ── */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    background: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--divider);
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 2px 16px rgba(44,58,140,0.07);
}

/* ── BUTTONS ── */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: rgba(45, 58, 140, 0.05);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 11px;
}

/* ── FORMS ── */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid var(--divider);
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── TABLES ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    background: #f8fafc;
    color: var(--secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid var(--divider);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--divider);
    font-size: 13px;
}

tr:hover td {
    background: #fbfcfe;
}

/* ── BADGES ── */
.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-aberta, .status-approved { background: #e8f5e9; color: #2e7d32; }
.status-pendente, .status-pending { background: #fff4e5; color: #e67e22; }
.status-concluida { background: #e3f2fd; color: #1976d2; }
.status-recusada { background: #fee2e2; color: #b91c1c; }
.status-blocked { background: #450a0a; color: #fecaca; }
.status-inactive { background: #f1f5f9; color: #64748b; }
.status-rejected { background: #fee2e2; color: #b91c1c; }

/* ── ALERTS ── */
.flash-messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-warning { background: #fff4e5; color: #663c00; border: 1px solid #ffe0b2; }
.alert-danger { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* ── UTILITIES ── */
.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem; }

a svg {
    pointer-events: none;
}

.auth-card {
    max-width: 460px;
    margin: 4rem auto;
}

/* ── TOOLTIPS ── */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}

[data-tooltip]:after {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
}

[data-tooltip]:hover:after {
    opacity: 1;
    visibility: visible;
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: white;
    width: 480px;
    max-width: 95%;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    transform: translateY(20px);
    transition: all 0.3s;
}

/* ── RESPONSIVE DESIGN ── */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 64px;
        height: calc(100vh - 64px);
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }
    
    .sidebar.mobile-active {
        left: 0;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .auth-card {
        margin: 2rem 1rem;
    }

    .sidebar-toggle {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .container {
        padding: 0;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .modal-card {
        padding: 1.5rem;
    }

    .header-info {
        display: none !important;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    position: fixed;
    top: 64px;
    left: 0;
    width: 100%;
    height: calc(100vh - 64px);
    background: rgba(0,0,0,0.4);
    z-index: 998;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}


.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-icon {
    width: 64px;
    height: 64px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.modal-text {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
    font-size: 14px;
}

/* -- FORM GRIDS -- */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

@media (max-width: 768px) {
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ── COMPONENTES DE LAYOUT (HEADER / FOOTER / BREADCRUMB) ── */
.main-header {
    background: var(--header-bg);
    display: flex;
    align-items: center;
    padding: 0 32px;
    height: 64px;
    position: relative;
    overflow: hidden;
}

.main-header img {
    height: 48px;
    width: auto;
    position: relative;
    z-index: 1;
}

.header-separator {
    width: 1px;
    height: 30px;
    background: rgba(255,255,255,0.35);
    margin: 0 24px;
    position: relative;
    z-index: 1;
}

.header-title {
    color: rgba(255,255,255,0.95);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.1px;
    position: relative;
    z-index: 1;
}

.breadcrumb-container {
    background: #fff;
    border-bottom: 1px solid var(--divider);
    padding: 0 24px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.breadcrumb-path {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.breadcrumb-path a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.breadcrumb-separator {
    color: #aaa;
}

.breadcrumb-current {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.header-user-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-welcome {
    font-size: 12px;
    color: var(--text-muted);
}

.main-footer {
    background: #fff;
    border-top: 1px solid var(--divider);
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #888;
    letter-spacing: 0.2px;
}

.sidebar-support {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid var(--divider);
}

.support-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

.support-email {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

/* ── COMPONENTES DE AUTENTICAÇÃO ── */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    color: var(--primary);
    font-size: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    border-top: 1px solid var(--divider);
    padding-top: 1.5rem;
}

.auth-footer-text {
    font-size: 13px;
    color: var(--text-muted);
}

.auth-footer-link {
    color: var(--primary);
    font-weight: 600;
}

.btn-full {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-federated {
    width: 100%;
    height: 48px;
    background: #ffffff;
    color: #5e5e5e;
    border: 1px solid #8c8c8c;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    gap: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

.auth-divider-container {
    margin: 1.5rem 0;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-divider-line {
    position: absolute;
    width: 100%;
    border: 0;
    border-top: 1px solid var(--divider);
    margin: 0;
    z-index: 0;
}

.auth-divider-text {
    background: #ffffff;
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 12px;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

.forgot-password-link {
    text-align: right;
    margin-top: 5px;
}

.forgot-password-link a {
    font-size: 11px;
    color: var(--secondary);
    font-weight: 500;
}

.captcha-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}
