@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Theme Light (Default) */
    --bg-app: #f4f7fc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(226, 232, 240, 0.8);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Brand Accents */
    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-primary-glow: rgba(79, 70, 229, 0.15);
    
    /* Status Colors */
    --color-na: #64748b;
    --color-na-bg: rgba(100, 116, 139, 0.1);
    --color-na-border: rgba(100, 116, 139, 0.2);
    
    --color-iniciando: #3b82f6;
    --color-iniciando-bg: rgba(59, 130, 246, 0.1);
    --color-iniciando-border: rgba(59, 130, 246, 0.2);
    
    --color-proceso: #f59e0b;
    --color-proceso-bg: rgba(245, 158, 11, 0.1);
    --color-proceso-border: rgba(245, 158, 11, 0.2);
    
    --color-finalizado: #10b981;
    --color-finalizado-bg: rgba(16, 185, 129, 0.1);
    --color-finalizado-border: rgba(16, 185, 129, 0.2);

    /* Glassmorphism Details */
    --glass-blur: blur(12px);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px -2px rgba(148, 163, 184, 0.12), 0 2px 8px -1px rgba(148, 163, 184, 0.08);
    --shadow-lg: 0 20px 25px -5px rgba(148, 163, 184, 0.15), 0 10px 10px -5px rgba(148, 163, 184, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Theme Dark */
    --bg-app: #080c14;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-card-hover: rgba(15, 23, 42, 0.9);
    --border-color: rgba(51, 65, 85, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Brand Accents */
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-primary-glow: rgba(99, 102, 241, 0.25);
    
    /* Status Colors */
    --color-na: #475569;
    --color-na-bg: rgba(71, 85, 105, 0.2);
    --color-na-border: rgba(71, 85, 105, 0.3);
    
    --color-iniciando: #60a5fa;
    --color-iniciando-bg: rgba(96, 165, 250, 0.15);
    --color-iniciando-border: rgba(96, 165, 250, 0.3);
    
    --color-proceso: #fbbf24;
    --color-proceso-bg: rgba(251, 191, 36, 0.15);
    --color-proceso-border: rgba(251, 191, 36, 0.3);
    
    --color-finalizado: #34d399;
    --color-finalizado-bg: rgba(52, 211, 153, 0.15);
    --color-finalizado-border: rgba(52, 211, 153, 0.3);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.8);
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
    padding: 24px;
}

/* Header & Container Layout */
.app-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo-container {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px var(--accent-primary-glow);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    color: white;
}

.brand-info h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Styled Button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px var(--accent-primary-glow);
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    transform: translateY(-1px);
}

.btn-icon-only {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-only:hover {
    background-color: var(--border-color);
    transform: scale(1.05);
}

/* KPIs Section */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-primary);
}

.kpi-card.kpi-finalizado::before { background: var(--color-finalizado); }
.kpi-card.kpi-proceso::before { background: var(--color-proceso); }
.kpi-card.kpi-pendiente::before { background: var(--color-iniciando); }

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.kpi-content h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--color-na-bg);
    color: var(--text-secondary);
}

.kpi-finalizado .kpi-icon-wrapper {
    background: var(--color-finalizado-bg);
    color: var(--color-finalizado);
}

.kpi-proceso .kpi-icon-wrapper {
    background: var(--color-proceso-bg);
    color: var(--color-proceso);
}

.kpi-pendiente .kpi-icon-wrapper {
    background: var(--color-iniciando-bg);
    color: var(--color-iniciando);
}

/* Dashboard Analytics Row */
.analytics-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-width: 0;
}

