/* ==========================================================================
   Asistencia Smart — Sistema de diseño
   Documentación: DESIGN.md (raíz del proyecto)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Marca (tomada del logotipo) */
    --brand-50: #eef3ff;
    --brand-100: #dce6ff;
    --brand-200: #bccfff;
    --brand-300: #90aeff;
    --brand-500: #275dfe;
    --brand-600: #1f4de0;
    --brand-700: #1a3fb4;
    --brand-900: #16296b;

    /* Neutros */
    --ink-900: #0d1117;
    --ink-800: #161c24;
    --ink-700: #272f3a;
    --ink-600: #3f4854;
    --ink-500: #5b6472;
    --ink-400: #7e8794;
    --ink-300: #a5adb9;
    --ink-200: #d3d9e0;
    --ink-100: #e5e9ee;
    --ink-75:  #eef1f5;
    --ink-50:  #f5f7f9;

    --paper: #ffffff;
    --canvas: #f6f8fa;

    /* Semánticos */
    --ok-700: #0a6b3d;
    --ok-600: #12805a;
    --ok-100: #d6efe2;
    --ok-50: #ecf8f1;

    --warn-700: #94520a;
    --warn-600: #b0700e;
    --warn-100: #f8e6c6;
    --warn-50: #fdf4e6;

    --danger-700: #9b1c1c;
    --danger-600: #c02b2b;
    --danger-100: #f6d5d5;
    --danger-50: #fdeded;

    --info-700: #1a3fb4;
    --info-600: #1f4de0;
    --info-100: #dce6ff;
    --info-50: #eef3ff;

    /* Texto */
    --text: var(--ink-900);
    --text-secondary: var(--ink-600);
    --text-muted: var(--ink-400);

    /* Bordes */
    --border: var(--ink-100);
    --border-strong: var(--ink-200);

    /* Radios */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-full: 999px;

    /* Sombras — muy contenidas, nunca de color */
    --shadow-xs: 0 1px 2px rgba(13, 17, 23, .05);
    --shadow-sm: 0 1px 2px rgba(13, 17, 23, .06), 0 1px 3px rgba(13, 17, 23, .04);
    --shadow-md: 0 2px 4px -1px rgba(13, 17, 23, .06), 0 8px 20px -6px rgba(13, 17, 23, .10);
    --shadow-lg: 0 12px 40px -12px rgba(13, 17, 23, .22);

    /* Anillo de foco */
    --ring: 0 0 0 3px rgba(39, 93, 254, .16);

    /* Métricas del layout */
    --sidebar-w: 244px;
    --topbar-h: 58px;
    --gutter: 24px;

    /* Tipografía */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Inter Tight', 'Inter', -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, monospace;

    /* Puente con Bootstrap: los componentes nativos heredan nuestros tokens */
    --bs-body-font-family: var(--font-sans);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--canvas);
    --bs-border-color: var(--border);
    --bs-primary: var(--brand-600);
    --bs-primary-rgb: 31, 77, 224;
    --bs-link-color: var(--brand-600);
    --bs-link-hover-color: var(--brand-700);
    --bs-border-radius: var(--r-md);
    --bs-border-radius-sm: var(--r-sm);
    --bs-border-radius-lg: var(--r-lg);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv05' 1, 'cv11' 1, 'ss01' 1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.014em;
    color: var(--text);
    margin: 0;
}

h1, .h1 { font-size: 24px; line-height: 1.25; }
h2, .h2 { font-size: 19px; line-height: 1.3; }
h3, .h3 { font-size: 16px; line-height: 1.35; }
h4, .h4, h5, .h5, h6, .h6 { font-size: 14px; line-height: 1.4; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; text-underline-offset: 2px; }

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; opacity: 1; }

::selection { background: var(--brand-100); color: var(--brand-900); }

:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}

/* Cifras siempre alineadas: crítico en tableros de datos */
.num, td, th, .stat-value, .kpi .value, input[type="date"], input[type="datetime-local"] {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }

/* --------------------------------------------------------------------------
   3. Estructura: shell, sidebar, topbar
   -------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--paper);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.32, .72, 0, 1);
}

.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

.sidebar-brand {
    height: var(--topbar-h);
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img { height: 26px; width: auto; display: block; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 20px;
    scrollbar-width: thin;
}

.nav-section {
    margin: 18px 0 6px;
    padding: 0 10px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-400);
}

.nav-section:first-child { margin-top: 2px; }

.nav-link-custom {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 10px;
    margin-bottom: 1px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-600);
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease;
}

.nav-link-custom i {
    width: 16px;
    font-size: 13px;
    text-align: center;
    color: var(--ink-400);
    transition: color .12s ease;
}

.nav-link-custom:hover {
    background: var(--ink-50);
    color: var(--ink-900);
    text-decoration: none;
}

.nav-link-custom:hover i { color: var(--ink-600); }

.nav-link-custom.active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.nav-link-custom.active i { color: var(--brand-600); }

.nav-link-custom.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: var(--brand-600);
}

.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-400);
    font-variant-numeric: tabular-nums;
}

.sidebar-footer {
    flex: none;
    border-top: 1px solid var(--border);
    padding: 10px 12px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--r-sm);
}

.user-chip:hover { background: var(--ink-50); }
.user-chip .meta { min-width: 0; line-height: 1.25; }
.user-chip .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-chip .role { font-size: 11.5px; color: var(--text-muted); }

.main-wrap { min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 var(--gutter);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.breadcrumb-line {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.breadcrumb-line .sep { color: var(--ink-300); font-size: 10px; }

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.clock {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ink-900);
}

.content {
    padding: var(--gutter);
    max-width: 1500px;
}

/* Encabezado de página */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head h1 { font-size: 22px; }

.page-head .desc {
    margin-top: 3px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   4. Superficies
   -------------------------------------------------------------------------- */
.card,
.card-soft {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.card-head h2,
.card-head h3 { font-size: 14.5px; font-weight: 600; }

.card-head .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

details.card > summary {
    list-style: none;
    cursor: pointer;
}

details.card > summary::-webkit-details-marker { display: none; }

details.card:not([open]) > summary { border-bottom: 0; }

details.card[open] > summary .fa-chevron-down { transform: rotate(180deg); }

.card-foot {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--ink-50);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* Tarjeta de indicador */
.stat {
    position: relative;
    height: 100%;
    padding: 16px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.stat-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .045em;
    text-transform: uppercase;
    color: var(--ink-400);
}

.stat-value {
    margin-top: 10px;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -.025em;
}

.stat-foot {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--r-full);
    flex: none;
    background: var(--ink-300);
}

.stat.is-ok .stat-dot { background: var(--ok-600); }
.stat.is-warn .stat-dot { background: var(--warn-600); }
.stat.is-danger .stat-dot { background: var(--danger-600); }
.stat.is-info .stat-dot { background: var(--brand-600); }

.stat.is-ok .stat-value { color: var(--ok-700); }
.stat.is-warn .stat-value { color: var(--warn-700); }
.stat.is-danger .stat-value { color: var(--danger-700); }
.stat.is-info .stat-value { color: var(--brand-700); }

/* Compatibilidad con la clase previa */
.kpi {
    padding: 16px;
    border-radius: var(--r-lg);
    background: var(--paper);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.kpi .label { font-size: 11.5px; font-weight: 600; letter-spacing: .045em; text-transform: uppercase; color: var(--ink-400); }
.kpi .value { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; margin-top: 8px; }

/* --------------------------------------------------------------------------
   5. Botones
   -------------------------------------------------------------------------- */
.btn {
    --bs-btn-focus-box-shadow: var(--ring);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--r-md);
    font-size: 13.5px;
    font-weight: 550;
    line-height: 1;
    white-space: nowrap;
    transition: background-color .13s ease, border-color .13s ease, color .13s ease, box-shadow .13s ease;
}

.btn:active { transform: translateY(.5px); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }

/* Primario sólido — sin degradados */
.btn-brand,
.btn-primary,
.btn-primary-gradient {
    background: var(--brand-600);
    border: 1px solid var(--brand-600);
    color: #fff;
    box-shadow: var(--shadow-xs);
}

.btn-brand:hover,
.btn-primary:hover,
.btn-primary-gradient:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
    filter: none;
}

.btn-brand:focus-visible,
.btn-primary-gradient:focus-visible { box-shadow: var(--ring); outline: none; }

/* Secundario */
.btn-ghost,
.btn-outline-secondary,
.btn-light {
    background: var(--paper);
    border: 1px solid var(--border-strong);
    color: var(--ink-700);
    box-shadow: var(--shadow-xs);
}

