/* ============================================
   ROOMONITOR DASHBOARD — Estilos corporativos
   ============================================ */

/* === Variables CSS === */
:root {
    --primary: #1B2A4A;
    --secondary: #2E86DE;
    --accent: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --text-tertiary: #BDC3C7;
    --border: #E1E8ED;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --header-height: 0px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

/* === Reset y base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

a {
    color: var(--secondary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.logo-img {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: var(--transition);
}

.sidebar.collapsed .logo-img {
    height: 24px;
    width: 24px;
    object-fit: cover;
    object-position: left;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    font-size: 0.9rem;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.nav-item.active {
    color: #fff;
    background: var(--secondary);
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .user-info span {
    display: none;
}

.nav-item.logout {
    color: rgba(255, 255, 255, 0.5);
}

.nav-item.logout:hover {
    color: var(--danger);
    background: rgba(231, 76, 60, 0.15);
}

/* === Contenido principal === */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    transition: var(--transition);
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

.main-content-full {
    margin-left: 0;
    width: 100%;
}

.dashboard-container {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* === Encabezado de página === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === Barra de filtros === */
.filters-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.filters-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

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

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-left: auto;
}

/* === Formularios === */
.form-control {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46, 134, 222, 0.15);
}

.form-select-multi {
    min-width: 140px;
    min-height: 36px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-error {
    display: block;
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* === Botones === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--secondary);
    color: #fff;
}

.btn-primary:hover {
    background: #2578c5;
}

