/* =============================================
   RHHelper Admin Theme
   ============================================= */
:root {
    --primary: #1a3a5c;
    --primary-light: #2c6fad;
    --accent: #00b4d8;
    --accent2: #0077b6;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* ---- LAYOUT ---- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0d2137 0%, #1a3a5c 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,.25);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
}

.sidebar-brand .brand-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    color: white;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .5px;
}

.sidebar-brand .brand-sub {
    color: rgba(255,255,255,.45);
    font-size: 10px;
    display: block;
    margin-top: -2px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    color: rgba(255,255,255,.35);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 12px 10px 6px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    margin-bottom: 3px;
}

.nav-item-link:hover {
    background: rgba(255,255,255,.08);
    color: white;
}

.nav-item-link.active {
    background: linear-gradient(135deg, rgba(0,180,216,.25), rgba(0,119,182,.25));
    color: #7dd3f8;
    border: 1px solid rgba(0,180,216,.3);
}

.nav-item-link .nav-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item-link.active .nav-icon {
    background: rgba(0,180,216,.25);
}

.nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(220,38,38,.4);
    flex-shrink: 0;
}

/* ── Menu lateral agrupado em submenus ── */
.nav-group { margin-bottom: 4px; }

.nav-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255,255,255,.78);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all .2s;
}

.nav-group-header:hover { background: rgba(255,255,255,.08); color: white; }
.nav-group-header:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.nav-group-header .nav-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-group.open > .nav-group-header { background: rgba(255,255,255,.06); color: white; }
.nav-group.has-active > .nav-group-header { color: #7dd3f8; }
.nav-group.has-active > .nav-group-header .nav-icon { background: rgba(0,180,216,.25); }

.nav-chevron {
    margin-left: auto;
    font-size: 20px;
    line-height: 1;
    color: rgba(255,255,255,.45);
    transition: transform .2s;
}
.nav-badge + .nav-chevron { margin-left: 8px; }
.nav-group.open > .nav-group-header .nav-chevron { transform: rotate(90deg); }

.nav-sub {
    margin: 3px 0 8px 16px;
    padding-left: 6px;
    border-left: 1px solid rgba(255,255,255,.12);
}
.nav-sub .nav-item-link { padding: 7px 8px; font-size: 13px; gap: 8px; margin-bottom: 2px; }
.nav-sub .nav-item-link .nav-icon { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.35);
    font-size: 11px;
}