.btn-ghost:hover,
.btn-outline-secondary:hover,
.btn-light:hover {
    background: var(--ink-50);
    border-color: var(--ink-300);
    color: var(--ink-900);
}

/* Terciario / sin borde */
.btn-quiet {
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-600);
    box-shadow: none;
}

.btn-quiet:hover { background: var(--ink-50); color: var(--ink-900); }

.btn-outline-primary {
    background: var(--paper);
    border: 1px solid var(--brand-200);
    color: var(--brand-700);
}

.btn-outline-primary:hover { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }

.btn-outline-danger {
    background: var(--paper);
    border: 1px solid var(--danger-100);
    color: var(--danger-600);
}

.btn-outline-danger:hover { background: var(--danger-50); border-color: var(--danger-600); color: var(--danger-700); }

.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* --------------------------------------------------------------------------
   6. Formularios
   -------------------------------------------------------------------------- */
.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--ink-700);
}

.form-control,
.form-select {
    height: 36px;
    padding: 0 11px;
    font-size: 13.5px;
    color: var(--text);
    background-color: var(--paper);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    transition: border-color .13s ease, box-shadow .13s ease;
}

textarea.form-control { height: auto; min-height: 76px; padding: 9px 11px; line-height: 1.5; }

.form-control::placeholder { color: var(--ink-300); }

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    box-shadow: var(--ring);
    outline: none;
}

.form-control:disabled,
.form-select:disabled { background: var(--ink-50); color: var(--text-muted); }

.form-select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237e8794' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-size: 12px;
    background-position: right 11px center;
}

.form-check-input {
    width: 15px;
    height: 15px;
    margin-top: .18em;
    border: 1px solid var(--border-strong);
    box-shadow: none;
}

.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.form-check-label { font-size: 13.5px; color: var(--ink-700); }

.form-hint { margin-top: 5px; font-size: 12px; color: var(--text-muted); }

.autocomplete {
    position: relative;
    width: 100%;
}

.autocomplete-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.autocomplete-input {
    padding-left: 34px;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237e8794' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 12px;
    background-position: right 11px center;
}

.autocomplete-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--ink-300);
    pointer-events: none;
}

.autocomplete-list {
    display: none;
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--paper);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
}

.autocomplete.is-open .autocomplete-list { display: block; }

.autocomplete-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--ink-800);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
    background: var(--brand-50);
    color: var(--brand-700);
}

.autocomplete-empty {
    padding: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Barra de filtros */
.toolbar {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

.toolbar .form-control,
.toolbar .form-select {
    width: 100%;
    min-width: 0;
}

.toolbar-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .045em;
    text-transform: uppercase;
    color: var(--ink-400);
    padding-right: 2px;
}

.filter-field {
    grid-column: span 3;
    min-width: 0;
}

.filter-field.is-wide { grid-column: span 4; }
.filter-field.is-search { grid-column: span 4; }

.filter-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 550;
    color: var(--ink-600);
}

.filter-actions {
    grid-column: span 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.filter-summary {
    grid-column: 1 / -1;
    margin-bottom: -3px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
}

.filter-summary strong {
    font-weight: 600;
    color: var(--ink-700);
    font-variant-numeric: tabular-nums;
}

.field-search { position: relative; }
.field-search .form-control { padding-left: 34px; }
.field-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--ink-300);
    pointer-events: none;
}

/* El indicador nativo de fecha es muy oscuro y compite con el texto */
.toolbar input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: .45;
    cursor: pointer;
}

.toolbar input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: .75; }

.btn-filter-reset {
    width: 36px;
    padding: 0;
    flex: none;
}

/* --------------------------------------------------------------------------
   7. Tablas de datos
   -------------------------------------------------------------------------- */
.table-responsive { overflow-x: auto; }

.table {
    --bs-table-bg: transparent;
    width: 100%;
    margin: 0;
    border-color: var(--border);
    color: var(--text);
}

.table > thead > tr > th {
    padding: 9px 14px;
    background: var(--ink-50);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-500);
    white-space: nowrap;
    vertical-align: middle;
}

.table > tbody > tr > td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13.5px;
}

.table > tbody > tr:last-child > td { border-bottom: 0; }

.table > tbody > tr { transition: background-color .1s ease; }
.table > tbody > tr:hover > td { background: var(--ink-50); }

.table-dias > tbody > tr > td { padding: 8px 14px; }

.table.table-sm > thead > tr > th { padding: 8px 12px; }
.table.table-sm > tbody > tr > td { padding: 9px 12px; }

