/* ============================================================
   LaborApp v2 - Design System
   Visual line: novateksolutions.es (teal/cyan, modern SaaS)
   ============================================================ */

:root {
    /* Primary palette */
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --primary-bg: rgba(8, 145, 178, 0.08);

    /* Neutrals */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: rgba(8, 145, 178, 0.2);

    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #22d3ee;

    /* Borders */
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Status */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --radius: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition: 0.2s ease;
}

/* Dark theme */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-sidebar-hover: #0f172a;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

.hidden { display: none !important; }

/* ============ LOGIN PAGE ============ */
.login-page { background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.login-container {
    display: flex;
    width: 900px;
    max-width: 95vw;
    min-height: 540px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 50%, #22d3ee 100%);
    color: white;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand { margin-bottom: 48px; }
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-left h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.login-left p { font-size: 16px; opacity: 0.85; }

.login-features { display: flex; flex-direction: column; gap: 16px; }
.login-feature {
    display: flex; align-items: center; gap: 12px;
    font-size: 14px; opacity: 0.9;
    padding: 10px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}
.login-feature i { font-size: 18px; width: 24px; text-align: center; }

.login-right {
    flex: 1;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form h2 { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }
.login-form input[type="text"], .login-form input[type="password"] { height: 44px; padding: 10px 14px; font-size: 14px; }
.login-form .btn { height: 44px; font-size: 14px; }

.login-footer { margin-top: auto; text-align: center; color: var(--text-muted); font-size: 12px; }

@media (max-width: 768px) {
    .login-left { display: none; }
    .login-container { width: 100%; min-height: 100vh; border-radius: 0; }
    .login-right { padding: 32px 24px; }
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 20px; position: relative; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group label i { margin-right: 4px; color: var(--primary); }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], input[type="tel"],
input[type="time"], input[type="search"], input[type="checkbox"],
input[type="radio"], select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    height: 36px;
    box-sizing: border-box;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
textarea { height: auto; min-height: 60px; }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}
input::placeholder { color: var(--text-muted); }
.form-control, .form-select, .form-select-sm {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    height: 36px;
    box-sizing: border-box;
    outline: none;
}

.input-password { position: relative; }
.input-password input { padding-right: 44px; }
.btn-eye {
    position: absolute; right: 1px; top: 1px; bottom: 1px;
    width: 42px;
    background: transparent; border: none;
    color: var(--text-muted); cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.btn-eye:hover { color: var(--primary); }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.form-inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* Horizontal form: label and control on the same line */
.form-horizontal > .emp-tab-content > .form-group,
.form-horizontal > .emp-tab-content > .form-row > .form-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.form-horizontal > .emp-tab-content > .form-group > label,
.form-horizontal > .emp-tab-content > .form-row > .form-group > label {
    flex: 0 0 140px;
    min-width: 140px;
    margin-bottom: 0;
    font-size: 12px;
    white-space: nowrap;
    text-align: right;
}
.form-horizontal > .emp-tab-content > .form-group > input,
.form-horizontal > .emp-tab-content > .form-group > select,
.form-horizontal > .emp-tab-content > .form-row > .form-group > input,
.form-horizontal > .emp-tab-content > .form-row > .form-group > select {
    flex: 1;
}
.form-horizontal > .emp-tab-content > .form-group > .radio-group {
    flex: 1;
    display: flex;
    gap: 12px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 13px;
    font-family: inherit;
    height: 36px;
    box-sizing: border-box;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn i { font-size: 13px; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-secondary:hover { background: var(--primary-bg); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.9); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.9); }
.btn-warning { background: var(--warning); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; height: 30px; }
.btn-xs { padding: 4px 8px; font-size: 11px; height: 26px; border-radius: 4px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ ALERTS ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }

/* ============ APP LAYOUT ============ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 700;
    color: white;
}
.sidebar-logo i { color: var(--primary-light); font-size: 24px; }

.sidebar-toggle {
    background: none; border: none;
    color: var(--text-sidebar);
    cursor: pointer; font-size: 16px;
    padding: 6px;
}
.sidebar-toggle:hover { color: white; }

.sidebar-user {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; color: white;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role {
    display: inline-block;
    font-size: 11px;
    padding: 1px 8px;
    background: var(--primary-bg);
    color: var(--primary-light);
    border-radius: 10px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section { padding: 0 20px; margin-top: 16px; }
.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 4px;
}

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: var(--text-sidebar);
    font-size: 13px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}
.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}
.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    border-left-color: var(--primary-light);
}
.sidebar-link i { width: 20px; text-align: center; font-size: 15px; }
.sidebar-link span { white-space: nowrap; }

.sidebar-bottom {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 8px 0;
}

/* Collapsed sidebar */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .nav-section-title { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-header { justify-content: center; }

/* ============ TOPBAR ============ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-menu-btn {
    display: none;
    background: none; border: none;
    font-size: 20px; color: var(--text);
    cursor: pointer; padding: 4px;
}

.topbar-breadcrumb {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-icon-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.topbar-icon-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ============ CONTENT AREA ============ */
.content-area {
    flex: 1;
    padding: 24px;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.page-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border-light); }

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.kpi-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.kpi-icon.primary { background: var(--primary-bg); color: var(--primary); }
.kpi-icon.success { background: var(--success-bg); color: var(--success); }
.kpi-icon.warning { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.info { background: var(--info-bg); color: var(--info); }

.kpi-data h4 { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; }
.kpi-data p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ============ TABLES ============ */
.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-bg); }

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-muted { background: var(--border-light); color: var(--text-muted); }

/* ============ VACATION GRID ============ */
.vacation-grid-wrapper { overflow-x: auto; }

.vacation-grid {
    border-collapse: collapse;
    width: 100%;
    min-width: 900px;
    font-size: 12px;
}
.vacation-grid th {
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    background: var(--bg);
    border: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}
.vacation-grid th.month-header { background: var(--primary); color: white; }
.vacation-grid td {
    padding: 0;
    border: 1px solid var(--border);
    text-align: center;
    min-width: 22px;
    height: 28px;
}
.vacation-grid td.employee-name {
    text-align: left;
    padding: 4px 8px;
    font-weight: 500;
    white-space: nowrap;
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 1;
    min-width: 160px;
}
.vacation-grid td.day-cell {
    cursor: pointer;
    transition: background var(--transition);
}
.vacation-grid td.day-cell:hover { background: var(--primary-bg); }
.vacation-grid td.weekend { background: #f1f5f9; }
.vacation-grid td.holiday { background: #fef3c7; }
.vacation-grid td.today { outline: 2px solid var(--primary); outline-offset: -2px; }

.vacation-grid td.day-cell[data-status] {
    color: white;
    font-size: 10px;
    font-weight: 600;
}

.day-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* ============ CALENDAR ============ */
.calendar-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-day-header {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
}

.calendar-day {
    min-height: 80px;
    padding: 6px;
    background: var(--bg-card);
    cursor: pointer;
    transition: background var(--transition);
}
.calendar-day:hover { background: var(--primary-bg); }
.calendar-day.other-month { background: var(--bg); }
.calendar-day.other-month .day-number { color: var(--text-muted); }
.calendar-day.today { background: var(--primary-bg); }
.calendar-day.today .day-number { color: var(--primary); font-weight: 700; }

.day-number {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.calendar-event {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.calendar-nav h3 { font-size: 18px; font-weight: 600; }
.calendar-nav-btns { display: flex; gap: 8px; }

/* ============ YEAR CALENDAR ============ */
.year-calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    transition: background-color 0.3s;
    padding: 8px;
    border-radius: var(--radius);
}
@media (max-width: 1200px) { .year-calendar-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .year-calendar-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .year-calendar-grid { grid-template-columns: 1fr; } }

.year-month {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.year-month-header {
    text-align: center;
    padding: 8px;
    font-weight: 600;
    font-size: 13px;
    background: var(--primary);
    color: #fff;
}
.year-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding: 4px;
}
.year-day-header {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 2px 0;
}
.year-day {
    position: relative;
    text-align: center;
    padding: 2px 1px;
    min-height: 28px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
}
.year-day:hover { background: var(--primary-bg); }
.year-day.empty { cursor: default; }
.year-day.empty:hover { background: transparent; }
.year-day.today { outline: 2px solid var(--primary); outline-offset: -1px; border-radius: 3px; }
.year-day.weekend .year-day-num { color: var(--text-muted); }
.year-day.holiday-nacional { background: rgba(35,131,196,0.15); }
.year-day.holiday-autonomico { background: rgba(68,157,68,0.15); }
.year-day.holiday-local { background: rgba(240,96,0,0.15); }

.year-day-num {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    display: block;
}
.year-day-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 1px;
    flex-wrap: wrap;
}
.year-day-dots .event-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Calendar summary bar */
.cal-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 13px;
}
.cal-summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cal-summary-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.cal-summary-hours { min-width: 55px; text-align: right; }
.cal-summary-days { min-width: 70px; text-align: right; }
.cal-summary-label { color: var(--text-secondary); }
.cal-summary-total { border-top: 1px solid var(--border); padding-top: 4px; }

/* ============ FILTER BAR ============ */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; display: flex; align-items: center; gap: 6px; }
.filter-bar label { font-size: 11px; white-space: nowrap; margin-bottom: 0; }

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all var(--transition);
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

.toast-close {
    margin-left: auto;
    background: none; border: none;
    color: white; cursor: pointer;
    font-size: 16px; opacity: 0.7;
}
.toast-close:hover { opacity: 1; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: var(--bg);
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer; color: var(--text-secondary);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
}
.modal-body .form-group { margin-bottom: 10px; }
.modal-body .form-group label { font-size: 12px; margin-bottom: 3px; }
.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    font-size: 13px;
    padding: 8px 12px;
    height: 34px;
    box-sizing: border-box;
}
.modal-body .form-group textarea { height: auto; }
.modal-body .form-row { gap: 10px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============ LOADING / SKELETON ============ */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    color: var(--text-secondary);
    gap: 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-box { height: 120px; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state i { font-size: 48px; color: var(--text-muted); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto; }

/* ============ CHECKIN WIDGET ============ */
.checkin-widget {
    text-align: center;
    padding: 32px;
}
.checkin-time {
    font-size: 48px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}
.checkin-date { color: var(--text-secondary); margin-bottom: 24px; }

.checkin-btn {
    width: 120px; height: 120px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 32px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.checkin-btn:hover { background: var(--primary); color: white; transform: scale(1.05); }
.checkin-btn.exit { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.checkin-btn.exit:hover { background: var(--danger); color: white; }

.checkin-records {
    margin-top: 24px;
    text-align: left;
}
.checkin-record {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.checkin-record i { font-size: 14px; }
.checkin-record .entry { color: var(--success); }
.checkin-record .exit { color: var(--danger); }

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============ TABS ============ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}
.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .topbar-menu-btn { display: flex; }

    .content-area { padding: 16px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }

    .filter-bar { flex-direction: column; }
    .filter-bar .form-group { width: 100%; }

    .page-header { flex-direction: column; align-items: flex-start; }
    .form-row { flex-direction: column; gap: 0; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .login-right { padding: 24px 20px; }
}

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 12px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

/* Color dot utility */
.color-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute; z-index: 1000;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-md);
    max-height: 200px; overflow-y: auto; width: 100%;
}
.autocomplete-item {
    padding: 8px 12px; cursor: pointer;
    font-size: 0.9rem; border-bottom: 1px solid var(--border-light);
}
.autocomplete-item:hover { background: var(--primary-bg); }
.autocomplete-item:last-child { border-bottom: none; }

/* Responsive table with cards on mobile */
@media (max-width: 768px) {
    .responsive-table thead { display: none; }
    .responsive-table tbody tr {
        display: block;
        padding: 12px;
        margin-bottom: 8px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }
    .responsive-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        border: none;
    }
    .responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 12px;
    }
}

/* ============ PRINT ============ */
@media print {
    .sidebar, .topbar, .filter-bar, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0; }
    body { background: white; }
}