/* ---- Barra de acções do utilizador, no fundo da barra lateral (Portal/Password/Sair) ---- */
.sidebar-user-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.65);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .2px;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.sidebar-user-action span:first-child { font-size: 15px; line-height: 1; }
.sidebar-user-action:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.sidebar-user-action-danger:hover {
    background: rgba(239,68,68,.22);
    color: #fca5a5;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0; z-index: 50;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.topbar-spacer { flex: 1; }

.topbar-badge {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
}

.page-body {
    flex: 1;
    padding: 28px;
}

/* ---- CARDS ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.card-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
}

.card-header-actions { margin-left: auto; }

.card-body { padding: 20px 22px; }

/* ---- STAT CARDS ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    opacity: 0;
    transition: opacity .2s;
}

.stat-card:hover::before { opacity: 1; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.09);
}

.stat-card.stat-card-alert::before { background: linear-gradient(90deg, var(--danger), #f87171); opacity: 1; }
.stat-card.stat-card-warn::before { background: linear-gradient(90deg, var(--warning), #fbbf24); opacity: 1; }

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

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

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; }
.stat-icon.green  { background: #d1fae5; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.red    { background: #fee2e2; }

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

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ---- FILTER BAR ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 18px 22px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.filter-group input[type="date"],
.filter-group input[type="text"],
.filter-group input[type="search"],
.filter-group input[type="number"],
.filter-group select {
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    min-width: 160px;
    font-family: inherit;
}

.filter-group select {
    padding: 0 36px 0 12px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(44,111,173,.10);
}

.filter-group select:hover {
    border-color: var(--primary-light);
}

.btn {
    height: 38px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all .2s;
    text-decoration: none;
}

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

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

.btn-outline {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
}

/* ---- TABLE ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
}

/* Qualquer .card-body que contenha uma tabela ganha scroll horizontal automático,
   mesmo em páginas que não usam .table-wrapper explicitamente. */
.card-body:has(table.data-table) {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--primary);
    color: white;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.data-table thead th:first-child { border-radius: 8px 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 8px 0 0; }

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.data-table tbody tr:hover { background: #f8fafc; }

.data-table tbody td {
    padding: 11px 14px;
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:last-child td:first-child { border-radius: 0 0 0 8px; }
.data-table tbody tr:last-child td:last-child  { border-radius: 0 0 8px 0; }

/* ---- BADGE ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fef3c7; color: #92400e; }

/* ---- CHART BARS ---- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 140px;
    padding: 10px 0;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    height: 100%;
    justify-content: flex-end;
}

.bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--accent), var(--accent2));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height .5s ease;
}

.bar-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

.bar-value {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
}

/* ---- DEPT BARS ---- */
.dept-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dept-bar-label {
    width: 130px;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.dept-bar-track {
    flex: 1;
    height: 10px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}

.dept-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    border-radius: 999px;
    transition: width .6s ease;
}

.dept-bar-count {
    width: 36px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
    opacity: .35;
}

.empty-state p { font-size: 14px; }

/* ---- LOADING ---- */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

.spinner {
    width: 22px; height: 22px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

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

.page-header-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.page-header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ---- RESPONSIVE ---- */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px; height: 34px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.hamburger-btn span {
    display: block;
    width: 16px; height: 2px;
    margin: 0 auto;
    background: var(--primary);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6,22,38,.55);
    z-index: 99;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}
.sidebar-overlay.visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ---- GRELHAS RESPONSIVAS DE UTILIDADE GERAL ----
   Para layouts de duas/três colunas fora do .form-grid (ex: painéis lado-a-lado no
   Dashboard e no Portal) — reduzem sempre a uma só coluna em ecrãs estreitos. */
.responsive-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.responsive-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.responsive-grid-2-1 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }

@media (max-width: 900px) {
    .responsive-grid-2, .responsive-grid-3, .responsive-grid-2-1 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .hamburger-btn { display: flex; }
    .topbar { padding: 0 16px; gap: 12px; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform .28s ease;
        width: min(var(--sidebar-width), 82vw);
    }
    .sidebar.sidebar-mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-body { padding: 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .form-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-header .btn, .page-header button { width: 100%; justify-content: center; }
    .data-table { font-size: 12px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 14px 16px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; justify-content: center; }
    .topbar-title { display: none; }
    .card-header { flex-wrap: wrap; gap: 8px; }
}

/* =============================================
   COLABORADORES & FALTOSOS — v1.1
   ============================================= */

/* Stat icon teal */
.stat-icon.teal {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

/* Shortcut cards */
.shortcut-card {
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.shortcut-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,.10);
}
.shortcut-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}
.shortcut-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}
.shortcut-arrow {
    margin-left: auto;
    font-size: 20px;
    color: var(--text-muted);
}
.shortcut-danger:hover {
    border-left: 3px solid var(--danger);
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table thead th {
    background: var(--bg);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.data-table tbody tr:hover {
    background: rgba(0,180,216,.04);
}
.data-table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
}

/* Department badge */
.dept-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(44,111,173,.12);
    color: var(--primary-light);
    letter-spacing: .4px;
}
.dept-badge-danger {
    background: rgba(239,68,68,.12);
    color: var(--danger);
}

/* Status badge */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
}
.status-presente {
    background: rgba(16,185,129,.12);
    color: var(--success);
}
.status-ausente {
    background: rgba(239,68,68,.12);
    color: var(--danger);
}