.table .num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }

.table-flush { border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; }

/* Encabezado fijo para la matriz de asistencias */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-sticky tbody th,
.table-sticky .col-sticky {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--paper);
    box-shadow: 1px 0 0 var(--border);
}

.table-sticky tbody tr:hover .col-sticky { background: var(--ink-50); }

.cell-name { font-weight: 550; color: var(--ink-900); }

.table a.text-reset {
    text-decoration: none;
    color: inherit;
}

.table a.text-reset:hover .cell-name { color: var(--brand-600); }
.cell-sub { font-size: 12px; color: var(--text-muted); }

/* Matriz mensual de asistencias */
.matrix-scroll { max-height: 65vh; overflow: auto; scrollbar-width: thin; }

.matrix { border-collapse: separate; border-spacing: 0; }

.matrix .col-sticky { min-width: 210px; max-width: 210px; }

.matrix-empleado {
    display: flex;
    flex-direction: column;
    gap: 1px;
    color: inherit;
    text-decoration: none;
}

.matrix-empleado .cell-name { color: var(--brand-600); }

.matrix-empleado:hover {
    color: inherit;
    text-decoration: none;
}

.matrix-empleado:hover .cell-name {
    color: var(--brand-700);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.matrix .th-day {
    width: 38px;
    padding: 6px 2px;
    text-align: center;
    line-height: 1.15;
}

.matrix .th-day .dow {
    display: block;
    font-size: 9.5px;
    color: var(--ink-300);
    text-transform: uppercase;
}

.matrix .th-day .dom {
    display: block;
    font-size: 12px;
    color: var(--ink-600);
    font-variant-numeric: tabular-nums;
}

.matrix .th-day.is-weekend { background: var(--ink-75); }
.matrix .th-day.is-weekend .dom { color: var(--ink-400); }

.matrix .th-total { width: 36px; text-align: right; }
.matrix > tbody > tr > td { padding: 6px 6px; }
.matrix > tbody > tr > td.col-sticky { padding: 8px 14px; }

/* --------------------------------------------------------------------------
   8. Etiquetas de estado
   -------------------------------------------------------------------------- */
.badge-estado,
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 24px;
    padding: 3px 8px;
    border-radius: var(--r-full);
    border: 1px solid transparent;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .01em;
    white-space: nowrap;
}

.chip-neutral { background: var(--ink-50); color: var(--ink-600); border-color: var(--ink-100); }
.chip-ok { background: var(--ok-50); color: var(--ok-700); border-color: var(--ok-100); }
.chip-warn { background: var(--warn-50); color: var(--warn-700); border-color: var(--warn-100); }
.chip-danger { background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-100); }
.chip-info { background: var(--info-50); color: var(--info-700); border-color: var(--info-100); }

/* Celda compacta de la matriz mensual */
.cell-estado {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 24px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
    color: inherit;
}

/* Punto de aviso: ese día tiene tiempo extra esperando autorización */
.cell-estado.has-extra::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    background: var(--warn-600);
    border: 1.5px solid var(--paper);
}

.cell-empty { color: var(--ink-200); }

.badge { font-weight: 600; font-size: 11.5px; padding: .35em .6em; border-radius: var(--r-full); }

/* Leyenda de estados */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(13, 17, 23, .08); }

/* --------------------------------------------------------------------------
   9. Avatares
   -------------------------------------------------------------------------- */
.avatar {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ink-75);
    color: var(--ink-700);
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: .02em;
    border: 1px solid rgba(13, 17, 23, .05);
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.avatar-photo { object-fit: cover; }

.face-capture {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.face-preview {
    position: relative;
    width: 210px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--ink-75);
}

.face-preview img,
.face-preview video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.face-preview video { transform: scaleX(-1); }

.face-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--ink-400);
    font-size: 12px;
}

.face-placeholder i { font-size: 38px; color: var(--ink-200); }
.face-capture-controls { padding-top: 4px; }

@media (max-width: 575.98px) {
    .face-capture { grid-template-columns: 1fr; }
    .face-preview { width: min(100%, 280px); margin-inline: auto; }
}

.clock-pick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.clock-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.clock-pick-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 14px 14px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--paper);
    cursor: pointer;
    user-select: none;
}

.clock-pick-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.clock-pick-card.is-static { cursor: default; }

.clock-pick-card:hover:not(.is-static) { border-color: var(--border-strong); }