/* ============ SELECT2 OVERRIDES ============ */
.topbar-company { min-width: 250px; }
.topbar-company .select2-container { width: 100% !important; }
.topbar-company .select2-container--default .select2-selection--single {
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    padding: 3px 8px;
    font-size: 13px;
}
.topbar-company .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    color: var(--text);
    padding-left: 4px;
}
.topbar-company .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
}
.select2-dropdown {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
}
.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 13px;
}
.select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary) !important;
}
.select2-container--default .select2-results__option--selected {
    background-color: var(--primary-bg);
}
.select2-dropdown {
    background: #fff;
    color: #1e293b;
}
.select2-results__option {
    color: #1e293b !important;
    padding: 8px 12px;
}
.select2-results__option--highlighted[aria-selected] {
    color: #fff !important;
}
.select2-search--dropdown .select2-search__field {
    color: #1e293b;
    background: #fff;
}
[data-theme="dark"] .select2-dropdown {
    background: #1e293b;
    color: #e2e8f0;
}
[data-theme="dark"] .select2-results__option {
    color: #e2e8f0 !important;
}
[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    color: #e2e8f0;
    background: #0f172a;
    border-color: #334155;
}

/* ── Tabs (for employee form etc.) ── */
.emp-tabs { margin-bottom: 1rem; }
.emp-tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}
.emp-tab-btn {
    padding: 0.5rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.15s, border-color 0.15s;
}
.emp-tab-btn:hover { color: var(--primary); }
.emp-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.emp-tab-content { padding: 0.25rem 0; }