/* Icon action buttons */
.btn-icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background .12s, border-color .12s;
    line-height: 1;
}
.btn-icon:hover { background: var(--bg); }
.btn-icon.btn-edit:hover { border-color: var(--accent); }
.btn-icon.btn-danger:hover { border-color: var(--danger); background: rgba(239,68,68,.06); }

/* btn-danger */
.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.btn-danger:hover { opacity: .88; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.modal-box {
    background: var(--card-bg);
    border-radius: 14px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background .12s;
}
.modal-close:hover { background: var(--bg); }
.modal-body {
    padding: 24px;
    flex: 1;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form grid inside modal */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-group input,
.form-group select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
    height: 42px;
}
.form-group select {
    padding: 9px 36px 9px 12px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(0,180,216,.10);
}
.form-group select:hover {
    border-color: var(--accent);
}

/* Alert error inside form */
.alert-error {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(239,68,68,.10);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 8px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
}

/* Faltosos count badge */
.faltosos-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(239,68,68,.12);
    border: 1.5px solid rgba(239,68,68,.3);
    border-radius: 20px;
    color: var(--danger);
    font-weight: 700;
    font-size: 14px;
}

/* =============================================
   SELECT WRAPPER — seta customizada universal
   ============================================= */
.select-wrapper {
    position: relative;
    display: inline-block;
}
.select-wrapper::after {
    content: '';
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-muted);
    pointer-events: none;
    transition: border-top-color .15s;
}
.select-wrapper:hover::after {
    border-top-color: var(--primary-light);
}
.select-wrapper select {
    width: 100%;
    padding-right: 34px;
    appearance: none;
    -webkit-appearance: none;
    background-image: none !important; /* usa o ::after pseudo-element */
    cursor: pointer;
}
/* Quando dentro de filter-group herda height do pai */
.filter-group .select-wrapper {
    display: block;
}
.filter-group .select-wrapper select {
    width: 100%;
    min-width: 180px;
}

/* ---- Combobox de perfil, usado na criação de utilizadores em massa ----
   Mais compacto que os selects normais de formulário (cabe bem numa linha de tabela) e com
   uma cor associada a cada perfil, para se identificar de relance, numa lista longa, quais as
   linhas com permissões elevadas antes de gravar em massa. */
.select-perfil {
    width: 100%;
    min-width: 170px;
    height: 34px;
    padding: 0 30px 0 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.select-perfil:hover { border-color: var(--primary-light); }
.select-perfil:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,180,216,.12);
}
.select-perfil-limitado {
    color: var(--text-muted);
}
.select-perfil-chefe {
    border-color: rgba(0,119,182,.35);
    background-color: rgba(0,119,182,.07);
    color: #0077b6;
}
.select-perfil-supervisor {
    border-color: rgba(245,158,11,.4);
    background-color: rgba(245,158,11,.08);
    color: #b45309;
}
.select-perfil-admin {
    border-color: rgba(239,68,68,.4);
    background-color: rgba(239,68,68,.07);
    color: #b91c1c;
}

/* =============================================
   FALTOSOS — dept summary strip
   ============================================= */
.faltosos-dept-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.faltosos-dept-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    padding: 14px 20px;
    background: white;
    border: 1.5px solid rgba(239,68,68,.25);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(239,68,68,.08);
    gap: 2px;
}
.faltosos-dept-count {
    font-size: 28px;
    font-weight: 800;
    color: var(--danger);
    line-height: 1;
}
.faltosos-dept-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: .5px;
    margin-top: 4px;
}
.faltosos-dept-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Faltoso table row highlight */
.faltoso-row {
    background: rgba(239,68,68,.03);
    border-left: 3px solid transparent;
    transition: background .12s, border-left-color .12s;
}
.faltoso-row:hover {
    background: rgba(239,68,68,.07);
    border-left-color: var(--danger);
}