@media (max-width: 1024px) {
    .analytics-section {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 320px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
    height: 240px;
    min-width: 0;
    min-height: 0;
}

/* Filter & Search Bar */
.controls-bar {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.filters-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 11px 16px;
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 160px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* Data Table Panel */
.table-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-header-row {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.table-title h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.table-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead {
    background-color: rgba(148, 163, 184, 0.04);
    border-bottom: 1px solid var(--border-color);
}

th {
    padding: 16px 20px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: rgba(148, 163, 184, 0.03);
}

td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.td-id {
    font-weight: 700;
    color: var(--text-secondary);
    width: 60px;
}

.td-cliente {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 140px;
}

.tag-entrada {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background-color: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.td-responsable {
    font-weight: 600;
    color: var(--text-primary);
}

.responsable-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-primary-glow);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* Interactive LED Status Dots */
.status-cell {
    text-align: center;
    position: relative;
    cursor: pointer;
}

.led-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.led-dot::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: var(--transition);
}

/* Status specific layouts */
.led-na {
    background-color: var(--color-na-bg);
    border: 1px solid var(--color-na-border);
}
.led-na::after {
    background-color: var(--color-na);
}

.led-iniciando {
    background-color: var(--color-iniciando-bg);
    border: 1px solid var(--color-iniciando-border);
}
.led-iniciando::after {
    background-color: var(--color-iniciando);
    box-shadow: 0 0 8px var(--color-iniciando);
}

.led-proceso {
    background-color: var(--color-proceso-bg);
    border: 1px solid var(--color-proceso-border);
}
.led-proceso::after {
    background-color: var(--color-proceso);
    box-shadow: 0 0 8px var(--color-proceso);
}

.led-finalizado {
    background-color: var(--color-finalizado-bg);
    border: 1px solid var(--color-finalizado-border);
}
.led-finalizado::after {
    background-color: var(--color-finalizado);
    box-shadow: 0 0 8px var(--color-finalizado);
}

.led-dot:hover {
    transform: scale(1.2);
}

.actions-cell {
    white-space: nowrap;
    text-align: right;
}

.btn-table-action {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-table-action:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-table-action.delete:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Table Footer / Pagination */
.table-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    gap: 6px;
}

.page-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.page-btn:hover {
    background-color: var(--border-color);
}

.page-btn.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Slide-out Drawer Panel for Create / Edit (Extremely Premium!) */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: flex-end;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 100vh;
    background-color: var(--bg-app);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.drawer form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}


.drawer-overlay.active .drawer {
    transform: translateX(0);
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.drawer-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.drawer-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-card);
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    padding: 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* Form Stages Matrix Grid */
.stages-form-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.stage-form-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.stage-form-item span {
    font-size: 14px;
    font-weight: 600;
}

.status-selector {
    display: flex;
    gap: 6px;
}

.status-pill-opt {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.status-pill-opt:hover {
    transform: scale(1.1);
}

.status-pill-opt.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

/* Elegant Popover Menu for Quick Status Updates */
.popover-menu {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    min-width: 160px;
    animation: fadeIn 0.15s ease-out;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
}

.popover-item:hover {
    background-color: var(--border-color);
}

.popover-item .item-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(-5px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transform: translateY(100px);
    opacity: 0;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border-left: 4px solid var(--accent-primary);
}

.toast.success { border-left-color: var(--color-finalizado); }
.toast.info { border-left-color: var(--color-iniciando); }
.toast.error { border-left-color: #ef4444; }

@keyframes slideIn {
    to { transform: translateY(0); opacity: 1; }
}

/* Grid Legend on top of Table */
.legend-section {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
}

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

.legend-dot-preview {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    position: relative;
}

.legend-dot-preview::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* Expandable Comment Rows Styling */
.comment-row {
    display: none;
    background-color: rgba(148, 163, 184, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.comment-row.expanded {
    display: table-row;
    animation: slideDownComment 0.25s ease-out;
}

.comment-expanded-content {
    padding: 16px 24px 20px 24px;
    font-size: 13px;
    border-left: 4px solid var(--accent-primary);
    margin: 4px 24px 12px 24px;
    background-color: rgba(148, 163, 184, 0.04);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.comment-expanded-content strong {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.comment-expanded-content p {
    line-height: 1.6;
    white-space: pre-line; /* Mantiene los saltos de línea */
}

/* Indicador de Comentarios en Fila Principal */
.tr-main {
    cursor: pointer;
}

.tr-main:hover {
    background-color: rgba(148, 163, 184, 0.04);
}

.comment-indicator-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.comment-indicator-badge:hover {
    transform: scale(1.2);
}

@keyframes slideDownComment {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Timeline Estético en Detalles */
.timeline-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
}

.timeline-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline {
    position: relative;
    margin: 8px 0 16px 12px;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-item {
    position: relative;
}

.timeline-badge {
    position: absolute;
    left: -27px;
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-app);
    background-color: var(--text-muted);
    transition: var(--transition);
}

.timeline-badge.led-na { background-color: var(--color-na); box-shadow: 0 0 6px var(--color-na); }
.timeline-badge.led-iniciando { background-color: var(--color-iniciando); box-shadow: 0 0 6px var(--color-iniciando); }
.timeline-badge.led-proceso { background-color: var(--color-proceso); box-shadow: 0 0 6px var(--color-proceso); }
.timeline-badge.led-finalizado { background-color: var(--color-finalizado); box-shadow: 0 0 6px var(--color-finalizado); }

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.timeline-stage {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
}

.timeline-status {
    font-size: 11px;
    color: var(--text-secondary);
}

.timeline-time {
    font-size: 10px;
    color: var(--text-muted);
}

/* Evidencias en Detalles */
.evidence-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
}

.evidence-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

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

.evidence-item-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
}

.evidence-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 16 / 10;
    background-color: rgba(148,163,184,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.evidence-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.evidence-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.evidence-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.evidence-delete-btn:hover {
    background-color: rgb(220, 38, 38);
    transform: scale(1.1);
}

/* Upload Evidence Button Placeholder */
.evidence-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    aspect-ratio: 16 / 10;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 10px;
    transition: var(--transition);
    gap: 4px;
    background-color: rgba(148,163,184,0.02);
}

.evidence-upload-label:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background-color: var(--accent-primary-glow);
}

.evidence-upload-label span {
    font-size: 16px;
}

/* Selector de Tamaño de Página en el Footer */
.table-footer-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-size-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.page-size-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: var(--transition);
}

.page-size-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.page-size-custom-input {
    width: 45px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    text-align: center;
    transition: var(--transition);
}

.page-size-custom-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Modal Lightbox para ver evidencias */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    border: 1px solid var(--border-color);
}

.lightbox-caption {
    color: white;
    font-size: 14px;
    font-family: var(--font-heading);
    text-align: center;
    font-weight: 500;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    transition: var(--transition);
}

.lightbox-close:hover {
    transform: scale(1.1);
    color: var(--color-proceso);
}

/* Reporte de Impresión PDF */
@media print {
    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .app-container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    /* Ocultar elementos de navegación y control */
    header, 
    .controls-bar,
    .actions-cell,
    .table-footer,
    #popoverMenu,
    #toastContainer,
    #drawerOverlay,
    #themeToggle {
        display: none !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 24px !important;
    }

    .kpi-card {
        background: white !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        color: black !important;
        border-radius: 6px !important;
    }

    .kpi-value {
        color: black !important;
    }

    .analytics-section {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        page-break-after: always;
    }

    .chart-card {
        background: white !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        border-radius: 6px !important;
        color: black !important;
    }

    .table-card {
        background: white !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        border-radius: 6px !important;
        color: black !important;
        margin-top: 0 !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    th {
        background-color: #f1f5f9 !important;
        color: #1e293b !important;
        border-bottom: 2px solid #cbd5e1 !important;
        font-weight: bold !important;
    }

    td {
        border-bottom: 1px solid #e2e8f0 !important;
        color: black !important;
    }

    .led-dot {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-shadow: none !important;
        border: 1px solid #64748b !important;
    }

    .led-na { background-color: #e2e8f0 !important; }
    .led-iniciando { background-color: #3b82f6 !important; }
    .led-proceso { background-color: #f59e0b !important; }
    .led-finalizado { background-color: #10b981 !important; }

    .comment-row {
        display: table-row !important;
        background-color: #f8fafc !important;
    }

    .comment-expanded-content {
        border-left: 4px solid #4f46e5 !important;
        background-color: #f1f5f9 !important;
        margin: 10px 20px !important;
        padding: 12px 16px !important;
    }
}

.clickable-filter {
    cursor: pointer;
    transition: var(--transition);
}

.clickable-filter:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    opacity: 0.9;
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Efecto de difuminado y bloqueo para usuarios no autenticados */
.auth-blurred {
    filter: blur(12px) grayscale(20%);
    pointer-events: none;
    user-select: none;
    transition: filter 0.4s ease;
}

.dropdown-item-btn:hover {
    background-color: var(--border-color) !important;
}

/* Dropdown de exportación: estilos sólidos sin backdrop-filter para evitar 
   problemas de stacking context con el header */
.dropdown-export-content {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12) !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Tema oscuro: fondo explícito para máximo contraste */
[data-theme="dark"] .dropdown-export-content {
    background: #1e293b !important;
    border-color: rgba(51, 65, 85, 0.8) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4) !important;
}

.dropdown-export-content.active {
    display: flex !important;
}