/* ── Radio group (inline radios) ── */
.radio-group {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    padding: 0.5rem 0;
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}
.radio-label input[type="radio"] {
    accent-color: var(--primary);
}

/* ── Config page tabs ── */
.config-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.working-days-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    user-select: none;
}
.checkbox-inline input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* ============================================================
   CUADRO DE VACACIONES
   ============================================================ */

/* --- Variables cuadro --- */
:root {
    --cuadro-cell-size: 26px;
    --cuadro-emp-col-width: 200px;
    --cuadro-prc-col-width: 50px;
    --cuadro-before-col-width: 60px;
    --cuadro-pending-col-width: 50px;
}

.cuadro-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    min-width: 0;
}

/* --- Cuadro page: prevent overflow beyond viewport --- */
#tabVacaciones, #tabParcial, #tabCompleta,
.cuadro-filters, .cuadro-stats, .cuadro-tabs {
    max-width: 100%;
    box-sizing: border-box;
}

/* --- Filters bar --- */
.cuadro-filters {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}
.cuadro-filters label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: block;
}
.cuadro-filters .filter-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 120px;
}
.cuadro-filters select,
.cuadro-filters input[type="text"] {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 10px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-card);
    width: 100%;
    height: 36px;
}
.cuadro-filters select:focus,
.cuadro-filters input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-bg);
}
.cuadro-filters .filter-group-search {
    flex: 2;
    max-width: 280px;
}
.cuadro-filters .filter-group-search input {
    width: 100%;
}