/* Avatar initials helper */
.avatar-initials {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.avatar-danger {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.avatar-default {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
}

/* =============================================
   TOPBAR — user badge + logout
   ============================================= */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}
.topbar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(26,58,92,.25);
}
.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: .2px;
}
.topbar-logout {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 15px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1;
    margin-left: 2px;
}
.topbar-logout:hover {
    background: rgba(239,68,68,.08);
    color: var(--danger);
    border-color: rgba(239,68,68,.35);
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a1628 0%, #0d2137 40%, #1a3a5c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

/* Animated decorative shapes */
.login-shape {
    position: absolute;
    border-radius: 50%;
    opacity: .06;
    animation: floatShape 8s ease-in-out infinite;
}
.login-shape-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent), transparent);
    top: -150px; right: -100px;
    animation-delay: 0s;
}
.login-shape-2 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, var(--primary-light), transparent);
    bottom: -100px; left: -80px;
    animation-delay: 3s;
}
.login-shape-3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, var(--accent2), transparent);
    top: 50%; left: 15%;
    animation-delay: 5s;
}
@keyframes floatShape {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-30px) scale(1.05); }
}

/* Card */
.login-card {
    background: rgba(255,255,255,.97);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    padding: 40px 40px 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(20px);
    animation: slideUp .4s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* Brand */
.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    display: block;
    filter: drop-shadow(0 6px 14px rgba(0,119,182,.35));
}
.login-brand-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.login-brand-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.login-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin-bottom: 28px;
}

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.login-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.login-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    transition: color .15s;
}
.login-form-group.focused .login-label {
    color: var(--primary-light);
}
.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.login-input-icon {
    position: absolute;
    left: 13px;
    font-size: 15px;
    pointer-events: none;
    z-index: 1;
}
.login-input {
    width: 100%;
    height: 46px;
    padding: 0 42px 0 40px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    font-family: inherit;
}
.login-input:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(44,111,173,.12);
}
.login-input.input-error {
    border-color: var(--danger);
    background: rgba(239,68,68,.03);
}
.login-input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.login-eye {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
    transition: background .12s;
    line-height: 1;
}
.login-eye:hover { background: var(--bg); }

/* Error message */
.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.25);
    border-radius: 9px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    animation: shake .35s ease both;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

/* Login button */
.login-btn {
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    transition: opacity .15s, transform .15s, box-shadow .15s;
    box-shadow: 0 4px 16px rgba(26,58,92,.3);
    letter-spacing: .3px;
}
.login-btn:hover:not(:disabled) {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(26,58,92,.4);
}
.login-btn:active:not(:disabled) {
    transform: translateY(0);
}
.login-btn:disabled {
    opacity: .7;
    cursor: not-allowed;
}
.login-btn-arrow {
    font-size: 18px;
    transition: transform .2s;
}
.login-btn:hover .login-btn-arrow {
    transform: translateX(4px);
}

/* Spinner inside button */
.login-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .5px;
}
.login-footer-slogan {
    display: block;
    font-size: 13px;
    font-weight: 600;
    font-style: italic;
    letter-spacing: .2px;
    color: var(--primary-light);
}

/* =============================================
   LOGIN — SPLIT SCREEN (moderno)
   ============================================= */
.login-split {
    min-height: 100vh;
    display: flex;
    background: #f8fafc;
    overflow: hidden;
}

/* ---- Painel esquerdo: marca + proposta de valor ---- */
.login-left {
    flex: 1 1 50%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 64px;
    background: radial-gradient(circle at 15% 10%, #0d3a5c 0%, #0a2440 45%, #061626 100%);
    overflow: hidden;
    color: white;
}
.login-left::before,
.login-left::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: .35;
    animation: floatShape 9s ease-in-out infinite;
}
.login-left::before {
    width: 420px; height: 420px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    top: -120px; right: -100px;
}
.login-left::after {
    width: 320px; height: 320px;
    background: radial-gradient(circle, var(--accent2), transparent 70%);
    bottom: -80px; left: -60px;
    animation-delay: 3.5s;
}
.login-left-glow {
    position: absolute;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(0,180,216,.25), transparent 70%);
    top: 40%; left: 55%;
    border-radius: 50%;
    animation: floatShape 7s ease-in-out infinite;
    animation-delay: 1.5s;
}

