/**
 * TSI Sistema - Estilos Globais
 * Design System Profissional
 * Versão: 2.0
 */

/* === RESET E BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta Profissional */
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #475569;
    --accent: #0ea5e9;
    --dark: #0f172a;
    --gray-900: #1e293b;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --white: #ffffff;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0284c7;
    --info-light: #e0f2fe;

    /* Sombras refinadas */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Fontes */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
}

/* === DARK THEME === */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --primary-dark: #3b82f6;
    --secondary: #94a3b8;
    --accent: #38bdf8;
    --dark: #f1f5f9;
    --gray-900: #f1f5f9;
    --gray-800: #e2e8f0;
    --gray-700: #cbd5e1;
    --gray-600: #94a3b8;
    --gray-500: #64748b;
    --gray-400: #475569;
    --gray-300: #334155;
    --gray-200: #1e293b;
    --gray-100: #0f172a;
    --gray-50: #020617;
    --white: #0f172a;
    --success: #34d399;
    --success-light: #064e3b;
    --warning: #fbbf24;
    --warning-light: #451a03;
    --danger: #f87171;
    --danger-light: #450a0a;
    --info: #22d3ee;
    --info-light: #083344;

    /* Sombras para dark mode */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
}

body {
    font-family: var(--font-family);
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* === ÍCONES SVG === */
.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* === HEADER === */
.app-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    position: relative;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.brand-content {
    color: white;
}

.header-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: 0.125rem;
    color: white;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-subtitle {
    font-size: var(--font-size-base);
    opacity: 0.8;
    font-weight: 400;
}

.header-logo {
    flex-shrink: 0;
}

.company-logo {
    height: 45px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: opacity var(--transition-base);
}

.company-logo:hover {
    opacity: 0.9;
}

/* === NAVEGAÇÃO === */
.app-nav {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--gray-200);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    gap: 0;
}

.nav-links a {
    padding: 0.875rem 1.25rem;
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.nav-links a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--gray-50);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--gray-700);
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--gray-200);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
}

/* === DROPDOWN DO USUÁRIO === */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    background: transparent;
    border: none;
    color: var(--gray-700);
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.user-dropdown-toggle:hover {
    background: var(--gray-100);
}

.user-dropdown-toggle .icon-chevron {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-base);
}

.user-dropdown.active .icon-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1000;
}

.user-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0.5rem;
}

.user-dropdown-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: var(--font-size-sm);
    margin-bottom: 0.25rem;
}

.user-dropdown-email {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    font-size: var(--font-size-sm);
}

.user-dropdown-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.user-dropdown-item .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-dropdown-item.danger {
    color: var(--danger);
}

.user-dropdown-item.danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

/* === CONTEÚDO PRINCIPAL === */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* === CARDS === */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* === ESTATÍSTICAS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.info .stat-value { color: var(--info); }

/* === ALERTAS E MENSAGENS === */
.alert {
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #fcd34d;
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid #7dd3fc;
}

/* === BOTÕES === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover:not(:disabled) {
    background: #047857;
}

.btn-warning {
    background: var(--warning);
    color: white;
}
.btn-warning:hover:not(:disabled) {
    background: #b45309;
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-info {
    background: var(--info);
    color: white;
}
.btn-info:hover:not(:disabled) {
    background: #0369a1;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 0.5rem;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-900);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
}

.btn-block {
    width: 100%;
}

/* === FORMULÁRIOS === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--white);
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    margin-top: 0.25rem;
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

/* === TABELAS === */
.table-container {
    overflow: auto;
    max-height: 70vh;
}

.table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table th {
    background: var(--gray-50);
    color: var(--gray-700);
    padding: 0.75rem 0.625rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: var(--font-size-xs);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table th.group-header {
    background: var(--primary);
    color: white;
    text-align: center;
}

.data-table td {
    padding: 0.75rem 0.625rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    color: var(--gray-700);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    min-width: 45px;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* === SEÇÕES COLAPSÁVEIS === */
.collapsible {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
}

.collapsible-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-900);
}

.collapsible-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.collapsible-toggle:hover {
    background: var(--gray-100);
}

.collapsible-content {
    padding: 1.5rem;
    max-height: 2000px;
    opacity: 1;
    transition: all var(--transition-slow);
    overflow: hidden;
}

.collapsible-content.collapsed {
    max-height: 0;
    padding: 0 1.5rem;
    opacity: 0;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-500);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--gray-300);
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: var(--font-size-base);
    margin-bottom: 1.5rem;
}

/* === FILTROS === */
.filter-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-900);
}

