﻿:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1e293b;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, #0f172a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.sidebar .logo {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar .logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.sidebar .logo h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.menu {
    flex: 1;
    padding: 1rem 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.menu-item.has-submenu {
    position: relative;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.menu-item.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: white;
    border-left-color: var(--primary-color);
}

.menu-item i {
    font-size: 1.25rem;
    width: 24px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.user-info i {
    font-size: 2rem;
    color: var(--primary-color);
}

.user-info div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-info strong {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateX(2px);
}

.btn-logout i {
    font-size: 1.125rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-section h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-bar {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.search-bar i {
    color: var(--text-secondary);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
}

.filters-panel {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.filters-panel select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    min-width: 150px;
}

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.table-container {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: var(--bg-primary);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.data-table td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: #f1f5f9;
}

.data-table td.loading {
    text-align: center;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

.info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 0.375rem;
}

.info-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.info-item p {
    font-size: 0.9375rem;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.document-card h3 {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-info h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.document-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}
/* ==================== DASHBOARD ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-primary { border-left-color: #2563eb; }
.stat-success { border-left-color: #10b981; }
.stat-warning { border-left-color: #f59e0b; }
.stat-info    { border-left-color: #6366f1; }
.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.stat-primary .stat-icon { background: linear-gradient(135deg, #2563eb, #1e40af); color: white; }
.stat-success .stat-icon { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.stat-warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.stat-info    .stat-icon { background: linear-gradient(135deg, #6366f1, #4f46e5); color: white; }
.stat-content { flex: 1; }
.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.1rem;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.stat-footer i { color: var(--success-color); }
.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (max-width: 1200px) {
    .dashboard-content { grid-template-columns: 1fr; }
}
.dashboard-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-body {
    padding: 1.5rem;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary-color);
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: #e0e7ff;
    transform: translateX(4px);
}

.activity-item.documento {
    border-left-color: var(--success-color);
}

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

.activity-item .activity-icon {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.activity-item.documento .activity-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.activity-info {
    flex: 1;
    min-width: 0;
}

.activity-info h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Estados Panel */
.estados-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.estado-item {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.estado-item:hover {
    border-color: currentColor;
    transform: translateY(-2px);
}

.estado-activo {
    color: #10b981;
}

.estado-proceso {
    color: #f59e0b;
}

.estado-cerrado {
    color: #6366f1;
}

.estado-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: currentColor;
    color: white;
    opacity: 0.9;
}

.estado-content {
    flex: 1;
}

.estado-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.estado-valor {
    font-size: 1.75rem;
    font-weight: 700;
    color: currentColor;
}

/* Chart Container */
#chartTipos {
    max-height: 300px;
}

/* Fecha Actual */
#fechaActual {
    font-weight: 500;
}

/* Scrollbar Personalizado */
.activity-list::-webkit-scrollbar {
    width: 6px;
}

.activity-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

.activity-list::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

.activity-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
/* ==================== SEGUIMIENTO Y TIMELINE ==================== */

.seguimiento-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

@media (max-width: 1200px) {
    .seguimiento-container {
        grid-template-columns: 1fr;
    }
}

.seguimiento-form-container {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 0.75rem;
    height: fit-content;
    position: sticky;
    top: 1rem;
}

.seguimiento-form-container h3 {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check input[type="checkbox"] {
    width: auto;
}

.form-check label {
    margin-bottom: 0;
    font-weight: normal;
}

.timeline-container {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
}

.timeline-container h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--bg-primary);
}

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

/* Timeline Visual */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
    padding-left: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
    z-index: 1;
}

.timeline-item.historial::before {
    border-color: var(--secondary-color);
}

.timeline-item.agenda::before {
    border-color: var(--success-color);
}

.timeline-item.aviso::before {
    border-color: #f59e0b;
}

.timeline-item.termino::before {
    border-color: var(--danger-color);
}

.timeline-item.pendiente::before {
    background: #fef3c7;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.timeline-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.timeline-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.timeline-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-type {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.timeline-type.historial {
    background: #e2e8f0;
    color: #475569;
}

.timeline-type.agenda {
    background: #d1fae5;
    color: #065f46;
}

.timeline-type.aviso {
    background: #fef3c7;
    color: #92400e;
}

