:root {
    /* Color Palette - Premium & Modern */
    --primary-color: #2563eb;
    /* Royal Blue */
    --primary-dark: #1e40af;
    --primary-light: #60a5fa;
    --secondary-color: #10b981;
    /* Emerald Green */
    --accent-color: #f59e0b;
    /* Amber */
    --danger-color: #ef4444;
    /* Red */
    --bg-body: #f3f4f6;
    /* Light Gray Background */
    --bg-white: #ffffff;
    --text-primary: #1f2937;
    /* Dark Gray */
    --text-secondary: #6b7280;
    /* Medium Gray */
    --border-color: #e5e7eb;
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    transition: transform 0.3s ease;
    z-index: 50;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    font-weight: 500;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.nav-item i {
    width: 24px;
    margin-right: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0; /* impede flex item de ultrapassar o container */
}

/* Header */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-search input {
    background-color: var(--bg-body);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    width: 300px;
    font-size: 0.9rem;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* Page Content */
.page-content {
    padding: 2rem;
    max-width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-trend {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.trend-up {
    color: var(--secondary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

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

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

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

.btn-outline:hover {
    background-color: var(--bg-body);
}

/* Utilities */
.text-success {
    color: var(--secondary-color);
}

.text-warning {
    color: var(--accent-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-secondary {
    color: var(--text-secondary);
}

/* ── Forms (global standard) ────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.form-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: .375rem;
}

.form-control {
    width: 100%;
    height: 42px;
    padding: .5rem .875rem;
    font-size: .9rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    /* 0.5rem — padrão do sistema */
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.form-control:disabled,
.form-control[readonly] {
    background: #f9fafb;
    color: var(--text-secondary);
    cursor: not-allowed;
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* ── Seções de formulário de documentos ─────────────────────── */
.doc-form-section {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    /* 0.75rem — igual ao .card */
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.doc-form-section h3 {
    font-size: .875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.doc-info-band {
    border-radius: var(--radius-md);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .84rem;
}

.doc-info-band.green {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.doc-info-band.amber {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.doc-info-band.blue {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.doc-form-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    padding-top: .5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    #mobile-sidebar-toggle {
        display: block !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .doc-form-section {
        padding: 1rem;
    }

    .form-control {
        font-size: .875rem;
    }
}