:root {
    --brand: #1e3a8a;
    --brand-600: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-width: 250px;
    --topbar-h: 60px;
    --bg: #f4f6fb;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
}

/* ---- Shell / layout ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    transition: transform .25s ease;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-mark {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-600), #4f46e5);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.brand-mark-lg { width: 64px; height: 64px; font-size: 2rem; border-radius: 16px; }

.brand-name { display: block; font-weight: 700; color: #fff; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { display: block; font-size: .72rem; color: #64748b; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px; }
.nav-group {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    padding: 14px 12px 6px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .92rem;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--brand-600); color: #fff; }
.nav-link i { font-size: 1.05rem; width: 18px; text-align: center; }
.nav-badge { margin-left: auto; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-meta { min-width: 0; }
.user-name { display: block; color: #e2e8f0; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; color: #64748b; font-size: .72rem; text-transform: capitalize; }

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.clock-chip {
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: .85rem;
    color: #475569;
}

.user-menu {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 4px 8px;
}

/* ---- Content ---- */
.content { padding: 24px; }

/* ---- Avatares ---- */
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 2rem; border-radius: 24px; }

/* ---- KPI cards ---- */
.kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
}
.kpi-icon {
    width: 38px; height: 38px;
    border-radius: 0;
    background: transparent !important;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.kpi-icon img { width: 37px; height: 37px; object-fit: contain; display: block; }
.kpi-value { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.kpi-unit { font-size: .9rem; color: #64748b; }
.kpi-label { font-size: .75rem; color: #64748b; }

/* ---- Soft backgrounds ---- */
.bg-soft-blue  { background: #dbeafe; color: #1d4ed8; }
.bg-soft-green { background: #dcfce7; color: #16a34a; }
.bg-soft-red   { background: #fee2e2; color: #dc2626; }
.bg-soft-amber { background: #fef3c7; color: #d97706; }
.bg-soft-purple{ background: #ede9fe; color: #7c3aed; }
.text-bg-purple { background-color: #5b21b6 !important; color: #ffffff !important; }
.bg-soft-cyan  { background: #cffafe; color: #0891b2; }

/* ---- Badges ---- */
.badge-soft { font-weight: 600; }

/* ---- Expediente de empleado ---- */
.expediente-field {
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 12px;
    height: 100%;
}
.expediente-cell {
    padding: 12px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.expediente-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 2px;
}
.expediente-value {
    font-size: .95rem;
    font-weight: 600;
    color: #1e293b;
    word-break: break-word;
}

/* ---- Fotografía de empleado ---- */
.employee-photo {
    width: 72px; height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: #dbeafe;
    color: #1d4ed8;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    border: 2px solid #e2e8f0;
}
.employee-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.employee-photo-lg {
    width: 120px; height: 120px;
    font-size: 3rem;
}

/* ---- Navegación lateral del expediente ---- */
.expediente-nav .list-group-item {
    border-left: 3px solid transparent;
    font-size: .875rem;
    font-weight: 600;
    color: #475569;
}
.expediente-nav .list-group-item.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-left-color: #1d4ed8;
    font-weight: 700;
}
.expediente-nav .list-group-item:hover {
    background: #f8fafc;
}

/* ---- Shift dot / pill ---- */
.shift-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.schedule-pill { font-weight: 600; border-radius: 20px; }

/* ---- Auth (glassmorphism) ---- */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, #1e1b4b 0%, #312e81 28%, #4338ca 52%, #2563eb 78%, #06b6d4 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.auth-body::before,
.auth-body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .5;
    pointer-events: none;
}
.auth-body::before {
    width: 380px; height: 380px;
    background: radial-gradient(circle, #06b6d4, transparent 70%);
    top: -80px; right: -80px;
}
.auth-body::after {
    width: 340px; height: 340px;
    background: radial-gradient(circle, #a855f7, transparent 70%);
    bottom: -60px; left: -70px;
}
.auth-wrap { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-card {
    border: 0; border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
    color: #fff;
}
.auth-card .text-muted { color: rgba(255, 255, 255, 0.65) !important; }
.auth-card .text-secondary { color: rgba(255, 255, 255, 0.7) !important; }
.auth-card .form-label { color: #fff; }
.auth-card .input-group-text {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.auth-card .form-control {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.auth-card .form-control::placeholder { color: rgba(255, 255, 255, 0.5); }
.auth-card .form-control:focus {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(103, 232, 249, 0.6);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}
.auth-card .demo-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
}
.auth-card .brand-mark {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---- Cards / tables ---- */
.card { border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { border-bottom: 1px solid #eef2f7; }
.js-attendance-expandable { cursor: zoom-in; }
.js-attendance-expandable.table-active { outline: 2px solid #93c5fd; outline-offset: -2px; }
.attendance-detail-row > td { background: #eff6ff !important; }
.attendance-detail-wrap { padding: 8px 12px 10px; }
.attendance-detail-wrap thead th { background: #16365c; color: #fff; font-size: .72rem; white-space: nowrap; }
.attendance-detail-wrap tbody td { font-size: .78rem; white-space: nowrap; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; font-weight: 600; }

/* ---- Zebra azul tenue (listados) ---- */
.table-zebra-blue tbody tr:nth-child(odd) > td { background-color: #dbeafe !important; }
.table-zebra-blue tbody tr:nth-child(even) > td { background-color: #ffffff !important; }
.dashboard-alerts-card .card-header h5 { font-size: 1rem; }
.dashboard-alerts-list { overflow: visible; }
.dashboard-alert-pagination { border-top: 1px solid #e2e8f0; background: #f8fafc; }
.dashboard-alerts-list .list-group-item { min-height: 38px; padding-top: .4rem !important; padding-bottom: .4rem !important; }
.dashboard-summary-panels > [class*="col-"] > .card { border-radius: 12px; box-shadow: 0 8px 22px rgba(15, 23, 42, .08); }
.dashboard-summary-panels .card-header { min-height: 48px; }
.branch-card { border-radius: 12px; box-shadow: 0 8px 22px rgba(15, 23, 42, .08); }
.dashboard-chart-card { border-radius: 12px; box-shadow: 0 8px 22px rgba(15, 23, 42, .08); background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%); }
.dashboard-chart-body { display: flex; align-items: center; gap: 2rem; min-height: 210px; }
.dashboard-pie-wrap { width: 210px; height: 180px; flex: 0 0 210px; perspective: 700px; display: flex; align-items: center; justify-content: center; }
.dashboard-pie-wrap canvas { transform: rotateX(12deg) rotateZ(-2deg); filter: drop-shadow(0 11px 5px rgba(30, 58, 138, .22)); transform-origin: center; }
.dashboard-chart-legend { display: grid; gap: .65rem; color: #475569; font-size: .86rem; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .45rem; }
.legend-blue { background: #2563eb; } .legend-amber { background: #f59e0b; } .legend-red { background: #ef4444; } .legend-purple { background: #8b5cf6; }
@media (max-width: 575px) { .dashboard-chart-body { flex-direction: column; justify-content: center; gap: 1rem; } }

/* Selector compacto de rango para filtros de reportes. */
.range-picker { position: relative; }
.range-picker-toggle { text-align: left; background: #fff; color: #334155; }
.range-picker-popover {
    position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 650px;
    display: grid; grid-template-columns: 150px 1fr; gap: 0; padding: 0; background: #fff; border: 1px solid #dbe3ef;
    border-radius: 10px; box-shadow: 0 10px 25px rgba(15, 23, 42, .14);
}
.range-picker-shortcuts { padding: .75rem; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: .25rem; }
.range-picker-shortcuts button { border: 0; background: transparent; border-radius: 7px; color: #64748b; padding: .45rem .55rem; text-align: left; font-size: .78rem; }
.range-picker-shortcuts button:hover, .range-picker-shortcuts button.active { background: #eaf2ff; color: #1e3a8a; font-weight: 600; }
.range-picker-calendars { display: grid; grid-template-columns: 1fr 1fr; padding: .65rem .8rem .4rem; }
.range-calendar + .range-calendar { border-left: 1px solid #e2e8f0; padding-left: .8rem; }
.range-calendar-head { display: flex; align-items: center; justify-content: space-between; color: #1e3a8a; font-size: .78rem; text-transform: capitalize; }
.range-calendar-head button { border: 0; background: #eef4ff; color: #1d4ed8; border-radius: 6px; width: 26px; height: 26px; }
.range-calendar-week, .range-calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.range-calendar-week { color: #64748b; font-size: .65rem; font-weight: 700; margin: .6rem 0 .25rem; }
.range-calendar-days button { border: 0; background: transparent; border-radius: 6px; color: #334155; font-size: .72rem; height: 28px; }
.range-calendar-days button:hover, .range-calendar-days button.is-between { background: #eaf2ff; color: #1d4ed8; }
.range-calendar-days button.is-selected { background: #1e3a8a; color: #fff; font-weight: 700; }
.range-calendar-days .is-empty { height: 28px; }
.range-picker-footer { grid-column: 1 / -1; border-top: 1px solid #e2e8f0; padding: .55rem .75rem; display: flex; justify-content: space-between; align-items: center; color: #64748b; font-size: .7rem; }
.filter-multiselect { position: relative; }
.filter-multiselect-menu { display: none; position: absolute; z-index: 30; top: 100%; left: .75rem; right: .75rem; max-height: 220px; overflow-y: auto; padding: .45rem; background: #fff; border: 1px solid #bfdbfe; border-radius: 8px; box-shadow: 0 10px 24px rgba(15, 23, 42, .15); }
.filter-multiselect.is-open .filter-multiselect-menu { display: block; }
.filter-multiselect-menu label { display: block; padding: .35rem .4rem; border-radius: 5px; font-size: .78rem; color: #334155; cursor: pointer; }
.filter-multiselect-menu label:hover { background: #eaf2ff; color: #1e3a8a; }
.filter-multiselect-menu input { accent-color: #1d4ed8; margin-right: .25rem; }
.overtime-table th, .overtime-table td { padding-top: .5rem; padding-bottom: .5rem; }
.overtime-table tbody tr.overtime-summary-row.overtime-row-blue > td { background-color: #dbeafe !important; }
.overtime-table tbody tr.overtime-summary-row.overtime-row-white > td { background-color: #ffffff !important; }
.overtime-detail-row > td { background: #c5ddf7 !important; padding: .65rem !important; }
.overtime-breakdown { font-size: .8rem; }
.overtime-breakdown th, .overtime-breakdown td { padding: .35rem .5rem; white-space: nowrap; }
.overtime-breakdown thead th { background: #102a4c; color: #ffffff; border-color: #0c213d; }
.overtime-metric-help { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; line-height: inherit; cursor: help; }
.overtime-metric-help .bi { font-size: .72rem; opacity: .82; }
.overtime-metric-help:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 3px; border-radius: 2px; }
.overtime-breakdown .overtime-metric-help:focus-visible { outline-color: #ffffff; }
.overtime-breakdown tbody td { background: #9fc5ed; border-color: #82addb; }
.overtime-breakdown tbody tr:nth-child(even) td { background: #9fc5ed; }
.overtime-breakdown .overtime-alert-badge { display: inline-block; background: #fff7ed; border: 1px solid #fb923c; color: #9a3412; border-radius: 999px; padding: .12rem .38rem; font-size: .72rem; font-weight: 700; }
.overtime-detail-toggle { color: #185abc; border-color: #dbe7f5; }
.overtime-difference-pending { color: #a16207 !important; }
.overtime-difference-balanced { color: #047857 !important; }
.overtime-detail-summary { color: #163a63; border-top: 1px solid #82addb; padding-top: .45rem; }
.overtime-detail-summary span { background: #eef6ff; border: 1px solid #9fc5ed; border-radius: 999px; padding: .2rem .5rem; }
.overtime-detail-summary .overtime-alert-badge { background: #fff7ed; border-color: #fb923c; color: #9a3412; font-weight: 700; }
@media (max-width: 760px) { .range-picker-popover { min-width: min(650px, calc(100vw - 32px)); left: 50%; transform: translateX(-50%); } }

/* ---- Planificador ---- */
.planner-table th.is-today { background: #eff6ff; }
.planner-table th.is-today .small { color: var(--brand-600) !important; }

.planner-cell { cursor: pointer; transition: background .12s; }
.planner-cell:hover { background: #f8fafc; }

.att-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block;
}
.att-dot.dot-ok    { background: #16a34a; }
.att-dot.dot-inc   { background: #f59e0b; }
.att-dot.dot-falta { background: #dc2626; }
.att-dot.dot-rest  { background: #cbd5e1; }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}

/* ---- Logo de marca (Prezenza) ---- */
/* Cuando el recuadro lleva el logotipo real, se quita el fondo para que
   el símbolo se vea limpio sobre la barra oscura. */
.brand-mark.brand-mark-logo {
    background: transparent;
    border: 0;
    padding: 0;
    overflow: visible;
}
.brand-mark.brand-mark-logo img {
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: contain;
}
.auth-card .brand-mark.brand-mark-lg.brand-mark-logo {
    background: transparent;
    border: 0;
}
.auth-brand-lockup { display: block; width: min(260px, 82%); height: auto; object-fit: contain; }

/* En iOS el teclado puede desplazar horizontalmente el documento cuando el
   formulario es más ancho que el viewport visual. Mantener la tarjeta dentro
   del ancho disponible y usar 16px evita además el zoom automático del campo. */
@media (max-width: 575.98px) {
    html, body.auth-body { width: 100%; max-width: 100%; overflow-x: hidden; }
    .auth-body {
        align-items: flex-start;
        padding: max(16px, env(safe-area-inset-top))
                 max(16px, env(safe-area-inset-right))
                 max(16px, env(safe-area-inset-bottom))
                 max(16px, env(safe-area-inset-left));
    }
    .auth-wrap { width: 100%; max-width: 420px; min-width: 0; }
    .auth-card { width: 100%; min-width: 0; }
    .auth-card input,
    .auth-card select,
    .auth-card textarea,
    .auth-card button { font-size: 16px; }
}