.login-left-content {
    position: relative;
    z-index: 1;
    max-width: 460px;
}
.login-left-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}
.login-left-brand svg { width: 40px; height: 40px; flex-shrink: 0; }
.login-left-brand span {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.login-left-headline {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 16px;
    letter-spacing: -.3px;
}
.login-left-headline .accent-text {
    background: linear-gradient(90deg, var(--accent), #7fe3f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.login-left-tagline {
    font-size: 15px;
    color: rgba(255,255,255,.65);
    line-height: 1.6;
    margin-bottom: 30px;
}

.login-feature-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.login-feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}
.login-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    opacity: 0;
    animation: fadeInUpSmall .5s ease-out forwards;
}
.login-feature-item:nth-child(1) { animation-delay: .05s; }
.login-feature-item:nth-child(2) { animation-delay: .1s; }
.login-feature-item:nth-child(3) { animation-delay: .15s; }
.login-feature-item:nth-child(4) { animation-delay: .2s; }
.login-feature-item:nth-child(5) { animation-delay: .25s; }
.login-feature-item:nth-child(6) { animation-delay: .3s; }
.login-feature-item:nth-child(7) { animation-delay: .35s; }
.login-feature-item:nth-child(8) { animation-delay: .4s; }
.login-feature-icon {
    width: 34px; height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    backdrop-filter: blur(6px);
    transition: transform .2s, background .2s;
}
.login-feature-item:hover .login-feature-icon {
    transform: translateY(-2px);
    background: rgba(0,180,216,.22);
    border-color: rgba(0,180,216,.4);
}
.login-feature-text {
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255,255,255,.75);
    font-weight: 500;
    padding-top: 6px;
}
.login-feature-text strong { color: white; display: block; font-size: 13.5px; margin-bottom: 1px; }

.login-left-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px;
    opacity: 0;
    animation: fadeInUpSmall .5s ease-out forwards;
    animation-delay: .5s;
}
.login-left-badge {
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,.8);
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    padding: 6px 14px;
    backdrop-filter: blur(6px);
    white-space: nowrap;
}

.login-left-mockup {
    margin-top: 48px;
    position: relative;
    z-index: 1;
}

/* ---- Painel direito: formulário ---- */
.login-right {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    position: relative;
}
.login-right-inner {
    width: 100%;
    max-width: 380px;
    animation: slideUp .45s cubic-bezier(.22,.61,.36,1) both;
}
.login-right-header {
    margin-bottom: 32px;
    text-align: center;
}
.login-right-eyebrow {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.login-right-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
}
.login-right-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.login-mobile-brand {
    display: none;
}

@media (max-width: 900px) {
    .login-left { display: none; }
    .login-right { padding: 24px 20px; }
    .login-mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 28px;
    }
    .login-mobile-brand svg { width: 34px; height: 34px; }
    .login-mobile-brand span {
        font-size: 17px;
        font-weight: 800;
        color: var(--primary);
        letter-spacing: 1px;
        text-transform: uppercase;
    }
}

/* =============================================
   DOWNLOAD BUTTON & INLINE SPINNER
   ============================================= */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    height: 38px;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .3px;
    transition: opacity .15s, transform .15s, box-shadow .15s;
    box-shadow: 0 3px 10px rgba(13,148,136,.3);
    white-space: nowrap;
}
.btn-download:hover:not(:disabled) {
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(13,148,136,.4);
}
.btn-download:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}

