/* ============================================================
   SISTEMA DE PRODUÇÃO - ESTILOS MODULARES (OTIMIZADO TABLET)
   ============================================================ */

/* ========== CSS VARIABLES ========== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;

    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-hover: #f8fafc;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

    --transition: all 0.2s ease;
    --transition-fast: all 0.15s ease;
}

/* ============================================================
   DARK MODE — Tema escuro completo do sistema
   ============================================================ */

/* ── Transição suave ao trocar tema ── */
*,
*::before,
*::after {
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        color 0.1s ease,
        box-shadow 0.25s ease;
}

/* ── Tema escuro: redefine todas as variáveis do :root ── */
[data-theme="dark"] {

    /* Cores de ação — permanecem vibrantes */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #a78bfa;

    /* Fundos */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --bg-hover: #263347;

    /* Textos */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    /* Bordas */
    --border-color: #334155;

    /* Sombras — mais intensas no escuro */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
}

/* ── Correções pontuais que CSS variables não cobrem ── */

/* Inputs: fundo branco hardcoded no :focus */
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
    background: var(--bg-card);
}

/* Inputs: cor do texto */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .filter-group select,
[data-theme="dark"] .filter-group input {
    color: var(--text-primary);
    color-scheme: dark;
}

/* Badges de nível no modo escuro */
[data-theme="dark"] .user-badge.admin {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

[data-theme="dark"] .user-badge.lider {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

[data-theme="dark"] .user-badge.operador {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

/* Status badges */
[data-theme="dark"] .status-badge.green {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

[data-theme="dark"] .status-badge.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

[data-theme="dark"] .status-badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

[data-theme="dark"] .status-badge.gray {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

/* Badges genéricos */
[data-theme="dark"] .badge-primary {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

[data-theme="dark"] .badge-secondary {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

/* Tabela: th fica escuro */
[data-theme="dark"] .table th {
    background: var(--bg-hover);
}

/* Modal backdrop */
[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.7);
}

/* Nav tab ativo */
[data-theme="dark"] .nav-tab.active {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Notificações toast */
[data-theme="dark"] .toast-msg {
    background: #1e293b;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast-text {
    color: #e2e8f0;
}

/* ── CORREÇÃO: Contraste dos números e textos no modo escuro ── */

/* Tabela: textos e números com alto contraste */
[data-theme="dark"] .table td {
    color: #e2e8f0 !important;
    /* Cinza muito claro */
    font-weight: 500;
}

[data-theme="dark"] .table th {
    color: #94a3b8 !important;
    font-weight: 600;
}

/* Números específicos - META, PRODUÇÃO, SALDO */
[data-theme="dark"] .table td strong,
[data-theme="dark"] .table td b {
    color: #f1f5f9 !important;
    /* Branco quase puro */
    font-weight: 700;
}

/* Saldo positivo (verde mais claro) */
[data-theme="dark"] .saldo-positive {
    color: #6ee7b7 !important;
    /* Verde claro vibrante */
    font-weight: 700;
}

/* Saldo negativo (vermelho mais claro) */
[data-theme="dark"] .saldo-negative {
    color: #fca5a5 !important;
    /* Vermelho claro vibrante */
    font-weight: 700;
}

/* Badges de alerta/porcentagem */
[data-theme="dark"] .badge,
[data-theme="dark"] .op-badge {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Badges coloridos - ajustes para modo escuro */
[data-theme="dark"] .badge-primary {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .badge-secondary {
    background: rgba(245, 158, 11, 0.25) !important;
    color: #fcd34d !important;
}

/* Valores numéricos em geral */
[data-theme="dark"] .stat-value,
[data-theme="dark"] .func-stat .value {
    color: #f8fafc !important;
    /* Branco */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Labels e textos secundários */
[data-theme="dark"] .stat-label,
[data-theme="dark"] .func-stat .label {
    color: #cbd5e1 !important;
    /* Cinza claro */
}

/* Inputs e selects - texto visível */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    color: #f1f5f9 !important;
    background: #1e293b !important;
    border-color: #475569 !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b !important;
}

/* Cards e containers */
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
}

/* Hover nas linhas da tabela */
[data-theme="dark"] .table tbody tr:hover td {
    background: #334155 !important;
    color: #f8fafc !important;
}

/* Botões de ação */
[data-theme="dark"] .btn-small {
    color: #e2e8f0 !important;
}

/* Ajustes específicos para números grandes */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] .hd-title {
    color: #f8fafc !important;
}

/* Subtítulos */
[data-theme="dark"] .hd-subtitle,
[data-theme="dark"] p {
    color: #cbd5e1 !important;
}

/* body base */
[data-theme="dark"] body {
    background: var(--bg-main);
    color: var(--text-primary);
}


/* ========== RESET ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== APP CONTAINER ========== */
#app {
    min-height: 100vh;
}

/* ── Variáveis extras de tema ──────────────────────────────── */
:root {
    --lp-grad-a: #1e3a5f;
    --lp-grad-b: #0f2340;
    --lp-card-bg: #ffffff;
    --lp-card-border: rgba(255, 255, 255, 0.6);
    --lp-input-bg: #f8fafc;
    --lp-input-border: #e2e8f0;
    --lp-input-focus: #2563eb;
    --lp-text: #1e293b;
    --lp-text-sub: #64748b;
    --lp-text-muted: #94a3b8;
    --lp-btn: #2563eb;
    --lp-btn-hover: #1d4ed8;
    --lp-logo-a: #2563eb;
    --lp-logo-b: #7c3aed;
    --lp-footer: rgba(255, 255, 255, 0.55);
    --lp-theme-bg: rgba(255, 255, 255, 0.12);
    --lp-theme-color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] {
    --lp-grad-a: #0a0f1e;
    --lp-grad-b: #060c18;
    --lp-card-bg: #111827;
    --lp-card-border: rgba(255, 255, 255, 0.06);
    --lp-input-bg: #0d1424;
    --lp-input-border: #1e2d45;
    --lp-input-focus: #3b82f6;
    --lp-text: #f1f5f9;
    --lp-text-sub: #94a3b8;
    --lp-text-muted: #475569;
    --lp-btn: #2563eb;
    --lp-btn-hover: #1d4ed8;
    --lp-logo-a: #3b82f6;
    --lp-logo-b: #8b5cf6;
    --lp-footer: rgba(255, 255, 255, 0.3);
    --lp-theme-bg: rgba(255, 255, 255, 0.06);
    --lp-theme-color: rgba(255, 255, 255, 0.6);
}

/* ── Wrapper da página ─────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.lp-bg {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(37, 99, 235, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(124, 58, 237, 0.2) 0%, transparent 55%),
        linear-gradient(160deg, var(--lp-grad-a) 0%, var(--lp-grad-b) 100%);
    position: relative;
    overflow: hidden;
}

/* Padrão de pontos sutil no fundo */
.lp-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* ── Toggle de tema ────────────────────────────────────────── */
.lp-theme-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--lp-theme-bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    color: var(--lp-theme-color);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    z-index: 50;
}

.lp-theme-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.lp-theme-icon {
    display: flex;
    align-items: center;
}

/* Esconde o ícone inativo */
[data-theme="light"] .lp-icon-sun,
[data-theme="dark"] .lp-icon-moon {
    display: none;
}

/* ── Card ──────────────────────────────────────────────────── */
.lp-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--lp-card-bg);
    border: 1px solid var(--lp-card-border);
    border-radius: 20px;
    padding: 40px 36px 32px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 24px 48px -12px rgba(0, 0, 0, 0.45),
        0 8px 16px -4px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: lp-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes lp-rise {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Cabeçalho ─────────────────────────────────────────────── */
.lp-header {
    text-align: center;
    margin-bottom: 32px;
}

.lp-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--lp-logo-a), var(--lp-logo-b));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.4);
    position: relative;
    overflow: hidden;
}

/* Brilho interno no logo */
.lp-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, transparent 60%);
}

