:root {
    --primary-color: #0056b3; /* Azul América Rental */
    --primary-light: #e6f0fa;
    --success-color: #28a745; /* Verde */
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --text-main: #333333;
    --text-muted: #6c757d;
    --bg-main: #f4f6f9; /* Cinza Fundo */
    --bg-card: #ffffff;
    --border-color: #e0e0e0;
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --radius-md: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

/* Utilities */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.pb-3 { padding-bottom: 1rem; }
.pt-4 { padding-top: 1.5rem; }
.p-0 { padding: 0 !important; }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.text-muted { color: var(--text-muted); }

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.8rem;
}
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: #004494; }
.btn-secondary { background-color: white; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: #f8f9fa; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: #c82333; }
.btn-warning { background-color: var(--warning-color); color: #212529; }
.btn-warning:hover { background-color: #e0a800; }
.btn-block { width: 100%; justify-content: center; }

/* --- New Standardized Button System --- */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.95rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    color: white;
}
.btn-action i { font-size: 0.9rem; }
.btn-action:active { transform: scale(0.96); }
.btn-action:disabled { opacity: 0.7; cursor: wait; transform: none; }

.btn-voltar { background-color: #228be6; } /* Blue */
.btn-voltar:hover { background-color: #1c7ed6; }

.btn-cancelar { background-color: #fa5252; }
.btn-cancelar:hover { background-color: #e03131; }

.btn-parcial { background-color: #f59f00; } /* Yellow */
.btn-parcial:hover { background-color: #e67700; }

.btn-salvar { background-color: var(--success-color); font-size: 0.85rem; padding: 0.5rem 1.2rem; }
.btn-salvar:hover { background-color: #218838; }

.btn-sm { padding: 0.4rem 0.9rem !important; font-size: 0.85rem !important; }

/* Font Editor Toolbar */
.btn-tool {
    background: white;
    border: 1px solid #ddd;
    color: #475569;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-tool:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-tool i { font-size: 1.1rem; }
.btn-sm i { font-size: 1rem !important; }

@keyframes spin { 100% { transform: rotate(360deg); } }
.ph-spin { animation: spin 1s linear infinite; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.span-2 { grid-column: span 2; }
.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.input-group label { font-weight: 500; font-size: 0.9rem; }
.input-group input, .input-group select {
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}
.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* App Layout */
#app-shell {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   DEPARTMENT RAIL SIDEBAR
   ============================================ */
.dept-rail {
    width: 72px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    z-index: 2000;
    box-shadow: 2px 0 8px rgba(0,0,0,0.06);
}

.dept-rail-logo {
    width: 72px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.dept-rail-bottom {
    margin-top: auto;
    padding-bottom: 48px;
}

.dept-item {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.dept-btn {
    width: 60px;
    height: 60px;
    margin: 4px 0;
    border: none;
    border-radius: 14px;
    background: var(--dept-bg);
    color: var(--dept-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.55rem;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    outline: none;
}
.dept-btn i {
    font-size: 1.45rem;
    line-height: 1;
}
.dept-btn:hover, .dept-btn.active {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Submenu panel */
.dept-submenu {
    display: none;
    position: fixed;
    left: 72px;
    top: 0;
    width: 220px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
    z-index: 1999;
    padding: 0 0 120px 0;
    overflow-y: auto;
    animation: slideInLeft 0.18s ease;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.dept-item:hover .dept-submenu,
.dept-item:focus-within .dept-submenu {
    display: block;
}

/* Fecha o submenu imediatamente ao clicar em um item */
.dept-item.submenu-force-close .dept-submenu {
    display: none !important;
}

.dept-submenu-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 2px solid #f1f5f9;
    letter-spacing: 0.01em;
    flex-shrink: 0;
    background: #fafafa;
}

.dept-submenu .nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1.25rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.dept-submenu .nav-item i { font-size: 1.05rem; color: #94a3b8; flex-shrink: 0; }
.dept-submenu .nav-item:hover {
    background: var(--bg-main);
    color: var(--dept-color, var(--primary-color));
    border-left-color: var(--dept-color, #f503c5);
    border-right-color: var(--dept-color, var(--primary-color));
}
.dept-submenu .nav-item:hover i { color: var(--dept-color, var(--primary-color)); }
.dept-submenu .nav-item.active {
    background: var(--dept-bg, var(--primary-light));
    color: var(--dept-color, var(--primary-color));
    border-left-color: var(--dept-color, #f503c5);
    border-right-color: var(--dept-color, var(--primary-color));
    font-weight: 700;
}
.dept-submenu .nav-item.active i { color: var(--dept-color, var(--primary-color)); }

/* ── Grupo aninhado no submenu (ex: Rota Redonda) ─────────────── */
.nav-group { display: flex; flex-direction: column; }

/* Botão de label / toggle */
.nav-group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    user-select: none;
    background: transparent;
    width: 100%;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}
.nav-group-label:hover { 
    background: var(--bg-main); 
    color: var(--dept-color, var(--primary-color));
}
.nav-group-label i { font-size: 1.05rem; color: #94a3b8; transition: var(--transition); }
.nav-group-label i.nav-group-chevron { font-size: 0.85rem; }
.nav-group-label:hover i { color: var(--dept-color, var(--primary-color)); }

/* Seta do acordeão */
.nav-group-chevron {
    font-size: 0.75rem;
    transition: transform 0.22s ease;
    opacity: 0.6;
    flex-shrink: 0;
}
.nav-group.open .nav-group-chevron {
    transform: rotate(90deg);
    opacity: 1;
}

/* Itens: recolhidos por padrão */
.nav-group-items {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease;
    opacity: 0;
}
/* Abertos quando .open */
.nav-group.open .nav-group-items {
    max-height: 200px;
    opacity: 1;
}

/* Item sub-indentado */
.dept-submenu .nav-item.nav-item-sub {
    padding-left: 2.1rem;
    font-size: 0.84rem;
    border-left: 3px solid transparent;
}

/* ── Grupos aninhados (Financeiro > Compras > Frota): o grupo interno so abre quando ele proprio estiver .open ── */
.nav-group .nav-group:not(.open) > .nav-group-items { max-height: 0; opacity: 0; }
.nav-group.open > .nav-group-items.nav-group-items-aninhado { max-height: 420px; }
.nav-group.open .nav-group.open > .nav-group-items { max-height: 260px; opacity: 1; }
.dept-submenu .nav-group-label.nav-group-label-sub { padding-left: 2.1rem; font-size: 0.84rem; }
.dept-submenu .nav-item.nav-item-sub.nav-item-sub2 { padding-left: 3.1rem; }

/* Keep old sidebar references inert */

.sidebar { display: none; }
.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    h2 { font-size: 1.1rem; color: var(--primary-color); font-weight: 700; margin: 0;}
}
.sidebar-nav {
    padding: 1rem 0;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.nav-item i { font-size: 1.25rem; }
.nav-item:hover, .nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.main-wrapper {
    flex: 1;
    margin-left: 72px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.25s ease;
}
.main-wrapper.sidebar-collapsed {
    margin-left: 72px;
}

.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.topbar-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    width: 300px;
}
.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    margin-left: 0.5rem;
    width: 100%;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-info { display: flex; flex-direction: column; align-items: flex-end; }
.user-info span { font-size: 0.9rem; font-weight: 500; line-height: 1.2;}
.badge { background-color: var(--primary-light); color: var(--primary-color); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem !important; margin-top: 2px;}
.user-avatar i { font-size: 2rem; color: var(--text-muted); }

.content-area {
    padding: 1.5rem;
    flex: 1;
}
.page-header {
    position: sticky;
    top: 60px;
    z-index: 99;
    background: var(--bg-main);
    padding: 1.25rem 0;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}
.page-header h2 { font-size: 1.5rem; font-weight: 600; margin: 0; }

/* Views */
.view-section { display: none; }
.view-section.active { display: block; }
.content-view { display: none; }
.content-view.active { display: block; }
/* View Colaboradores usa flex column como layout */
#view-colaboradores.active { display: flex !important; }

/* Novo Formulário 2 Colunas ERP */
.form-layout-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.form-column .card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Status Chips */
.status-chips {
    display: flex;
    gap: 0.75rem;
}
.status-chip {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    border: 1.5px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background-color: #f8fafc;
    color: #64748b;
    opacity: 0.75;
}
.status-chip:hover { opacity: 1; transform: translateY(-1px); }
.status-chip.active { 
    opacity: 1; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-width: 2px;
    transform: translateY(-1px);
}

/* Admissão Stepper */
.admissao-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2.5rem;
    padding: 0 10px;
}
.admissao-progress-line {
    position: absolute;
    top: 18px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: #e2e8f0;
    z-index: 1;
}
.admissao-progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.4s ease;
}
.step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex: 1;
}
.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #94a3b8;
    transition: all 0.3s;
    position: relative;
}
.step-icon .percent {
    position: absolute;
    top: -8px;
    right: -12px;
    background: #94a3b8;
    color: white;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 10px;
    border: 1.5px solid white;
}
/* Comportamento Base Active */
.step-item.active .step-icon { 
    transform: scale(1.1); 
}

/* Cores por Porcentagem no Círculo (Priority) */
.step-item.pc-warning:not(.pc-completed) .step-icon { 
    background: #fef3c7 !important; 
    border-color: #f59e0b !important; 
    color: #b45309 !important; 
}
.step-item.pc-warning .step-icon .percent { background: #f59e0b !important; }

.step-item.pc-success .step-icon { 
    background: #dcfce7 !important; 
    border-color: #10b981 !important; 
    color: #15803d !important; 
}
.step-item.pc-success .step-icon .percent { background: #10b981 !important; }

/* Destaque do Foco (Step Selecionado) */
.step-item.active .step-icon {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Se ativo mas 0%, mantém o azul de borda no círculo branco */
.step-item.active:not(.pc-warning):not(.pc-success) .step-icon {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: #eff6ff !important;
}

.step-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
}
.step-item.active .step-label { color: var(--primary-color); }

.admissao-panel {
    display: none;
    animation: fadeInPanel 0.4s ease;
}
.admissao-panel.active {
    display: block;
}


.checklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}
.checklist-item:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}
.checklist-item div {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.checklist-item .check-icon {
    font-size: 1.4rem;
    color: #cbd5e0;
    transition: all 0.2s;
}
.checklist-item.checked .check-icon {
    color: var(--success-color);
}
.checklist-item input[type="file"] {
    display: none;
}

.checklist-item.checked {
    border-color: var(--success-color);
    background: #f0fdf4;
}

/* Checklist items styles end */
.checklist-item.checked label {
    text-decoration: none;
    color: #475569;
}

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Status Specific Colors (Permanent) - Sync with Dashboard */
.status-chip[data-value="Ativo"] { 
    border-color: #c3e6cb; background-color: #d4edda; color: var(--success-color); 
}
.status-chip[data-value="Férias"] { 
    border-color: #ffeeba; background-color: #fff3cd; color: #856404; /* Mantemos o texto escuro para legibilidade no fundo amarelo */
}
.status-chip[data-value="Afastado"] { 
    border-color: #ffd8a8; background-color: #ffe8cc; color: #d9480f; /* Laranja para Afastados */
}
.status-chip[data-value="Desligado"] { 
    border-color: #f5c6cb; background-color: #f8d7da; color: var(--danger-color); 
}
.status-chip[data-value="Aguardando início"] { 
    border-color: #e2e8f0; background-color: #f1f5f9; color: #64748b; 
}
.status-chip[data-value="Processo iniciado"] { 
    border-color: #d1d9e6; background-color: #e3f2fd; color: #228be6; 
}

/* Active State - Stronger Colors/Borders */
.status-chip.active[data-value="Ativo"] { border-color: var(--success-color); background-color: #d4edda; }
.status-chip.active[data-value="Férias"] { border-color: var(--warning-color); background-color: #fff3cd; }
.status-chip.active[data-value="Afastado"] { border-color: #d9480f; background-color: #ffe8cc; }
.status-chip.active[data-value="Desligado"] { border-color: var(--danger-color); background-color: #f8d7da; }
.status-chip.active[data-value="Aguardando início"] { border-color: #64748b; background-color: #f1f5f9; }
.status-chip.active[data-value="Processo iniciado"] { border-color: #228be6; background-color: #e3f2fd; }

/* Photo Upload */
.photo-upload-container {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Phase 1: New */
#photo-state-new {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: #cccccc;
    color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
    border: 2px dashed #0056b3;
    box-sizing: border-box;
}

/* Phase 2: Saved (Camera) */
#photo-state-saved {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: #0056b3;
    color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    border: 2px solid transparent;
    box-sizing: border-box;
    cursor: pointer;
    transition: var(--transition);
}
#photo-state-saved:hover { background: #004494; }

/* Phase 3: Preview Image */
#colab-foto-preview {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px dashed #0056b3;
    box-sizing: border-box;
    cursor: pointer;
}

/* Listas simples */
.doc-list-simple {
    list-style: none;
    padding: 0;
    margin: 0;
}
.doc-list-simple li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.doc-list-simple li:last-child { border-bottom: none; }

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}
.stat-card { 
    display: flex; 
    align-items: center; 
    gap: 0.6rem; 
    padding: 0.75rem 0.9rem !important;
    border-left: 4px solid #ddd; /* Default fallback */
}
.stat-card i { font-size: 1.5rem; }
.stat-card.primary { border-left-color: var(--primary-color); }
.stat-card.primary i { color: var(--primary-color); }
.stat-card.success { border-left-color: var(--success-color); }
.stat-card.success i { color: var(--success-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.warning i { color: var(--warning-color); }
.stat-card.danger { border-left-color: var(--danger-color); }
.stat-card.danger i { color: var(--danger-color); }
.stat-card.orange { border-left-color: #fc6e06; }
.stat-card.orange i { color: #fc6e06; }
.stat-card.purple { border-left-color: #6f42c1; }
.stat-card.purple i { color: #6f42c1; }
.stat-card.gray { border-left-color: #adb5bd; }
.stat-card.gray i { color: #868e96; }
.stat-info h3 { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin: 0;}
.stat-info p { font-size: 1.1rem; font-weight: 700; margin: 0.1rem 0 0 0; }

/* Table */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-weight: 600; color: var(--text-muted); background-color: var(--bg-main); }
.table tbody tr:hover { background-color: var(--bg-main); }
.status-badge {
    padding: 4px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: 500; display: inline-block;
}
.status-badge.Ativo { background-color: #d4edda; color: var(--success-color); }
.status-badge.Férias { background-color: #fff3cd; color: #856404; }
.status-badge.Afastado { background-color: #ffe8cc; color: #d9480f; }
.status-badge.Desligado { background-color: #f8d7da; color: var(--danger-color); }

/* Prontuário layout */
.prontuario-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

/* Novo Formulário 2 Colunas ERP (Refined) */
.form-layout-erp {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
}

.form-layout-erp > .column-full {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .form-layout-erp {
        grid-template-columns: 1fr;
    }
    .form-layout-erp > .column-full {
        grid-column: span 1;
    }
    .prontuario-layout {
        grid-template-columns: 1fr;
    }
}.prontuario-tabs ul { list-style: none; }
.prontuario-tabs li {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}
.prontuario-tabs li:hover { background-color: var(--bg-main); }
.prontuario-tabs li.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

/* Document Upload Items */
.doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}
.doc-info { display: flex; align-items: center; gap: 1rem; }
.doc-info i { font-size: 1.5rem; color: var(--text-muted); }
.doc-info.has-file i { color: var(--success-color); }
.doc-info h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.doc-info p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.doc-actions { display: flex; gap: 0.5rem; }
.doc-upload-form { display: none; }

/* Login Box */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-color);
}
.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}
.logo-area { text-align: center; margin-bottom: 2rem; }
.logo-area h2 { color: var(--primary-color); font-weight: 700; margin: 0; }
.logo-area p { color: var(--text-muted); font-size: 0.9rem; margin-top: 5px; }
.error-msg { color: var(--danger-color); font-size: 0.9rem; margin-top: 1rem; text-align: center; }

/* Modals */
.modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content {
    background-color: #fff;
    margin: 3% auto;
    padding: 0; 
    border-radius: var(--radius-md);
    width: 600px;
    max-width: 95%;
    position: relative;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    flex-shrink: 0;
}
.modal-content.large { width: 800px; height: 85vh; display: flex; flex-direction: column; }
.modal-content.fullness { 
    width: 100vw; 
    height: 100vh; 
    max-width: 100vw; 
    max-height: 100vh; 
    margin: 0; 
    border-radius: 0; 
}
.modal-content.fullness .modal-body {
    overflow-y: auto;
    background-color: #f4f6f9;
}
.close-modal { position: absolute; right: 1.5rem; top: 1.5rem; font-size: 1.5rem; font-weight: bold; cursor: pointer; line-height: 1; }
.close-modal:hover { color: var(--danger-color); }
#modal-doc-body { flex: 1; background: #eee; border-radius: var(--radius-md); overflow: hidden; display: flex; justify-content: center; align-items: center; }
#modal-doc-body iframe, #modal-doc-body img { width: 100%; height: 100%; border: none; object-fit: contain; }
.probation-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
}

/* 4. Opcionais Refined Layout (Exactly like Image) */
.opcionais-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reduced gap between items */
}

.opcional-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0; /* Even more reduced padding */
    border-bottom: 1px solid #f1f5f9;
    gap: 1.5rem;
}

.opcional-item:last-child {
    border-bottom: none;
}

.opcional-info {
    flex: 1;
    min-width: 320px;
}

.opcional-info h4 {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 0.4rem; /* Tiny margin */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.opcional-question-row {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Radios closer to text */
    gap: 1.5rem;
}

.opcional-question {
    font-size: 0.85rem;
    color: #475569;
    font-weight: 600;
}

.radio-pill-group {
    display: flex;
    background: #f8fafc;
    padding: 2px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
}

.radio-pill-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 4px 12px; /* Thinner pills */
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    transition: all 0.2s;
}

.opcional-details-box {
    flex: 1.2;
    background: #f8faff;
    border: 1px dashed #cbdcf7;
    border-radius: 8px;
    padding: 0.5rem 1rem; /* Compact padding */
    min-height: 48px;
    animation: fadeIn 0.3s ease;
}

/* Labels in front of inputs - Force Row */
.opcional-details-box .input-group {
    display: flex !important;
    flex-direction: row !important; /* Force labels to the left */
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.opcional-details-box .input-group:last-child {
    margin-bottom: 0;
}

.opcional-details-box .input-group label {
    min-width: 130px; /* Adjusted width */
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    margin: 0;
    text-align: left; /* Ensure label is left-aligned */
}

.opcional-details-box .input-group select,
.opcional-details-box .input-group input {
    flex: 1;
    padding: 0.35rem 0.6rem; /* Thinner inputs */
    font-size: 0.85rem;
    height: 32px; /* Fixed height for consistency */
}

/* Chaves grid specifically adjusted */
.chaves-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem; /* Reduced gap */
    width: 100%;
}

.chave-entry-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    background: #fff;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #eef2f7;
}

.btn-delete-chave {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-chave:hover {
    background: #fecaca;
    color: #dc2626;
}

.btn-add-chave-circle {
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.probation-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    color: white;
    background-color: #9c27b0; /* Roxo */
    text-transform: uppercase;
    display: inline-block;
    min-width: 65px;
    text-align: center;
    line-height: 1.2;
}

.probation-badge.second {
    background-color: #0f4ea4; /* Azul solicitado */
}
/* Assinafy Integration Styles */
.assinafy-integrated-container {
    padding: 2px;
}

.btn-assinafy {
    background: #6366f1; /* Indigo */
    color: white;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-assinafy:hover {
    background: #4f46e5;
    color: white;
    transform: translateY(-1px);
}

.btn-assinafy:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

.assinafy-status-badge {
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
}

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

.assinafy-status-badge.assinado {
    background: #dcfce7;
    color: #166534;
}

.assinafy-status-badge.aguardando-webhook {
    background: #dbeafe;
    color: #1e40af;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ============================================
   TOPBAR USER AREA - Avatar + Nome + Sair
   ============================================ */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-info span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.user-avatar:hover {
    border-color: #f503c5;
}

.user-avatar i {
    font-size: 1.5rem;
    color: #94a3b8;
}

/* Botão Sair no topbar */
.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #f8f9fa;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.topbar-logout-btn i {
    font-size: 1rem;
}

.topbar-logout-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220,38,38,0.15);
}

.topbar-logout-btn:active {
    transform: translateY(0);
}

/* Abas de navegação fixas abaixo da topbar */
#app-tabs-container {
    position: sticky;
    top: var(--topbar-height, 60px);
    z-index: 998;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
#app-tabs-container .app-top-tab {
    font-family: 'Inter', sans-serif !important;
}
body.has-open-tabs .page-header {
    top: calc(var(--topbar-height, 60px) + 38px) !important;
}
/* Enhanced Active Step Highlight */
.step-item.active .step-icon {
    transform: scale(1.15) !important;
    box-shadow: 0 0 0 4px var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: #eff6ff !important;
}
.step-item.active .step-label {
    color: var(--primary-color) !important;
    font-weight: 900 !important;
}

/* ═══════════════════════════════════════════════
   MÓDULO LICENÇAS
   ═══════════════════════════════════════════════ */
.licenca-tab-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 0.6rem 1.2rem; border: none; cursor: pointer;
    background: none; font-size: 0.88rem; font-weight: 600;
    color: #64748b; border-bottom: 3px solid transparent;
    transition: all 0.2s; border-radius: 4px 4px 0 0;
    font-family: inherit;
}
.licenca-tab-btn:hover { color: var(--tab-color, #d9480f); background: #f8fafc; }
.licenca-tab-btn.active { color: var(--tab-color, #d9480f); background: #fff; }

.licencas-alert-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.licencas-alert-chip {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 600;
}

.licencas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.licenca-card {
    position: relative; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s, transform 0.2s;
    background: #fff;
}
.licenca-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-2px); }
.licenca-card-empty { opacity: 0.85; }

.licenca-status-strip {
    position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}

.licenca-card-body { padding: 1rem 1rem 0.85rem 1.25rem; }

.licenca-card-header {
    display: flex; align-items: flex-start; gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.licenca-doc-icon {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}

.licenca-doc-nome {
    font-weight: 700; color: #1e293b; font-size: 0.9rem;
    line-height: 1.3;
}

.licenca-empresa-badge {
    display: inline-block; font-size: 0.68rem; font-weight: 600;
    padding: 1px 8px; border-radius: 10px; margin-top: 3px;
    white-space: nowrap;
}

.licenca-status-badge {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.72rem; font-weight: 700; padding: 3px 10px;
    border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}

.licenca-validade-row {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.82rem; color: #475569; margin-bottom: 0.6rem;
}
.licenca-validade-row strong { color: #1e293b; }
.licenca-upload-date { color: #94a3b8; font-size: 0.75rem; }

.licenca-card-actions {
    display: flex; gap: 6px; align-items: center;
    padding-top: 0.6rem; border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.licenca-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0.3rem 0.75rem; border-radius: 6px; font-size: 0.78rem;
    font-weight: 600; cursor: pointer; border: 1px solid transparent;
    transition: all 0.15s; font-family: inherit;
}
.licenca-btn-view   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.licenca-btn-view:hover { background: #dbeafe; }
.licenca-btn-edit   { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.licenca-btn-edit:hover { background: #ffedd5; }
.licenca-btn-del    { background: #fef2f2; color: #dc2626; border-color: #fecaca; padding: 0.3rem 0.5rem; }
.licenca-btn-del:hover { background: #fee2e2; }
.licenca-btn-upload { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.licenca-btn-upload:hover { background: #dcfce7; }


/* Days of the week as colored buttons (labels) */
.day-btn {
    display: inline-block;
    height: 28px;
    min-width: 44px;
    padding: 0;
    margin: 0;
    line-height: 25px; /* Centra o texto verticalmente para altura de 28px e borda 1.5px */
    text-align: center;
    vertical-align: middle;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    box-sizing: border-box;
    background: #fff;
    border-width: 1.5px;
    border-style: solid;
}

.day-btn input[type="checkbox"] {
    display: none;
}

/* Day individual colors - Unselected & Selected states */
.day-btn-seg {
    border-color: #ef4444;
    color: #ef4444;
}
.day-btn-seg:has(input:checked) {
    background: #ef4444;
    color: #fff;
}

.day-btn-ter {
    border-color: #f97316;
    color: #f97316;
}
.day-btn-ter:has(input:checked) {
    background: #f97316;
    color: #fff;
}

.day-btn-qua {
    border-color: #d97706;
    color: #d97706;
}
.day-btn-qua:has(input:checked) {
    background: #d97706;
    color: #fff;
}

.day-btn-qui {
    border-color: #16a34a;
    color: #16a34a;
}
.day-btn-qui:has(input:checked) {
    background: #16a34a;
    color: #fff;
}

.day-btn-sex {
    border-color: #2563eb;
    color: #2563eb;
}
.day-btn-sex:has(input:checked) {
    background: #2563eb;
    color: #fff;
}

.day-btn-sab {
    border-color: #7c3aed;
    color: #7c3aed;
}
.day-btn-sab:has(input:checked) {
    background: #7c3aed;
    color: #fff;
}

.day-btn-dom {
    border-color: #db2777;
    color: #db2777;
}
.day-btn-dom:has(input:checked) {
    background: #db2777;
    color: #fff;
}

/* Orange container badge for calendar icon */
.calendar-badge {
    background: #fbbf24; /* yellow/orange */
    color: #fff;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 4px;
}

/* Deixar a fonte de tudo que está preenchido no sistema em letras maiúsculas (caixa alta) */
input:not([type="password"]):not([type="email"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not(#login-username):not(#login-password),
select,
select option,
textarea {
    text-transform: uppercase !important;
}
input::placeholder,
textarea::placeholder {
    text-transform: none !important;
}