/* ── BLAZOR ERROR UI ────────────────────────────────────────────────────── */
/* Garante que a barra de erro aparece sempre por cima da sidebar e topbar  */
#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;          /* muito acima da sidebar (z-index:100) */
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    color: #fff;
    padding: 14px 24px;
    display: none;           /* Blazor mostra via JS quando necessário */
    align-items: center;
    justify-content: center; /* centra o conteúdo horizontalmente na barra */
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 -4px 20px rgba(0,0,0,.35);
    border-top: 2px solid #ef4444;
}
#blazor-error-ui.blazor-error-ui-visible,
#blazor-error-ui[style*="display: flex"],
#blazor-error-ui[style*="display:flex"] {
    display: flex !important;
}
#blazor-error-ui .reload {
    color: #fde68a;
    font-weight: 700;
    text-decoration: underline;
    margin-left: 8px;
}
#blazor-error-ui .reload:hover { color: #fbbf24; }
#blazor-error-ui .dismiss {
    position: absolute;  /* não afecta o centramento dos outros elementos */
    right: 20px;
    cursor: pointer;
    font-size: 16px;
    opacity: .8;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s;
}
#blazor-error-ui .dismiss:hover { background: rgba(255,255,255,.15); opacity: 1; }

/* Label hint (texto pequeno ao lado do label) */
.label-hint {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
    opacity: .8;
}

/* ── RHHelper — Módulos de RH (adições) ───────────────────────────────── */

.status-atraso {
    background: rgba(245,158,11,.12);
    color: var(--warning);
}

.status-info {
    background: rgba(0,180,216,.12);
    color: var(--accent);
}

.alert-success {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(16,185,129,.10);
    border: 1px solid rgba(16,185,129,.3);
    border-radius: 8px;
    color: var(--success);
    font-size: 13px;
    font-weight: 600;
}

.toggle-btn {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    background: white;
    transition: background .12s, border-color .12s;
}
.toggle-on {
    background: rgba(16,185,129,.12);
    color: var(--success);
    border-color: rgba(16,185,129,.3);
}
.toggle-off {
    background: rgba(239,68,68,.10);
    color: var(--danger);
    border-color: rgba(239,68,68,.3);
}

.tabs-bar {
    flex-wrap: wrap;
}

/* ---- Abas em pílula, usadas no Portal do Colaborador ---- */
.portal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--bg);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.portal-tab {
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.portal-tab:hover { color: var(--text); background: rgba(0,0,0,.04); }
.portal-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(13,33,55,.25);
}

/* ---- Campos de dados do Portal ("Os Meus Dados") ---- */
.portal-data-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.portal-data-icon {
    font-size: 16px;
    line-height: 1.4;
    flex-shrink: 0;
}
.portal-data-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 1px;
}
.portal-data-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.row-selected {
    background: rgba(0,180,216,.06);
}
.row-selected td {
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
}

/* =============================================
   ONBOARDING CHECKLIST
   ============================================= */
.onboarding-card {
    background: linear-gradient(135deg, #0d2137 0%, #1a3a5c 100%);
    border-radius: 16px;
    padding: 24px 26px;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(13,33,55,.25);
}

.onboarding-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.onboarding-title {
    font-size: 17px;
    font-weight: 700;
}

.onboarding-sub {
    font-size: 12.5px;
    color: rgba(255,255,255,.6);
    margin-top: 2px;
}

.onboarding-progress-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.onboarding-progress-track {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,.14);
    border-radius: 999px;
    overflow: hidden;
}

.onboarding-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #7fe3f7);
    border-radius: 999px;
    transition: width .4s ease;
}

.onboarding-progress-label {
    font-size: 12px;
    font-weight: 700;
    color: #7dd3f8;
    white-space: nowrap;
}

.onboarding-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
    color: white;
    transition: background .15s, transform .15s;
}

.onboarding-step:hover {
    background: rgba(255,255,255,.10);
    transform: translateY(-1px);
    color: white;
}

.onboarding-step.done {
    background: rgba(16,185,129,.10);
    border-color: rgba(16,185,129,.25);
}

.onboarding-step-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.onboarding-step.done .onboarding-step-icon {
    background: rgba(16,185,129,.25);
}