/* --- Stats --- */
.cuadro-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.cuadro-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 160px;
}
.cuadro-stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
}
.stat-icon.bg-primary { background: var(--primary); }
.stat-icon.bg-success { background: var(--success); }
.stat-icon.bg-warning { background: var(--warning); }
.stat-icon.bg-danger { background: var(--danger); }
.cuadro-stat-card .stat-info .stat-value {
    font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2;
}
.cuadro-stat-card .stat-info .stat-label {
    font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px;
}

/* --- Tabs --- */
.cuadro-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--primary);
}
.cuadro-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}
.cuadro-tab:hover { color: var(--primary); }
.cuadro-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-bg);
}
.cuadro-tab-content { display: none; }
.cuadro-tab-content.active { display: block; }

/* --- Container --- */
.cuadro-container {
    background: var(--bg-card);
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--border);
    border-top: none;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.cuadro-scroll-wrapper {
    overflow: auto;
    max-height: calc(100vh - 200px);
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* --- Main table --- */
.cuadro-table {
    border-collapse: separate;
    border-spacing: 0;
    width: auto;
    min-width: 100%;
    font-size: 12px;
    table-layout: fixed;
}

/* Header (sticky per-cell, works with overflow scroll) */
.cuadro-table thead th {
    position: sticky;
    z-index: 20;
}
.cuadro-table thead tr.cuadro-months th {
    top: 0;
    background: var(--bg-sidebar);
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    padding: 6px 0;
    border-right: 1px solid #475569;
    white-space: nowrap;
    letter-spacing: 0.5px;
}
.cuadro-table thead tr.cuadro-days th {
    top: 30px; /* height of months row */
    background: #334155;
    color: #e2e8f0;
    font-weight: 400;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    width: var(--cuadro-cell-size);
    min-width: var(--cuadro-cell-size);
    max-width: var(--cuadro-cell-size);
    border-right: 1px solid #475569;
    border-bottom: 2px solid var(--primary);
}

/* Fixed columns (left) */
.cuadro-table th.cuadro-fixed,
.cuadro-table td.cuadro-fixed {
    position: sticky;
    z-index: 10;
    background: var(--bg-card);
}
.cuadro-table thead th.cuadro-fixed {
    z-index: 40; /* above both row-sticky and col-sticky */
}
.cuadro-table .cuadro-col-num {
    left: 0;
    width: 30px; min-width: 30px; max-width: 30px;
    text-align: center;
}
.cuadro-table .cuadro-col-emp {
    left: 30px;
    width: var(--cuadro-emp-col-width);
    min-width: var(--cuadro-emp-col-width);
    max-width: var(--cuadro-emp-col-width);
}
.cuadro-table .cuadro-col-prc {
    left: calc(30px + var(--cuadro-emp-col-width));
    width: var(--cuadro-prc-col-width);
    min-width: var(--cuadro-prc-col-width);
    max-width: var(--cuadro-prc-col-width);
    text-align: center;
}
.cuadro-table .cuadro-col-before {
    left: calc(30px + var(--cuadro-emp-col-width) + var(--cuadro-prc-col-width));
    width: var(--cuadro-before-col-width);
    min-width: var(--cuadro-before-col-width);
    max-width: var(--cuadro-before-col-width);
    text-align: center;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}

/* Pending column (right sticky) */
.cuadro-table .cuadro-col-pending {
    position: sticky;
    right: 0;
    z-index: 10;
    width: var(--cuadro-pending-col-width);
    min-width: var(--cuadro-pending-col-width);
    max-width: var(--cuadro-pending-col-width);
    text-align: center;
    background: var(--bg-card);
    box-shadow: -2px 0 4px rgba(0,0,0,0.08);
}
.cuadro-table thead .cuadro-col-pending { z-index: 40; }

/* Header fixed columns (both row 1 and row 2 with rowspan) */
.cuadro-table thead th.cuadro-col-num,
.cuadro-table thead th.cuadro-col-emp,
.cuadro-table thead th.cuadro-col-prc,
.cuadro-table thead th.cuadro-col-before,
.cuadro-table thead th.cuadro-col-pending {
    top: 0; /* rowspan=2, anchored at top */
    background: var(--bg-sidebar);
    color: #fff;
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

/* Body cells */
.cuadro-table tbody td {
    padding: 0;
    height: var(--cuadro-cell-size);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    font-size: 10px;
    transition: background 0.1s;
}
.cuadro-table tbody td.cuadro-col-emp {
    text-align: left;
    padding: 0 6px;
    font-weight: 500;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.cuadro-table tbody td.cuadro-col-emp:hover { color: var(--primary); }
.cuadro-table tbody td.cuadro-col-num { font-size: 10px; color: var(--text-secondary); }
.cuadro-table tbody td.cuadro-col-prc { font-size: 10px; color: var(--text-secondary); }
.cuadro-table tbody td.cuadro-col-before { font-size: 10px; font-weight: 500; }
.cuadro-table tbody td.cuadro-col-pending { font-weight: 700; font-size: 11px; }

.cuadro-col-pending.pending-ok { color: var(--success); }
.cuadro-col-pending.pending-warn { color: var(--warning); }
.cuadro-col-pending.pending-over { color: var(--danger); }

/* Day cells */
.cuadro-day-cell {
    width: var(--cuadro-cell-size);
    min-width: var(--cuadro-cell-size);
    max-width: var(--cuadro-cell-size);
}
.cuadro-day-cell.is-weekend { background: rgba(148, 163, 184, 0.15) !important; }
[data-theme="dark"] .cuadro-day-cell.is-weekend { background: rgba(100, 116, 139, 0.2) !important; }
.cuadro-day-cell.is-holiday { background: rgba(203, 213, 225, 0.3) !important; }
[data-theme="dark"] .cuadro-day-cell.is-holiday { background: rgba(100, 116, 139, 0.3) !important; }
.cuadro-day-cell.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.cuadro-day-cell.month-start { border-left: 2px solid #94a3b8; }

/* Day markers */
.cuadro-day-cell .day-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cuadro-cell-size);
    height: var(--cuadro-cell-size);
    color: #fff;
    font-weight: 700;
    font-size: 10px;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.cuadro-day-cell .day-marker-perm {
    font-size: 8px;
    font-weight: 600;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    border: 1px dashed rgba(255,255,255,0.5);
    border-radius: 2px;
}

/* Tooltip */
.cuadro-day-cell[data-tooltip] { position: relative; }
.cuadro-day-cell[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-sidebar);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

/* Totals row */
.cuadro-table tbody tr.cuadro-totals-row {
    position: sticky;
    bottom: 0;
    z-index: 15;
}
.cuadro-totals-row td {
    background: var(--border-light) !important;
    font-weight: 700;
    font-size: 10px;
    color: var(--text);
    border-top: 2px solid var(--primary);
}
.cuadro-totals-row td.cuadro-col-emp {
    font-size: 11px;
    font-weight: 700;
    color: var(--bg-sidebar);
    text-transform: uppercase;
}
.cuadro-totals-row td.total-low {
    background: var(--danger-bg) !important;
    color: var(--danger);
}

/* Zebra striping */
.cuadro-table tbody tr:nth-child(4n+1) td.cuadro-fixed,
.cuadro-table tbody tr:nth-child(4n+1) td.cuadro-col-pending {
    background: var(--bg);
}
.cuadro-table tbody tr:hover td { background-color: rgba(8, 145, 178, 0.05); }
.cuadro-table tbody tr:hover td.cuadro-fixed,
.cuadro-table tbody tr:hover td.cuadro-col-pending {
    background-color: rgba(8, 145, 178, 0.1);
}

/* Detail row */
.cuadro-emp-detail { display: none; }
.cuadro-emp-detail.active { display: table-row; }
.cuadro-emp-detail td {
    padding: 8px 12px !important;
    background: var(--primary-bg) !important;
    height: auto !important;
}
.cuadro-emp-detail .detail-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cuadro-emp-detail .detail-task {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.cuadro-emp-detail .detail-task .task-color {
    width: 8px; height: 8px; border-radius: 2px;
}
.cuadro-emp-detail .detail-task .task-status {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    margin-left: 4px;
}
.cuadro-emp-detail .detail-task .task-status.st-pending { background: var(--warning); }
.cuadro-emp-detail .detail-task .task-status.st-approved { background: var(--success); }
.cuadro-emp-detail .detail-task .task-status.st-denied { background: var(--danger); }

/* Legend */
.cuadro-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 18px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}
.cuadro-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}
.cuadro-legend-color {
    width: 14px; height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Loading */
.cuadro-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-secondary);
    font-size: 14px;
    gap: 10px;
}

/* Info tables (Jornada Parcial / Completa) */
.cuadro-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.cuadro-info-table thead tr {
    background: var(--bg-sidebar);
    color: #fff;
}
.cuadro-info-table thead th {
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    border: none;
    color: #fff;
    background: var(--bg-sidebar);
}
.cuadro-info-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.cuadro-info-table tbody tr:hover { background: var(--primary-bg); }
.cuadro-info-totals td {
    background: var(--border-light) !important;
    font-weight: 700;
}
.cuadro-info-box {
    padding: 12px;
    background: var(--info-bg);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text);
}