.lp-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--lp-text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.lp-subtitle {
    font-size: 13px;
    color: var(--lp-text-sub);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Formulário ────────────────────────────────────────────── */
.lp-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lp-field {
    margin-bottom: 18px;
}

.lp-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--lp-text);
    margin-bottom: 7px;
}

.lp-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.lp-input-icon {
    position: absolute;
    left: 13px;
    color: var(--lp-text-muted);
    pointer-events: none;
    transition: color 0.2s;
    flex-shrink: 0;
}

.lp-input {
    width: 100%;
    padding: 11px 42px 11px 40px;
    background: var(--lp-input-bg);
    border: 2px solid var(--lp-input-border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--lp-text);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.lp-input::placeholder {
    color: var(--lp-text-muted);
}

.lp-input:hover {
    border-color: #94a3b8;
}

.lp-input:focus {
    border-color: var(--lp-input-focus);
    background: var(--lp-card-bg);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.lp-input:focus~.lp-input-icon,
.lp-input-wrap:focus-within .lp-input-icon {
    color: var(--lp-input-focus);
}

/* Botão olho */
.lp-eye-btn {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--lp-text-muted);
    border-radius: 6px;
    transition: color 0.2s;
}

.lp-eye-btn:hover {
    color: var(--lp-text);
}

/* ── Botão de submit ───────────────────────────────────────── */
.lp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: 13px;
    background: var(--lp-btn);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.35);
}