.onboarding-step-title {
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.onboarding-step-desc {
    font-size: 11.5px;
    color: rgba(255,255,255,.55);
    margin-top: 3px;
    line-height: 1.4;
}

.onboarding-check {
    color: #34d399;
    font-size: 13px;
}

/* =============================================
   MARCAÇÃO DE PRESENÇA (Portal do Colaborador)
   ============================================= */
.marcacao-card {
    background: linear-gradient(135deg, #0d2137 0%, #1a3a5c 100%);
    color: white;
    border: none;
}

.marcacao-clock {
    text-align: center;
    padding-right: 20px;
    border-right: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}

.marcacao-time {
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.marcacao-date {
    font-size: 11px;
    color: rgba(255,255,255,.55);
    margin-top: 4px;
    text-transform: capitalize;
}

/* O cartão de marcação tem fundo azul-escuro: o título, o cabeçalho e os textos de apoio têm de ser claros
   (antes ficavam cinzento/azul-escuro sobre azul-escuro, quase ilegíveis). */
.marcacao-card .card-title { color: #fff; }
.marcacao-card .card-header { background: transparent; border-bottom: 1px solid rgba(255,255,255,.14); }
.marcacao-sub { color: rgba(255,255,255,.78); }

.marcacao-card .btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ── Portal do colaborador: separação por secções ── */
/* A barra de secções do portal só aparece ao Colaborador em ecrãs pequenos (o menu lateral, que já as tem, fica escondido). */
.portal-secoes.so-movel { display: none; }
@media (max-width: 768px) { .portal-secoes.so-movel { display: flex; } }

.portal-atalhos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.portal-atalho {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--primary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all .2s;
}
.portal-atalho:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,119,182,.12); transform: translateY(-1px); }
.portal-atalho-icone { font-size: 24px; line-height: 1; }
.portal-atalho small { display: block; font-weight: 500; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Portal: etiquetas dos métodos de marcação (rede/IP, geolocalização, câmara) ── */
.metodos-marcacao { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.metodos-titulo { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.metodo-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; border: 1px solid transparent; }
.metodo-ip { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.metodo-geo { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.metodo-foto { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.metodo-geofoto { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.metodos-nota { font-size: 13px; color: var(--text-muted); margin: 0 0 16px; }

/* ── Como foi feita a marcação (nos registos e na assiduidade) ── */
.metodo-terminal { background: #e2e8f0; color: #334155; border-color: #cbd5e1; }
.metodo-desconhecido { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.metodo-chip.mini { padding: 2px 9px; font-size: 11.5px; gap: 4px; white-space: nowrap; }

/* ---- Formulário do colaborador: ocupa a página (não é uma janela), em secções e colunas para não obrigar a deslizar ---- */
.colab-pagina { display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.colab-identificacao { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.colab-foto { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.colab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.colab-grid .span2 { grid-column: span 2; }
.colab-grid .span3 { grid-column: 1 / -1; }
/* A barra de acções acompanha o ecrã: Guardar e Cancelar estão sempre à vista, sem ir ao fundo do formulário. */
.colab-acoes {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 12px 22px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.colab-erro { margin-right: auto; background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
@media (max-width: 1100px) { .colab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
    .colab-identificacao { grid-template-columns: 1fr; }
    .colab-grid { grid-template-columns: 1fr; }
    .colab-grid .span2 { grid-column: auto; }
    .colab-acoes .btn { flex: 1; justify-content: center; }
}

/* ---- Horários: dias da semana e dias com horário diferente ---- */
.horario-dias { display: flex; flex-wrap: wrap; gap: 8px; }
.horario-dia { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card-bg); cursor: pointer; font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); }
.horario-dia input { width: 16px; height: 16px; margin: 0; }
.horario-dia-off { opacity: .45; cursor: not-allowed; }
.horario-extra { border: 1px solid var(--border); border-left: 4px solid var(--accent, #2c6fad); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--bg); }
.horario-resumo { border: 1px dashed var(--border); border-radius: 10px; padding: 10px 14px; background: var(--bg); font-size: 14px; }
@media (max-width: 760px) { .horario-extra .form-grid { grid-template-columns: 1fr 1fr !important; } }