/* --- Cuadro responsive --- */
@media (max-width: 992px) {
    .cuadro-filters .filter-group { min-width: calc(50% - 12px); }
    .cuadro-stats { flex-direction: column; }
    :root {
        --cuadro-cell-size: 22px;
        --cuadro-emp-col-width: 160px;
    }
}
@media (max-width: 576px) {
    .cuadro-filters { flex-direction: column; align-items: stretch; }
    .cuadro-filters .filter-group { min-width: 100%; }
    :root {
        --cuadro-cell-size: 20px;
        --cuadro-emp-col-width: 120px;
    }
    .cuadro-stat-card { min-width: auto; flex: 1; }
}

/* --- Cuadro print --- */
@media print {
    .cuadro-filters, .cuadro-stats, .cuadro-legend, .cuadro-tabs,
    .sidebar, .topbar, .page-header { display: none !important; }
    .cuadro-tab-content { display: none !important; }
    .cuadro-tab-content.active { display: block !important; }
    .cuadro-scroll-wrapper { max-height: none; overflow: visible; }
    .cuadro-container { border: none; box-shadow: none; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0; max-width: none; }
    .cuadro-table { font-size: 8px; }
    .cuadro-day-cell,
    .cuadro-table thead tr.cuadro-days th {
        width: 16px !important;
        min-width: 16px !important;
        max-width: 16px !important;
    }
}