.btn-success {
    background: var(--accent);
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d68910;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-outline {
    background: transparent;
    color: var(--secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--secondary);
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* === Tarjetas === */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

.card-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.card-half {
    flex: 1;
    margin-bottom: 0;
}

/* === KPI Cards === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.kpi-blue::before { background: var(--secondary); }
.kpi-green::before { background: var(--accent); }
.kpi-red::before { background: var(--danger); }
.kpi-orange::before { background: var(--warning); }
.kpi-purple::before { background: #8E44AD; }
.kpi-teal::before { background: #1ABC9C; }

.kpi-icon {
    margin-bottom: 8px;
}

.kpi-blue .kpi-icon svg { stroke: var(--secondary); }
.kpi-green .kpi-icon svg { stroke: var(--accent); }
.kpi-red .kpi-icon svg { stroke: var(--danger); }
.kpi-orange .kpi-icon svg { stroke: var(--warning); }
.kpi-purple .kpi-icon svg { stroke: #8E44AD; }
.kpi-teal .kpi-icon svg { stroke: #1ABC9C; }

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-pct {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* === KPI Devoluciones (inline dentro de No Atendidas) === */
.kpi-devolucion-inline {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.kpi-devolucion-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
    background: #eee;
}

.kpi-dev-segment {
    height: 100%;
    transition: width 0.3s ease;
    min-width: 0;
}

.kpi-dev-green { background: #27AE60; }
.kpi-dev-orange { background: #F39C12; }
.kpi-dev-red { background: #E74C3C; }

.kpi-devolucion-detail {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 4px;
}

.kpi-dev-item {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.kpi-dev-item::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kpi-dev-item-green { color: #1E8449; }
.kpi-dev-item-green::before { background: #27AE60; }
.kpi-dev-item-orange { color: #B7950B; }
.kpi-dev-item-orange::before { background: #F39C12; }
.kpi-dev-item-red { color: #C0392B; }
.kpi-dev-item-red::before { background: #E74C3C; }

.kpi-dev-item small {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* === KPI Card Links (clickables) === */
.kpi-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.kpi-card-link .kpi-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card-link:hover .kpi-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* === GAP inline badges (calls list) === */
.gap-inline {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.gap-inline-ok {
    background: rgba(39, 174, 96, 0.15);
    color: #1E8449;
}

.gap-inline-late {
    background: rgba(231, 76, 60, 0.15);
    color: #C0392B;
}

/* === Tablas === */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(46, 134, 222, 0.04);
}

/* Filas con estilos especiales para tramos */
.row-empty {
    background: #F8F9FA;
    color: #CCC;
}

.row-empty:hover {
    background: #F0F1F3 !important;
}

.row-danger {
    background: #FDEDEC;
}

.row-success {
    background: #EAFAF1;
}

.row-total {
    background: rgba(46, 134, 222, 0.08) !important;
}

.row-total td {
    border-top: 2px solid var(--secondary);
    border-bottom: none;
}

.cell-tramo {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}

/* Barra de progreso dentro de celda */
.progress-cell {
    position: relative;
    background: var(--bg);
    border-radius: 4px;
    height: 22px;
    overflow: hidden;
    min-width: 80px;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(39, 174, 96, 0.15);
    color: #1e8449;
}

.badge-danger {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: #b7950b;
}

.badge-info {
    background: rgba(46, 134, 222, 0.15);
    color: #2471a3;
}

.badge-primary {
    background: rgba(27, 42, 74, 0.15);
    color: var(--primary);
}

.badge-secondary {
    background: rgba(127, 140, 141, 0.15);
    color: var(--text-secondary);
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* === Matching stats === */
.match-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 12px;
}

.match-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
}

.match-unlinked {
    color: var(--warning);
    opacity: 0.7;
}

/* === Agent detail === */
.agent-detail-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.day-card { margin-bottom: 12px; }

.day-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
}

.day-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.day-date { font-weight: 700; }

.day-summary {
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.timeline-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 10px;
    border-radius: 2px;
}

/* === Shift timeline bar === */
.shift-timeline {
    position: relative;
    height: 52px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.tl-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
    z-index: 1;
}

.tl-tick-label {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tl-bar {
    position: absolute;
    border-radius: 3px;
}

.tl-planned {
    top: 4px;
    height: 16px;
    background: rgba(46, 134, 222, 0.3);
    border: 1px solid rgba(46, 134, 222, 0.6);
    z-index: 2;
}

.tl-actual {
    top: 22px;
    height: 16px;
    background: rgba(39, 174, 96, 0.35);
    border: 1px solid rgba(39, 174, 96, 0.6);
    z-index: 2;
}

.tl-call {
    position: absolute;
    top: 40px;
    height: 8px;
    background: #E67E22;
    border-radius: 1px;
    z-index: 3;
    min-width: 2px;
}

.kpi-orange { border-left: 4px solid #E67E22; }
.kpi-orange .kpi-icon { color: #E67E22; }

/* === Gráficos === */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.chart-container-small {
    height: 280px;
}

/* === Autenticación === */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-img {
    height: 36px;
    width: auto;
}

.auth-title {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === Subida de archivos === */
.upload-card {
    max-width: 700px;
    margin: 0 auto 24px;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 16px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--secondary);
    background: rgba(46, 134, 222, 0.04);
}

.upload-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-top: 12px;
}

.upload-link {
    color: var(--secondary);
    cursor: pointer;
    font-weight: 500;
}

.upload-link:hover {
    text-decoration: underline;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.upload-input {
    display: none;
}

.upload-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(39, 174, 96, 0.08);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-weight: 500;
    color: var(--accent);
}

.btn-remove-file {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
}

.progress-container {
    margin-bottom: 16px;
}

.progress-bar-upload {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--secondary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
    animation: progress-indeterminate 1.5s infinite ease-in-out;
}

@keyframes progress-indeterminate {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.columns-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.columns-list code {
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary);
    border: 1px solid var(--border);
}

/* === Alertas === */
.alert {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.alert-warning {
    background: rgba(243, 156, 18, 0.12);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.alert-icon {
    flex-shrink: 0;
    color: var(--warning);
}

.alert-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.alert-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === Solapamiento === */
.overlap-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.summary-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.overlap-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 32px 0;
}

/* === Batch detail === */
.batch-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.batch-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.batch-info-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.batch-info-item .value {
    font-weight: 500;
    color: var(--text-primary);
}

.batch-info-full {
    grid-column: 1 / -1;
}

/* === Paginación === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* === Toast notifications === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    animation: toast-in 0.3s ease;
    max-width: 400px;
    font-size: 0.9rem;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-success {
    background: #27AE60;
    color: #fff;
}

.toast-danger {
    background: #E74C3C;
    color: #fff;
}

.toast-warning {
    background: #F39C12;
    color: #fff;
}

.toast-info {
    background: #2E86DE;
    color: #fff;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    margin-left: auto;
    padding: 0;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* === Estado vacío === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 16px;
}

/* === Acciones en tabla === */
.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* === Utilidades === */
.text-muted {
    color: var(--text-secondary);
}

/* === Custom Filter Dropdowns === */
.filter-dropdown-group {
    position: relative;
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 130px;
    cursor: pointer;
    background: var(--card-bg);
    white-space: nowrap;
}

.filter-dropdown-toggle svg {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.filter-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 6px 0;
}

.filter-dropdown-panel.open {
    display: block;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

.filter-checkbox-item:hover {
    background: var(--bg);
}

.filter-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.filter-checkbox-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Filter Chips === */
.filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.filter-chips-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(46, 134, 222, 0.1);
    color: var(--secondary);
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.chip-remove {
    background: none;
    border: none;
    color: var(--secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.chip-remove:hover {
    opacity: 1;
    color: var(--danger);
}

.filter-clear-all {
    margin-left: auto;
    font-size: 0.75rem;
}

/* === Ranking Table === */
.ranking-table td:first-child {
    text-align: center;
    width: 48px;
    font-weight: 600;
}

.ranking-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.ranking-medal-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
}

.ranking-medal-2 {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    box-shadow: 0 2px 6px rgba(192, 192, 192, 0.4);
}

.ranking-medal-3 {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    box-shadow: 0 2px 6px rgba(205, 127, 50, 0.4);
}

.ranking-top {
    background: rgba(39, 174, 96, 0.06);
}

.ranking-bottom {
    background: rgba(231, 76, 60, 0.06);
}

.cell-agent-name {
    font-weight: 500;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Minutes bar inside ranking */
.minutes-bar-cell {
    position: relative;
    background: var(--bg);
    border-radius: 4px;
    height: 22px;
    overflow: hidden;
    min-width: 120px;
}

.minutes-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(46, 134, 222, 0.3), rgba(46, 134, 222, 0.6));
    transition: width 0.5s ease;
}

.minutes-label {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* === Agent Detail === */
.agent-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.agent-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.tramo-link {
    text-decoration: none;
    display: block;
}

.tramo-link .progress-cell {
    cursor: pointer;
    transition: opacity 0.2s;
}

.tramo-link:hover .progress-cell {
    opacity: 0.8;
}

.tramo-link:hover .progress-bar {
    filter: brightness(1.1);
}

.agent-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.agent-stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 16px;
    text-align: center;
    border-top: 3px solid var(--secondary);
}

.agent-stat-card.agent-stat-success {
    border-top-color: #27AE60;
}

.agent-stat-card.agent-stat-danger {
    border-top-color: #E74C3C;
}

.agent-stat-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.agent-stat-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recording-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(46, 134, 222, 0.1);
    color: var(--secondary);
    transition: all 0.2s;
}

.recording-link:hover {
    background: var(--secondary);
    color: #fff;
}

/* === Devolución de llamadas === */
.devolucion-cell {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.88em;
}

a.devolucion-cell {
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s, box-shadow 0.15s;
}

a.devolucion-cell:hover {
    filter: brightness(0.9);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.devolucion-green {
    background: rgba(39, 174, 96, 0.35);
    color: #145a32;
}

.devolucion-orange {
    background: rgba(243, 156, 18, 0.40);
    color: #7d5a00;
}

.devolucion-red {
    background: rgba(231, 76, 60, 0.35);
    color: #922b21;
}

.devolucion-legend {
    display: flex;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.devolucion-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.devolucion-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.devolucion-dot.devolucion-green {
    background: #1e8449;
}

.devolucion-dot.devolucion-orange {
    background: #d68910;
}

.devolucion-dot.devolucion-red {
    background: #c0392b;
}

/* === GAP Timeline === */
.gap-card {
    border-left: 4px solid var(--secondary);
}

.gap-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 0;
}

.gap-point {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.gap-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gap-icon-red {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.gap-icon-green {
    background: rgba(39, 174, 96, 0.15);
    color: #1e8449;
}

.gap-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gap-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.gap-time {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gap-connector {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 80px;
    margin: 0 12px;
}

.gap-line {
    flex: 1;
    height: 0;
    border-top: 2px solid;
}

.gap-line-green {
    border-color: #27AE60;
}

.gap-line-red {
    border-color: #E74C3C;
}

.gap-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.gap-badge-green {
    background: rgba(39, 174, 96, 0.15);
    color: #145a32;
    border: 2px solid #27AE60;
}

.gap-badge-red {
    background: rgba(231, 76, 60, 0.15);
    color: #922b21;
    border: 2px solid #E74C3C;
}

/* === Responsive === */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .kpi-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .agent-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .sidebar .nav-item span,
    .sidebar .user-info span {
        display: none;
    }
    .sidebar .logo-img {
        height: 24px;
        width: 24px;
        object-fit: cover;
        object-position: left;
    }
    .main-content {
        margin-left: var(--sidebar-collapsed);
    }

    .card-row {
        flex-direction: column;
    }

    .filters-form {
        gap: 10px;
    }

    .overlap-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .batch-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-grid,
    .kpi-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .agent-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-container {
        padding: 16px;
    }

    .filters-form {
        flex-direction: column;
    }

    .filter-actions {
        margin-left: 0;
        width: 100%;
    }

    .filter-actions .btn {
        flex: 1;
    }
}

/* =============================================
   Peak Analysis — Heatmap
   ============================================= */

.heatmap-table {
    border-collapse: separate;
    border-spacing: 3px;
    width: 100%;
    margin-top: 8px;
}

.heatmap-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heatmap-hour {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    padding: 6px 10px;
    text-align: right;
    white-space: nowrap;
}

.heatmap-cell {
    text-align: center;
    padding: 8px 4px;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 48px;
    border-radius: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: default;
}

.heatmap-cell:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
    position: relative;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
}

.heatmap-gradient {
    width: 200px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right,
        hsl(200, 80%, 90%),
        hsl(150, 80%, 75%),
        hsl(60, 80%, 65%),
        hsl(30, 80%, 60%),
        hsl(0, 80%, 50%)
    );
}

/* Season filter chips */
.season-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.season-chip {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.season-chip:hover {
    background: rgba(46, 134, 222, 0.1);
    color: var(--secondary);
    border-color: var(--secondary);
}

.season-chip.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* Queue analysis table row colors */
.queue-ok {
    background-color: rgba(39, 174, 96, 0.08) !important;
}

.queue-warn {
    background-color: rgba(243, 156, 18, 0.08) !important;
}

.queue-bad {
    background-color: rgba(231, 76, 60, 0.08) !important;
}

/* Progress bars for hot periods */
.progress-cell {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.progress-green {
    background: linear-gradient(90deg, #27AE60, #2ECC71);
}

.progress-orange {
    background: linear-gradient(90deg, #F39C12, #E67E22);
}

.progress-red {
    background: linear-gradient(90deg, #E74C3C, #C0392B);
}

/* Responsive heatmap */
@media (max-width: 768px) {
    .heatmap-cell {
        font-size: 0.7rem;
        padding: 5px 2px;
        min-width: 36px;
    }
    .heatmap-hour {
        font-size: 0.7rem;
        padding: 4px 6px;
    }
}