.lp-btn:hover:not(:disabled) {
    background: var(--lp-btn-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.45);
}

.lp-btn:active:not(:disabled) {
    transform: translateY(0);
}

.lp-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.lp-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lp-spin 0.75s linear infinite;
    flex-shrink: 0;
}

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

/* ── Rodapé interno do card ────────────────────────────────── */
.lp-card-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--lp-input-border);
    font-size: 12px;
    color: var(--lp-text-muted);
}

.lp-card-footer strong {
    color: var(--lp-text-sub);
}

/* ── Rodapé abaixo do card ─────────────────────────────────── */
.lp-page-footer {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    font-size: 12px;
    color: var(--lp-footer);
    text-align: center;
}

/* ── Responsivo ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .lp-card {
        padding: 28px 22px 24px;
        border-radius: 16px;
    }

    .lp-title {
        font-size: 19px;
    }

    .lp-theme-btn {
        top: 12px;
        right: 12px;
        padding: 7px 11px;
        font-size: 12px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background: var(--bg-hover);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

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

.form-row.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--border-radius-sm);
    margin-top: 8px;
}

.summary-item {
    text-align: center;
}

.summary-item span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.summary-item strong {
    font-size: 18px;
    color: var(--text-primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

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

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

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

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
}

.btn-small svg {
    width: 16px;
    height: 16px;
}

/* ========== HEADER ========== */
.header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.logo svg {
    width: 22px;
    height: 22px;
    color: white;
}

.page-title {
    display: flex;
    flex-direction: column;
}