/* ── Timeline / Registro de presencia ────────────────────────── */
.timeline-container {
    font-size: 13px;
    min-width: 1200px;
}
.timeline-header {
    display: flex;
    align-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    border-radius: var(--radius) var(--radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 5;
}
.timeline-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    min-height: 32px;
    position: relative;
}
.timeline-row:hover {
    background: var(--bg-hover, rgba(0,0,0,0.02));
}
.timeline-totals {
    background: var(--bg);
    font-weight: 600;
}
.timeline-emp-header {
    padding: 10px 12px 4px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    margin-top: 8px;
}
.timeline-col.timeline-day {
    width: 90px;
    min-width: 90px;
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
}
.timeline-col.timeline-bars {
    flex: 1;
    display: flex;
    min-width: 0;
    height: 24px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    overflow: hidden;
}
.timeline-col.timeline-stat {
    width: 60px;
    min-width: 60px;
    text-align: center;
    padding: 4px 2px;
    font-size: 11px;
    border-left: 1px solid var(--border);
}
.timeline-bar {
    height: 100%;
    transition: opacity 0.2s;
}
.timeline-bar:hover {
    opacity: 0.8;
}
.timeline-bar-work {
    background: var(--success);
}
.timeline-bar-idle {
    background: transparent;
}
.timeline-hour-label {
    flex: 1;
    text-align: center;
    border-left: 1px solid rgba(255,255,255,0.2);
    padding: 4px 0;
    font-size: 10px;
}
.timeline-detail-btn {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}
.timeline-row:hover .timeline-detail-btn {
    opacity: 1;
}
.timeline-detail-btn:hover {
    color: var(--primary);
}

