:root {
    --primary: #5d5388;
    --primary-hover: #4d4575;
    --primary-light: rgba(93, 83, 136, 0.12);
    --secondary: #5d5388;
    --secondary-hover: #4d4575;
    --secondary-light: rgba(93, 83, 136, 0.08);
    --bg-body: #f2f1ed;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border: #e0e0e0;
    --danger: #dc2626;
    --danger-light: rgba(220, 38, 38, 0.1);
    --success: #059669;
    --success-light: rgba(5, 150, 105, 0.12);
    --warning: #d97706;
    --warning-light: rgba(217, 119, 6, 0.12);
    --sidebar-width: 260px;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.d-flex { display: flex; width: 100%; }
.content { flex: 1; padding: 28px 32px; overflow-y: auto; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }

/* Cards */
.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }

/* Tabelas */
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tr { transition: background var(--transition); }
tbody tr:hover { background: var(--secondary-light); }

/* Inputs e formulários */
input, select, button {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    width: 100%;
    margin-bottom: 10px;
    font-size: 0.9375rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Botões base */
button {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    cursor: pointer;
    font-weight: 700;
    text-align: center;
    transition: background var(--transition), color var(--transition);
}
button:hover {
    background: var(--primary);
    color: white;
}
button:active { transform: scale(0.98); }

/* Links como botões: sem fundo sólido, borda + texto na cor, hover = fundo + texto branco */
a.btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid;
    transition: background var(--transition), color var(--transition);
}

a.btn-primary, .btn-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
a.btn-primary:hover, .btn-primary:hover {
    background: var(--primary);
    color: white;
}

a.btn-secondary, .btn-secondary {
    background: transparent;
    color: var(--secondary);
    border-color: var(--secondary);
}
a.btn-secondary:hover, .btn-secondary:hover {
    background: var(--secondary);
    color: white;
}

a.btn-outline, .btn-outline {
    background: transparent;
    color: var(--secondary);
    border-color: var(--secondary);
}
a.btn-outline:hover, .btn-outline:hover {
    background: var(--secondary);
    color: white;
}

a.btn-ghost, .btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
a.btn-ghost:hover, .btn-ghost:hover {
    background: var(--text-muted);
    color: white;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}
a.btn-sm { padding: 8px 14px; }

.btn-danger, a.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
a.btn-danger:hover, .btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-success, a.btn-success {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
a.btn-success:hover, .btn-success:hover {
    background: var(--primary);
    color: white;
}

/* Badges */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.bg-approved {
    background: var(--success-light);
    color: #047857;
}
.bg-pending {
    background: var(--warning-light);
    color: #b45309;
}
.bg-rejected {
    background: var(--danger-light);
    color: #b91c1c;
}

/* Sidebar (dashboard) */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    color: var(--text-main);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
    z-index: 10;
}
.sidebar h2 { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--text-main); }
.sidebar .nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar .nav-btn:hover {
    background: var(--secondary);
    color: white;
}
.sidebar .nav-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
}
.sidebar .nav-btn.active:hover {
    background: var(--primary);
    color: white;
}
.sidebar .logout {
    margin-top: auto;
    color: var(--danger);
    border-color: var(--danger);
}
.sidebar .logout:hover {
    background: var(--danger);
    color: white;
}
.sidebar .nav-btn i { width: 18px; text-align: center; margin-right: 10px; }

/* Marca (login + sidebar) */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}
.brand-logo i {
    color: var(--primary);
    font-size: 1.5rem;
}

/* Login */
.login-page {
    min-height: 100vh;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
}
.login-header {
    background: var(--bg-card);
    padding: 16px 32px;
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow);
}
.login-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}
.login-box {
    background: var(--bg-card);
    padding: 40px 36px;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: none;
}
.login-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 28px;
}
.login-box label {
    display: block;
    color: var(--text-main);
    font-size: 0.875rem;
    margin-bottom: 6px;
}
.login-box input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 18px;
}
.login-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.login-box button[type="submit"] {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 0;
}
.login-box button[type="submit"]:hover {
    background: var(--primary-hover);
    color: #fff;
}
.login-error {
    color: var(--danger);
    text-align: center;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(93, 83, 136, 0.25);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.is-open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    width: min(900px, 96vw);
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.modal-title { font-weight: 700; font-size: 1.05rem; color: var(--text-main); }
.modal-header .modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.modal-header .modal-close:hover {
    background: var(--border);
    color: var(--text-main);
}
.modal-body .modal-close { padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: white; font-weight: 600; color: var(--text-muted); }
.modal-body .modal-close:hover { background: var(--border); color: var(--text-main); }
.modal-body { padding: 20px; max-height: 75vh; overflow: auto; }
.modal-body form { margin: 0; }

/* Coluna Ações: itens sempre na horizontal (uma linha) */
td.cell-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}
td.cell-actions .form-inline-actions {
    flex: 0 1 auto;
    min-width: 0;
}

.text-muted { color: var(--text-muted); font-size: 0.9rem; }

/* Link externo (ex: Ver Arquivo) como botão pequeno */
a.btn-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    text-decoration: none;
    background: var(--secondary-light);
    transition: background var(--transition), color var(--transition);
}
a.btn-link:hover { background: rgba(93, 83, 136, 0.18); color: var(--secondary-hover); }

/* Botão apenas ícone (ex: upload) */
.btn-icon {
    min-width: 36px;
    padding: 8px 10px;
    font-size: 1.1rem;
    line-height: 1;
}
.btn-icon span { display: inline-block; }

/* Formulário inline na coluna Ações (documentos / contratos) */
.form-inline-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}
.form-inline-actions input[type="date"],
.form-inline-actions input[type="file"] {
    width: auto;
    margin: 0;
    min-height: 36px;
}
.form-inline-actions input[type="date"] { max-width: 130px; }
.form-inline-actions input[type="file"] { max-width: 120px; }

/* Gestão documental colaborador: input arquivo oculto, botão "Selecionar" no lugar; data com fonte 20% menor */
.input-file-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}
.form-doc-colab .input-date-doc { font-size: 0.8em; }