.page-title h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-title span {
    font-size: 12px;
    color: var(--text-muted);
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    background: none;
    border: none;
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.header-center {
    flex: 1;
    text-align: center;
}

.current-time {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.user-info span {
    font-weight: 500;
    color: var(--text-primary);
}

.user-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.user-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.user-badge.lider {
    background: #dbeafe;
    color: #1e40af;
}

.user-badge.operador {
    background: #d1fae5;
    color: #065f46;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

/* ========== PAGE HEADER ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.page-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ========== STATUS LEGEND ========== */
.status-legend {
    display: flex;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.green {
    background: var(--success);
}

.status-dot.yellow {
    background: var(--warning);
}

.status-dot.red {
    background: var(--danger);
}

/* ========== STATUS BADGE ========== */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.green {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.yellow {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.red {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.gray {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* ========== FILTER BAR ========== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    background: var(--bg-hover);
    min-width: 150px;
    font-family: inherit;
}

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

.filter-info {
    display: flex;
    gap: 20px;
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
}

.filter-info strong {
    color: var(--text-primary);
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stats-grid.small {
    grid-template-columns: repeat(4, 1fr);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-card.mini {
    padding: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-icon.amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #34d399);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.stat-progress span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card.mt-4 {
    margin-top: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.card-body {
    padding: 24px;
}

/* ========== TABLES ========== */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-hover);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    font-size: 14px;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.table .total-row {
    background: var(--bg-hover);
    font-weight: 600;
}

.table .total-row td {
    border-top: 2px solid var(--border-color);
}

/* ========== EMPLOYEE CELL ========== */
.employee-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.employee-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.employee-name {
    font-weight: 500;
}

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

/* ========== SALDO COLORS ========== */
.saldo-positive {
    color: var(--success);
    font-weight: 600;
}

.saldo-negative {
    color: var(--danger);
    font-weight: 600;
}

/* ========== ACTION BUTTONS ========== */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* ========== CHART CONTAINER ========== */
.chart-container {
    padding: 20px;
    height: 300px;
}

/* ========== FUNCIONARIO HEADER ========== */
.funcionario-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.funcionario-avatar {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}

.funcionario-info {
    flex: 1;
}

.funcionario-info h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

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

.funcionario-stats {
    display: flex;
    gap: 24px;
}

.func-stat {
    text-align: center;
}

.func-stat .label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.func-stat .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========== OPERACOES GRID ========== */
.operacoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 20px;
}

.operacao-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-hover);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
}

.operacao-item .codigo {
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
}

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

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-close:hover {
    background: var(--bg-hover);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-hover);
}

/* ========== NOTIFICATION ========== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--danger);
}

.notification.warning {
    background: var(--warning);
}

.notification.info {
    background: var(--primary);
}

/* ========== NAVIGATION ========== */
.nav-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-hover);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.nav-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ========== UTILITY CLASSES (GLOBAL) ========== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #fef3c7;
    color: #92400e;
}

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

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

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

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

/* ========== RESPONSIVE - TABLET LANDSCAPE (1024px) ========== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== RESPONSIVE - TABLET PORTRAIT (768px) - OTIMIZADO ========== */
@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
    }

    .header-center {
        display: none;
    }

    .user-info span {
        display: none;
    }

    .user-badge {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .status-legend {
        display: none;
    }

    /* MELHORIA TABLET: Filtros lado a lado com wrap */
    .filter-bar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 12px;
    }

    .filter-group {
        flex: 1;
        min-width: 180px;
        /* Garante tamanho mínimo */
    }

    /* MELHORIA TABLET: Botão de filtro ocupa largura total se quebrar */
    .filter-bar .btn {
        flex-basis: 100%;
        margin-top: 4px;
    }

    .filter-info {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }

    /* MELHORIA TABLET: Mantém 2 cards por linha */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid.small {
        grid-template-columns: repeat(2, 1fr);
    }

    .table th,
    .table td {
        padding: 10px 12px;
    }

    .funcionario-header {
        flex-direction: column;
        text-align: center;
    }

    .funcionario-stats {
        justify-content: center;
    }

    .form-row.two-cols {
        grid-template-columns: 1fr;
    }

    .form-summary {
        grid-template-columns: 1fr;
    }

    .nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .nav-tab {
        white-space: nowrap;
    }
}

/* ========== RESPONSIVE - MOBILE (480px) ========== */
@media (max-width: 480px) {
    .login-card {
        padding: 24px;
    }

    .page-header h2 {
        font-size: 22px;
    }

    .stat-card {
        padding: 16px;
    }

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

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

    .funcionario-avatar {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }

    .func-stat .value {
        font-size: 20px;
    }

    /* MELHORIA MOBILE: Cards e Filtros 1 por linha */
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: 100%;
    }
}