.timeline-type.termino {
    background: #fee2e2;
    color: #991b1b;
}

.timeline-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.timeline-meta i {
    margin-right: 0.25rem;
}

.timeline-description {
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.timeline-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.timeline-user {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.timeline-actions {
    display: flex;
    gap: 0.5rem;
}

.badge-pendiente {
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-interno {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}
/* ==================== AGENDA PERSONAL ==================== */

.agenda-user-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agenda-user-selector label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.agenda-user-selector input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    min-width: 200px;
}

.agenda-user-selector {
    background: white;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}
.agenda-resumen {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.resumen-card {
    background: white;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid transparent;
}
.resumen-card.urgente { border-left-color: #ef4444; }
.resumen-card.hoy     { border-left-color: #f59e0b; }
.resumen-card.semana  { border-left-color: #3b82f6; }
.resumen-card.mes     { border-left-color: #8b5cf6; }
.resumen-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.resumen-card.urgente .resumen-icon { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.resumen-card.hoy     .resumen-icon { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.resumen-card.semana  .resumen-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; }
.resumen-card.mes     .resumen-icon { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; }
.resumen-content { flex: 1; }
.resumen-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.1rem;
}
.resumen-valor {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}
.agenda-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    background: white;
    border-bottom: 2px solid var(--border-color);
    padding: 0 0.5rem;
    box-shadow: var(--shadow-sm);
}
.agenda-tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: -2px;
    border-radius: 0;
}
.agenda-tab-btn:hover {
    color: var(--primary-color);
    background: rgba(59,130,246,0.04);
}
.agenda-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
    background: transparent;
}
.agenda-content {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.agenda-lista {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agenda-tarea {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease;
    border-left: 3px solid var(--primary-color);
}
.agenda-tarea:first-child { border-radius: 6px 6px 0 0; }
.agenda-tarea:last-child  { border-radius: 0 0 6px 6px; border-bottom: none; }
.agenda-tarea:hover { background: #f8fafc; }
.agenda-tarea.atrasada { border-left-color: #ef4444; background: #fff8f8; }
.agenda-tarea.atrasada:hover { background: #fef2f2; }
.agenda-tarea.hoy { border-left-color: #f59e0b; background: #fffdf5; }
.agenda-tarea.termino { border-left-color: #ef4444; }
.agenda-checkbox { flex-shrink: 0; }
.agenda-checkbox input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }
.agenda-tarea-content { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agenda-tarea-hora { font-size: 12px; font-weight: 700; color: #2563eb; min-width: 38px; flex-shrink: 0; }
.agenda-tarea-titulo { font-weight: 600; font-size: 13px; color: var(--text-primary); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; flex-shrink: 0; }
.agenda-tarea-titulo:hover { color: var(--primary-color); }
.agenda-tarea-desc { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.agenda-tarea-usuario { font-size: 11px; color: #64748b; white-space: nowrap; flex-shrink: 0; }
.agenda-tarea-usuario i { margin-right: 3px; }
.agenda-tarea-tipo { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; flex-shrink: 0; text-transform: uppercase; }
.agenda-tarea-tipo.agenda  { background: #d1fae5; color: #065f46; }
.agenda-tarea-tipo.termino { background: #fee2e2; color: #991b1b; }
.agenda-tarea-tipo.aviso   { background: #fef3c7; color: #92400e; }
.agenda-badge-atrasada { background: #fee2e2; color: #991b1b; padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.agenda-badge-atrasada i { animation: parpadeo 1.5s infinite; }
@keyframes parpadeo { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.agenda-tarea-expediente { font-size: 11px; color: var(--text-secondary); cursor: pointer; padding: 2px 7px; border: 1px solid var(--border-color); border-radius: 4px; white-space: nowrap; flex-shrink: 0; transition: all 0.15s; }
.agenda-tarea-expediente:hover { border-color: var(--primary-color); color: var(--primary-color); }
.agenda-tarea-actions { flex-shrink: 0; margin-left: auto; }
.agenda-tarea-actions .btn-sm { padding: 3px 7px; font-size: 11px; }

/* ==================== DOCUMENTOS MEJORADOS ==================== */

.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.documents-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 2rem;
}

.documents-filters select,
.documents-filters input[type="search"] {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.documents-filters input[type="search"] {
    min-width: 250px;
}

/* Vista de Tarjetas */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.document-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.document-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: #2563eb;
}

.document-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Iconos por tipo de archivo */
.document-icon.pdf { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.document-icon.word { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; }
.document-icon.excel { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.document-icon.image { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.document-icon.powerpoint { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.document-icon.text { background: linear-gradient(135deg, #6b7280, #4b5563); color: white; }
.document-icon.other { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; }

.document-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

.document-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.document-card-meta i {
    width: 16px;
    text-align: center;
}

.document-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
}

.document-badge.demanda { background: #dbeafe; color: #1e40af; }
.document-badge.sentencia { background: #fef3c7; color: #92400e; }
.document-badge.escritura { background: #d1fae5; color: #065f46; }
.document-badge.poder { background: #e0e7ff; color: #3730a3; }
.document-badge.contrato { background: #f3e8ff; color: #6b21a8; }
.document-badge.otro { background: #f1f5f9; color: #475569; }
.document-badge.general { background: #f1f5f9; color: #475569; }

.document-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.document-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.document-actions .btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
}

/* Modal de Visor */
.modal-viewer {
    z-index: 10000;
}

.modal-viewer .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.viewer-container {
    flex: 1;
    overflow: auto;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.viewer-container iframe {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border: none;
    border-radius: 8px;
    background: white;
}

.viewer-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.viewer-toolbar {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1rem;
    justify-content: space-between;
    align-items: center;
}

.viewer-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}

.viewer-info p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
}

/* Empty state */
.documents-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
    grid-column: 1 / -1;
}

.documents-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.documents-empty h3 {
    margin: 1rem 0 0.5rem;
    color: #1e293b;
}

/* Responsive */
@media (max-width: 768px) {
    .documents-grid {
        grid-template-columns: 1fr;
    }
}

/* Paginación */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #f8fafc;
    border-color: #2563eb;
}

.pagination-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    padding: 0.5rem 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.stats-documents {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-doc-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.stat-doc-card h4 {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-doc-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}
/* Sistema de Etiquetas */
.etiquetas-sugeridas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
}

.tag-suggestion {
    padding: 0.25rem 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
}

.tag-suggestion:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    transform: translateY(-2px);
}

.tag-suggestion:active {
    transform: translateY(0);
}

/* Modal de editar etiquetas */
.modal-editar-etiquetas .current-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    min-height: 60px;
}

.current-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #475569;
}

.current-tag button {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.current-tag button:hover {
    background: #fee2e2;
}

.empty-tags {
    color: #94a3b8;
    font-style: italic;
}

/* Botón editar en tarjeta */
.document-card .btn-edit-tags {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.2s;
}

.document-card:hover .btn-edit-tags {
    opacity: 1;
}

.document-card {
    position: relative;
}

/* ==================== EDICIÓN DE EXPEDIENTES ==================== */

.estado-actual-card {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.estado-actual-card h4 {
    margin: 0 0 1rem 0;
    color: #64748b;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 600;
}

.estado-badge-large {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.estado-badge-large i {
    font-size: 0.8rem;
    color: #10b981;
}

/* Historial de estados */
#historialEstadosContainer {
    max-height: 400px;
    overflow-y: auto;
}

.historial-estado-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.historial-estado-item:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.historial-cambio {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
}

.estado-anterior {
    color: #ef4444;
    text-decoration: line-through;
    opacity: 0.7;
}

.estado-flecha {
    color: #64748b;
}

.estado-nuevo {
    color: #10b981;
    font-weight: 600;
}

.historial-fecha {
    font-size: 0.85rem;
    color: #64748b;
}

.historial-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

.historial-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.historial-observaciones {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #475569;
}

.historial-empty {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.historial-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Botón de editar en la vista de expediente */
.btn-editar-expediente {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.info-panel {
    position: relative;
}

/* Estados con colores */
.estado-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.estado-badge.activo {
    background: #dbeafe;
    color: #1e40af;
}

.estado-badge.finalizado {
    background: #d1fae5;
    color: #065f46;
}

.estado-badge.archivo {
    background: #f1f5f9;
    color: #475569;
}
/* ==================== ESTILOS CONFIGURACIÓN ==================== */

/* Submenú de configuración */
.submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background-color: #1e293b;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 1000;
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    font-size: 0.9em;
}

.submenu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.submenu-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 3px solid #6366f1;
}

.submenu-item i {
    margin-right: 12px;
    font-size: 0.9em;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.8em;
    transition: transform 0.3s;
}

.menu-item.active .submenu-arrow {
    transform: rotate(180deg);
}

/* Badges de estado */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    gap: 5px;
}

.badge::before {
    content: "";
    font-size: 1.2em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
    text-transform: capitalize;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* Botones pequeños en tablas */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
    margin: 0 3px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-warning {
    background-color: #fbbf24;
    color: #000;
}

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

/* Form rows para campos lado a lado */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Checkboxes en formularios */
.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
    transform: scale(1.1);
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin-top: 10px;
}

/* Select mejorado */
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Mejoras visuales para modales de configuración */
#modal-abogado .modal-content,
#modal-usuario .modal-content,
#modal-oficina .modal-content {
    max-width: 600px;
}

/* Estilos para inputs de tipo tel y email */
input[type="tel"],
input[type="email"] {
    font-family: inherit;
}

/* Animación para badges */
.badge {
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hover effect para filas de tabla */
.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
    transform: translateX(2px);
}

/* Estilo para campos requeridos */
.form-group label::after {
    content: '';
}

.form-group:has(input[required]) label::after,
.form-group:has(select[required]) label::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

/* Loading state para tablas */
.loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-style: italic;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 10px 0;
    color: #64748b;
}

.empty-state p {
    color: #94a3b8;
}

/* Responsive para vista de configuración */
@media (max-width: 1024px) {
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 800px;
    }
}

/* Estilo para el botón de editar que aparece en hover */
.btn-sm {
    opacity: 0.9;
}

.btn-sm:hover {
    opacity: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
/* ==================== ESTILOS EXPEDIENTES MEJORADOS ==================== */

.form-section {
    margin: 25px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #6366f1;
}

.form-section h3 {
    margin: 0 0 15px 0;
    font-size: 1em;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.info-section {
    margin: 25px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
}

.info-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expediente-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.expediente-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
}

.descripcion-text {
    line-height: 1.6;
    color: #475569;
    padding: 15px;
    background: white;
    border-radius: 6px;
}

.btn-editar-expediente {
    width: 100%;
    margin-bottom: 20px;
}

/* ==================== TABLA DE EXPEDIENTES CON COLUMNAS ADICIONALES ==================== */

/* Ajustar ancho de columnas de la tabla de expedientes */
#tablaExpedientes th:nth-child(1) { width: 120px; } /* Nº Expediente */
#tablaExpedientes th:nth-child(2) { width: 180px; } /* Cliente */
#tablaExpedientes th:nth-child(3) { width: 100px; } /* Tipo */
#tablaExpedientes th:nth-child(4) { width: 120px; } /* Estado */
#tablaExpedientes th:nth-child(5) { width: 150px; } /* Abogado */
#tablaExpedientes th:nth-child(6) { width: 150px; } /* Usuario */
#tablaExpedientes th:nth-child(7) { width: 150px; } /* Oficina */
#tablaExpedientes th:nth-child(8) { width: 100px; } /* Fecha */
#tablaExpedientes th:nth-child(9) { width: 150px; } /* Acciones */

/* Hacer la tabla responsive con scroll horizontal */
#view-expedientes .table-container {
    overflow-x: auto;
}

#view-expedientes .data-table {
    min-width: 1200px; /* Ancho mínimo para todas las columnas */
}

/* Ajustar columnas de asignación para que quepa mejor el texto */
#tablaExpedientes td:nth-child(5),
#tablaExpedientes td:nth-child(6),
#tablaExpedientes td:nth-child(7) {
    font-size: 0.9em;
    padding: 8px 6px;
}

/* Estilo para "Sin asignar" */
#tablaExpedientes td span[style*="color: #999"] {
    color: #999 !important;
    font-style: italic;
}
/* ==================== REPORTES ==================== */

.tab-reporte {
    display: none;
}

.tab-reporte.active {
    display: block;
}

#tabla-carga-abogados td,
#tabla-oficinas-reporte td {
    text-align: center;
}

#tabla-carga-abogados td:first-child,
#tabla-oficinas-reporte td:first-child {
    text-align: left;
    font-weight: 600;
}

/* ========================================
   PANTALLA DE LOGIN
   ======================================== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-screen.hidden {
    display: none;
}

.login-container {
    background: white;
    border-radius: 15px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.4s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    color: #2d3748;
    margin: 10px 0 5px 0;
}

.login-header p {
    color: #718096;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
}

.login-form label i {
    margin-right: 8px;
    color: #667eea;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-error {
    background: #fee;
    color: #c53030;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid #c53030;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login i {
    margin-right: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.login-footer p {
    color: #a0aec0;
    font-size: 12px;
}
/* Badges de roles adicionales */
.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-info {
    background-color: #e0f2fe;
    color: #0369a1;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background-color: #f3f4f6;
    color: #4b5563;
}
/* ========================================
   SIDEBAR LAYOUT MEJORADO
   ======================================== */

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    flex-shrink: 0; /* No se comprime */
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1; /* Ocupa todo el espacio disponible */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

/* Scrollbar personalizado para el sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-footer {
    flex-shrink: 0; /* No se comprime */
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn {
    width: 100%;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar-footer .btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ===================================================
   TIMELINE ESTILO KMALEON - tabla compacta scrolleable
   =================================================== */

.timeline-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-header-row h3 {
    margin: 0;
    font-size: 0.95rem;
}

.timeline-filters {
    display: flex;
    gap: 0.25rem;
}

.timeline-filters .filter-btn {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 4px;
    cursor: pointer;
    color: #475569;
    transition: all 0.15s;
}

.timeline-filters .filter-btn.active,
.timeline-filters .filter-btn:hover {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

/* Wrapper scrolleable con altura fija */
.timeline-table-wrapper {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-top: 0.25rem;
}

.timeline-table-wrapper::-webkit-scrollbar {
    width: 6px;
}
.timeline-table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Tabla compacta */
.timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.timeline-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #1e293b;
    color: #e2e8f0;
}

.timeline-table thead th {
    padding: 0.4rem 0.5rem;
    font-weight: 600;
    text-align: left;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.timeline-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.timeline-table tbody tr:hover {
    background: #f0f7ff;
}

/* Filas alternadas */
.timeline-table tbody tr:nth-child(even) {
    background: #f8fafc;
}
.timeline-table tbody tr:nth-child(even):hover {
    background: #e8f0fe;
}

.timeline-table td {
    padding: 0.3rem 0.5rem;
    vertical-align: middle;
    line-height: 1.3;
}

/* Columna fecha */
.tl-fecha {
    white-space: nowrap;
    color: #475569;
    font-size: 0.72rem;
}

/* Columna hora */
.tl-hora {
    white-space: nowrap;
    color: #94a3b8;
    font-size: 0.72rem;
}

/* Columna asunto - expandible */
.tl-asunto {
    font-weight: 500;
    color: #1e293b;
}

.tl-desc {
    color: #64748b;
    font-size: 0.72rem;
    margin-top: 1px;
}

/* Badges de tipo */
.tl-tipo-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tl-tipo-historial  { background: #e0f2fe; color: #0369a1; }
.tl-tipo-agenda     { background: #dcfce7; color: #166534; }
.tl-tipo-aviso      { background: #fef9c3; color: #854d0e; }
.tl-tipo-termino    { background: #fce7f3; color: #9d174d; }
.tl-tipo-estado     { background: #ede9fe; color: #5b21b6; }
.tl-tipo-documento  { background: #dbeafe; color: #1e40af; }

/* Columna usuario */
.tl-usuario {
    font-size: 0.7rem;
    color: #64748b;
    white-space: nowrap;
}

/* Iconos de flags */
.tl-flags {
    white-space: nowrap;
}
.tl-flags i {
    font-size: 0.7rem;
    margin-right: 2px;
}
.tl-flags .fa-clock      { color: #f59e0b; }
.tl-flags .fa-lock       { color: #94a3b8; }
.tl-flags .fa-exchange-alt { color: #8b5cf6; }

/* Estado vacío / loading */
.timeline-loading {
    text-align: center;
    padding: 1.5rem;
    color: #94a3b8;
    font-size: 0.82rem;
}

/* Fila resaltada para cambios de estado */
.timeline-table tbody tr.row-estado {
    background: #f5f3ff;
    border-left: 3px solid #8b5cf6;
}


/* ===================================================
   TAB ESTADO DEL EXPEDIENTE
   =================================================== */

.estado-tab-container {
    padding: 1rem 0;
    max-width: 560px;
    margin: 0 auto;
}

.estado-actual-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.2rem;
}

.estado-actual-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.estado-actual-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    background: #dbeafe;
    color: #1e40af;
}

.estado-info-text {
    font-size: 0.8rem;
    color: #64748b;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    margin-bottom: 1rem;
}

.estado-info-text i {
    color: #0284c7;
    margin-right: 0.3rem;
}

/* Fila pendiente en timeline */
.timeline-table tbody tr.row-pendiente {
    border-left: 3px solid #f59e0b;
    background: #fffbeb;
}
.timeline-table tbody tr.row-pendiente:hover {
    background: #fef3c7;
}

/* Botones de acción dentro de la tabla - muy compactos */
.timeline-table .btn-sm {
    padding: 0.15rem 0.35rem;
    font-size: 0.68rem;
    line-height: 1.2;
    margin-left: 2px;
}
.seguimiento-toolbar {
    margin-bottom: 0.75rem;
}
.seguimiento-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* Fix: botón y timeline en columna, no en fila */
.seguimiento-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem;
}
#tab-seguimiento .seguimiento-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem;
}

.sug-tag-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    font-weight: 500;
    transition: all .15s;
}
.sug-tag-btn:hover { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.sug-tag-btn.used { opacity: .35; cursor: default; }
.tag-chip-doc {
    background: #ede9fe;
    color: #6d28d9;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}
.tag-chip-doc button {
    background: none;
    border: none;
    color: #6d28d9;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    opacity: .7;
}
.tag-chip-doc button:hover { opacity: 1; }

.sug-tag-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    font-weight: 500;
    transition: all .15s;
}
.sug-tag-btn:hover { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.sug-tag-btn.used { opacity: .35; cursor: default; }
.tag-chip-doc {
    background: #ede9fe;
    color: #6d28d9;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}
.tag-chip-doc button {
    background: none;
    border: none;
    color: #6d28d9;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    opacity: .7;
}
.tag-chip-doc button:hover { opacity: 1; }


/* ===================================
   BUSCADOR 360
   =================================== */
.buscador360-container { max-width: 800px; margin: 0 auto; padding: 20px 0; }
.buscador360-input-wrap { position: relative; margin-bottom: 24px; }
.buscador360-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #888; font-size: 18px; }
.buscador360-input { width: 100%; padding: 16px 16px 16px 48px; font-size: 16px; border: 2px solid #e0e0e0; border-radius: 12px; outline: none; transition: border 0.2s; box-sizing: border-box; }
.buscador360-input:focus { border-color: #4f8ef7; }
.buscador360-hint { color: #888; padding: 20px; text-align: center; font-size: 14px; }
.buscador360-hint.error { color: #e74c3c; }
.resultado360-grupo { margin-bottom: 20px; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); overflow: hidden; }
.resultado360-titulo { padding: 10px 16px; background: #f0f4ff; font-weight: 700; font-size: 13px; color: #4f8ef7; border-bottom: 1px solid #e0e8ff; }
.resultado360-item { padding: 12px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background 0.15s; font-size: 14px; }
.resultado360-item:last-child { border-bottom: none; }
.resultado360-item:hover { background: #f7f9ff; }
.resultado360-item small { color: #888; }
.r360-meta { font-size: 12px; color: #4f8ef7; margin-bottom: 4px; }
.r360-cliente { font-size: 12px; color: #666; margin-bottom: 2px; }

/* ===== TOP BAR ===== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 24px;
    background: #f4f6fb;
    border-bottom: 1px solid #e0e0e0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu-wrap {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.user-menu-btn:hover {
    background: #f0f4ff;
}

.user-menu-btn i.fa-user-circle {
    font-size: 18px;
    color: #4f8ef7;
}

.user-menu-btn i.fa-chevron-down {
    font-size: 11px;
    color: #888;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 200;
    overflow: hidden;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-menu-info strong {
    font-size: 14px;
    color: #222;
}

.user-menu-info small {
    font-size: 12px;
    color: #888;
    text-transform: capitalize;
}

.user-menu-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid #f0f0f0;
}

.user-menu-dropdown button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #e74c3c;
    transition: background 0.15s;
}

.user-menu-dropdown button:hover {
    background: #fff5f5;
}
/* ==================== AGENDA HOY DASHBOARD ==================== */
.agenda-hoy-list { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.agenda-hoy-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; background: #f8fafc; border-radius: 8px; border-left: 3px solid #2563eb; }
.agenda-hoy-hora { font-size: 13px; font-weight: 700; color: #2563eb; min-width: 42px; padding-top: 2px; }
.agenda-hoy-info { flex: 1; }
.agenda-hoy-titulo { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.agenda-hoy-titulo i { margin-right: 6px; }
.agenda-hoy-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-hoy-usuario { font-size: 12px; color: #64748b; }
.agenda-hoy-usuario i { margin-right: 3px; }
.badge-tipo { font-size: 11px; padding: 2px 8px; border-radius: 12px; font-weight: 600; text-transform: uppercase; }
.badge-tipo-agenda { background: #dbeafe; color: #1d4ed8; }
.badge-tipo-aviso { background: #fef3c7; color: #b45309; }
.badge-tipo-termino { background: #fee2e2; color: #b91c1c; }
.badge-agenda { font-size: 12px; color: #64748b; font-weight: 500; }
.card-footer-link { padding-top: 12px; border-top: 1px solid #e2e8f0; margin-top: 8px; }
.card-footer-link a { font-size: 13px; color: #2563eb; text-decoration: none; font-weight: 500; }
.card-footer-link a:hover { text-decoration: underline; }
.stats-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }

/* ==================== EQUIPO EXPEDIENTE ==================== */
.equipo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.equipo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.equipo-avatar {
    font-size: 2rem;
    color: #6c757d;
}
.equipo-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.equipo-info strong {
    font-size: 0.95rem;
    color: #2d3748;
}
.mt-2 {
    margin-top: 8px;
}
#modalAgregarEquipo {
    z-index: 9999 !important;
}
#modalAgregarEquipo .modal-content {
    z-index: 10000 !important;
}

/* ==================== CHECKBOXES GRID ==================== */
.checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    max-height: 200px;
    overflow-y: auto;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s;
}
.checkbox-item:hover {
    background: #e9ecef;
}
.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* ==================== DETALLE EXPEDIENTE REDISEÑO ==================== */
.exp-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}
.btn-editar-mini {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto !important;
    min-width: unset !important;
    height: auto !important;
    transition: background 0.2s;
}
.btn-editar-mini:hover { background: #2563eb; }
.exp-filas {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.exp-fila {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.exp-campo {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 10px;
    background: #f8f9fa;
    border-radius: 6px;
}
.exp-label {
    font-size: 0.72rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.exp-valor {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1f2937;
}
.exp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    width: 100%;
}
.exp-descripcion {
    font-size: 0.88rem;
    color: #4a5568;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}
.exp-equipo-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
}
.exp-equipo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.87rem;
    color: #374151;
}
.btn-agregar-miembro {
    background: white;
    border: 1px solid #3b82f6;
    color: #3b82f6;
    border-radius: 5px;
    padding: 3px 9px;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto !important;
    min-width: unset !important;
    transition: all 0.2s;
}
.btn-agregar-miembro:hover { background: #3b82f6; color: white; }
.equipo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.equipo-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.82rem;
}
.equipo-chip i.fa-user-circle { color: #3b82f6; }
.equipo-chip small {
    background: #eff6ff;
    color: #3b82f6;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.72rem;
}
.equipo-chip button {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 0;
    font-size: 0.72rem;
    line-height: 1;
    transition: color 0.2s;
}
.equipo-chip button:hover { color: #ef4444; }

/* ==================== TAB ESTADO REDISEÑO ==================== */
.estado-tab-nuevo {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}
.estado-actual-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 14px;
}
.estado-actual-lbl {
    font-size: 0.72rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.estado-cambio-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.estado-cambio-titulo {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}
.estado-cambio-nota {
    font-size: 0.82rem;
    color: #6b7280;
    background: #eff6ff;
    border-radius: 6px;
    padding: 7px 10px;
    margin: 0;
}
.estado-cambio-campos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.estado-campo-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.estado-campo-group label {
    font-size: 0.78rem;
    color: #6b7280;
    font-weight: 500;
}
.estado-campo-group select,
.estado-campo-group textarea {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 0.88rem;
    color: #1f2937;
    background: white;
    width: 100%;
    box-sizing: border-box;
}
.estado-campo-group textarea {
    resize: vertical;
    min-height: 70px;
}
.btn-cambiar-estado {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto !important;
    min-width: unset !important;
    transition: background 0.2s;
    align-self: flex-start;
}
.btn-cambiar-estado:hover { background: #d97706; }

/* ==================== NUEVA ANOTACION REDISEÑO ==================== */
.anotacion-form-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}
.anotacion-fila {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.anotacion-campo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.anotacion-campo-wide {
    grid-column: span 2;
}
.anotacion-campo label {
    font-size: 0.78rem;
    color: #6b7280;
    font-weight: 500;
}
.anotacion-campo input,
.anotacion-campo select,
.anotacion-campo textarea {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 0.88rem;
    color: #1f2937;
    background: white;
    width: 100%;
    box-sizing: border-box;
}
.anotacion-campo textarea {
    resize: vertical;
    min-height: 60px;
}
.anotacion-checks-fila {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 10px 0;
    flex-wrap: wrap;
}
.anotacion-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #374151;
}
.anotacion-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.anotacion-adjunto {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 0.82rem;
    color: #6b7280;
}
.anotacion-adjunto label {
    white-space: nowrap;
    cursor: pointer;
    color: #3b82f6;
}
.anotacion-adjunto input[type="file"] {
    font-size: 0.78rem;
    max-width: 160px;
}
.anotacion-acciones {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.btn-guardar-anotacion {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto !important;
    min-width: unset !important;
    transition: background 0.2s;
}
.btn-guardar-anotacion:hover { background: #2563eb; }
.btn-cancelar-anotacion {
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    width: auto !important;
    min-width: unset !important;
    transition: all 0.2s;
}
.btn-cancelar-anotacion:hover { background: #f3f4f6; color: #374151; }
/* ==================== EDITAR EXPEDIENTE REDISEÑO ==================== */
.edit-form-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.edit-fila {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.edit-campo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.edit-campo-wide {
    grid-column: span 2;
}
.edit-campo label {
    font-size: 0.78rem;
    color: #6b7280;
    font-weight: 500;
}
.edit-campo input,
.edit-campo select,
.edit-campo textarea {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 0.88rem;
    color: #1f2937;
    background: white;
    width: 100%;
    box-sizing: border-box;
}
.edit-campo textarea {
    resize: vertical;
    min-height: 70px;
}
.edit-seccion {
    background: white;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
}
.edit-seccion-titulo {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.edit-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}
/* ==================== REPORTES REDISEÑO ==================== */
.reporte-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    width: fit-content;
}
.reporte-tab-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    width: auto !important;
    min-width: unset !important;
}
.reporte-tab-btn.active {
    background: white;
    color: #1f2937;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.reporte-tab-btn:hover:not(.active) { background: #e2e8f0; color: #374151; }
.reporte-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.reporte-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    border: 1px solid #f1f5f9;
}
.reporte-card-full {
    grid-column: 1 / -1;
}
.reporte-card-titulo {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}
.reporte-card-titulo i { color: #3b82f6; }
/* ==================== REPORTES FILTROS ==================== */
.reporte-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.reporte-filtros {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 14px;
}
.reporte-filtro-campo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.reporte-filtro-campo label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}
.reporte-filtro-campo input,
.reporte-filtro-campo select {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
    color: #1f2937;
    background: white;
    height: 34px;
    box-sizing: border-box;
}
.btn-filtrar-reporte {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    width: auto !important;
    min-width: unset !important;
    transition: background 0.2s;
}
.btn-filtrar-reporte:hover { background: #2563eb; }
.btn-descargar-reporte {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    width: auto !important;
    min-width: unset !important;
    transition: background 0.2s;
}
.btn-descargar-reporte:hover { background: #059669; }