/* btn-icon for action buttons in tables */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 14px;
    color: var(--text-muted);
    border-radius: 4px;
    transition: all 0.15s;
}
.btn-icon:hover {
    background: var(--bg);
    color: var(--primary);
}
.btn-icon.text-danger:hover {
    color: var(--danger);
}
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* Table section row for jornadas */
.table-section td {
    background: var(--bg);
    padding: 8px 12px !important;
}
.table-totals td {
    background: var(--bg);
    border-top: 2px solid var(--border);
}

/* Dark theme adjustments */
[data-theme="dark"] .timeline-header { background: var(--primary-dark); }
[data-theme="dark"] .timeline-bar-idle { background: transparent; }
[data-theme="dark"] .timeline-row:hover { background: rgba(255,255,255,0.03); }

/* Dropdown menu (terminals) */
.dropdown-menu-custom {
    position: absolute;
    z-index: 100;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    padding: 4px 0;
}
.dropdown-menu-custom a {
    display: block;
    padding: 8px 14px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s;
}
.dropdown-menu-custom a:hover {
    background: var(--primary);
    color: #fff;
}
.dropdown-menu-custom a i {
    width: 18px;
    margin-right: 6px;
    text-align: center;
}

/* ============ THIN SCROLLBARS (global) ============ */
/* Webkit (Chrome, Edge, Safari) */
body ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
body ::-webkit-scrollbar-track {
    background: transparent;
}
body ::-webkit-scrollbar-thumb {
    background: #22d3ee;
    border-radius: 4px;
}
body ::-webkit-scrollbar-thumb:hover {
    background: #0891b2;
}
/* Firefox */
body * {
    scrollbar-width: thin;
    scrollbar-color: #22d3ee transparent;
}

/* ============ DASHBOARD SCROLLABLE CARDS ============ */
.card-body-scroll {
    max-height: 300px;
    overflow-y: auto !important;
    overflow-x: hidden;
}
.card-body-scroll .table-container {
    overflow: visible;
}

/* ============ PAGER COMPONENT ============ */
.pager-toolbar {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 8px;
}
.pager-select { width: auto; min-width: 60px; }
.pager-nav {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; padding: 10px 0 0;
}
.pager-nav button {
    min-width: 30px; height: 30px; padding: 0 6px;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text); border-radius: var(--radius);
    cursor: pointer; font-size: 12px;
}
.pager-nav button:hover:not(:disabled) { background: var(--primary-bg); border-color: var(--primary); }
.pager-nav button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager-nav button:disabled { opacity: 0.4; cursor: default; }

/* ============ DATATABLE COMPONENT ============ */
.dt-wrapper { font-size: 13px; }
.dt-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.dt-toolbar-left { display: flex; align-items: center; gap: 6px; }
.dt-select { width: auto; min-width: 60px; }
.dt-search { max-width: 220px; }
.dt-table-wrap { overflow-x: auto; }
.dt-table { width: 100%; border-collapse: collapse; }
.dt-table th, .dt-table td {
    padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border);
    font-size: 13px; white-space: nowrap;
}
.dt-table th {
    background: var(--bg); font-weight: 600; font-size: 12px;
    text-transform: uppercase; color: var(--text-secondary);
    user-select: none;
}
.dt-table th i { font-size: 10px; margin-left: 2px; }
.dt-table tbody tr:hover { background: var(--primary-bg); }
.dt-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; padding: 12px 0 0;
}
.dt-pagination button {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text); border-radius: var(--radius);
    cursor: pointer; font-size: 12px;
}
.dt-pagination button:hover:not(:disabled) { background: var(--primary-bg); border-color: var(--primary); }
.dt-pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dt-pagination button:disabled { opacity: 0.4; cursor: default; }