.clock-pick-card.is-on {
    border-color: var(--brand-200);
    background: var(--brand-50);
}

.clock-pick-card.is-pending {
    border-color: var(--warn-100);
    background: var(--warn-50);
}

.clock-pick-mark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-full);
    border: 1px solid var(--border-strong);
    background: var(--paper);
    color: transparent;
    font-size: 11px;
}

.clock-pick-card.is-on .clock-pick-mark {
    border-color: var(--brand-600);
    background: var(--brand-600);
    color: #fff;
}

.clock-pick-card.is-pending .clock-pick-mark {
    border-color: var(--warn-600);
    background: var(--warn-600);
}

.clock-pick-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    background: var(--ink-75);
    color: var(--ink-500);
    margin-bottom: 6px;
}

.clock-pick-card.is-on .clock-pick-icon {
    background: #fff;
    color: var(--brand-700);
}

.clock-pick-name {
    font-size: 14px;
    font-weight: 650;
    color: var(--ink-900);
    padding-right: 22px;
}

.clock-pick-meta {
    font-size: 12px;
    color: var(--ink-400);
}

.clock-pick-card.is-on .clock-pick-meta { color: var(--brand-700); }
.clock-pick-card.is-pending .clock-pick-meta { color: var(--warn-700); }

/* --------------------------------------------------------------------------
   10. Avisos y estados vacíos
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 13.5px;
    box-shadow: var(--shadow-xs);
}

.alert i { margin-top: 2px; }

.alert-success { background: var(--ok-50); border-color: var(--ok-100); color: var(--ok-700); }
.alert-danger { background: var(--danger-50); border-color: var(--danger-100); color: var(--danger-700); }
.alert-warning { background: var(--warn-50); border-color: var(--warn-100); color: var(--warn-700); }
.alert-info { background: var(--info-50); border-color: var(--info-100); color: var(--info-700); }

.empty {
    padding: 40px 20px;
    text-align: center;
}

.empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink-50);
    border: 1px solid var(--border);
    color: var(--ink-400);
}

.empty-title { font-size: 14px; font-weight: 600; color: var(--ink-800); }
.empty-text { margin-top: 4px; font-size: 13px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   11. Listas y líneas de tiempo
   -------------------------------------------------------------------------- */
.list-rows { display: flex; flex-direction: column; }

.list-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
}

.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--ink-50); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-size: 13.5px; font-weight: 550; color: var(--ink-900); }
.list-row .sub { font-size: 12px; color: var(--text-muted); }

.timeline { position: relative; padding-left: 20px; }

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--border);
}

.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 5px;
    width: 9px;
    height: 9px;
    border-radius: var(--r-full);
    background: var(--paper);
    border: 2px solid var(--brand-500);
}

.timeline-item.is-out::before { border-color: var(--ink-300); }
.timeline-time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline-meta { font-size: 12px; color: var(--text-muted); }

/* Filas de detalle clave/valor */
.detail-list { display: flex; flex-direction: column; }
.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--text-muted); font-weight: 400; }
.detail-row dd { margin: 0; font-weight: 550; text-align: right; }

/* --------------------------------------------------------------------------
   12. Paginación
   -------------------------------------------------------------------------- */
.pagination { --bs-pagination-border-radius: var(--r-sm); gap: 3px; margin: 0; }

.page-link {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    font-size: 13px;
    color: var(--ink-600);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--paper);
}

.page-link:hover { background: var(--ink-50); color: var(--ink-900); }
.page-item.active .page-link { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.page-item.disabled .page-link { color: var(--ink-300); background: var(--paper); }

/* --------------------------------------------------------------------------
   13. Autenticación
   -------------------------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: var(--paper);
}

.auth-box { width: 100%; max-width: 372px; }

.auth-aside {
    display: none;
    position: relative;
    padding: 48px;
    background: var(--ink-900);
    color: #fff;
    overflow: hidden;
}

/* Retícula sutil: textura, no decoración llamativa */
.auth-aside::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at 30% 20%, #000 10%, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000 10%, transparent 72%);
}

.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { color: #fff; font-size: 27px; line-height: 1.25; max-width: 15ch; }
.auth-aside p { color: rgba(255, 255, 255, .62); font-size: 14px; max-width: 42ch; }

.auth-points { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; color: rgba(255, 255, 255, .82); }
.auth-points i { color: var(--brand-300); font-size: 12px; margin-top: 4px; }

.auth-foot { margin-top: 44px; font-size: 12px; color: rgba(255, 255, 255, .38); }

/* --------------------------------------------------------------------------
   14. Utilidades
   -------------------------------------------------------------------------- */
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-brand { color: var(--brand-600) !important; }
.text-ok { color: var(--ok-700) !important; }
.text-warn { color: var(--warn-700) !important; }
.text-danger { color: var(--danger-600) !important; }

.micro-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .045em;
    text-transform: uppercase;
    color: var(--ink-400);
}

.divider-v { width: 1px; height: 20px; background: var(--border); }

.surface-muted { background: var(--ink-50); }

.scroll-x { overflow-x: auto; scrollbar-width: thin; }
.scroll-y { max-height: 340px; overflow-y: auto; scrollbar-width: thin; }

.chart-wrap { position: relative; height: 260px; }

/* --------------------------------------------------------------------------
   15. Adaptable
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
    .sidebar { transform: none; box-shadow: none; }
    .main-wrap { margin-left: var(--sidebar-w); }
    .mobile-toggle { display: none !important; }
    .auth-shell.has-aside { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
    .auth-shell.has-aside .auth-aside { display: flex; flex-direction: column; justify-content: center; }
}

@media (max-width: 991px) {
    :root { --gutter: 16px; }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(13, 17, 23, .4);
        z-index: 1040;
        display: none;
    }

    .sidebar-backdrop.show { display: block; }
    .page-head { align-items: flex-start; }
    .stat-value { font-size: 24px; }

    .filter-field,
    .filter-field.is-wide { grid-column: span 4; }
    .filter-field.is-search { grid-column: span 6; }
    .filter-actions { grid-column: span 4; }
}

@media (max-width: 767px) {
    .toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 12px;
    }

    .filter-field,
    .filter-field.is-wide,
    .filter-field.is-search { grid-column: span 2; }

    .filter-field.is-half { grid-column: span 1; }

    .filter-actions {
        grid-column: span 2;
        justify-content: stretch;
    }

    .filter-actions .btn-brand { flex: 1; }
}

@media (max-width: 420px) {
    .filter-field.is-half { grid-column: span 2; }
}

/* --------------------------------------------------------------------------
   16. Impresión
   -------------------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .page-actions, .toolbar, .sidebar-backdrop { display: none !important; }
    .main-wrap { margin-left: 0; }
    .card, .card-soft, .stat { box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}

/* --------------------------------------------------------------------------
   17. Documentación API
   -------------------------------------------------------------------------- */
.api-docs pre {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    overflow-x: auto;
    color: var(--ink-800);
    margin: 0 0 12px;
}
.api-docs .api-ep {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    margin-bottom: 8px;
}
.api-token-plain {
    display: block;
    word-break: break-all;
    font-family: var(--font-mono);
    font-size: 12px;
}

.api-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    width: fit-content;
    max-width: 100%;
}
.api-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    color: var(--ink-600);
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.api-tab i { font-size: 12px; }
.api-tab:hover { color: var(--ink-900); background: var(--paper); }
.api-tab.is-active {
    background: var(--paper);
    color: var(--ink-900);
    border-color: var(--border);
}

[data-tab-panel] { display: none; }
[data-tab-panel].is-active { display: block; }

.form-tabs-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    gap: 8px;
    padding: 12px 0 4px;
    background: var(--canvas);
    border-top: 1px solid var(--border);
}

.api-swagger-card { overflow: hidden; padding: 0; }
.api-docs-frame {
    display: block;
    width: 100%;
    min-height: 78vh;
    border: 0;
    background: #fff;
}

.timeline-audit {
    margin-top: 2px;
    font-size: 12px;
    color: var(--ink-600);
}

.owner-alert {
    align-items: flex-start;
}

.qr-img {
    width: 220px;
    height: 220px;
    border-radius: 12px;
    background: #fff;
}

.marca-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--paper);
}

.marca-preview img {
    max-height: 64px;
    max-width: 220px;
    object-fit: contain;
}

.list-row-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.visita-qr-modal .modal-header,
.visita-qr-modal .modal-footer {
    border-color: var(--border);
}

.visita-qr-modal .modal-title {
    font-size: 16px;
    font-weight: 650;
    margin: 0;
}

.visita-qr-link {
    display: block;
    word-break: break-all;
    font-size: 12px;
}

.visita-qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}