.filter-content {
    padding: 1.5rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 1.25rem;
}

.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: var(--primary-light);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.filter-tag-remove {
    cursor: pointer;
    opacity: 0.8;
    font-weight: bold;
    margin-left: 0.125rem;
}

.filter-tag-remove:hover {
    opacity: 1;
}

/* === LEGENDA === */
.legend {
    background: var(--white);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-top: 1.5rem;
}

.legend-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.875rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
}

/* === UTILITÁRIOS === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-500); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* === ANIMAÇÕES === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

/* === RESPONSIVIDADE === */

/* Tablets e telas médias */
@media (max-width: 1024px) {
    .header-content {
        padding: 1rem 1.5rem;
    }

    .nav-container {
        padding: 0 1.5rem;
    }

    .main-content {
        padding: 1.25rem 1.5rem;
    }

    .header-title {
        font-size: var(--font-size-xl);
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --font-size-base: 0.8125rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }

    .header-title {
        font-size: var(--font-size-lg);
        justify-content: center;
    }

    .company-logo {
        height: 35px;
    }

    .nav-container {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .nav-links a {
        padding: 0.625rem 0.75rem;
        font-size: var(--font-size-sm);
        border-bottom: none;
        border-radius: var(--radius-md);
    }

    .nav-links a.active {
        background: var(--primary);
        color: white;
    }

    .user-section {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .card-header {
        padding: 0.875rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .filter-header {
        padding: 0.875rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-content {
        padding: 1rem;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .btn {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 0.625rem 1rem;
    }

    .data-table {
        font-size: var(--font-size-xs);
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.375rem;
    }

    .legend-items {
        flex-direction: column;
        gap: 0.75rem;
    }

    .collapsible-header {
        padding: 0.875rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Mobile pequeno */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header-title {
        font-size: var(--font-size-base);
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

/* === GRÁFICOS (Dashboard) === */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* === MÉTRICAS ADICIONAIS (Dashboard) === */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metrics-grid .card {
    transition: all var(--transition-base);
    cursor: default;
}

.metrics-grid .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--gray-900);
}

.chart-container {
    padding: 1.25rem;
    height: 280px;
}

.chart-container.large {
    height: 350px;
}

/* === ATIVIDADES RECENTES === */
.activity-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.activity-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-900);
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: var(--gray-50);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-user {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.375rem;
}

.activity-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.activity-metric {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

/* === STATUS BADGES === */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
}

.status-excellent {
    background: var(--success-light);
    color: var(--success);
}

.status-good {
    background: var(--info-light);
    color: var(--info);
}

.status-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.status-critical {
    background: var(--danger-light);
    color: var(--danger);
}

/* === STAT CHANGE INDICATOR === */
.stat-change {
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-top: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.stat-change.positive {
    background: var(--success-light);
    color: var(--success);
}

.stat-change.negative {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-change.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-change.neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* === RESPONSIVIDADE GRÁFICOS === */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chart-container {
        height: 250px;
        padding: 1rem;
    }

    .chart-header {
        padding: 0.875rem 1rem;
    }

    .activity-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .activity-details {
        gap: 0.5rem;
    }
}

/* === EFEITOS ADICIONAIS === */
.card {
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* === SELEÇÃO === */
::selection {
    background: var(--primary);
    color: #ffffff;
}

/* === SCROLLBAR GLOBAL === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* === BOTÃO DE TOGGLE DE TEMA === */
.theme-toggle-btn {
    background: var(--gray-200);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.625rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    color: var(--gray-700);
    margin-right: 1rem;
}

.theme-toggle-btn:hover {
    background: var(--gray-300);
    transform: scale(1.05);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-toggle-btn .icon {
    width: 20px;
    height: 20px;
}

/* === FOCUS VISIBLE === */
*:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* === IMPRESSÃO === */
@media print {
    .app-nav,
    .filter-section,
    .btn,
    .user-section {
        display: none !important;
    }

    .app-header {
        background: none !important;
        color: var(--dark) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .header-title,
    .header-subtitle {
        color: var(--dark) !important;
    }

    .card,
    .stat-card {
        box-shadow: none !important;
        border: 1px solid var(--gray-300) !important;
    }

    body {
        background: white !important;
    }
}

/* === TRANSIÇÕES DE TEMA === */
.card,
.stat-card,
.metric-card,
.app-header,
.app-nav,
.main-content,
.chart-card,
input,
select,
textarea,
button,
.btn,
.alert {
    transition: background-color var(--transition-base),
                color var(--transition-base),
                border-color var(--transition-base),
                box-shadow var(--transition-base);
}