/* ============ COPILOT ============ */
/* Incident marks */
.cp-marca-entrada { display:inline-block; padding:2px 6px; border-radius:10px; font-size:11px; margin:1px; background:#d4edda; color:#155724; }
.cp-marca-salida  { display:inline-block; padding:2px 6px; border-radius:10px; font-size:11px; margin:1px; background:#f8d7da; color:#721c24; }
.cp-marca-pausa   { display:inline-block; padding:2px 6px; border-radius:10px; font-size:11px; margin:1px; background:#fff3cd; color:#856404; }
.cp-marca-nuevo    { outline:2px solid var(--success); outline-offset:1px; font-weight:bold; }
.cp-marca-nuevo small { color:var(--success); font-size:9px; }
.cp-marca-cambiado { outline:2px solid #ffc107; outline-offset:1px; font-weight:bold; }
.cp-marca-cambiado small { color:#e68a00; font-size:9px; }
.cp-marca-eliminado { text-decoration:line-through; opacity:0.5; background:#f5c6cb; }
.cp-marca-ignorado  { text-decoration:line-through; opacity:0.6; background:#e2e3e5; color:#6c757d; }

/* Cuadro grid */
.cp-cuadro { border-collapse:collapse; min-width:100%; }
.cp-cuadro th, .cp-cuadro td { border:1px solid var(--border); padding:3px 4px; vertical-align:top; text-align:center; font-size:11px; }
.cp-cuadro thead th { background:var(--primary); color:#fff; font-size:11px; font-weight:bold; padding:4px 2px; position:sticky; top:0; z-index:2; }
.cp-cuadro thead .cp-col-trab { z-index:4; }
.cp-cuadro .cp-dia-hdr { min-width:70px; width:70px; }
.cp-cuadro .cp-col-trab {
    position:sticky; left:0; z-index:2; background:var(--bg-card);
    min-width:150px; max-width:200px; text-align:left; font-weight:bold;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    border-right:2px solid var(--text-muted);
}
.cp-cuadro thead .cp-col-trab { background:var(--primary); color:#fff; z-index:3; }
.cp-cuadro .cp-col-total { min-width:55px; font-weight:bold; font-size:11px; vertical-align:middle; white-space:nowrap; border-left:2px solid var(--text-muted); }
.cp-cuadro thead .cp-col-total { background:var(--primary-dark); }
.cp-cuadro .cp-fila-diasem th { background:var(--bg); color:var(--text-secondary); font-size:10px; font-weight:normal; padding:2px; position:sticky; top:26px; z-index:2; }
.cp-cuadro .cp-fila-diasem .cp-col-trab { background:var(--bg); }
.cp-cuadro .cp-dia-cell { font-size:10px; line-height:1.4; padding:2px 3px; }
.cp-cuadro .cp-horario { color:var(--text-muted); font-size:9px; white-space:nowrap; }
.cp-cuadro .cp-marcajes { margin-top:1px; }
.cp-cuadro .cp-m-e { display:inline-block; padding:0 3px; border-radius:6px; font-size:9px; background:#d4edda; color:#155724; }
.cp-cuadro .cp-m-s { display:inline-block; padding:0 3px; border-radius:6px; font-size:9px; background:#f8d7da; color:#721c24; }
.cp-cuadro .cp-m-p { display:inline-block; padding:0 3px; border-radius:6px; font-size:9px; background:#fff3cd; color:#856404; }
.cp-dia-fs { background:var(--bg) !important; }
.cp-dia-fest { background:#fff8f0 !important; }
.cp-dia-incid { background:#fff3f3 !important; }
.cp-dia-vacio { background:var(--bg-card) !important; }
.cp-dia-permiso { background:#edf7ff !important; }
.cp-tag-permiso { background:var(--primary); color:#fff; padding:0 4px; border-radius:6px; font-size:8px; font-weight:bold; }
.cp-tag-fs { background:var(--text-muted); color:#fff; padding:0 4px; border-radius:6px; font-size:8px; font-weight:bold; }
.cp-tag-fest { background:#e83e8c; color:#fff; padding:0 4px; border-radius:6px; font-size:8px; font-weight:bold; }
[data-theme="dark"] .cp-cuadro .cp-col-trab { background:var(--bg-card); }
[data-theme="dark"] .cp-dia-fest { background:#3d2a1a !important; }
[data-theme="dark"] .cp-dia-incid { background:#3d1a1a !important; }

/* ============ REPORTS MODULE ============ */
.report-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.report-table th {
    background: var(--primary);
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.report-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.report-table tbody tr:hover {
    background: var(--primary-bg);
}
.report-table tfoot td {
    background: var(--bg);
    border-top: 2px solid var(--primary);
    padding: 8px 12px;
    font-weight: 600;
}

/* Print-specific for reports */
@media print {
    .sidebar, .topbar, #reportFilters, #reportCards,
    .page-header, .card-header button, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    #reportResult { display: block !important; box-shadow: none !important; border: none !important; }
    #reportResult .card-header { border-bottom: 2px solid #333; padding: 8px 0; }
    #reportResult .card-header h3 { display: block !important; font-size: 18px; }
    .report-table th { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-table { font-size: 10px; }
    .report-table td, .report-table th { padding: 4px 6px; }
}
