/* ============================================================
   VARIÁVEIS - TEMA Lufan (lufan.com.br)
   ============================================================ */
:root {
    --primary: #1B3A5C;
    --primary-dark: #0F2440;
    --primary-light: #2A5A8C;
    --secondary: #E8A530;
    --secondary-light: #F0C060;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #2980b9;
}

[data-tema="claro"] {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1B3A5C;
    --bg-sidebar-hover: #2A5A8C;
    --bg-header: #ffffff;
    --bg-input: #ffffff;
    --bg-table-header: #1B3A5C;
    --bg-table-row: #ffffff;
    --bg-table-row-alt: #f8f9fa;
    --bg-table-hover: #e8f0fe;
    --bg-modal: #ffffff;
    --bg-overlay: rgba(0,0,0,0.5);
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --text-sidebar: #cbd5e0;
    --text-sidebar-active: #ffffff;
    --text-table-header: #ffffff;
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
}

[data-tema="escuro"] {
    --bg-body: #0d1117;
    --bg-card: #161b22;
    --bg-sidebar: #0d1117;
    --bg-sidebar-hover: #1a2332;
    --bg-header: #161b22;
    --bg-input: #0d1117;
    --bg-table-header: #1a2332;
    --bg-table-row: #161b22;
    --bg-table-row-alt: #1a1f26;
    --bg-table-hover: #1e2a3a;
    --bg-modal: #161b22;
    --bg-overlay: rgba(0,0,0,0.7);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-light: #e6edf3;
    --text-sidebar: #8b949e;
    --text-sidebar-active: #ffffff;
    --text-table-header: #e6edf3;
    --border-color: #30363d;
    --border-light: #21262d;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* LOGIN */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 32px; font-weight: 700; color: var(--primary); }
.login-logo span { color: var(--secondary); }
.login-logo p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* FORMS */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.3s;
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.15);
}
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='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* BOTÕES */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    gap: 8px;
    text-decoration: none;
    line-height: 1.4;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-secondary { background: var(--secondary); color: var(--primary-dark); }
.btn-secondary:hover { background: var(--secondary-light); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-cancel { background: var(--border-color); color: var(--text-primary); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }
.btn-icon { padding: 8px 12px; border-radius: 8px; }
.btn-group { display: flex; gap: 6px; }

/* LAYOUT */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}
.sidebar-brand {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand h2 { color: #fff; font-size: 24px; font-weight: 700; }
.sidebar-brand h2 span { color: var(--secondary); }
.sidebar-brand small {
    color: var(--text-sidebar);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-sidebar);
    border-radius: 10px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 14px;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}
.sidebar-nav a.active {
    background: rgba(232, 165, 48, 0.15);
    color: var(--secondary);
}
.sidebar-nav .nav-icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    padding: 20px 16px 8px;
    font-weight: 600;
}
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { display: flex; align-items: center; gap: 12px; color: var(--text-sidebar); font-size: 13px; }
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 14px;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content { flex: 1; margin-left: 260px; min-height: 100vh; }

.top-header {
    background: var(--bg-header);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.top-header h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.top-header-actions { display: flex; align-items: center; gap: 12px; }
.btn-tema {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    transition: all 0.3s;
    text-decoration: none;
}
.btn-tema:hover { border-color: var(--secondary); color: var(--secondary); }
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
}
.page-content { padding: 32px; }

/* CARDS */
.card {
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.card-header h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 24px; }

/* TABELAS */
.table-responsive { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table thead th {
    background: var(--bg-table-header);
    color: var(--text-table-header);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}
table tbody tr { background: var(--bg-table-row); transition: background 0.2s; }
table tbody tr:nth-child(even) { background: var(--bg-table-row-alt); }
table tbody tr:hover { background: var(--bg-table-hover); }

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.badge-aprovado { background: #d4edda; color: #155724; }
.badge-sem-retorno { background: #fff3cd; color: #856404; }
.badge-inviavel { background: #f8d7da; color: #721c24; }
.badge-reprovado { background: #e2e3e5; color: #383d41; }
.badge-desenvolvimento { background: #cce5ff; color: #004085; }
.badge-atrasado { background: #f8d7da; color: #721c24; }
.badge-entregue { background: #d4edda; color: #155724; }

[data-tema="escuro"] .badge-aprovado { background: rgba(39, 174, 96, 0.2); color: #27ae60; }
[data-tema="escuro"] .badge-sem-retorno { background: rgba(243, 156, 18, 0.2); color: #f39c12; }
[data-tema="escuro"] .badge-inviavel { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }
[data-tema="escuro"] .badge-reprovado { background: rgba(149, 165, 166, 0.2); color: #95a5a6; }
[data-tema="escuro"] .badge-desenvolvimento { background: rgba(52, 152, 219, 0.2); color: #3498db; }
[data-tema="escuro"] .badge-atrasado { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }
[data-tema="escuro"] .badge-entregue { background: rgba(39, 174, 96, 0.2); color: #27ae60; }

/* FILTROS */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-bar select {
    padding: 8px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}
.filter-bar select:focus { border-color: var(--primary); }

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-overlay);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-modal);
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
.modal-lg { max-width: 950px; }
@keyframes modalIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ALERTAS */
.alert {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: alertIn 0.4s ease;
}
@keyframes alertIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
[data-tema="escuro"] .alert-success { background: rgba(39, 174, 96, 0.15); color: #27ae60; border-color: rgba(39, 174, 96, 0.3); }
[data-tema="escuro"] .alert-error { background: rgba(231, 76, 60, 0.15); color: #e74c3c; border-color: rgba(231, 76, 60, 0.3); }

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.stat-icon-blue { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.stat-icon-green { background: rgba(39, 174, 96, 0.15); color: #27ae60; }
.stat-icon-yellow { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.stat-icon-red { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.stat-info h4 { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-info p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* CADASTROS */
.cadastros-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cadastro-list { list-style: none; }
.cadastro-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}
.cadastro-list li:last-child { border-bottom: none; }
.cadastro-list .item-nome { font-weight: 500; color: var(--text-primary); }
.inline-form { display: flex; gap: 10px; margin-bottom: 16px; }
.inline-form .form-control { flex: 1; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h4 { font-size: 18px; margin-bottom: 8px; color: var(--text-primary); }

/* MOEDA */
.text-money { font-weight: 600; font-variant-numeric: tabular-nums; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* RESPONSIVO */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .page-content { padding: 16px; }
    .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .cadastros-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .top-header { padding: 12px 16px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }